[webkit-changes] [WebKit/WebKit] 5326da: Inline style should always be cacheable in matched...
Antti Koivisto
noreply at github.com
Fri Aug 18 03:21:21 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5326da20993d8ae1af4adfcf9efecbed999adec0
https://github.com/WebKit/WebKit/commit/5326da20993d8ae1af4adfcf9efecbed999adec0
Author: Antti Koivisto <antti at apple.com>
Date: 2023-08-18 (Fri, 18 Aug 2023)
Changed paths:
M Source/WebCore/dom/ElementData.cpp
M Source/WebCore/dom/ElementData.h
M Source/WebCore/dom/StyledElement.cpp
M Source/WebCore/dom/StyledElement.h
M Source/WebCore/style/ElementRuleCollector.cpp
Log Message:
-----------
Inline style should always be cacheable in matched declarations cache
https://bugs.webkit.org/show_bug.cgi?id=260254
rdar://113960228
Reviewed by Alan Baradlay.
Mutable inline style (created by modification via JS wrapper) prevents style caching
in the matched declarations cache. This patch turns any mutable style immutable during
style resolution so we can cache it. Due to deduplication the cache entries can be reused
accross elements and mutations.
* Source/WebCore/dom/ElementData.cpp:
(WebCore::UniqueElementData::UniqueElementData):
* Source/WebCore/dom/ElementData.h:
Save the immutable style in UniqueElementData.
* Source/WebCore/dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged):
(WebCore::StyledElement::invalidateStyleAttribute):
Take care to invalidate the cached immutable copy.
(WebCore::StyledElement::inlineStyleForStyleResolution const):
The accessor constructs ImmutableStyleProperties lazily on demand.
* Source/WebCore/dom/StyledElement.h:
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::addElementInlineStyleProperties):
Allow caching.
Canonical link: https://commits.webkit.org/267035@main
More information about the webkit-changes
mailing list