[mpc] Only mark dependencies from non-inherited properties
Before the dependency-aware MatchedPropertiesCache, we would set a flag HasVariableReferenceFromNonInheritedProperty whenever some non- inherited property referenced a custom property. However, with the dependency-aware MPC enabled, var() references from inherited properties can also incur dependencies. This caused a regression in the CustomPropertiesVarAlias.htm benchmark, since it creates a rule with 2000 var() references that are referenced from other custom property declarations. Since (regular) custom property declarations are _inherited_ properties, they would not be excluded from the cache with the old code, but they are excluded now, since we exceed the dependency limit. To fix this, we only produce a dependency from a var() if it is referenced from a non-inherited property. However, this creates a new problem for the "apply inherited only"-type of cache hit: applying inherited properties mean custom properties (that are not registered as non-inherited) will be applied as well, and this affects any var() references in non-inherited properties. This problem is exactly the same as "apply inherited only" when it affects the font or zoom (which may affect lots of other non-inherited properties). Therefore, this CL changes ::EffectiveZoomOrFontChanged to ::IsUsableAfterApplyInheritedOnly (name inspired by Webkit's similar code), which also takes changes to inherited variables into account. Sidenote: The reason for using CascadeResolver to figure out the current CSSProperty rather than propagating it as an argument is to avoid having multiple sources of truth. If we passed a CSSProperty as a parameter, it would be possible to pass the wrong thing (vs. what is contained by CascadeResolver), and that would be very bad. Bug: 1057072, 1095460 Change-Id: I137fb8ffc69eb2b913c8494ab9b1d1debc8038eb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247767 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by:Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#780079}
Showing
Please register or sign in to comment