mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
remove CSS 'all' property.
The human mind is simply not capable of beholding the sheer power of the CSS 'all' property. We shall remove it now and leave its echo for generations to contemplate. R=ojan@chromium.org Review URL: https://codereview.chromium.org/1068393002
This commit is contained in:
parent
1381402a70
commit
64e97bbea8
@ -2137,9 +2137,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
/* @viewport rule properties */
|
||||
case CSSPropertyOrientation:
|
||||
break;
|
||||
|
||||
case CSSPropertyAll:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
logUnimplementedPropertyID(propertyID);
|
||||
|
||||
@ -499,9 +499,6 @@ z-index animatable, type_name=unsigned, custom_all
|
||||
// Properties that we ignore in the StyleBuilder.
|
||||
// FIXME: We should see if any of these should actually be unreachable
|
||||
|
||||
// OBSOLETE
|
||||
all builder_skip
|
||||
|
||||
// OBSOLETE
|
||||
orientation builder_skip
|
||||
|
||||
|
||||
@ -172,18 +172,4 @@ CSSPropertyID CSSProperty::resolveDirectionAwareProperty(CSSPropertyID propertyI
|
||||
}
|
||||
}
|
||||
|
||||
bool CSSProperty::isAffectedByAllProperty(CSSPropertyID propertyID)
|
||||
{
|
||||
if (propertyID == CSSPropertyAll)
|
||||
return false;
|
||||
|
||||
// all shorthand spec says:
|
||||
// The all property is a shorthand that resets all CSS properties except
|
||||
// direction and unicode-bidi. It only accepts the CSS-wide keywords.
|
||||
// c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand
|
||||
// So CSSPropertyUnicodeBidi and CSSPropertyDirection are not
|
||||
// affected by all property.
|
||||
return propertyID != CSSPropertyUnicodeBidi && propertyID != CSSPropertyDirection;
|
||||
}
|
||||
|
||||
} // namespace blink
|
||||
|
||||
@ -75,7 +75,6 @@ public:
|
||||
void wrapValueInCommaSeparatedList();
|
||||
|
||||
static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirection);
|
||||
static bool isAffectedByAllProperty(CSSPropertyID);
|
||||
|
||||
const StylePropertyMetadata& metadata() const { return m_metadata; }
|
||||
|
||||
|
||||
@ -317,8 +317,6 @@ bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, CSSValueID valueID
|
||||
return false;
|
||||
|
||||
switch (propertyId) {
|
||||
case CSSPropertyAll:
|
||||
return valueID == CSSValueUnset;
|
||||
case CSSPropertyBackgroundRepeatX: // repeat | no-repeat
|
||||
case CSSPropertyBackgroundRepeatY: // repeat | no-repeat
|
||||
return valueID == CSSValueRepeat || valueID == CSSValueNoRepeat;
|
||||
@ -461,7 +459,6 @@ bool isKeywordPropertyID(CSSPropertyID propertyId)
|
||||
switch (propertyId) {
|
||||
case CSSPropertyAlignItems:
|
||||
case CSSPropertyAlignSelf:
|
||||
case CSSPropertyAll:
|
||||
case CSSPropertyBackgroundRepeatX:
|
||||
case CSSPropertyBackgroundRepeatY:
|
||||
case CSSPropertyBorderBottomStyle:
|
||||
|
||||
@ -5280,7 +5280,7 @@ PassRefPtr<CSSValue> CSSPropertyParser::parseWillChange()
|
||||
ASSERT(CSSPropertyMetadata::isEnabledProperty(property));
|
||||
// Now "all" is used by both CSSValue and CSSPropertyValue.
|
||||
// Need to return nullptr when currentValue is CSSPropertyAll.
|
||||
if (property == CSSPropertyWillChange || property == CSSPropertyAll)
|
||||
if (property == CSSPropertyWillChange)
|
||||
return nullptr;
|
||||
values->append(cssValuePool().createIdentifierValue(property));
|
||||
} else {
|
||||
|
||||
@ -393,44 +393,6 @@ bool StyleResolver::isPropertyForPass(CSSPropertyID property)
|
||||
return firstCSSPropertyId<pass>() <= property && property <= lastCSSPropertyId<pass>();
|
||||
}
|
||||
|
||||
// This method expands the 'all' shorthand property to longhand properties
|
||||
// and applies the expanded longhand properties.
|
||||
template <StyleResolver::StyleApplicationPass pass>
|
||||
void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allValue)
|
||||
{
|
||||
bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedValue();
|
||||
unsigned startCSSProperty = firstCSSPropertyId<pass>();
|
||||
unsigned endCSSProperty = lastCSSPropertyId<pass>();
|
||||
|
||||
for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) {
|
||||
CSSPropertyID propertyId = static_cast<CSSPropertyID>(i);
|
||||
|
||||
// StyleBuilder does not allow any expanded shorthands.
|
||||
if (isExpandedShorthandForAll(propertyId))
|
||||
continue;
|
||||
|
||||
// all shorthand spec says:
|
||||
// The all property is a shorthand that resets all CSS properties
|
||||
// except direction and unicode-bidi.
|
||||
// c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand
|
||||
// We skip applyProperty when a given property is unicode-bidi or
|
||||
// direction.
|
||||
if (!CSSProperty::isAffectedByAllProperty(propertyId))
|
||||
continue;
|
||||
|
||||
CSSValue* value;
|
||||
if (!isUnsetValue) {
|
||||
value = allValue;
|
||||
} else {
|
||||
if (CSSPropertyMetadata::isInheritedProperty(propertyId))
|
||||
value = cssValuePool().createInheritedValue().get();
|
||||
else
|
||||
value = cssValuePool().createExplicitInitialValue().get();
|
||||
}
|
||||
StyleBuilder::applyProperty(propertyId, state, value);
|
||||
}
|
||||
}
|
||||
|
||||
template <StyleResolver::StyleApplicationPass pass>
|
||||
void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, bool inheritedOnly)
|
||||
{
|
||||
@ -438,12 +400,6 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
|
||||
for (unsigned i = 0; i < propertyCount; ++i) {
|
||||
StylePropertySet::PropertyReference current = properties->propertyAt(i);
|
||||
|
||||
CSSPropertyID property = current.id();
|
||||
if (property == CSSPropertyAll) {
|
||||
applyAllProperty<pass>(state, current.value());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inheritedOnly && !current.isInherited()) {
|
||||
// If the property value is explicitly inherited, we need to apply further non-inherited properties
|
||||
// as they might override the value inherited here. For this reason we don't allow declarations with
|
||||
@ -452,6 +408,7 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
|
||||
continue;
|
||||
}
|
||||
|
||||
CSSPropertyID property = current.id();
|
||||
if (!isPropertyForPass<pass>(property))
|
||||
continue;
|
||||
if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
|
||||
|
||||
@ -121,8 +121,6 @@ private:
|
||||
void applyProperties(StyleResolverState&, const StylePropertySet* properties, bool inheritedOnly);
|
||||
template <StyleApplicationPass pass>
|
||||
void applyAnimatedProperties(StyleResolverState&, const HashMap<CSSPropertyID, RefPtr<Interpolation> >&);
|
||||
template <StyleResolver::StyleApplicationPass pass>
|
||||
void applyAllProperty(StyleResolverState&, CSSValue*);
|
||||
|
||||
MatchedPropertiesCache m_matchedPropertiesCache;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user