DescriptionCascade declared property values instead of applying values on top of each other
Currently, the StyleResolver builds the style for an element by calling
StyleBuilder::applyProperty in the appropriate order for all the matched
property declarations. This is inefficient in that for elements with
complex styling, many of these declarations will be overridden by other
declarations, so we will end up doing many unneeded conversions of
CSSValues. This patch makes us cascade declared property values before
applying, so that we generally only end up applying each property at
most once (-webkit-appearance and animations break this rule).
The existence of vendor-prefixed properties complicate this change
somewhat. It's generally accepted that specifying a property and a
vendor-prefixed variant will have the latter one take effect. Thus we
map these to the same property, so they can properly cascade, and
disallow calling into the StyleBuilder with these aliased properties.
To handle this for the various non-standard direction aware properties,
we resolve the values of direction and writing-mode (now super-high
priority) before cascading.
Note that -webkit-perspective allows more values that perspective (in
particular, numbers are allowed), although they now use the same handler.
The test transforms/perspective-parsing.html ensures that perspective
considers values that are allowed for -webkit-perspective as invalid.
This patch is similar in nature to similar work done in WebKit by akling,
https://bugs.webkit.org/show_bug.cgi?id=125213. The implementation is
different here in lots of little ways, although I've copied the function
elementTypeHasAppearanceFromUAStyle to avoid doing work to support
-webkit-appearance in the common case.
BUG=399497
Patch Set 1 #Patch Set 2 : tests pass; needs clean up and whatnot #Patch Set 3 : ready for review! #Patch Set 4 : rebase and small clean ups #Patch Set 5 : #
Total comments: 4
Patch Set 6 : rebase #Patch Set 7 : address some comments #Patch Set 8 : move functions around :| #
Total comments: 16
Patch Set 9 : rebase #Patch Set 10 : address comments #Patch Set 11 : rebase #Patch Set 12 : rebase #
Total comments: 4
Patch Set 13 : rebase #Patch Set 14 : leave property whitelists on styleresolver and dont return CSSValue*& #Patch Set 15 : minor optimisation #Patch Set 16 : rebase #Patch Set 17 : rebase #Messages
Total messages: 16 (0 generated)
|