Title: [134678] trunk
Revision
134678
Author
[email protected]
Date
2012-11-14 15:09:28 -0800 (Wed, 14 Nov 2012)

Log Message

[CSS Exclusions] Basic shapes on 'shape-inside' should be animatable
https://bugs.webkit.org/show_bug.cgi?id=102123

Reviewed by Antti Koivisto.

Source/WebCore:

The '-webkit-shape-inside' propery takes a BasicShape as input like
'-webkit-clip-path'. Follow up on http://trac.webkit.org/changeset/134352 and
make '-webkit-shape-inside' animatable as well.

Test: fast/exclusions/shape-inside/shape-inside-animation.html

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Blend fuction for exclusion shapes. The property takes another
    input then '-webkit-clip-path'.
(WebCore):
(PropertyWrapperBasicShape): Add wrapper for BasicShape object. Can be reused by
    '-webkit-shape-ourside' as well.
(WebCore::PropertyWrapperBasicShape::PropertyWrapperBasicShape):
(WebCore::CSSPropertyAnimation::ensurePropertyMap):

LayoutTests:

Add new animation test for 'shape-inside', similar to 'clip-path' test.

* animations/resources/animation-test-helpers.js:
(getPropertyValue):
(comparePropertyValue):
* fast/exclusions/shape-inside/shape-inside-animation-expected.txt: Added.
* fast/exclusions/shape-inside/shape-inside-animation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134677 => 134678)


--- trunk/LayoutTests/ChangeLog	2012-11-14 23:04:43 UTC (rev 134677)
+++ trunk/LayoutTests/ChangeLog	2012-11-14 23:09:28 UTC (rev 134678)
@@ -1,3 +1,18 @@
+2012-11-14  Dirk Schulze  <[email protected]>
+
+        [CSS Exclusions] Basic shapes on 'shape-inside' should be animatable
+        https://bugs.webkit.org/show_bug.cgi?id=102123
+
+        Reviewed by Antti Koivisto.
+
+        Add new animation test for 'shape-inside', similar to 'clip-path' test.
+
+        * animations/resources/animation-test-helpers.js:
+        (getPropertyValue):
+        (comparePropertyValue):
+        * fast/exclusions/shape-inside/shape-inside-animation-expected.txt: Added.
+        * fast/exclusions/shape-inside/shape-inside-animation.html: Added.
+
 2012-11-14  Justin Novosad  <[email protected]>
 
         Updating baselines after r134631

Modified: trunk/LayoutTests/animations/resources/animation-test-helpers.js (134677 => 134678)


--- trunk/LayoutTests/animations/resources/animation-test-helpers.js	2012-11-14 23:04:43 UTC (rev 134677)
+++ trunk/LayoutTests/animations/resources/animation-test-helpers.js	2012-11-14 23:09:28 UTC (rev 134678)
@@ -296,6 +296,7 @@
                || property == "webkitMaskBoxImage"
                || property == "webkitFilter"
                || property == "webkitClipPath"
+               || property == "webkitShapeInside"
                || !property.indexOf("webkitTransform")) {
         computedValue = window.getComputedStyle(element)[property.split(".")[0]];
     } else {
@@ -328,7 +329,7 @@
         var filterParameters = getFilterParameters(computedValue);
         var filter2Parameters = getFilterParameters(expectedValue);
         result = filterParametersMatch(filterParameters, filter2Parameters, tolerance);
-    } else if (property == "webkitClipPath") {
+    } else if (property == "webkitClipPath" || property == "webkitShapeInside") {
         var clipPathParameters = parseBasicShape(computedValue);
         var clipPathParameters2 = parseBasicShape(expectedValue);
         if (!clipPathParameters || !clipPathParameters2)

Added: trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt (0 => 134678)


--- trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt	2012-11-14 23:09:28 UTC (rev 134678)
@@ -0,0 +1,5 @@
+Moving Text Moving Text Moving Text
+PASS - "webkitShapeInside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%)
+PASS - "webkitShapeInside" property for "circle-box" element at 1s saw something close to: circle(35%, 35%, 35%)
+PASS - "webkitShapeInside" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%)
+

Added: trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html (0 => 134678)


--- trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html	                        (rev 0)
+++ trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html	2012-11-14 23:09:28 UTC (rev 134678)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <script>
+      if (window.internals)
+          window.internals.settings.setCSSExclusionsEnabled(true);
+  </script>
+  <style>
+    .box {
+        height: 100px;
+        width: 100px;
+        margin: 10px;
+        display: inline-block;
+    }
+
+    #rectangle-box {
+      -webkit-animation: rectangle-anim 2s linear
+    }
+
+    #circle-box {
+      -webkit-animation: circle-anim 2s linear
+    }
+
+    #ellipse-box {
+      -webkit-animation: ellipse-anim 2s linear
+    }
+
+
+    @-webkit-keyframes rectangle-anim {
+        from { -webkit-shape-inside: rectangle(0%, 0%, 100%, 100%); }
+        to   { -webkit-shape-inside: rectangle(20%, 20%, 60%, 60%); }
+    }
+
+    @-webkit-keyframes circle-anim {
+        from { -webkit-shape-inside: circle(50%, 50%, 50%); }
+        to   { -webkit-shape-inside: circle(20%, 20%, 20%); }
+    }
+
+    @-webkit-keyframes ellipse-anim {
+        from { -webkit-shape-inside: ellipse(50%, 50%, 50%, 40%); }
+        to   { -webkit-shape-inside: ellipse(20%, 20%, 20%, 20%); }
+    }
+
+  </style>
+  <script src=""
+  <script type="text/_javascript_">
+    const expectedValues = [
+      // [animation-name, time, element-id, property, expected-value, tolerance]
+      ["rectangle-anim",  1, "rectangle-box", "webkitShapeInside", 'rectangle(10%, 10%, 80%, 80%)', 0.05],
+      ["circle-anim",  1, "circle-box", "webkitShapeInside", 'circle(35%, 35%, 35%)', 0.05],
+      ["ellipse-anim",  1, "ellipse-box", "webkitShapeInside", 'ellipse(35%, 35%, 35%, 30%)', 0.05],
+    ];
+    
+    runAnimationTest(expectedValues);
+  </script>
+</head>
+<body>
+
+<div class="box" id="rectangle-box">Moving Text</div>
+<div class="box" id="circle-box">Moving Text</div>
+<div class="box" id="ellipse-box">Moving Text</div>
+
+<div id="result">
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (134677 => 134678)


--- trunk/Source/WebCore/ChangeLog	2012-11-14 23:04:43 UTC (rev 134677)
+++ trunk/Source/WebCore/ChangeLog	2012-11-14 23:09:28 UTC (rev 134678)
@@ -1,3 +1,25 @@
+2012-11-14  Dirk Schulze  <[email protected]>
+
+        [CSS Exclusions] Basic shapes on 'shape-inside' should be animatable
+        https://bugs.webkit.org/show_bug.cgi?id=102123
+
+        Reviewed by Antti Koivisto.
+
+        The '-webkit-shape-inside' propery takes a BasicShape as input like
+        '-webkit-clip-path'. Follow up on http://trac.webkit.org/changeset/134352 and
+        make '-webkit-shape-inside' animatable as well.
+
+        Test: fast/exclusions/shape-inside/shape-inside-animation.html
+
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc): Blend fuction for exclusion shapes. The property takes another
+            input then '-webkit-clip-path'.
+        (WebCore):
+        (PropertyWrapperBasicShape): Add wrapper for BasicShape object. Can be reused by
+            '-webkit-shape-ourside' as well.
+        (WebCore::PropertyWrapperBasicShape::PropertyWrapperBasicShape):
+        (WebCore::CSSPropertyAnimation::ensurePropertyMap):
+
 2012-11-14  Helder Correia  <[email protected]>
 
         [TexMap][Cairo] Accelerated compositing debug visuals

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (134677 => 134678)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2012-11-14 23:04:43 UTC (rev 134677)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2012-11-14 23:09:28 UTC (rev 134678)
@@ -146,6 +146,21 @@
     return ShapeClipPathOperation::create(toShape->blend(fromShape, progress));
 }
 
+#if ENABLE(CSS_EXCLUSIONS)
+static inline PassRefPtr<BasicShape> blendFunc(const AnimationBase*, BasicShape* from, BasicShape* to, double progress)
+{
+    // FIXME: Support animations between different shapes in the future.
+    if (from->type() != to->type())
+        return to;
+
+    // FIXME: Support animations between polygons in the future.
+    if (from->type() == BasicShape::BASIC_SHAPE_POLYGON)
+        return to;
+
+    return to->blend(from, progress);
+}
+#endif
+
 #if ENABLE(CSS_FILTERS)
 static inline PassRefPtr<FilterOperation> blendFunc(const AnimationBase* anim, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
 {
@@ -397,6 +412,16 @@
     }
 };
 
+#if ENABLE(CSS_EXCLUSIONS)
+class PropertyWrapperBasicShape : public RefCountedPropertyWrapper<BasicShape> {
+public:
+    PropertyWrapperBasicShape(CSSPropertyID prop, BasicShape* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<BasicShape>))
+        : RefCountedPropertyWrapper<BasicShape>(prop, getter, setter)
+    {
+    }
+};
+#endif
+
 class StyleImagePropertyWrapper : public RefCountedPropertyWrapper<StyleImage> {
 public:
     StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>))
@@ -1145,6 +1170,10 @@
 
     gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipPath, &RenderStyle::clipPath, &RenderStyle::setClipPath));
 
+#if ENABLE(CSS_EXCLUSIONS)
+    gPropertyWrappers->append(new PropertyWrapperBasicShape(CSSPropertyWebkitShapeInside, &RenderStyle::shapeInside, &RenderStyle::setShapeInside));
+#endif
+
     gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitColumnRuleColor, MaybeInvalidColor, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor));
     gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextStrokeColor, MaybeInvalidColor, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::visitedLinkTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor));
     gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextFillColor, MaybeInvalidColor, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::visitedLinkTextFillColor, &RenderStyle::setVisitedLinkTextFillColor));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to