RESOLVED FIXED 23111
Backgrounds in HTML inside foreignObject don't draw
https://bugs.webkit.org/show_bug.cgi?id=23111
Summary Backgrounds in HTML inside foreignObject don't draw
Simon Fraser (smfr)
Reported 2009-01-04 20:04:32 PST
If HTML inside an SVG foreignObject has CSS backgrounds, they fail to draw.
Attachments
Testcase (675 bytes, text/html)
2009-01-04 20:04 PST, Simon Fraser (smfr)
no flags
Another testcase (642 bytes, image/svg+xml)
2009-05-19 22:35 PDT, Simon Fraser (smfr)
no flags
Patch (5.09 KB, patch)
2012-02-01 14:57 PST, Florin Malita
no flags
Simon Fraser (smfr)
Comment 1 2009-01-04 20:04:54 PST
Created attachment 26419 [details] Testcase
Simon Fraser (smfr)
Comment 2 2009-01-04 20:07:06 PST
The HTML backgrounds do draw, but get obliterated by the SVGRoot painting its background in the PaintPhaseForeground. There are a bunch of issues here: 1. The RendererForeignObject should be a stacking context, and isn't 2. SVG renderers are not set up to have RenderLayers amongst them. 3. HTML rendering code has "body background is drawn by the root" logic that should not apply when the <body> is inside a <foreignObject>.
Eric Seidel (no email)
Comment 3 2009-01-04 20:12:32 PST
Are we also propagating all of the proper drawing phases out to the foreignObject content? Your previous comment makes it sound like we are. And yes, FOs should probably have a stacking context, even though stacking contexts make no sense in SVG's world.
Simon Fraser (smfr)
Comment 4 2009-01-04 20:28:01 PST
(In reply to comment #3) > Are we also propagating all of the proper drawing phases out to the > foreignObject content? Your previous comment makes it sound like we are. Yes, but the SVGRoot draws its background in the foreground phase, thus clobbering the HTML backgrounds. > yes, FOs should probably have a stacking context, even though stacking > contexts make no sense in SVG's world. I think we're either going to have to give RenderForeignObject a layer and make it a stacking context (which requires fixing up RenderSVGContainer to do some layer stuff), or we make RenderForeignObject::paint() do what FrameView::paintContents does, which is just paint the root layer.
Eric Seidel (no email)
Comment 5 2009-05-04 23:51:25 PDT
This looks like it works already in Safari 4?
Simon Fraser (smfr)
Comment 6 2009-05-19 22:35:48 PDT
Created attachment 30497 [details] Another testcase No, it doesn't work. See this testcase.
Eric Seidel (no email)
Comment 7 2009-05-19 22:50:27 PDT
That test case hits: See /usr/include/servers/bootstrap_defs.h for the error codes. ASSERTION FAILED: useTransforms (/Projects/WebKit/WebCore/rendering/SVGRenderSupport.cpp:67 static void WebCore::SVGRenderBase::mapLocalToContainer(const WebCore::RenderObject*, WebCore::RenderBoxModelObject*, bool, bool, WebCore::TransformState&)) (when attempting to select text) in ToT, which might suggest that there is just a painting error here.
Simon Fraser (smfr)
Comment 8 2009-05-19 22:56:48 PDT
That assertion happens only when you select, because it's computing selection rectangles. The basic background painting bug is still there. We need to make SVGForeignObject paint all the phases of the HTML I think.
Peter Murray
Comment 9 2011-12-08 08:55:41 PST
This was reported also against chrome at this bug: http://code.google.com/p/chromium/issues/detail?id=35545 Is there any update on the status of this issue? Perhaps a workaround that can be used to fool webkit into rendering these html backgrounds properly?
Simon Fraser (smfr)
Comment 10 2011-12-08 11:22:09 PST
I think bug 58417 may have fixed this.
Florin Malita
Comment 11 2012-02-01 14:50:13 PST
(In reply to comment #10) > I think bug 58417 may have fixed this. Almost there, but the second testcase is still failing. <body> background painting is not working for SVG docs due to the logic in RenderBox::paintBackground (Simon's point #3). I have a small patch based on smfr's earlier FO stacking context work (https://bugs.webkit.org/show_bug.cgi?id=23113#c8) that takes care of that.
Florin Malita
Comment 12 2012-02-01 14:57:08 PST
Eric Seidel (no email)
Comment 13 2012-02-01 15:23:50 PST
Comment on attachment 125022 [details] Patch This seems reasonable to me.
WebKit Review Bot
Comment 14 2012-02-01 16:00:14 PST
Comment on attachment 125022 [details] Patch Clearing flags on attachment: 125022 Committed r106510: <http://trac.webkit.org/changeset/106510>
WebKit Review Bot
Comment 15 2012-02-01 16:00:19 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.