Reviewed by Maciej Stachowiak.
Bug 26897 - Dynamic SVG images do not display correctly
https://bugs.webkit.org/show_bug.cgi?id=26897
Use repaint() to fix a rendering problem with a SVG image embedded in xhtml.
Test: svg/custom/createImageElement2.xhtml
* rendering/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::imageChanged):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@45550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6ab6b1f..a357ffb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2009-07-05 Rob Buis <rwlbuis@gmail.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Test for:
+ Bug 26897 - Dynamic SVG images do not display correctly
+ https://bugs.webkit.org/show_bug.cgi?id=26897
+
+ * platform/mac/svg/custom/createImageElement2-expected.checksum: Added.
+ * platform/mac/svg/custom/createImageElement2-expected.png: Added.
+ * platform/mac/svg/custom/createImageElement2-expected.txt: Added.
+ * svg/custom/createImageElement2.xhtml: Added.
+
2009-07-03 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
Not reviewed. Forgot to land ontimer-inline-event.html results within my last WML commit.
diff --git a/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.checksum b/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.checksum
new file mode 100644
index 0000000..e423238
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.checksum
@@ -0,0 +1 @@
+72f66ad64567ccc86597d5aaa000159d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.png b/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.png
new file mode 100644
index 0000000..309390b
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.txt b/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.txt
new file mode 100644
index 0000000..43c2547
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/createImageElement2-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x104
+ RenderBlock {html} at (0,0) size 800x104
+ RenderInline {head} at (0,0) size 80x18
+ RenderText {#text} at (0,0) size 0x0
+ RenderInline {title} at (0,0) size 76x18
+ RenderText {#text} at (0,86) size 76x18
+ text run at (0,86) width 76: "SVG Image"
+ RenderText {#text} at (76,86) size 4x18
+ text run at (76,86) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderInline {body} at (0,0) size 600x18
+ RenderText {#text} at (0,0) size 0x0
+ RenderSVGRoot {svg} at (90,10) size 100x60
+ RenderSVGImage {image} at (90,10) size 100x60
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/svg/custom/createImageElement2.xhtml b/LayoutTests/svg/custom/createImageElement2.xhtml
new file mode 100644
index 0000000..5c61436
--- /dev/null
+++ b/LayoutTests/svg/custom/createImageElement2.xhtml
@@ -0,0 +1,22 @@
+<html>
+<head>
+ <title>SVG Image</title>
+</head>
+<body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;">
+ <svg xmlns="http://www.w3.org/2000/svg" id='root' width="600px" height="100px">
+ <script type="text/javascript"><![CDATA[
+ window.onload = function() {
+ var el = document.getElementById('root');
+ var ie = document.createElementNS('http://www.w3.org/2000/svg', "image");
+ ie.setAttribute("x", "10px");
+ ie.setAttribute("y", "10px");
+ ie.setAttribute("width", "100px");
+ ie.setAttribute("height", "60px");
+ ie.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'resources/green-checker.png');
+ el.appendChild(ie);
+ }
+ ]]>
+ </script>
+ </svg>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f72785a..46affa7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-07-05 Rob Buis <rwlbuis@gmail.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 26897 - Dynamic SVG images do not display correctly
+ https://bugs.webkit.org/show_bug.cgi?id=26897
+
+ Use repaint() to fix a rendering problem with a SVG image embedded in xhtml.
+
+ Test: svg/custom/createImageElement2.xhtml
+
+ * rendering/RenderSVGImage.cpp:
+ (WebCore::RenderSVGImage::imageChanged):
+
2009-07-05 Xan Lopez <xlopez@igalia.com>
Reviewed by Jan Alonzo.
diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp
index b38352e..9b5da45 100644
--- a/WebCore/rendering/RenderSVGImage.cpp
+++ b/WebCore/rendering/RenderSVGImage.cpp
@@ -2,7 +2,7 @@
Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
Copyright (C) 2006 Apple Computer, Inc.
Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
+ Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org>
Copyright (C) 2009, Google, Inc.
This library is free software; you can redistribute it and/or
@@ -227,9 +227,7 @@
void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect)
{
RenderImage::imageChanged(image, rect);
-
- // We override to invalidate a larger rect, since SVG images can draw outside their "bounds"
- repaintRectangle(absoluteClippedOverflowRect()); // FIXME: Isn't this just repaint()?
+ repaint();
}
IntRect RenderSVGImage::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)