Title: [90937] trunk/Source/WebCore
Revision
90937
Author
[email protected]
Date
2011-07-13 11:56:37 -0700 (Wed, 13 Jul 2011)

Log Message

[CSS Exclusions] Fix for comment #23 on wrap-shape parsing bug 61726
https://bugs.webkit.org/show_bug.cgi?id=64464

Patch by Alexandru Chiculita <[email protected]> on 2011-07-13
Reviewed by Tony Chang.

No new tests needed.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseWrapShapeRect): Removed the "valid" local.
(WebCore::CSSParser::parseWrapShapeCircle): Removed the "valid" local.
(WebCore::CSSParser::parseWrapShapeEllipse): Removed the "valid" local.
* css/CSSPrimitiveValue.cpp:
* css/CSSWrapShapes.h:
(WebCore::CSSWrapShapePolygon::getXAt): Replaced bit shift with multiplication.
(WebCore::CSSWrapShapePolygon::getYAt): Replaced bit shift with multiplication.
* rendering/style/RenderStyle.cpp:
* rendering/style/StyleRareNonInheritedData.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90936 => 90937)


--- trunk/Source/WebCore/ChangeLog	2011-07-13 18:51:44 UTC (rev 90936)
+++ trunk/Source/WebCore/ChangeLog	2011-07-13 18:56:37 UTC (rev 90937)
@@ -1,3 +1,23 @@
+2011-07-13  Alexandru Chiculita  <[email protected]>
+
+        [CSS Exclusions] Fix for comment #23 on wrap-shape parsing bug 61726
+        https://bugs.webkit.org/show_bug.cgi?id=64464
+
+        Reviewed by Tony Chang.
+
+        No new tests needed.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseWrapShapeRect): Removed the "valid" local.
+        (WebCore::CSSParser::parseWrapShapeCircle): Removed the "valid" local.
+        (WebCore::CSSParser::parseWrapShapeEllipse): Removed the "valid" local.
+        * css/CSSPrimitiveValue.cpp:
+        * css/CSSWrapShapes.h:
+        (WebCore::CSSWrapShapePolygon::getXAt): Replaced bit shift with multiplication.
+        (WebCore::CSSWrapShapePolygon::getYAt): Replaced bit shift with multiplication.
+        * rendering/style/RenderStyle.cpp:
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2011-07-13  Abhishek Arya  <[email protected]>
 
         Reviewed by Adam Barth.

Modified: trunk/Source/WebCore/css/CSSParser.cpp (90936 => 90937)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-07-13 18:51:44 UTC (rev 90936)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-07-13 18:56:37 UTC (rev 90937)
@@ -56,6 +56,7 @@
 #include "CSSUnicodeRangeValue.h"
 #include "CSSValueKeywords.h"
 #include "CSSValueList.h"
+#include "CSSWrapShapes.h"
 #include "Counter.h"
 #include "Document.h"
 #include "FloatConversion.h"
@@ -82,10 +83,6 @@
 #include "DashboardRegion.h"
 #endif
 
-#if ENABLE(CSS_EXCLUSIONS)
-#include "CSSWrapShapes.h"
-#endif
-
 #define YYDEBUG 0
 
 #if YYDEBUG > 0
@@ -3670,17 +3667,14 @@
     // rect(x, y, width, height, [[rx], ry])
     if (args->size() != 7 && args->size() != 9 && args->size() != 11)
         return 0;
-        
-    bool valid = true;
     
     RefPtr<CSSWrapShapeRect> shape = CSSWrapShapeRect::create();
     
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        valid = validUnit(argument, FLength, m_strict);
-        if (!valid)
-            break;
+        if (!validUnit(argument, FLength, m_strict))
+            return 0;
         
         RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue, 
             (CSSPrimitiveValue::UnitTypes) argument->unit);
@@ -3707,17 +3701,15 @@
         }
         argument = args->next();
         if (argument) {
-            if (argument->unit == CSSParserValue::Operator && argument->iValue == ',')
-                argument = args->next();
-            else {
-                valid = false;
-                break;
-            }
+            if (argument->unit != CSSParserValue::Operator || argument->iValue != ',')
+                return 0;
+            
+            argument = args->next();
         }
         argumentNumber++;
     }
     
-    if (!valid || argumentNumber < 4)
+    if (argumentNumber < 4)
         return 0;    
     return shape;
 }
@@ -3730,16 +3722,13 @@
     if (args->size() != 5)
         return 0;
         
-    bool valid = true;
-    
     RefPtr<CSSWrapShapeCircle> shape = CSSWrapShapeCircle::create();
     
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        valid = validUnit(argument, FLength, m_strict);
-        if (!valid)
-            break;
+        if (!validUnit(argument, FLength, m_strict))
+            return 0;
 
         RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue, 
             (CSSPrimitiveValue::UnitTypes) argument->unit);
@@ -3758,17 +3747,14 @@
         
         argument = args->next();
         if (argument) {
-            if (argument->unit == CSSParserValue::Operator && argument->iValue == ',')
-                argument = args->next();
-            else {
-                valid = false;
-                break;
-            }
+            if (argument->unit != CSSParserValue::Operator || argument->iValue != ',')
+                return 0;            
+            argument = args->next();
         }
         argumentNumber++;
     }
     
-    if (!valid || argumentNumber < 3)
+    if (argumentNumber < 3)
         return 0;    
     return shape;
 }
@@ -3781,15 +3767,12 @@
     if (args->size() != 7)
         return 0;
         
-    bool valid = false;
-    
     RefPtr<CSSWrapShapeEllipse> shape = CSSWrapShapeEllipse::create();
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        valid = validUnit(argument, FLength, m_strict);
-        if (!valid)
-            break;
+        if (!validUnit(argument, FLength, m_strict))
+            return 0;
         
         RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue, 
             (CSSPrimitiveValue::UnitTypes) argument->unit);
@@ -3811,17 +3794,14 @@
         
         argument = args->next();
         if (argument) {
-            if (argument && argument->unit == CSSParserValue::Operator && argument->iValue == ',')
-                argument = args->next();
-            else {
-                valid = false;
-                break;
-            }
+            if (argument->unit != CSSParserValue::Operator || argument->iValue != ',')
+                return 0;
+            argument = args->next();
         }
         argumentNumber++;
     }
     
-    if (!valid || argumentNumber < 4)
+    if (argumentNumber < 4)
         return 0;
     return shape;
 }

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (90936 => 90937)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-07-13 18:51:44 UTC (rev 90936)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-07-13 18:56:37 UTC (rev 90937)
@@ -26,6 +26,7 @@
 #include "CSSPropertyNames.h"
 #include "CSSStyleSheet.h"
 #include "CSSValueKeywords.h"
+#include "CSSWrapShapes.h"
 #include "Color.h"
 #include "Counter.h"
 #include "ExceptionCode.h"
@@ -43,10 +44,6 @@
 #include "DashboardRegion.h"
 #endif
 
-#if ENABLE(CSS_EXCLUSIONS)
-#include "CSSWrapShapes.h"
-#endif
-
 using namespace WTF;
 
 namespace WebCore {

Modified: trunk/Source/WebCore/css/CSSWrapShapes.h (90936 => 90937)


--- trunk/Source/WebCore/css/CSSWrapShapes.h	2011-07-13 18:51:44 UTC (rev 90936)
+++ trunk/Source/WebCore/css/CSSWrapShapes.h	2011-07-13 18:56:37 UTC (rev 90937)
@@ -30,6 +30,8 @@
 #ifndef CSSWrapShapes_h
 #define CSSWrapShapes_h
 
+#if ENABLE(CSS_EXCLUSIONS)
+
 #include "CSSPrimitiveValue.h"
 #include "PlatformString.h"
 #include "WindRule.h"
@@ -149,8 +151,8 @@
         m_values.append(y);
     }
     
-    PassRefPtr<CSSPrimitiveValue> getXAt(unsigned i) { return m_values.at(i << 1); }
-    PassRefPtr<CSSPrimitiveValue> getYAt(unsigned i) { return m_values.at((i << 1) & 1); }
+    PassRefPtr<CSSPrimitiveValue> getXAt(unsigned i) { return m_values.at(i * 2); }
+    PassRefPtr<CSSPrimitiveValue> getYAt(unsigned i) { return m_values.at(i * 2 + 1); }
     
     void setWindRule(WindRule w) { m_windRule = w; }
     WindRule windRule() const { return m_windRule; }
@@ -170,4 +172,6 @@
 
 } // namespace WebCore
 
+#endif // ENABLE(CSS_EXCLUSIONS)
+
 #endif // CSSWrapShapes_h

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (90936 => 90937)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-13 18:51:44 UTC (rev 90936)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-13 18:56:37 UTC (rev 90937)
@@ -26,6 +26,7 @@
 #include "CursorList.h"
 #include "CSSPropertyNames.h"
 #include "CSSStyleSelector.h"
+#include "CSSWrapShapes.h"
 #include "FontSelector.h"
 #include "QuotesData.h"
 #include "RenderArena.h"
@@ -36,10 +37,6 @@
 #include <wtf/StdLibExtras.h>
 #include <algorithm>
 
-#if ENABLE(EXCLUSION)
-#include "CSSWrapShapes.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (90936 => 90937)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2011-07-13 18:51:44 UTC (rev 90936)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2011-07-13 18:56:37 UTC (rev 90937)
@@ -25,6 +25,7 @@
 #ifndef StyleRareNonInheritedData_h
 #define StyleRareNonInheritedData_h
 
+#include "CSSWrapShapes.h"
 #include "CounterDirectives.h"
 #include "CursorData.h"
 #include "DataRef.h"
@@ -36,10 +37,6 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 
-#if ENABLE(CSS_EXCLUSIONS)
-#include "CSSWrapShapes.h"
-#endif
-
 namespace WebCore {
 
 class AnimationList;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to