[webkit-changes] [WebKit/WebKit] 8b7bc2: Allow using longer ancestor chains in StyleCustomP...
Antti Koivisto
noreply at github.com
Sun Sep 3 10:01:42 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8b7bc22a8c879f1a47bd4966fa30b8a4ce3216ed
https://github.com/WebKit/WebKit/commit/8b7bc22a8c879f1a47bd4966fa30b8a4ce3216ed
Author: Antti Koivisto <antti at apple.com>
Date: 2023-09-03 (Sun, 03 Sep 2023)
Changed paths:
M Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.cpp
M Source/WebCore/rendering/style/StyleCustomPropertyData.cpp
M Source/WebCore/rendering/style/StyleCustomPropertyData.h
M Source/WebCore/style/Styleable.cpp
Log Message:
-----------
Allow using longer ancestor chains in StyleCustomPropertyData
https://bugs.webkit.org/show_bug.cgi?id=261025
rdar://114815380
Reviewed by Cameron McCormack.
Currently only one ancestor is allowed. It is typical to have many properties defined on :root.
If we have more definitions further down the tree on multiple levels then all those properties get
copied and we can get large maps duplicated to many elements. This also makes equality comparisons slow.
* Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.cpp:
(WebCore::ComputedStylePropertyMapReadOnly::entries const):
* Source/WebCore/rendering/style/StyleCustomPropertyData.cpp:
(WebCore::StyleCustomPropertyData::StyleCustomPropertyData):
If the parent has more than 8 own properties link to it instead of copying it even
if it already has a parent.
Also limit the maximum ancestor list size to 4.
(WebCore::StyleCustomPropertyData::get const):
(WebCore::StyleCustomPropertyData::set):
Add some asserts.
(WebCore::StyleCustomPropertyData::operator== const):
Shortcut the equality comparison in case the parents are the same.
Use forEach for the slow path.
(WebCore::StyleCustomPropertyData::forEachInternal const):
(WebCore::StyleCustomPropertyData::forEach const):
Traverse all ancestors.
Add IterationStatus return value so iteration can be broken early.
Add templated traversal that avoid Function<> for internal use.
(WebCore::StyleCustomPropertyData::findKeyAtIndex const):
(WebCore::StyleCustomPropertyData::size const):
We now always track the full size so no need to traverse ancestors for it.
* Source/WebCore/rendering/style/StyleCustomPropertyData.h:
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::updateCSSTransitions const):
Canonical link: https://commits.webkit.org/267595@main
More information about the webkit-changes
mailing list