Severe shadow repaint issues with SVGText elements
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Aug 2011 23:49:54 +0000 (23:49 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Aug 2011 23:49:54 +0000 (23:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=63648
<rdar://problem/7632269>

Reviewed by Darin Adler.

Make SVG elements which inherit from RenderSVGBlock take text-shadow
overflow into account when determining whether or not they should draw

Test: svg/custom/repaint-shadow.svg

* rendering/RenderBox.h:
(WebCore::RenderBox::visualOverflowRect):
* rendering/svg/RenderSVGBlock.cpp:
(WebCore::RenderSVGBlock::visualOverflowRect):
* rendering/svg/RenderSVGBlock.h:

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

LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/repaint-shadow.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/svg/RenderSVGBlock.cpp
Source/WebCore/rendering/svg/RenderSVGBlock.h

index d877c48..2e17508 100644 (file)
@@ -1,3 +1,18 @@
+2011-08-01  Tim Horton  <timothy_horton@apple.com>
+
+        Severe shadow repaint issues with SVGText elements
+        https://bugs.webkit.org/show_bug.cgi?id=63648
+        <rdar://problem/7632269>
+
+        Reviewed by Darin Adler.
+
+        Make SVG elements which inherit from RenderSVGBlock take text-shadow
+        overflow into account when determining whether or not they should draw
+
+        * platform/mac/svg/custom/repaint-shadow-expected.png: Added.
+        * platform/mac/svg/custom/repaint-shadow-expected.txt: Added.
+        * svg/custom/repaint-shadow.svg: Added.
+
 2011-08-01  Chris Rogers  <crogers@google.com>
 
         One more test_expectations.txt fix for windows web audio
diff --git a/LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.png b/LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.png
new file mode 100644 (file)
index 0000000..7c4077d
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.txt b/LayoutTests/platform/mac/svg/custom/repaint-shadow-expected.txt
new file mode 100644 (file)
index 0000000..6f96eeb
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (20,20) size 406x255
+    RenderSVGText {text} at (20,20) size 50x50 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 50x50
+        chunk 1 text run 1 at (20.00,60.00) startOffset 0 endOffset 1 width 50.00: "X"
+    RenderSVGText {text} at (171,20) size 50x50 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 50x50
+        chunk 1 text run 1 at (171.00,60.00) startOffset 0 endOffset 1 width 50.00: "X"
diff --git a/LayoutTests/svg/custom/repaint-shadow.svg b/LayoutTests/svg/custom/repaint-shadow.svg
new file mode 100644 (file)
index 0000000..54ff3ac
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewbox="0 0 480 360">
+    <text x="20" y="60" font-family="Ahem" font-size="50px" style="text-shadow: 200px 200px 5px red">X</text>
+    <text x="170" y="60" font-family="Ahem" font-size="50px" style="text-shadow: 200px 200px 5px red">X</text>
+
+    <script>
+        var text = document.getElementsByTagName('text')[1];
+
+        window.setTimeout(function() {
+            // Show differences, makes it easier to spot the repaint rect changes
+            if (window.layoutTestController)
+                layoutTestController.display();
+
+            text.setAttribute("x", 171);
+
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }, 0);
+
+        if (window.layoutTestController)
+            layoutTestController.waitUntilDone();
+
+    </script>
+</svg>
index 47b42b3..75b016c 100644 (file)
@@ -1,3 +1,22 @@
+2011-08-01  Tim Horton  <timothy_horton@apple.com>
+
+        Severe shadow repaint issues with SVGText elements
+        https://bugs.webkit.org/show_bug.cgi?id=63648
+        <rdar://problem/7632269>
+
+        Reviewed by Darin Adler.
+
+        Make SVG elements which inherit from RenderSVGBlock take text-shadow
+        overflow into account when determining whether or not they should draw
+
+        Test: svg/custom/repaint-shadow.svg
+
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::visualOverflowRect):
+        * rendering/svg/RenderSVGBlock.cpp:
+        (WebCore::RenderSVGBlock::visualOverflowRect):
+        * rendering/svg/RenderSVGBlock.h:
+
 2011-08-01  Zhenyao Mo  <zmo@google.com>
 
         Unreviewed, rolling out r92022.
index 269e820..be85026 100644 (file)
@@ -148,7 +148,7 @@ public:
     LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); }
     LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? maxXLayoutOverflow() : maxYLayoutOverflow(); }
     
-    LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
+    virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
     LayoutUnit minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : 0; }
     LayoutUnit maxYVisualOverflow() const { return m_overflow ? m_overflow->maxYVisualOverflow() : height(); }
     LayoutUnit minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : 0; }
index 2233c5e..fe5a4f1 100644 (file)
@@ -34,6 +34,16 @@ RenderSVGBlock::RenderSVGBlock(SVGElement* node)
 {
 }
 
+IntRect RenderSVGBlock::visualOverflowRect() const
+{
+    LayoutRect borderRect = borderBoxRect();
+
+    if (const ShadowData* textShadow = style()->textShadow())
+        textShadow->adjustRectForShadow(borderRect);
+
+    return borderRect;
+}
+
 void RenderSVGBlock::setStyle(PassRefPtr<RenderStyle> style) 
 {
     RefPtr<RenderStyle> useStyle = style;
index 78a6b41..3fb9042 100644 (file)
@@ -32,6 +32,8 @@ class RenderSVGBlock : public RenderBlock {
 public:
     explicit RenderSVGBlock(SVGElement*);
 
+    virtual IntRect visualOverflowRect() const;
+
 private:
     virtual void setStyle(PassRefPtr<RenderStyle>);
     virtual void updateBoxModelInfoFromStyle();