Title: [208119] trunk/Source/WebCore
Revision
208119
Author
[email protected]
Date
2016-10-29 20:48:06 -0700 (Sat, 29 Oct 2016)

Log Message

[CSS Parser] Fix text-emphasis-position parsing
https://bugs.webkit.org/show_bug.cgi?id=164197

Reviewed by Zalan Bujtas.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeTextEmphasisPosition):
(WebCore::CSSPropertyParser::parseSingleValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208118 => 208119)


--- trunk/Source/WebCore/ChangeLog	2016-10-30 02:56:39 UTC (rev 208118)
+++ trunk/Source/WebCore/ChangeLog	2016-10-30 03:48:06 UTC (rev 208119)
@@ -1,3 +1,17 @@
+2016-10-29  Dave Hyatt  <[email protected]>
+
+        [CSS Parser] Fix text-emphasis-position parsing
+        https://bugs.webkit.org/show_bug.cgi?id=164197
+
+        Reviewed by Zalan Bujtas.
+
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeTextEmphasisPosition):
+        (WebCore::CSSPropertyParser::parseSingleValue):
+
 2016-10-29  Darin Adler  <[email protected]>
 
         Convert more of DOM from ExceptionCode to Exception

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (208118 => 208119)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2016-10-30 02:56:39 UTC (rev 208118)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2016-10-30 03:48:06 UTC (rev 208119)
@@ -735,8 +735,6 @@
         return valueID == CSSValueBefore || valueID == CSSValueAfter || valueID == CSSValueInterCharacter;
     case CSSPropertyWebkitTextCombine:
         return valueID == CSSValueNone || valueID == CSSValueHorizontal;
-    case CSSPropertyWebkitTextEmphasisPosition:
-        return valueID == CSSValueOver || valueID == CSSValueUnder;
     case CSSPropertyWebkitTextSecurity: // disc | circle | square | none
         return valueID == CSSValueDisc || valueID == CSSValueCircle || valueID == CSSValueSquare || valueID == CSSValueNone;
     case CSSPropertyTransformStyle:
@@ -925,7 +923,6 @@
     // FIXME-NEWPARSER: Treat the following properties as keyword properties:
     // case CSSPropertyBackgroundRepeatX:
     // case CSSPropertyBackgroundRepeatY:
-    // case CSSPropertyWebkitTextEmphasisPosition:
 
     // FIXME-NEWPARSER: Add the following unprefixed properties:
     // case CSSPropertyBackfaceVisibility:

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (208118 => 208119)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-10-30 02:56:39 UTC (rev 208118)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-10-30 03:48:06 UTC (rev 208119)
@@ -3262,6 +3262,53 @@
     return CSSAspectRatioValue::create(leftValue->floatValue(), rightValue->floatValue());
 }
 
+static RefPtr<CSSValue> consumeTextEmphasisPosition(CSSParserTokenRange& range)
+{
+    bool foundOverOrUnder = false;
+    CSSValueID overUnderValueID = CSSValueOver;
+    bool foundLeftOrRight = false;
+    CSSValueID leftRightValueID = CSSValueRight;
+    while (!range.atEnd()) {
+        switch (range.peek().id()) {
+        case CSSValueOver:
+            if (foundOverOrUnder)
+                return nullptr;
+            foundOverOrUnder = true;
+            overUnderValueID = CSSValueOver;
+            break;
+        case CSSValueUnder:
+            if (foundOverOrUnder)
+                return nullptr;
+            foundOverOrUnder = true;
+            overUnderValueID = CSSValueUnder;
+            break;
+        case CSSValueLeft:
+            if (foundLeftOrRight)
+                return nullptr;
+            foundLeftOrRight = true;
+            leftRightValueID = CSSValueLeft;
+            break;
+        case CSSValueRight:
+            if (foundLeftOrRight)
+                return nullptr;
+            foundLeftOrRight = true;
+            leftRightValueID = CSSValueRight;
+            break;
+        default:
+            return nullptr;
+        }
+        
+        range.consumeIncludingWhitespace();
+    }
+    if (!foundOverOrUnder)
+        return nullptr;
+    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    list->append(CSSValuePool::singleton().createIdentifierValue(overUnderValueID));
+    if (foundLeftOrRight)
+        list->append(CSSValuePool::singleton().createIdentifierValue(leftRightValueID));
+    return list;
+}
+    
 RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSSPropertyID currentShorthand)
 {
     if (CSSParserFastPaths::isKeywordPropertyID(property)) {
@@ -3657,6 +3704,8 @@
         return consumeAlt(m_range, m_context);
     case CSSPropertyWebkitAspectRatio:
         return consumeWebkitAspectRatio(m_range);
+    case CSSPropertyWebkitTextEmphasisPosition:
+        return consumeTextEmphasisPosition(m_range);
     default:
         return nullptr;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to