WebCore:
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2007 23:08:27 +0000 (23:08 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2007 23:08:27 +0000 (23:08 +0000)
        Reviewed by Geoff.

        Make relative-size SVGs work in border-image.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::calculateBackgroundSize):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::paintBorderImage):

LayoutTests:

        Reviewed by Geoff.

        Tests for SVG as border-image.

        * fast/borders/resources/green-fixed-size-rect.svg: Added.
        * fast/borders/resources/green-relative-size-rect.svg: Added.
        * fast/borders/svg-as-border-image-2.html: Added.
        * fast/borders/svg-as-border-image.html: Added.
        * platform/mac/fast/borders/svg-as-border-image-2-expected.checksum: Added.
        * platform/mac/fast/borders/svg-as-border-image-2-expected.png: Added.
        * platform/mac/fast/borders/svg-as-border-image-2-expected.txt: Added.
        * platform/mac/fast/borders/svg-as-border-image-expected.checksum: Added.
        * platform/mac/fast/borders/svg-as-border-image-expected.png: Added.
        * platform/mac/fast/borders/svg-as-border-image-expected.txt: Added.

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/borders/resources/green-fixed-size-rect.svg [new file with mode: 0644]
LayoutTests/fast/borders/resources/green-relative-size-rect.svg [new file with mode: 0644]
LayoutTests/fast/borders/svg-as-border-image-2.html [new file with mode: 0644]
LayoutTests/fast/borders/svg-as-border-image.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderObject.cpp

index 289c123b63758edaf90345b62a2a3fd387019184..be8a1d59b5060a9c2e5b35a32ce91fcba7d7fe35 100644 (file)
@@ -1,3 +1,20 @@
+2007-12-16  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Geoff.
+
+        Tests for SVG as border-image.
+
+        * fast/borders/resources/green-fixed-size-rect.svg: Added.
+        * fast/borders/resources/green-relative-size-rect.svg: Added.
+        * fast/borders/svg-as-border-image-2.html: Added.
+        * fast/borders/svg-as-border-image.html: Added.
+        * platform/mac/fast/borders/svg-as-border-image-2-expected.checksum: Added.
+        * platform/mac/fast/borders/svg-as-border-image-2-expected.png: Added.
+        * platform/mac/fast/borders/svg-as-border-image-2-expected.txt: Added.
+        * platform/mac/fast/borders/svg-as-border-image-expected.checksum: Added.
+        * platform/mac/fast/borders/svg-as-border-image-expected.png: Added.
+        * platform/mac/fast/borders/svg-as-border-image-expected.txt: Added.
+
 2007-12-16  Andrew Wellington  <proton@wiretapped.net>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/borders/resources/green-fixed-size-rect.svg b/LayoutTests/fast/borders/resources/green-fixed-size-rect.svg
new file mode 100644 (file)
index 0000000..4794334
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width='100px' height='100px'>
+    <rect fill='green' width='100px' height='100px' />
+</svg>
diff --git a/LayoutTests/fast/borders/resources/green-relative-size-rect.svg b/LayoutTests/fast/borders/resources/green-relative-size-rect.svg
new file mode 100644 (file)
index 0000000..9eec19d
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width='100%' height='100%'>
+    <rect fill='green' width='100px' height='100px' />
+</svg>
diff --git a/LayoutTests/fast/borders/svg-as-border-image-2.html b/LayoutTests/fast/borders/svg-as-border-image-2.html
new file mode 100644 (file)
index 0000000..90b8ab4
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+<head>
+<style>
+    div {
+        border-width: 30px 30px 30px 30px;
+        height: 100px;
+        width: 100px;
+        margin: 10px;
+        display: inline-block;
+    }
+    
+    div.rr {
+        -webkit-border-image: url("resources/green-relative-size-rect.svg") 30 30 30 30 repeat repeat;
+    }
+    
+    div.rs {
+        -webkit-border-image: url("resources/green-relative-size-rect.svg") 30 30 30 30 repeat stretch;
+    }
+    
+    div.sr {
+        -webkit-border-image: url("resources/green-relative-size-rect.svg") 30 30 30 30 stretch repeat;
+    }
+    
+    div.ss {
+        -webkit-border-image: url("resources/green-relative-size-rect.svg") 30 30 30 30 stretch stretch;
+    }
+</style>
+</head>
+<body>
+
+    <div class="rr"></div>
+    <div class="rs"></div>
+    <br>
+    <div class="sr"></div>
+    <div class="ss"></div>
+
+</body>
+</html>
diff --git a/LayoutTests/fast/borders/svg-as-border-image.html b/LayoutTests/fast/borders/svg-as-border-image.html
new file mode 100644 (file)
index 0000000..4dd4e33
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+<head>
+<style>
+    div {
+        border-width: 30px 30px 30px 30px;
+        height: 100px;
+        width: 100px;
+        margin: 10px;
+        display: inline-block;
+    }
+    
+    div.rr {
+        -webkit-border-image: url("resources/green-fixed-size-rect.svg") 30 30 30 30 repeat repeat;
+    }
+    
+    div.rs {
+        -webkit-border-image: url("resources/green-fixed-size-rect.svg") 30 30 30 30 repeat stretch;
+    }
+    
+    div.sr {
+        -webkit-border-image: url("resources/green-fixed-size-rect.svg") 30 30 30 30 stretch repeat;
+    }
+    
+    div.ss {
+        -webkit-border-image: url("resources/green-fixed-size-rect.svg") 30 30 30 30 stretch stretch;
+    }
+</style>
+</head>
+<body>
+
+    <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/svg-as-border-image-2-expected.checksum b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.checksum
new file mode 100644 (file)
index 0000000..044f2bd
--- /dev/null
@@ -0,0 +1 @@
+06ecd0c2e20378429642fa56d97c8ec3
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.png b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.png
new file mode 100644 (file)
index 0000000..b9cfb54
Binary files /dev/null and b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.txt b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.txt
new file mode 100644 (file)
index 0000000..6ea17bc
--- /dev/null
@@ -0,0 +1,19 @@
+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
+      RenderBlock {DIV} at (10,10) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (180,166) size 4x18
+        text run at (180,166) width 4: " "
+      RenderBlock {DIV} at (194,10) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (364,166) size 4x18
+        text run at (364,166) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBlock {DIV} at (10,194) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (180,350) size 4x18
+        text run at (180,350) width 4: " "
+      RenderBlock {DIV} at (194,194) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.checksum b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.checksum
new file mode 100644 (file)
index 0000000..044f2bd
--- /dev/null
@@ -0,0 +1 @@
+06ecd0c2e20378429642fa56d97c8ec3
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.png b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.png
new file mode 100644 (file)
index 0000000..b9cfb54
Binary files /dev/null and b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.txt b/LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.txt
new file mode 100644 (file)
index 0000000..6ea17bc
--- /dev/null
@@ -0,0 +1,19 @@
+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
+      RenderBlock {DIV} at (10,10) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (180,166) size 4x18
+        text run at (180,166) width 4: " "
+      RenderBlock {DIV} at (194,10) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (364,166) size 4x18
+        text run at (364,166) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBlock {DIV} at (10,194) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (180,350) size 4x18
+        text run at (180,350) width 4: " "
+      RenderBlock {DIV} at (194,194) size 160x160 [border: (30px none #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
index ebfdb8fda65fa0fc59dfd373c1e1a98e870c7075..2ad7612a6dabc1739bb888b5f053ef4959671dd9 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-16  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Geoff.
+
+        Make relative-size SVGs work in border-image.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::calculateBackgroundSize):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::paintBorderImage):
+
 2007-12-16  Darin Adler  <darin@apple.com>
 
         - fix Tiger build (my fault it was broken)
index 5caf41e6f75e06dd206569e5cf32df1f51aef795..4b515eb346c202b2c04f03fa474111ea2455ea4d 100644 (file)
@@ -420,6 +420,7 @@ void RenderBox::paintBackground(GraphicsContext* context, const Color& c, const
 IntSize RenderBox::calculateBackgroundSize(const BackgroundLayer* bgLayer, int scaledWidth, int scaledHeight) const
 {
     CachedImage* bg = bgLayer->backgroundImage();
+    bg->setImageContainerSize(IntSize(m_width, m_height));
 
     if (bgLayer->isBackgroundSizeSet()) {
         int w = scaledWidth;
@@ -460,10 +461,8 @@ IntSize RenderBox::calculateBackgroundSize(const BackgroundLayer* bgLayer, int s
             }
         }
         return IntSize(max(1, w), max(1, h));
-    } else {
-        bg->setImageContainerSize(IntSize(m_width, m_height));
+    } else
         return bg->imageSize();
-    }
 }
 
 void RenderBox::imageChanged(CachedImage* image)
index c3ee9d8016944788b5f9b1ae08c7a4977baa5a4f..07ba54ff6099d5c882e6e3ab66aa175dd3b85fae 100644 (file)
@@ -1149,6 +1149,7 @@ bool RenderObject::paintBorderImage(GraphicsContext* graphicsContext, int tx, in
         clipped = true;
     }
 
+    borderImage->setImageContainerSize(IntSize(w, h));
     int imageWidth = borderImage->image()->width();
     int imageHeight = borderImage->image()->height();