Title: [208051] trunk/Source/WebCore
Revision
208051
Author
hy...@apple.com
Date
2016-10-28 09:23:18 -0700 (Fri, 28 Oct 2016)

Log Message

[CSS Parser] Miscellaneous bug fixes
https://bugs.webkit.org/show_bug.cgi?id=164131

Reviewed by Zalan Bujtas.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSPropertyNames.in:
The prefix was incorrectly dropped from -webkit-column-progression.
Put it back.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertPositionComponent):
(WebCore::StyleBuilderConverter::convertObjectPosition):
Fix object-position parsing so that the position components can
be ids.

* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueContent):
The new parser doesn't make a list for content:none, since none can't be
a component of a list anyway. Add code to handle this case in the
apply function.

* css/parser/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
Put the prefix back on -webkit-column-progression.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
Same.

* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parsePageSelector):
Make sure match type is checked, since our code asserts if it isn't.

* css/parser/CSSPropertyParser.cpp:
(WebCore::validWidthOrHeightKeyword):
(WebCore::consumeLineGrid):
(WebCore::CSSPropertyParser::parseSingleValue):
Add support for the line-grid properties and for -webkit-nbsp-mode.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208050 => 208051)


--- trunk/Source/WebCore/ChangeLog	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/ChangeLog	2016-10-28 16:23:18 UTC (rev 208051)
@@ -1,3 +1,47 @@
+2016-10-28  Dave Hyatt  <hy...@apple.com>
+
+        [CSS Parser] Miscellaneous bug fixes
+        https://bugs.webkit.org/show_bug.cgi?id=164131
+
+        Reviewed by Zalan Bujtas.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSPropertyNames.in:
+        The prefix was incorrectly dropped from -webkit-column-progression.
+        Put it back.
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertPositionComponent):
+        (WebCore::StyleBuilderConverter::convertObjectPosition):
+        Fix object-position parsing so that the position components can
+        be ids.
+
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyValueContent):
+        The new parser doesn't make a list for content:none, since none can't be
+        a component of a list anyway. Add code to handle this case in the
+        apply function.
+
+        * css/parser/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        Put the prefix back on -webkit-column-progression.
+
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+        Same.
+
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::parsePageSelector):
+        Make sure match type is checked, since our code asserts if it isn't.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::validWidthOrHeightKeyword):
+        (WebCore::consumeLineGrid):
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        Add support for the line-grid properties and for -webkit-nbsp-mode.
+
 2016-10-28  Antti Koivisto  <an...@apple.com>
 
         Always use iOS preload behavior

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (208050 => 208051)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2016-10-28 16:23:18 UTC (rev 208051)
@@ -289,7 +289,7 @@
     CSSPropertyColumnCount,
     CSSPropertyColumnFill,
     CSSPropertyColumnGap,
-    CSSPropertyColumnProgression,
+    CSSPropertyWebkitColumnProgression,
     CSSPropertyColumnRuleColor,
     CSSPropertyColumnRuleStyle,
     CSSPropertyColumnRuleWidth,
@@ -2800,7 +2800,7 @@
             if (style->hasNormalColumnGap())
                 return cssValuePool.createIdentifierValue(CSSValueNormal);
             return zoomAdjustedPixelValue(style->columnGap(), *style);
-        case CSSPropertyColumnProgression:
+        case CSSPropertyWebkitColumnProgression:
             return cssValuePool.createValue(style->columnProgression());
         case CSSPropertyColumnRuleColor:
             return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style->columnRuleColor());

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (208050 => 208051)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2016-10-28 16:23:18 UTC (rev 208051)
@@ -443,8 +443,7 @@
 -webkit-column-fill = column-fill
 column-gap [Custom=All]
 -webkit-column-gap = column-gap
-column-progression
--webkit-column-progression = column-progression
+-webkit-column-progression
 column-rule [Longhands=column-rule-width|column-rule-style|column-rule-color]
 -webkit-column-rule = column-rule
 column-rule-color [VisitedLinkColorSupport, Initial=invalidColor]

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (208050 => 208051)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2016-10-28 16:23:18 UTC (rev 208051)
@@ -158,7 +158,7 @@
 #endif
 
     static Length convertTo100PercentMinusLength(const Length&);
-    static Length convertPositionComponent(StyleResolver&, const CSSPrimitiveValue&);
+    template<CSSValueID, CSSValueID> static Length convertPositionComponent(StyleResolver&, const CSSPrimitiveValue&);
 
 #if ENABLE(CSS_GRID_LAYOUT)
     static GridLength createGridTrackBreadth(const CSSPrimitiveValue&, StyleResolver&);
@@ -323,6 +323,7 @@
     return Length(CalculationValue::create(WTFMove(op), ValueRangeAll));
 }
 
+template <CSSValueID cssValueFor0, CSSValueID cssValueFor100>
 inline Length StyleBuilderConverter::convertPositionComponent(StyleResolver& styleResolver, const CSSPrimitiveValue& value)
 {
     Length length;
@@ -337,7 +338,20 @@
 
         lengthValue = value.pairValue()->second();
     }
-
+    
+    if (value.isValueID()) {
+        switch (value.valueID()) {
+            case cssValueFor0:
+                return Length(0, Percent);
+            case cssValueFor100:
+                return Length(100, Percent);
+            case CSSValueCenter:
+                return Length(50, Percent);
+            default:
+                ASSERT_NOT_REACHED();
+        }
+    }
+        
     length = convertLength(styleResolver, *lengthValue);
 
     if (relativeToTrailingEdge)
@@ -353,8 +367,8 @@
     if (!pair || !pair->first() || !pair->second())
         return RenderStyle::initialObjectPosition();
 
-    Length lengthX = convertPositionComponent(styleResolver, *pair->first());
-    Length lengthY = convertPositionComponent(styleResolver, *pair->second());
+    Length lengthX = convertPositionComponent<CSSValueLeft, CSSValueRight>(styleResolver, *pair->first());
+    Length lengthY = convertPositionComponent<CSSValueTop, CSSValueBottom>(styleResolver, *pair->second());
 
     return LengthPoint(lengthX, lengthY);
 }

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (208050 => 208051)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2016-10-28 16:23:18 UTC (rev 208051)
@@ -1378,6 +1378,13 @@
 
 inline void StyleBuilderCustom::applyValueContent(StyleResolver& styleResolver, CSSValue& value)
 {
+    if (is<CSSPrimitiveValue>(value)) {
+        const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+        ASSERT_UNUSED(primitiveValue, primitiveValue.valueID() == CSSValueNormal || primitiveValue.valueID() == CSSValueNone);
+        styleResolver.style()->clearContent();
+        return;
+    }
+    
     bool didSet = false;
     for (auto& item : downcast<CSSValueList>(value)) {
         if (is<CSSImageGeneratorValue>(item.get())) {

Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (208050 => 208051)


--- trunk/Source/WebCore/css/parser/CSSParser.cpp	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp	2016-10-28 16:23:18 UTC (rev 208051)
@@ -838,7 +838,7 @@
         if (valueID == CSSValueAuto || valueID == CSSValueBalance)
             return true;
         break;
-    case CSSPropertyColumnProgression:
+    case CSSPropertyWebkitColumnProgression:
         if (valueID == CSSValueNormal || valueID == CSSValueReverse)
             return true;
         break;

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (208050 => 208051)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2016-10-28 16:23:18 UTC (rev 208051)
@@ -660,8 +660,7 @@
     case CSSPropertyUnicodeBidi:
         return valueID == CSSValueNormal || valueID == CSSValueEmbed
             || valueID == CSSValueBidiOverride || valueID == CSSValueWebkitIsolate
-            || valueID == CSSValueWebkitIsolateOverride || valueID == CSSValueWebkitPlaintext
-            || valueID == CSSValueIsolate || valueID == CSSValueWebkitIsolateOverride || valueID == CSSValueWebkitPlaintext;
+            || valueID == CSSValueWebkitIsolateOverride || valueID == CSSValueWebkitPlaintext;
     case CSSPropertyVectorEffect:
         return valueID == CSSValueNone || valueID == CSSValueNonScalingStroke;
     case CSSPropertyVisibility: // visible | hidden | collapse
@@ -691,6 +690,10 @@
         return valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueJustify;
     case CSSPropertyColumnFill:
         return valueID == CSSValueAuto || valueID == CSSValueBalance;
+    case CSSPropertyWebkitColumnAxis:
+        return valueID == CSSValueHorizontal || valueID == CSSValueVertical || valueID == CSSValueAuto;
+    case CSSPropertyWebkitColumnProgression:
+        return valueID == CSSValueNormal || valueID == CSSValueReverse;
     case CSSPropertyAlignContent:
         // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'.
         return valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch;
@@ -713,8 +716,12 @@
         return valueID == CSSValueAuto || valueID == CSSValueNormal || valueID == CSSValueNone;
     case CSSPropertyWebkitFontSmoothing:
         return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueAntialiased || valueID == CSSValueSubpixelAntialiased;
+    case CSSPropertyWebkitLineAlign:
+        return valueID == CSSValueNone || valueID == CSSValueEdges;
     case CSSPropertyWebkitLineBreak: // auto | loose | normal | strict | after-white-space
         return valueID == CSSValueAuto || valueID == CSSValueLoose || valueID == CSSValueNormal || valueID == CSSValueStrict || valueID == CSSValueAfterWhiteSpace;
+    case CSSPropertyWebkitLineSnap:
+        return valueID == CSSValueNone || valueID == CSSValueBaseline || valueID == CSSValueContain;
     case CSSPropertyWebkitMarginAfterCollapse:
     case CSSPropertyWebkitMarginBeforeCollapse:
     case CSSPropertyWebkitMarginBottomCollapse:
@@ -775,6 +782,16 @@
     case CSSPropertyApplePayButtonType: // plain | buy | set-up
         return valueID == CSSValuePlain || valueID == CSSValueBuy || valueID == CSSValueSetUp;
 #endif
+    case CSSPropertyWebkitNbspMode: // normal | space
+        return valueID == CSSValueNormal || valueID == CSSValueSpace;
+    case CSSPropertyWebkitTextZoom:
+        return valueID == CSSValueNormal || valueID == CSSValueReset;
+#if PLATFORM(IOS)
+    // Apple specific property. These will never be standardized and is purely to
+    // support custom WebKit-based Apple applications.
+    case CSSPropertyWebkitTouchCallout:
+        return valueID == CSSValueDefault || valueID == CSSValueNone;
+#endif
     default:
         ASSERT_NOT_REACHED();
         return false;
@@ -796,7 +813,7 @@
     case CSSPropertyCaptionSide:
     case CSSPropertyClear:
     case CSSPropertyColumnFill:
-    case CSSPropertyColumnProgression:
+    case CSSPropertyWebkitColumnProgression:
     case CSSPropertyColumnRuleStyle:
     case CSSPropertyDirection:
     case CSSPropertyDisplay:

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (208050 => 208051)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2016-10-28 16:23:18 UTC (rev 208051)
@@ -217,7 +217,7 @@
         selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector);
         if (!pseudo.isNull()) {
             selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePagePseudoSelector(pseudo));
-            if (!selector || selector->pseudoElementType() == CSSSelector::PseudoElementUnknown)
+            if (!selector || selector->match() != CSSSelector::PseudoElement || selector->pseudoElementType() == CSSSelector::PseudoElementUnknown)
                 return CSSSelectorList();
         }
         if (!typeSelector.isNull())

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (208050 => 208051)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-10-28 16:14:25 UTC (rev 208050)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-10-28 16:23:18 UTC (rev 208051)
@@ -917,8 +917,7 @@
 // FIXME-NEWPARSER: Drop the prefix on min-content, max-content and fit-content.
 static bool validWidthOrHeightKeyword(CSSValueID id, const CSSParserContext& /*context*/)
 {
-    if (id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent
-        || id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFitContent) {
+    if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent) {
         return true;
     }
     return false;
@@ -3119,6 +3118,13 @@
     return CSSLineBoxContainValue::create(lineBoxContain);
 }
 
+static RefPtr<CSSValue> consumeLineGrid(CSSParserTokenRange& range)
+{
+    if (range.peek().id() == CSSValueNone)
+        return consumeIdent(range);
+    return consumeCustomIdent(range);
+}
+
 RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSSPropertyID currentShorthand)
 {
     if (CSSParserFastPaths::isKeywordPropertyID(property)) {
@@ -3487,6 +3493,8 @@
     case CSSPropertyWebkitFlowFrom:
         return consumeFlowProperty(m_range);
 #endif
+    case CSSPropertyWebkitLineGrid:
+        return consumeLineGrid(m_range);
     default:
         return nullptr;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to