Title: [164380] trunk
Revision
164380
Author
k...@webkit.org
Date
2014-02-19 12:15:18 -0800 (Wed, 19 Feb 2014)

Log Message

Missing box doesn't use border-box as reference box for clip-path
https://bugs.webkit.org/show_bug.cgi?id=129049

Reviewed by Simon Fraser.

Source/WebCore:

If no reference box was specified the default reference box should be
border-box. Previously to this patch the reference box was the bounding
client rect. This was not following the specification.
http://www.w3.org/TR/2014/WD-css-masking-1-20140213/#the-clip-path
The change affects content using -webkit-clip-path in Safari. Since the
bounding client box is equalvalent to the border box most of the time
there shouldn't be to much impact.

Existing tests cover the issue.

* rendering/RenderLayer.cpp:
(WebCore::computeReferenceBox):

LayoutTests:

Update the result for overflowing content. The clip-path uses the border-box instead of
the bounding client rect as reference box.
Change pixel test to reference text.

* css3/masking/clip-path-circle-relative-overflow-expected.html: Added.
* platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png: Removed.
* platform/mac/css3/masking/clip-path-inset-expected.png: Added. This was missing in the repo.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164379 => 164380)


--- trunk/LayoutTests/ChangeLog	2014-02-19 20:10:53 UTC (rev 164379)
+++ trunk/LayoutTests/ChangeLog	2014-02-19 20:15:18 UTC (rev 164380)
@@ -1,3 +1,18 @@
+2014-02-19  Dirk Schulze  <k...@webkit.org>
+
+        Missing box doesn't use border-box as reference box for clip-path
+        https://bugs.webkit.org/show_bug.cgi?id=129049
+
+        Reviewed by Simon Fraser.
+
+        Update the result for overflowing content. The clip-path uses the border-box instead of
+        the bounding client rect as reference box.
+        Change pixel test to reference text.
+
+        * css3/masking/clip-path-circle-relative-overflow-expected.html: Added.
+        * platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png: Removed.
+        * platform/mac/css3/masking/clip-path-inset-expected.png: Added. This was missing in the repo.
+
 2014-02-19  James Craig  <jcr...@apple.com>
 
         Web Inspector: AX: clarify reason for ignored state where possible (hidden, default for tag, etc)

Copied: trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow-expected.html (from rev 164379, trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html) (0 => 164380)


--- trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow-expected.html	2014-02-19 20:15:18 UTC (rev 164380)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    border: 20px solid black;
+    -webkit-clip-path: circle(50% at 50% 50%) border-box;
+}
+</style>
+</head>
+<body>
+<div><div>
+</body>
+</html>

Modified: trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html (164379 => 164380)


--- trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html	2014-02-19 20:10:53 UTC (rev 164379)
+++ trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html	2014-02-19 20:15:18 UTC (rev 164380)
@@ -7,6 +7,7 @@
     height: 200px;
     background-color: green;
     border: 20px solid black;
+    /* Even on missing reference box and overflowing context chose border-box. */
     -webkit-clip-path: circle(50% at 50% 50%);
 }
 </style>

Deleted: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png


(Binary files differ)

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-inset-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-inset-expected.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (164379 => 164380)


--- trunk/Source/WebCore/ChangeLog	2014-02-19 20:10:53 UTC (rev 164379)
+++ trunk/Source/WebCore/ChangeLog	2014-02-19 20:15:18 UTC (rev 164380)
@@ -1,3 +1,23 @@
+2014-02-19  Dirk Schulze  <k...@webkit.org>
+
+        Missing box doesn't use border-box as reference box for clip-path
+        https://bugs.webkit.org/show_bug.cgi?id=129049
+
+        Reviewed by Simon Fraser.
+
+        If no reference box was specified the default reference box should be
+        border-box. Previously to this patch the reference box was the bounding
+        client rect. This was not following the specification.
+        http://www.w3.org/TR/2014/WD-css-masking-1-20140213/#the-clip-path
+        The change affects content using -webkit-clip-path in Safari. Since the
+        bounding client box is equalvalent to the border box most of the time
+        there shouldn't be to much impact.
+
+        Existing tests cover the issue.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::computeReferenceBox):
+
 2014-02-19  James Craig  <jcr...@apple.com>
 
         Web Inspector: AX: clarify reason for ignored state where possible (hidden, default for tag, etc)

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (164379 => 164380)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-02-19 20:10:53 UTC (rev 164379)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-02-19 20:15:18 UTC (rev 164380)
@@ -3790,38 +3790,35 @@
 template <class ReferenceBoxClipPathOperation>
 static inline LayoutRect computeReferenceBox(const RenderObject& renderer, const ReferenceBoxClipPathOperation& clippingPath, const LayoutPoint& offsetFromRoot, const LayoutRect& rootRelativeBounds)
 {
+    // FIXME: Support different reference boxes for inline content.
+    // https://bugs.webkit.org/show_bug.cgi?id=129047
+    if (!renderer.isBox())
+        return rootRelativeBounds;
+
     LayoutRect referenceBox;
-    if (renderer.isBox()) {
-        const RenderBox& box = toRenderBox(renderer);
-        switch (clippingPath.referenceBox()) {
-            case ContentBox:
-                referenceBox = box.contentBoxRect();
-                referenceBox.moveBy(offsetFromRoot);
-                break;
-            case PaddingBox:
-                referenceBox = box.paddingBoxRect();
-                referenceBox.moveBy(offsetFromRoot);
-                break;
-            // fill, stroke, view-box compute to border-box for HTML elements.
-            case Fill:
-            case Stroke:
-            case ViewBox:
-            case BorderBox:
-                referenceBox = box.borderBoxRect();
-                referenceBox.moveBy(offsetFromRoot);
-                break;
-            case MarginBox:
-                // FIXME: Support margin-box. Use bounding client rect for now.
-                // https://bugs.webkit.org/show_bug.cgi?id=127984
-            case BoxMissing:
-                // FIXME: If no reference box was specified the spec demands to use
-                // the border-box. However, the current prefixed version of clip-path uses
-                // bounding-box. Keep bounding-box for now.
-                referenceBox = rootRelativeBounds;
-        }
-    } else
-        // FIXME: Support different reference boxes for inline content.
-        referenceBox = rootRelativeBounds;
+    const RenderBox& box = toRenderBox(renderer);
+    switch (clippingPath.referenceBox()) {
+    case ContentBox:
+        referenceBox = box.contentBoxRect();
+        referenceBox.moveBy(offsetFromRoot);
+        break;
+    case PaddingBox:
+        referenceBox = box.paddingBoxRect();
+        referenceBox.moveBy(offsetFromRoot);
+        break;
+    // FIXME: Support margin-box. Use bounding client rect for now.
+    // https://bugs.webkit.org/show_bug.cgi?id=127984
+    case MarginBox:
+    // fill, stroke, view-box compute to border-box for HTML elements.
+    case Fill:
+    case Stroke:
+    case ViewBox:
+    case BorderBox:
+    case BoxMissing:
+        referenceBox = box.borderBoxRect();
+        referenceBox.moveBy(offsetFromRoot);
+        break;
+    }
 
     return referenceBox;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to