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

Unified Diff: sky/engine/core/css/resolver/StyleResolver.cpp

Issue 860423004: Remove css !important (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.h ('k') | sky/engine/core/dom/Element.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/resolver/StyleResolver.cpp
diff --git a/sky/engine/core/css/resolver/StyleResolver.cpp b/sky/engine/core/css/resolver/StyleResolver.cpp
index c2e2b967bab31684cb972353e53b4f005c480bdf..2a547778ee62b323377c2aa59a944a1832ce07f7 100644
--- a/sky/engine/core/css/resolver/StyleResolver.cpp
+++ b/sky/engine/core/css/resolver/StyleResolver.cpp
@@ -236,9 +236,6 @@ PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
StyleAdjuster adjuster;
adjuster.adjustRenderStyle(state.style(), state.parentStyle(), *element);
- // FIXME: The CSSWG wants to specify that the effects of animations are applied before
- // important rules, but this currently happens here as we require adjustment to have happened
- // before deciding which properties to transition.
if (applyAnimatedProperties(state, element))
adjuster.adjustRenderStyle(state.style(), state.parentStyle(), *element);
@@ -271,13 +268,11 @@ PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* element, const
state.fontBuilder().initForStyleResolve(state.document(), state.style());
- // We don't need to bother with !important. Since there is only ever one
- // decl, there's nothing to override. So just add the first properties.
// We also don't need to bother with animation properties since the only
// relevant one is animation-timing-function and we special-case that in
// CSSAnimations.cpp
bool inheritedOnly = false;
- applyMatchedProperties<HighPriorityProperties>(state, result, false, inheritedOnly);
+ applyMatchedProperties<HighPriorityProperties>(state, result, inheritedOnly);
// If our font got dirtied, go ahead and update it now.
updateFont(state);
@@ -287,7 +282,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* element, const
StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeightValue());
// Now do rest of the properties.
- applyMatchedProperties<LowPriorityProperties>(state, result, false, inheritedOnly);
+ applyMatchedProperties<LowPriorityProperties>(state, result, inheritedOnly);
loadPendingResources(state);
@@ -488,13 +483,11 @@ void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
}
template <StyleResolver::StyleApplicationPass pass>
-void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, bool isImportant, bool inheritedOnly)
+void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, bool inheritedOnly)
{
unsigned propertyCount = properties->propertyCount();
for (unsigned i = 0; i < propertyCount; ++i) {
StylePropertySet::PropertyReference current = properties->propertyAt(i);
- if (isImportant != current.isImportant())
- continue;
CSSPropertyID property = current.id();
if (property == CSSPropertyAll) {
@@ -520,10 +513,10 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
}
template <StyleResolver::StyleApplicationPass pass>
-void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult, bool isImportant, bool inheritedOnly)
+void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult, bool inheritedOnly)
{
for (const RefPtr<StylePropertySet>& properties : matchResult.matchedProperties) {
- applyProperties<pass>(state, properties.get(), isImportant, inheritedOnly);
+ applyProperties<pass>(state, properties.get(), inheritedOnly);
}
}
@@ -572,13 +565,8 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
applyInheritedOnly = true;
}
- // Now we have all of the matched rules in the appropriate order. Walk the rules and apply
- // high-priority properties first, i.e., those properties that other properties depend on.
- // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important
- // and (4) normal important.
state.setLineHeightValue(0);
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, applyInheritedOnly);
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, applyInheritedOnly);
+ applyMatchedProperties<HighPriorityProperties>(state, matchResult, applyInheritedOnly);
// If our font got dirtied, go ahead and update it now.
updateFont(state);
@@ -591,9 +579,7 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDescription() != state.style()->fontDescription())
applyInheritedOnly = false;
- // Now do the author and user normal priority properties and all the !important properties.
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, applyInheritedOnly);
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, applyInheritedOnly);
+ applyMatchedProperties<LowPriorityProperties>(state, matchResult, applyInheritedOnly);
loadPendingResources(state);
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.h ('k') | sky/engine/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698