[CSS Shapes] complex calc args for inset round vanish
authorzoltan@webkit.org <zoltan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2014 16:17:09 +0000 (16:17 +0000)
committerzoltan@webkit.org <zoltan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2014 16:17:09 +0000 (16:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132293

Reviewed by Bem Jones-Bey.

Source/WebCore:
In order to use calc in the rounded parameters for inset shapes, we need
to pass RenderStyle for the value creation as we did for the width arguments.
Without taking RenderStyle into account, we hit an assert not reache
in CSSPrimitiveValue::init in the debug builds.

I've added new parsing test.

* css/BasicShapeFunctions.cpp:
(WebCore::valueForBasicShape):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::init):
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::create):
* css/CSSValuePool.h:
(WebCore::CSSValuePool::createValue):

LayoutTests:
* fast/shapes/parsing/parsing-shape-outside-expected.txt:
* fast/shapes/parsing/parsing-test-utils.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167936 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt
LayoutTests/fast/shapes/parsing/parsing-test-utils.js
Source/WebCore/ChangeLog
Source/WebCore/css/BasicShapeFunctions.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSValuePool.h

index 27f821b..efca250 100644 (file)
@@ -1,5 +1,15 @@
 2014-04-29  Zoltan Horvath  <zoltan@webkit.org>
 
+        [CSS Shapes] complex calc args for inset round vanish
+        https://bugs.webkit.org/show_bug.cgi?id=132293
+
+        Reviewed by Bem Jones-Bey.
+
+        * fast/shapes/parsing/parsing-shape-outside-expected.txt:
+        * fast/shapes/parsing/parsing-test-utils.js:
+
+2014-04-29  Zoltan Horvath  <zoltan@webkit.org>
+
         [CSS Shapes] complex calc values for shape-margin return null for computed style
         https://bugs.webkit.org/show_bug.cgi?id=132313
 
index 9366f86..2c2f37f 100644 (file)
@@ -67,6 +67,8 @@ PASS getCSSText("-webkit-shape-outside", "inset(10px round 0px / 10px)") is "ins
 PASS getComputedStyleValue("-webkit-shape-outside", "inset(10px round 0px / 10px)") is "inset(10px round 0px / 10px)"
 PASS getCSSText("-webkit-shape-outside", "inset(calc(25%*3 - 10in) 0 0 0)") is "inset(calc(75% - 10in) 0px 0px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "inset(calc(25%*3 - 10in) 0 0 0)") is "inset(calc(75% - 960px) 0px 0px)"
+PASS getCSSText("-webkit-shape-outside", "inset(10px 10px 10px 10px round calc(25%*3 - 10in))") is "inset(10px round calc(75% - 10in))"
+PASS getComputedStyleValue("-webkit-shape-outside", "inset(10px 10px 10px 10px round calc(25%*3 - 10in))") is "inset(10px round calc(75% - 960px))"
 PASS getCSSText("-webkit-shape-outside", "circle()") is "circle(at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-outside", "circle()") is "circle(closest-side at 50% 50%)"
 PASS getCSSText("-webkit-shape-outside", "circle(farthest-side)") is "circle(farthest-side at 50% 50%)"
index ae54608..88bb590 100644 (file)
@@ -39,6 +39,7 @@ var validShapeValues = [
     "inset(10px round 0px / 10px)",
 
     ["inset(calc(25%*3 - 10in) 0 0 0)", "inset(calc(75% - 10in) 0px 0px)", "inset(calc(75% - 960px) 0px 0px)"],
+    ["inset(10px 10px 10px 10px round calc(25%*3 - 10in))", "inset(10px round calc(75% - 10in))", "inset(10px round calc(75% - 960px))"],
 
     ["circle()", "circle(at 50% 50%)", "circle(closest-side at 50% 50%)"],
     ["circle(farthest-side)", "circle(farthest-side at 50% 50%)", "circle(farthest-side at 50% 50%)"],
index fc08005..07d9fe4 100644 (file)
@@ -1,5 +1,29 @@
 2014-04-29  Zoltan Horvath  <zoltan@webkit.org>
 
+        [CSS Shapes] complex calc args for inset round vanish
+        https://bugs.webkit.org/show_bug.cgi?id=132293
+
+        Reviewed by Bem Jones-Bey.
+
+        In order to use calc in the rounded parameters for inset shapes, we need
+        to pass RenderStyle for the value creation as we did for the width arguments.
+        Without taking RenderStyle into account, we hit an assert not reache
+        in CSSPrimitiveValue::init in the debug builds.
+
+        I've added new parsing test.
+
+        * css/BasicShapeFunctions.cpp:
+        (WebCore::valueForBasicShape):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::init):
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::create):
+        * css/CSSValuePool.h:
+        (WebCore::CSSValuePool::createValue):
+
+2014-04-29  Zoltan Horvath  <zoltan@webkit.org>
+
         [CSS Shapes] complex calc values for shape-margin return null for computed style
         https://bugs.webkit.org/show_bug.cgi?id=132313
 
index f278940..87a396c 100644 (file)
@@ -112,10 +112,10 @@ PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicSha
         insetValue->setBottom(pool.createValue(inset->bottom(), style));
         insetValue->setLeft(pool.createValue(inset->left(), style));
 
-        insetValue->setTopLeftRadius(pool.createValue(inset->topLeftRadius()));
-        insetValue->setTopRightRadius(pool.createValue(inset->topRightRadius()));
-        insetValue->setBottomRightRadius(pool.createValue(inset->bottomRightRadius()));
-        insetValue->setBottomLeftRadius(pool.createValue(inset->bottomLeftRadius()));
+        insetValue->setTopLeftRadius(pool.createValue(inset->topLeftRadius(), style));
+        insetValue->setTopRightRadius(pool.createValue(inset->topRightRadius(), style));
+        insetValue->setBottomRightRadius(pool.createValue(inset->bottomRightRadius(), style));
+        insetValue->setBottomLeftRadius(pool.createValue(inset->bottomLeftRadius(), style));
 
         basicShapeValue = insetValue.release();
         break;
index f2280cd..ccfc499 100644 (file)
@@ -317,10 +317,10 @@ CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, const RenderStyle* st
     ASSERT_NOT_REACHED();
 }
 
-CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize)
+CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const RenderStyle* style)
     : CSSValue(PrimitiveClass)
 {
-    init(lengthSize);
+    init(lengthSize, style);
 }
 
 void CSSPrimitiveValue::init(const Length& length)
@@ -388,11 +388,11 @@ void CSSPrimitiveValue::init(const Length& length)
     ASSERT_NOT_REACHED();
 }
 
-void CSSPrimitiveValue::init(const LengthSize& lengthSize)
+void CSSPrimitiveValue::init(const LengthSize& lengthSize, const RenderStyle* style)
 {
     m_primitiveUnitType = CSS_PAIR;
     m_hasCachedCSSText = false;
-    m_value.pair = Pair::create(create(lengthSize.width()), create(lengthSize.height())).leakRef();
+    m_value.pair = Pair::create(create(lengthSize.width(), style), create(lengthSize.height(), style)).leakRef();
 }
 
 void CSSPrimitiveValue::init(PassRefPtr<Counter> c)
index ee7dbf7..0c461eb 100644 (file)
@@ -214,7 +214,7 @@ public:
     static PassRef<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
     static PassRef<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
     static PassRef<CSSPrimitiveValue> create(const Length& value, const RenderStyle* style) { return adoptRef(*new CSSPrimitiveValue(value, style)); }
-    static PassRef<CSSPrimitiveValue> create(const LengthSize& value) { return adoptRef(*new CSSPrimitiveValue(value)); }
+    static PassRef<CSSPrimitiveValue> create(const LengthSize& value, const RenderStyle* style) { return adoptRef(*new CSSPrimitiveValue(value, style)); }
 
     template<typename T> static PassRef<CSSPrimitiveValue> create(T value)
     {
@@ -346,7 +346,7 @@ private:
     CSSPrimitiveValue(unsigned color); // RGB value
     CSSPrimitiveValue(const Length&);
     CSSPrimitiveValue(const Length&, const RenderStyle*);
-    CSSPrimitiveValue(const LengthSize&);
+    CSSPrimitiveValue(const LengthSize&, const RenderStyle*);
     CSSPrimitiveValue(const String&, UnitTypes);
     CSSPrimitiveValue(double, UnitTypes);
 
@@ -368,7 +368,7 @@ private:
     template<typename T> operator T*(); // compile-time guard
 
     void init(const Length&);
-    void init(const LengthSize&);
+    void init(const LengthSize&, const RenderStyle*);
     void init(PassRefPtr<Counter>);
     void init(PassRefPtr<Rect>);
     void init(PassRefPtr<Pair>);
index 4990e22..7750fdc 100644 (file)
@@ -54,7 +54,7 @@ public:
     PassRef<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
     PassRef<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
     PassRef<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle* style) { return CSSPrimitiveValue::create(value, style); }
-    PassRef<CSSPrimitiveValue> createValue(const LengthSize& value) { return CSSPrimitiveValue::create(value); }
+    PassRef<CSSPrimitiveValue> createValue(const LengthSize& value, const RenderStyle* style) { return CSSPrimitiveValue::create(value, style); }
     template<typename T> static PassRef<CSSPrimitiveValue> createValue(T value) { return CSSPrimitiveValue::create(value); }
 
     void drain();