If HTML inside an SVG foreignObject has CSS backgrounds, they fail to draw.
Created attachment 26419 [details] Testcase
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>.
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.
(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.
This looks like it works already in Safari 4?
Created attachment 30497 [details] Another testcase No, it doesn't work. See this testcase.
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.
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.
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?
I think bug 58417 may have fixed this.
(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.
Created attachment 125022 [details] Patch
Comment on attachment 125022 [details] Patch This seems reasonable to me.
Comment on attachment 125022 [details] Patch Clearing flags on attachment: 125022 Committed r106510: <http://trac.webkit.org/changeset/106510>
All reviewed patches have been landed. Closing bug.