Title: [207629] trunk/Source/WebCore
- Revision
- 207629
- Author
- hy...@apple.com
- Date
- 2016-10-20 11:35:56 -0700 (Thu, 20 Oct 2016)
Log Message
[CSS Parser] Fix region, column and page break parsing
https://bugs.webkit.org/show_bug.cgi?id=163743
Reviewed by Simon Fraser.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Add the missing values for break support.
* css/parser/CSSPropertyParser.cpp:
(WebCore::isLegacyBreakProperty):
(WebCore::CSSPropertyParser::parseValueStart):
Add a special case for handling legacy break properties. Blink treats them like
shorthands, but we can't do that without breaking the old parser, so for now
we add a special case.
(WebCore::mapFromPageBreakBetween):
(WebCore::mapFromColumnBreakBetween):
(WebCore::mapFromRegionBreakBetween):
Updated to have the AvoidXXX values (where XXX is Column/Page/Region).
(WebCore::CSSPropertyParser::parseShorthand):
Remove the consumeLegacyBreak from the shorthand function, since we can't treat
the legacy break properties as shorthands yet.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (207628 => 207629)
--- trunk/Source/WebCore/ChangeLog 2016-10-20 18:30:59 UTC (rev 207628)
+++ trunk/Source/WebCore/ChangeLog 2016-10-20 18:35:56 UTC (rev 207629)
@@ -1,3 +1,30 @@
+2016-10-20 Dave Hyatt <hy...@apple.com>
+
+ [CSS Parser] Fix region, column and page break parsing
+ https://bugs.webkit.org/show_bug.cgi?id=163743
+
+ Reviewed by Simon Fraser.
+
+ * css/parser/CSSParserFastPaths.cpp:
+ (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+ Add the missing values for break support.
+
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::isLegacyBreakProperty):
+ (WebCore::CSSPropertyParser::parseValueStart):
+ Add a special case for handling legacy break properties. Blink treats them like
+ shorthands, but we can't do that without breaking the old parser, so for now
+ we add a special case.
+
+ (WebCore::mapFromPageBreakBetween):
+ (WebCore::mapFromColumnBreakBetween):
+ (WebCore::mapFromRegionBreakBetween):
+ Updated to have the AvoidXXX values (where XXX is Column/Page/Region).
+
+ (WebCore::CSSPropertyParser::parseShorthand):
+ Remove the consumeLegacyBreak from the shorthand function, since we can't treat
+ the legacy break properties as shorthands yet.
+
2016-10-20 Sam Weinig <s...@webkit.org>
Add convenience function that combines WTF::visit(...) with WTF::makeVisitor(...)
Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (207628 => 207629)
--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp 2016-10-20 18:30:59 UTC (rev 207628)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp 2016-10-20 18:35:56 UTC (rev 207629)
@@ -596,9 +596,17 @@
return valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueScroll || valueID == CSSValueAuto || valueID == CSSValueOverlay || valueID == CSSValueWebkitPagedX || valueID == CSSValueWebkitPagedY;
case CSSPropertyBreakAfter:
case CSSPropertyBreakBefore:
- return valueID == CSSValueAuto || valueID == CSSValueAvoid || valueID == CSSValueAvoidPage || valueID == CSSValuePage || valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueRecto || valueID == CSSValueVerso || valueID == CSSValueAvoidColumn || valueID == CSSValueColumn;
+ return valueID == CSSValueAuto || valueID == CSSValueAvoid || valueID == CSSValueAvoidPage || valueID == CSSValuePage || valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueRecto || valueID == CSSValueVerso || valueID == CSSValueAvoidColumn || valueID == CSSValueColumn
+#if ENABLE(CSS_REGIONS)
+ || valueID == CSSValueRegion || valueID == CSSValueAvoidRegion
+#endif
+ ;
case CSSPropertyBreakInside:
- return valueID == CSSValueAuto || valueID == CSSValueAvoid || valueID == CSSValueAvoidPage || valueID == CSSValueAvoidColumn;
+ return valueID == CSSValueAuto || valueID == CSSValueAvoid || valueID == CSSValueAvoidPage || valueID == CSSValueAvoidColumn
+#if ENABLE(CSS_REGIONS)
+ || valueID == CSSValueAvoidRegion
+#endif
+ ;
case CSSPropertyPointerEvents:
// none | visiblePainted | visibleFill | visibleStroke | visible |
// painted | fill | stroke | auto | all | bounding-box
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (207628 => 207629)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-10-20 18:30:59 UTC (rev 207628)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-10-20 18:35:56 UTC (rev 207629)
@@ -266,6 +266,27 @@
return value;
}
+static bool isLegacyBreakProperty(CSSPropertyID propertyID)
+{
+ switch (propertyID) {
+ case CSSPropertyPageBreakAfter:
+ case CSSPropertyPageBreakBefore:
+ case CSSPropertyPageBreakInside:
+ case CSSPropertyWebkitColumnBreakAfter:
+ case CSSPropertyWebkitColumnBreakBefore:
+ case CSSPropertyWebkitColumnBreakInside:
+#if ENABLE(CSS_REGIONS)
+ case CSSPropertyWebkitRegionBreakAfter:
+ case CSSPropertyWebkitRegionBreakBefore:
+ case CSSPropertyWebkitRegionBreakInside:
+#endif
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
bool CSSPropertyParser::parseValueStart(CSSPropertyID propertyID, bool important)
{
if (consumeCSSWideKeyword(propertyID, important))
@@ -278,6 +299,11 @@
// Variable references will fail to parse here and will fall out to the variable ref parser below.
if (parseShorthand(propertyID, important))
return true;
+ } else if (isLegacyBreakProperty(propertyID)) {
+ // FIXME-NEWPARSER: Can turn this into a shorthand once old parser is gone, and then
+ // we don't need the special case.
+ if (consumeLegacyBreakProperty(propertyID, important))
+ return true;
} else {
RefPtr<CSSValue> parsedValue = parseSingleValue(propertyID);
if (parsedValue && m_range.atEnd()) {
@@ -4003,8 +4029,10 @@
{
if (value == CSSValueAlways)
return CSSValuePage;
- if (value == CSSValueAuto || value == CSSValueAvoid || value == CSSValueLeft || value == CSSValueRight)
+ if (value == CSSValueAuto || value == CSSValueLeft || value == CSSValueRight)
return value;
+ if (value == CSSValueAvoid)
+ return CSSValueAvoidPage;
return CSSValueInvalid;
}
@@ -4012,8 +4040,10 @@
{
if (value == CSSValueAlways)
return CSSValueColumn;
- if (value == CSSValueAuto || value == CSSValueAvoid)
+ if (value == CSSValueAuto)
return value;
+ if (value == CSSValueAvoid)
+ return CSSValueAvoidColumn;
return CSSValueInvalid;
}
@@ -4022,8 +4052,10 @@
{
if (value == CSSValueAlways)
return CSSValueRegion;
- if (value == CSSValueAuto || value == CSSValueAvoid)
+ if (value == CSSValueAuto)
return value;
+ if (value == CSSValueAvoid)
+ return CSSValueAvoidRegion;
return CSSValueInvalid;
}
#endif
@@ -4571,13 +4603,6 @@
return consumeBorder(important);
case CSSPropertyBorderImage:
return consumeBorderImage(property, important);
- case CSSPropertyPageBreakAfter:
- case CSSPropertyPageBreakBefore:
- case CSSPropertyPageBreakInside:
- case CSSPropertyWebkitColumnBreakAfter:
- case CSSPropertyWebkitColumnBreakBefore:
- case CSSPropertyWebkitColumnBreakInside:
- return consumeLegacyBreakProperty(property, important);
case CSSPropertyWebkitMaskPosition:
case CSSPropertyBackgroundPosition: {
RefPtr<CSSValue> resultX;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes