Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2106073005: Add fast-path for propagated variable changes (WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@+pointer_events_fastpath_5
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 8fc3dab289d1b4d853272aba7112c80f3d00a38b..1fcf1d3bd95be2b0dd94c44703468ad6c44cd534 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -212,9 +212,14 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(
bool independentEqual = oldStyle->independentInheritedEqual(*newStyle);
bool nonIndependentEqual = oldStyle->nonIndependentInheritedEqual(*newStyle);
- if (!independentEqual || !nonIndependentEqual) {
+ bool variablesEqual = oldStyle->variablesEqual(*newStyle);
+ if (!independentEqual || !nonIndependentEqual || !variablesEqual) {
+ // Check if only independent inherited properties changed.
if (nonIndependentEqual && !oldStyle->hasExplicitlyInheritedProperties())
- return IndependentInherit;
+ if (variablesEqual)
+ return IndependentInherit;
+ // Variables and possibly independent inherited properties changed.
+ return IndependentInheritWithVariables;
return Inherit;
}
@@ -239,6 +244,16 @@ void ComputedStyle::propagateIndependentInheritedProperties(
setPointerEvents(parentStyle.pointerEvents());
if (m_nonInheritedData.m_isVisibilityInherited)
setVisibility(parentStyle.visibility());
+
+ // Variables.
+ if (parentStyle.variables() != variables()) {
+ for (const auto& variable : *parentStyle.variables()) {
+ if (inheritsVariableDefinitionFromParent(variable.key) &&
+ *variable.value != *variables()->getVariable(variable.key)) {
+ setVariable(variable.key, variable.value);
+ }
+ }
+ }
}
StyleSelfAlignmentData resolvedSelfAlignment(
@@ -518,6 +533,10 @@ bool ComputedStyle::nonIndependentInheritedEqual(
m_rareInheritedData == other.m_rareInheritedData;
}
+bool ComputedStyle::variablesEqual(const ComputedStyle& other) const {
+ return m_rareInheritedData->compareEqualVariables(*other.m_rareInheritedData);
+}
+
bool ComputedStyle::loadingCustomFontsEqual(const ComputedStyle& other) const {
return font().loadingCustomFonts() == other.font().loadingCustomFonts();
}
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698