WebCore:
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2009 17:07:31 +0000 (17:07 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2009 17:07:31 +0000 (17:07 +0000)
2009-03-25  David Hyatt  <hyatt@apple.com>

        Reviewed by Eric Seidel

        Fix for bug 23198, border images should not clip to border radii.  The border-image should just ignore
        the border-radius, since the assumption is that any desired rounding will be built into the border-image
        itself.

        Note that I do not agree with this change, but I am matching the spec.

        Added fast/borders/border-image-border-radius.html

        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintNinePieceImage):

LayoutTests:

2009-03-25  David Hyatt  <hyatt@apple.com>

        Reviewed by Eric Seidel

        Test case for bug 23198.

        * fast/borders/border-image-border-radius.html: Added.
        * platform/mac/fast/borders/border-image-border-radius-expected.checksum: Added.
        * platform/mac/fast/borders/border-image-border-radius-expected.png: Added.
        * platform/mac/fast/borders/border-image-border-radius-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/borders/border-image-border-radius.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBoxModelObject.cpp

index 47224b0..0d9057b 100644 (file)
@@ -1,3 +1,14 @@
+2009-03-25  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Eric Seidel
+
+        Test case for bug 23198.
+
+        * fast/borders/border-image-border-radius.html: Added.
+        * platform/mac/fast/borders/border-image-border-radius-expected.checksum: Added.
+        * platform/mac/fast/borders/border-image-border-radius-expected.png: Added.
+        * platform/mac/fast/borders/border-image-border-radius-expected.txt: Added.
+
 2009-03-25  Darin Adler  <darin@apple.com>
 
         Reviewed by David Hyatt.
diff --git a/LayoutTests/fast/borders/border-image-border-radius.html b/LayoutTests/fast/borders/border-image-border-radius.html
new file mode 100644 (file)
index 0000000..643eaae
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+<head>
+    <style>
+        div {
+            border-width: 21px 30px 30px 21px;
+            width: 75px;
+            height: 75px;
+            margin: 10px;
+            display: inline-block;
+            -webkit-border-radius: 10px;
+        }
+
+        div.rr {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 repeat repeat;
+        }
+
+        div.rs {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 repeat stretch;
+        }
+
+        div.sr {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 stretch repeat;
+        }
+
+        div.ss {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 stretch stretch;
+        }
+    </style>
+</head>
+<body>
+    This test checks to make sure the border-image is not clipped by the border radius.
+    <div class="rr"></div>
+    <div class="rs"></div>
+    <br>
+    <div class="sr"></div>
+    <div class="ss"></div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.checksum b/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.checksum
new file mode 100644 (file)
index 0000000..1c718d9
--- /dev/null
@@ -0,0 +1 @@
+38d801b6bb791e4d0199704ee8b3d39d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.png b/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.png
new file mode 100644 (file)
index 0000000..b3d1550
Binary files /dev/null and b/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.txt b/LayoutTests/platform/mac/fast/borders/border-image-border-radius-expected.txt
new file mode 100644 (file)
index 0000000..20bd28e
--- /dev/null
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,132) size 521x18
+        text run at (0,132) width 521: "This test checks to make sure the border-image is not clipped by the border radius. "
+      RenderBlock {DIV} at (531,10) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderBlock {DIV} at (10,160) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+      RenderText {#text} at (146,282) size 4x18
+        text run at (146,282) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBlock {DIV} at (10,310) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+      RenderText {#text} at (146,432) size 4x18
+        text run at (146,432) width 4: " "
+      RenderBlock {DIV} at (160,310) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
index 03b7af7..2f5d792 100644 (file)
@@ -1,3 +1,18 @@
+2009-03-25  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Eric Seidel
+
+        Fix for bug 23198, border images should not clip to border radii.  The border-image should just ignore
+        the border-radius, since the assumption is that any desired rounding will be built into the border-image
+        itself.
+
+        Note that I do not agree with this change, but I am matching the spec.
+
+        Added fast/borders/border-image-border-radius.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintNinePieceImage):
+
 2009-03-25  Gustavo Noronha Silva  <gns@gnome.org>
 
         Reviewed by Holger Freyther.
index 2a18e9a..d2897fe 100644 (file)
@@ -601,21 +601,14 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
                                                const NinePieceImage& ninePieceImage, CompositeOperator op)
 {
     StyleImage* styleImage = ninePieceImage.image();
-    if (!styleImage || !styleImage->canRender(style->effectiveZoom()))
+    if (!styleImage)
         return false;
 
     if (!styleImage->isLoaded())
         return true; // Never paint a nine-piece image incrementally, but don't paint the fallback borders either.
 
-    // If we have a border radius, the image gets clipped to the rounded rect.
-    bool clipped = false;
-    if (style->hasBorderRadius()) {
-        IntRect clipRect(tx, ty, w, h);
-        graphicsContext->save();
-        graphicsContext->addRoundedRectClip(clipRect, style->borderTopLeftRadius(), style->borderTopRightRadius(),
-                                            style->borderBottomLeftRadius(), style->borderBottomRightRadius());
-        clipped = true;
-    }
+    if (!styleImage->canRender(style->effectiveZoom()))
+        return false;
 
     // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function
     // doesn't have any understanding of the zoom that is in effect on the tile.
@@ -712,10 +705,6 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
                                         IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
                                         (Image::TileRule)hRule, (Image::TileRule)vRule, op);
 
-    // Clear the clip for the border radius.
-    if (clipped)
-        graphicsContext->restore();
-
     return true;
 }