[webkit-changes] [WebKit/WebKit] 257a35: Use ImmutableStyleProperties for presentational hi...

Antti Koivisto noreply at github.com
Tue Aug 15 09:37:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 257a3556e799a51761d132bc94c9575dd6fab14f
      https://github.com/WebKit/WebKit/commit/257a3556e799a51761d132bc94c9575dd6fab14f
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M Source/WebCore/css/MutableStyleProperties.cpp
    M Source/WebCore/css/MutableStyleProperties.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/dom/ElementData.h
    M Source/WebCore/dom/StyledElement.cpp
    M Source/WebCore/dom/StyledElement.h
    M Source/WebCore/html/HTMLTextFormControlElement.cpp
    M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/MatchResult.h

  Log Message:
  -----------
  Use ImmutableStyleProperties for presentational hint style
https://bugs.webkit.org/show_bug.cgi?id=260064
rdar://113741146

Reviewed by Simon Fraser.

The mutable style here is never actually mutated after construction. Using immutable style is
more memory efficient, allows deduplication and improves matched declarations cache performance.

* Source/WebCore/css/ImmutableStyleProperties.h:
* Source/WebCore/css/MutableStyleProperties.cpp:
(WebCore::MutableStyleProperties::immutableCopy const):
* Source/WebCore/css/MutableStyleProperties.h:
* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::immutableCopyIfNeeded const):
* Source/WebCore/dom/ElementData.h:
(WebCore::ElementData::presentationalHintStyle const):
* Source/WebCore/dom/StyledElement.cpp:
(WebCore::StyledElement::presentationalHintStyle const):
(WebCore::StyledElement::rebuildPresentationalHintStyle):

Make immutable after the attributes have been collected.

* Source/WebCore/dom/StyledElement.h:
(WebCore::StyledElement::presentationalHintStyle const): Deleted.
* Source/WebCore/html/HTMLTextFormControlElement.cpp:
* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ElementRuleCollector):
* Source/WebCore/style/MatchResult.h:
(WebCore::Style::MatchResult::MatchResult):
(WebCore::Style::operator==):
(WebCore::Style::add):

Include a bit telling if the match result is for link. Because visited link style handling links and
non-links can't share style. HTML <a> has UA sheet rules so this didn't occur easily, however SVG <a>
doesn't and this patch reveals the issue in some tests.

Canonical link: https://commits.webkit.org/266914@main




More information about the webkit-changes mailing list