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

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

Issue 1645433002: Basic implementation of @apply (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix expted.txt for failing test Created 4 years, 10 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 cc13a8e738e4e6d5a6d6b29612eec5613cf28a10..fe12341ca298ca686772a36632366923b56fadac 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -84,6 +84,7 @@
#include "core/inspector/InspectorInstrumentation.h"
#include "core/layout/GeneratedChildren.h"
#include "core/layout/LayoutView.h"
+#include "core/style/StyleVariableData.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGElement.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -1269,15 +1270,37 @@ void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
}
template <CSSPropertyPriority priority>
+void StyleResolver::applyPropertiesForApplyAtRule(StyleResolverState& state, const CSSValue* value, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
+{
+ if (priority == ResolveVariables)
+ return;
+ if (!state.style()->variables())
+ return;
+ AtomicString name(toCSSCustomIdentValue(value)->value());
+ CSSVariableData* variableData = state.style()->variables()->getVariable(name);
+ if (!variableData)
+ return;
+ const StylePropertySet* propertySet = variableData->propertySet();
+ if (propertySet)
+ applyProperties<priority>(state, propertySet, isImportant, inheritedOnly, propertyWhitelistType);
+}
+
+template <CSSPropertyPriority priority>
void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
{
unsigned propertyCount = properties->propertyCount();
for (unsigned i = 0; i < propertyCount; ++i) {
StylePropertySet::PropertyReference current = properties->propertyAt(i);
+ CSSPropertyID property = current.id();
+
+ if (property == CSSPropertyApplyAtRule) {
+ applyPropertiesForApplyAtRule<priority>(state, current.value(), isImportant, inheritedOnly, propertyWhitelistType);
+ continue;
+ }
+
if (isImportant != current.isImportant())
continue;
- CSSPropertyID property = current.id();
if (property == CSSPropertyAll) {
applyAllProperty<priority>(state, current.value(), inheritedOnly, propertyWhitelistType);
continue;

Powered by Google App Engine
This is Rietveld 408576698