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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 2366313006: CSS Properties and Values API: Support non-inherited custom properties (Closed)
Patch Set: use de morgan's law Created 4 years, 3 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/css/resolver/StyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
index ca4f2d9cb02ddc82ed3e736ec4db04d57860b606..b7d5dbfe4874621dd2b0cdf351047b2435be1b3a 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -86,7 +86,7 @@
#include "core/inspector/InspectorInstrumentation.h"
#include "core/layout/GeneratedChildren.h"
#include "core/layout/api/LayoutViewItem.h"
-#include "core/style/StyleVariableData.h"
+#include "core/style/StyleInheritedVariables.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGElement.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -108,7 +108,8 @@ void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element)
bool cacheCustomPropertiesForApplyAtRules(StyleResolverState& state, const MatchedPropertiesRange& range)
{
bool ruleSetsCustomProperty = false;
- if (!state.style()->variables())
+ // TODO(timloh): @apply should also work with properties registered as non-inherited.
+ if (!state.style()->inheritedVariables())
return false;
for (const auto& matchedProperties : range) {
const StylePropertySet& properties = *matchedProperties.properties;
@@ -118,7 +119,7 @@ bool cacheCustomPropertiesForApplyAtRules(StyleResolverState& state, const Match
if (current.id() != CSSPropertyApplyAtRule)
continue;
AtomicString name(toCSSCustomIdentValue(current.value()).value());
- CSSVariableData* variableData = state.style()->variables()->getVariable(name);
+ CSSVariableData* variableData = state.style()->inheritedVariables()->getVariable(name);
if (!variableData)
continue;
StylePropertySet* customPropertySet = variableData->propertySet();
@@ -1434,7 +1435,7 @@ template <CSSPropertyPriority priority>
void StyleResolver::applyPropertiesForApplyAtRule(StyleResolverState& state, const CSSValue& value, bool isImportant, PropertyWhitelistType propertyWhitelistType)
{
state.style()->setHasVariableReferenceFromNonInheritedProperty();
- if (!state.style()->variables())
+ if (!state.style()->inheritedVariables())
return;
const String& name = toCSSCustomIdentValue(value).value();
const StylePropertySet* propertySet = state.customPropertySetForApplyAtRule(name);

Powered by Google App Engine
This is Rietveld 408576698