Bug 21910

Summary: REGRESSION (r37146): SVG-as-image is not rendered
Product: WebKit Reporter: Pierre-Olivier Latour <pol>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Major CC: eric, hyatt, mitz, simon.fraser, sjoerd
Priority: P1 Keywords: InRadar, LayoutTestFailure, Regression
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on: 12095, 21322    
Bug Blocks:    
Attachments:
Description Flags
Patch, changelog, fixed testcases mitz: review+

Description Pierre-Olivier Latour 2008-10-27 18:02:10 PDT
While re-doing the image bases for https://bugs.webkit.org/show_bug.cgi?id=21821, we noticed that these pixel tests are currently failing (SVG does not seem to be rendering):

fast/backgrounds/svg-as-background-1.html
fast/backgrounds/svg-as-background-2.html
fast/backgrounds/svg-as-background-3.html
fast/backgrounds/svg-as-background-5.html
fast/backgrounds/svg-as-background-6.html
fast/backgrounds/svg-as-mask.html
fast/borders/svg-as-border-image-2.html
fast/borders/svg-as-border-image.html
fast/images/svg-as-background.html
fast/images/svg-as-image.html
fast/images/svg-as-relative-image.html
fast/images/svg-as-tiled-background.html
Comment 1 David Harrison 2008-10-28 16:31:31 PDT
This looks like rdar://problem/6326892
Comment 2 David Harrison 2008-10-28 16:32:25 PDT
... which I tracked to http://trac.webkit.org/changeset/37146
Comment 3 Simon Fraser (smfr) 2008-10-28 16:43:56 PDT
Which is hyatt's.
Comment 4 Simon Fraser (smfr) 2008-11-07 14:39:21 PST
Maybe fix:

diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp
index 4427277..33a6d56 100644
--- a/WebCore/svg/graphics/SVGImage.cpp
+++ b/WebCore/svg/graphics/SVGImage.cpp
@@ -72,6 +72,10 @@ void SVGImage::setContainerSize(const IntSize& containerSize)
 
     if (!m_frame || !m_frame->document())
         return;
+    
+    if (m_frame->view())
+        m_frame->view()->resize(containerSize);
+    
     SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
     if (!rootElement)
         return;

However, LayoutTests/fast/backgrounds/svg-as-background-5.html still renders all red until you cause a repaint to happen. The other tests work.
Comment 5 Simon Fraser (smfr) 2008-11-07 14:39:38 PST
Hm, that change doesn't fix <img src="foo.svg">
Comment 6 Simon Fraser (smfr) 2008-11-07 14:39:59 PST
Maybe call 
   m_frame->view()->resize(size());
in SVGImage::draw()?
Comment 7 Simon Fraser (smfr) 2008-12-23 20:55:22 PST
Created attachment 26233 [details]
Patch, changelog, fixed testcases
Comment 8 Simon Fraser (smfr) 2008-12-23 21:20:34 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	LayoutTests/ChangeLog
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-1-expected.checksum
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-1-expected.png
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-2-expected.checksum
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-2-expected.png
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-3-expected.checksum
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-3-expected.png
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-4-expected.checksum
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-4-expected.png
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-6-expected.checksum
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-background-6-expected.png
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-mask-expected.checksum
	M	LayoutTests/platform/mac/fast/backgrounds/svg-as-mask-expected.png
	M	LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-image-05-b-expected.checksum
	M	LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-image-05-b-expected.png
	M	WebCore/ChangeLog
	M	WebCore/svg/graphics/SVGImage.cpp
Committed r39462
Comment 9 Eric Seidel (no email) 2008-12-24 10:01:31 PST
Simon Fraser is my hero.
Comment 10 Simon Fraser (smfr) 2008-12-24 13:40:05 PST
Some more bases that I missed:
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	LayoutTests/ChangeLog
	M	LayoutTests/platform/mac/fast/images/svg-as-background-expected.checksum
	M	LayoutTests/platform/mac/fast/images/svg-as-background-expected.png
	M	LayoutTests/platform/mac/fast/images/svg-as-image-expected.checksum
	M	LayoutTests/platform/mac/fast/images/svg-as-image-expected.png
	M	LayoutTests/platform/mac/fast/images/svg-as-relative-image-expected.checksum
	M	LayoutTests/platform/mac/fast/images/svg-as-relative-image-expected.png
Committed r39469
Comment 11 Simon Fraser (smfr) 2008-12-26 10:59:35 PST
Final test fixing:
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	LayoutTests/ChangeLog
	M	LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.checksum
	M	LayoutTests/platform/mac/fast/borders/svg-as-border-image-2-expected.png
	M	LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.checksum
	M	LayoutTests/platform/mac/fast/borders/svg-as-border-image-expected.png
Committed r39479
Comment 12 Simon Fraser (smfr) 2008-12-30 21:20:17 PST
*** Bug 17552 has been marked as a duplicate of this bug. ***