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

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

Issue 2630683002: Move custom property isInheritedProperty storage logic into ComputedStyle (Closed)
Patch Set: Undo cscssvm change Created 3 years, 11 months 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 148d751dc42dd5cdc3b08435dd7d590110ebf414..e4402ca53b6f184c7597962f2942287aa310573e 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1826,24 +1826,43 @@ void ComputedStyle::setResolvedNonInheritedVariable(
variables.setRegisteredVariable(name, parsedValue);
}
-void ComputedStyle::removeInheritedVariable(const AtomicString& name) {
- mutableInheritedVariables().removeVariable(name);
+void ComputedStyle::removeVariable(const AtomicString& name,
+ bool isInheritedProperty) {
+ if (isInheritedProperty) {
+ mutableInheritedVariables().removeVariable(name);
+ } else {
+ mutableNonInheritedVariables().removeVariable(name);
+ }
}
-void ComputedStyle::removeNonInheritedVariable(const AtomicString& name) {
- mutableNonInheritedVariables().removeVariable(name);
+CSSVariableData* ComputedStyle::getVariable(const AtomicString& name) const {
+ CSSVariableData* variable = getVariable(name, true);
+ if (variable) {
+ return variable;
+ }
+ return getVariable(name, false);
}
-CSSVariableData* ComputedStyle::getVariable(const AtomicString& name) const {
- if (inheritedVariables()) {
- if (CSSVariableData* variable = inheritedVariables()->getVariable(name))
- return variable;
+CSSVariableData* ComputedStyle::getVariable(const AtomicString& name,
+ bool isInheritedProperty) const {
+ if (isInheritedProperty) {
+ return inheritedVariables() ? inheritedVariables()->getVariable(name)
+ : nullptr;
}
- if (nonInheritedVariables()) {
- if (CSSVariableData* variable = nonInheritedVariables()->getVariable(name))
- return variable;
+ return nonInheritedVariables() ? nonInheritedVariables()->getVariable(name)
+ : nullptr;
+}
+
+const CSSValue* ComputedStyle::getRegisteredVariable(
+ const AtomicString& name,
+ bool isInheritedProperty) const {
+ if (isInheritedProperty) {
+ return inheritedVariables() ? inheritedVariables()->registeredVariable(name)
+ : nullptr;
}
- return nullptr;
+ return nonInheritedVariables()
+ ? nonInheritedVariables()->registeredVariable(name)
+ : nullptr;
}
float ComputedStyle::wordSpacing() const {

Powered by Google App Engine
This is Rietveld 408576698