Title: [161667] trunk/Source/WebCore
Revision
161667
Author
betra...@adobe.com
Date
2014-01-10 13:12:26 -0800 (Fri, 10 Jan 2014)

Log Message

[CSS Shapes] Change parseBasicShape to return a CSSPrimitiveValue
https://bugs.webkit.org/show_bug.cgi?id=126713

Reviewed by Dirk Schulze.

Avoid the duplicated code wrapping the CSSBasicShape in a CSSPrimitiveValue
by having parseBasicShape return a CSSPrimitiveValue reference.

Refactoring, no new tests.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseShapeProperty):
(WebCore::CSSParser::parseClipPath):
(WebCore::CSSParser::parseBasicShape):
* css/CSSParser.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161666 => 161667)


--- trunk/Source/WebCore/ChangeLog	2014-01-10 21:10:57 UTC (rev 161666)
+++ trunk/Source/WebCore/ChangeLog	2014-01-10 21:12:26 UTC (rev 161667)
@@ -1,3 +1,21 @@
+2014-01-10  Bear Travis  <betra...@adobe.com>
+
+        [CSS Shapes] Change parseBasicShape to return a CSSPrimitiveValue
+        https://bugs.webkit.org/show_bug.cgi?id=126713
+
+        Reviewed by Dirk Schulze.
+
+        Avoid the duplicated code wrapping the CSSBasicShape in a CSSPrimitiveValue
+        by having parseBasicShape return a CSSPrimitiveValue reference.
+
+        Refactoring, no new tests.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseShapeProperty):
+        (WebCore::CSSParser::parseClipPath):
+        (WebCore::CSSParser::parseBasicShape):
+        * css/CSSParser.h:
+
 2014-01-10  Piotr Grad  <p.g...@samsung.com>
 
         Possible crash in ApplicationCache::removeResource.

Modified: trunk/Source/WebCore/css/CSSParser.cpp (161666 => 161667)


--- trunk/Source/WebCore/css/CSSParser.cpp	2014-01-10 21:10:57 UTC (rev 161666)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2014-01-10 21:12:26 UTC (rev 161667)
@@ -5866,7 +5866,7 @@
     CSSParserValue* value = m_valueList->current();
     CSSValueID valueId = value->id;
     RefPtr<CSSPrimitiveValue> keywordValue;
-    RefPtr<CSSBasicShape> shapeValue;
+    RefPtr<CSSPrimitiveValue> shapeValue;
 
     if (valueId == CSSValueNone
         || (valueId == CSSValueOutsideShape && propId == CSSPropertyWebkitShapeInside)) {
@@ -5902,10 +5902,12 @@
             return nullptr;
     }
 
+    ASSERT(!shapeValue || shapeValue->isShape());
+
     if (shapeValue && keywordValue)
-        shapeValue->setLayoutBox(keywordValue.release());
+        shapeValue->getShapeValue()->setLayoutBox(keywordValue.release());
 
-    return shapeValue ? cssValuePool().createValue(shapeValue.release()) : keywordValue.release();
+    return shapeValue ? shapeValue.release() : keywordValue.release();
 }
 #endif
 
@@ -5934,10 +5936,10 @@
         valueId = value->id;
         if (value->unit == CSSParserValue::Function && !shapeFound) {
             // parseBasicShape already asks for the next value list item.
-            RefPtr<CSSBasicShape> shapeValue = parseBasicShape();
+            RefPtr<CSSPrimitiveValue> shapeValue = parseBasicShape();
             if (!shapeValue)
                 return nullptr;
-            list->append(cssValuePool().createValue(shapeValue.release()));
+            list->append(shapeValue.release());
             shapeFound = true;
         } else if ((isBoxValue(valueId) || valueId == CSSValueBoundingBox) && !boxFound) {
             list->append(parseValidPrimitive(valueId, value));
@@ -5966,7 +5968,7 @@
     return false;
 }
 
-PassRefPtr<CSSBasicShape> CSSParser::parseBasicShape()
+PassRefPtr<CSSPrimitiveValue> CSSParser::parseBasicShape()
 {
     CSSParserValue* value = m_valueList->current();
     ASSERT(value->unit == CSSParserValue::Function);
@@ -5999,7 +6001,7 @@
         return nullptr;
 
     m_valueList->next();
-    return shape.release();
+    return cssValuePool().createValue(shape.release());
 }
 
 // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 'font-family'

Modified: trunk/Source/WebCore/css/CSSParser.h (161666 => 161667)


--- trunk/Source/WebCore/css/CSSParser.h	2014-01-10 21:10:57 UTC (rev 161666)
+++ trunk/Source/WebCore/css/CSSParser.h	2014-01-10 21:12:26 UTC (rev 161667)
@@ -179,7 +179,7 @@
     PassRefPtr<CSSValue> parseShapeProperty(CSSPropertyID);
 #endif
 
-    PassRefPtr<CSSBasicShape> parseBasicShape();
+    PassRefPtr<CSSPrimitiveValue> parseBasicShape();
     PassRefPtr<CSSPrimitiveValue> parseShapeRadius(CSSParserValue*);
     PassRefPtr<CSSBasicShape> parseBasicShapeRectangle(CSSParserValueList*);
     PassRefPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueList*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to