[CSS Exclusions] Enable shape-inside support for circles
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 17:31:39 +0000 (17:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 17:31:39 +0000 (17:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109713

Patch by Hans Muller <hmuller@adobe.com> on 2013-02-15
Reviewed by Dirk Schulze.

Source/WebCore:

Removed the test that disabled circle values for shape-inside.
The remaining support for circles, which is based on rounded rectangles
whose width/height is equal to their radiusX/radiusY, has not changed.

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

* rendering/ExclusionShapeInsideInfo.h:
(WebCore::ExclusionShapeInsideInfo::isEnabledFor): Now only disallows ellipse.

LayoutTests:

Added a test for circle shape-inside values.

* fast/exclusions/shape-inside/shape-inside-circle-expected.html: Added.
* fast/exclusions/shape-inside/shape-inside-circle.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/exclusions/shape-inside/shape-inside-circle-expected.html [new file with mode: 0644]
LayoutTests/fast/exclusions/shape-inside/shape-inside-circle.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/ExclusionShapeInsideInfo.h

index 9746c78..44da5d4 100644 (file)
@@ -1,3 +1,15 @@
+2013-02-15  Hans Muller  <hmuller@adobe.com>
+
+        [CSS Exclusions] Enable shape-inside support for circles
+        https://bugs.webkit.org/show_bug.cgi?id=109713
+
+        Reviewed by Dirk Schulze.
+
+        Added a test for circle shape-inside values.
+
+        * fast/exclusions/shape-inside/shape-inside-circle-expected.html: Added.
+        * fast/exclusions/shape-inside/shape-inside-circle.html: Added.
+
 2013-02-15  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Several consecutive Backspace or Delete strikes should not be marked as undoable state.
diff --git a/LayoutTests/fast/exclusions/shape-inside/shape-inside-circle-expected.html b/LayoutTests/fast/exclusions/shape-inside/shape-inside-circle-expected.html
new file mode 100644 (file)
index 0000000..ce82df0
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    #shape-inside {
+        position: relative;
+    }
+
+    #shape-outline {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        width: 400px;
+        height: 400px;
+    }
+
+    /* The size of a square that just fits within a circle of radius r is r * sqrt(2).  In this
+       case that's the size of one Ahem character: 100 * sqrt(2) == 141.42.
+
+       The left and top edges of a square that just fits within a circle of radius r are offset
+       by r - (r * sqrt(2)) / 2, which is 29.289 for r = 100.  The center of the circle is at 200,200
+       so the top and left edges of the square are 129.289.
+    */
+    #shape-content {
+        position: absolute;
+        top: 129.289px;
+        left: 129.289px;
+        font: 141.42px/1 Ahem, sans-serif;
+        color: green;
+    }
+</style>
+</head>
+<body>
+    <div id="shape-inside">
+        <div id="shape-content">X</div>
+        <svg id="shape-outline" xmlns="http://www.w3.org/2000/svg">
+            <circle cx="200" cy="200" r="100" stroke="blue" fill="none"/>
+        </svg>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/exclusions/shape-inside/shape-inside-circle.html b/LayoutTests/fast/exclusions/shape-inside/shape-inside-circle.html
new file mode 100644 (file)
index 0000000..a58aa03
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    if (window.internals)
+        window.internals.settings.setCSSExclusionsEnabled(true);
+</script>
+<style>
+    /* The size of a square that just fits within a circle of radius r is r * sqrt(2).  In this
+       case that's the size of one Ahem character: 100 * sqrt(2) == 141.42.
+    */
+    #shape-inside {
+        position: relative;
+        width: 400px;
+        height: 400px;
+        -webkit-shape-inside: circle(200px, 200px, 100px);
+        font: 141.42px/1 Ahem, sans-serif;
+
+        color: green;
+    }
+
+    #shape-outline {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        width: 400px;
+        height: 400px;
+    }
+</style>
+</head>
+<body>
+    <div id="shape-inside">
+        <svg id="shape-outline" xmlns="http://www.w3.org/2000/svg">
+            <circle cx="200" cy="200" r="100" stroke="blue" fill="none"/>
+        </svg>
+        X
+    </div>
+</body>
+</html>
index 90dfe22..aa61e55 100644 (file)
@@ -1,3 +1,19 @@
+2013-02-15  Hans Muller  <hmuller@adobe.com>
+
+        [CSS Exclusions] Enable shape-inside support for circles
+        https://bugs.webkit.org/show_bug.cgi?id=109713
+
+        Reviewed by Dirk Schulze.
+
+        Removed the test that disabled circle values for shape-inside.
+        The remaining support for circles, which is based on rounded rectangles
+        whose width/height is equal to their radiusX/radiusY, has not changed.
+
+        Test: fast/exclusions/shape-inside/shape-inside-circle.html
+
+        * rendering/ExclusionShapeInsideInfo.h:
+        (WebCore::ExclusionShapeInsideInfo::isEnabledFor): Now only disallows ellipse.
+
 2013-02-15  Christophe Dumez  <ch.dumez@sisa.samsung.com>
 
         [Soup] Leverage new soup_cookie_jar_get_cookie_list() API
index 7b71b73..da3c47e 100644 (file)
@@ -61,7 +61,7 @@ public:
         // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
         ExclusionShapeValue* shapeValue = renderer->style()->shapeInside();
         BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
-        return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON);
+        return shape && shape->type() != BasicShape::BASIC_SHAPE_ELLIPSE;
     }
     bool lineOverlapsShapeBounds() const { return logicalLineTop() < shapeLogicalBottom() && logicalLineBottom() >= shapeLogicalTop(); }