2007-01-14 Eric Seidel <eric@webkit.org>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Jan 2007 06:52:35 +0000 (06:52 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Jan 2007 06:52:35 +0000 (06:52 +0000)
        Reviewed by hyatt.

        SVG does not correctly handle float: left
        http://bugs.webkit.org/show_bug.cgi?id=12210

        Test: svg/custom/svg-float-border-padding.xml

        * rendering/RenderSVGContainer.cpp:
        (WebCore::RenderSVGContainer::paint):

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/svg-float-border-padding-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/svg-float-border-padding-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/svg-float-border-padding-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/svg-float-border-padding.xml [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderSVGContainer.cpp

index 0ed23749dd1b1c4108b8bd949e4d9e1367d5cd7b..978995f62e85b56ea3cb53dac20bcab8b994af43 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-14  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by hyatt.
+        
+        SVG does not correctly handle float: left
+        http://bugs.webkit.org/show_bug.cgi?id=12210
+
+        * svg/custom/svg-float-border-padding-expected.checksum: Added.
+        * svg/custom/svg-float-border-padding-expected.png: Added.
+        * svg/custom/svg-float-border-padding-expected.txt: Added.
+        * svg/custom/svg-float-border-padding.xml: Added.
+
 2007-01-14  Mitz Pettel  <mitz@webkit.org>
 
         Reviewed by Adam.
diff --git a/LayoutTests/svg/custom/svg-float-border-padding-expected.checksum b/LayoutTests/svg/custom/svg-float-border-padding-expected.checksum
new file mode 100644 (file)
index 0000000..d74f919
--- /dev/null
@@ -0,0 +1 @@
+76e4941eb091a37aa392f69051458d81
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/svg-float-border-padding-expected.png b/LayoutTests/svg/custom/svg-float-border-padding-expected.png
new file mode 100644 (file)
index 0000000..d695536
Binary files /dev/null and b/LayoutTests/svg/custom/svg-float-border-padding-expected.png differ
diff --git a/LayoutTests/svg/custom/svg-float-border-padding-expected.txt b/LayoutTests/svg/custom/svg-float-border-padding-expected.txt
new file mode 100644 (file)
index 0000000..5fb9e7d
--- /dev/null
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x516
+  RenderBlock {html} at (0,0) size 800x516
+    RenderBody {body} at (8,8) size 784x492
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 639x18
+          text run at (0,0) width 241: "The two blocks should look identical. "
+          text run at (241,0) width 398: "One uses an SVG, and the other just uses a normal HTML div."
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 354x18
+          text run at (0,0) width 354: "There should be a red, white and blue pattern below this"
+      RenderSVGContainer {svg} at (8,8) size 100x100
+        RenderPath {rect} at (8,8) size 100x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+      RenderBlock {p} at (0,228) size 784x18
+        RenderText {#text} at (0,0) size 353x18
+          text run at (0,0) width 353: "There should be a red, white and blue pattern above this"
+      RenderBlock {hr} at (0,262) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {p} at (0,280) size 784x18
+        RenderText {#text} at (0,0) size 354x18
+          text run at (0,0) width 354: "There should be a red, white and blue pattern below this"
+      RenderBlock (floating) {div} at (10,324) size 140x140 [border: (10px solid #FF0000)]
+        RenderBlock {div} at (20,20) size 100x100 [bgcolor=#0000FF]
+      RenderBlock {p} at (0,474) size 784x18
+        RenderText {#text} at (0,0) size 353x18
+          text run at (0,0) width 353: "There should be a red, white and blue pattern above this"
diff --git a/LayoutTests/svg/custom/svg-float-border-padding.xml b/LayoutTests/svg/custom/svg-float-border-padding.xml
new file mode 100644 (file)
index 0000000..f2867ac
--- /dev/null
@@ -0,0 +1,22 @@
+<html xmlns='http://www.w3.org/1999/xhtml'>
+  <body>
+  The two blocks should look identical.  One uses an SVG, and the other just uses a normal HTML div.
+  
+    <p>There should be a red, white and blue pattern below this</p>
+    <svg xmlns='http://www.w3.org/2000/svg' width='100px' height='100px' style='float: left; border:10px solid red; padding:10px; margin:10px'>
+      <rect width='100' height='100' fill='blue' />
+    </svg>
+    <p style='clear: left'>There should be a red, white and blue pattern above this</p>
+    
+    <hr/>
+    
+    <p>There should be a red, white and blue pattern below this</p>
+    <div style='width:120px; height:120px; float: left; border:10px solid red; margin:10px'>
+        <div style="width:100px;height:100px;background-color:blue; margin:10px;"></div>
+    </div>
+    <p style='clear: left'>There should be a red, white and blue pattern above this</p>
+    
+
+
+  </body>
+</html>
index 605a5adc4a5aa4593100017638d577cef6200b64..01d9c88adbd8bfbd4d48cf30bd3ba7c972c4e826 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-14  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by hyatt.
+        
+        SVG does not correctly handle float: left
+        http://bugs.webkit.org/show_bug.cgi?id=12210
+
+        Test: svg/custom/svg-float-border-padding.xml
+
+        * rendering/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::paint):
+
 2007-01-14  David Hyatt  <hyatt@apple.com>
 
         More work to fix 10145, regression where form elements don't break properly.  Make sure to really use
         (WebCore::GraphicsContext::setPlatformStrokeThickness):
         (WebCore::GraphicsContext::setPlatformFillColor):
 
-2007-01-13  Eric Seidel  <eric@eseidel.com>
+2007-01-13  Eric Seidel  <eric@webkit.org>
 
         Reviewed by hyatt.
 
index 36c7a942beb2244b591d8bfefb2075d1ba9954c0..3041b0bbbd19bcad23836148d925a0a627622a21 100644 (file)
@@ -134,8 +134,9 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int parentX, int parentY)
     if (paintInfo.context->paintingDisabled())
         return;
 
+    // This should only exist for <svg> renderers
     if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection)) 
-        paintBoxDecorations(paintInfo, parentX, parentY);
+        paintBoxDecorations(paintInfo, m_x + parentX, m_y + parentY);
 
     if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
         paintOutline(paintInfo.context, parentX, parentY, width(), height(), style());
@@ -149,10 +150,22 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int parentX, int parentY)
     
     paintInfo.context->save();
 
-    if (parentX != 0 || parentY != 0) {
+    if (!parent()->isSVGContainer()) {
         // Translate from parent offsets (html renderers) to a relative transform (svg renderers)
-        paintInfo.context->concatCTM(AffineTransform().translate(parentX, parentY));
+        IntPoint origin;
+        origin.move(parentX, parentY);
+        origin.move(m_x, m_y);
+        origin.move(borderLeft(), borderTop());
+        origin.move(paddingLeft(), paddingTop());
+        if (origin.x() || origin.y())
+            paintInfo.context->concatCTM(AffineTransform().translate(origin.x(), origin.y()));
         parentX = parentY = 0;
+    } else {
+        // Only the root <svg> element should need any translations using the HTML system
+        ASSERT(parentX == 0);
+        ASSERT(parentY == 0);
+        ASSERT(m_x == 0);
+        ASSERT(m_y == 0);
     }
 
     if (!viewport().isEmpty()) {