Diff
Modified: trunk/LayoutTests/ChangeLog (99861 => 99862)
--- trunk/LayoutTests/ChangeLog 2011-11-10 16:31:33 UTC (rev 99861)
+++ trunk/LayoutTests/ChangeLog 2011-11-10 16:47:16 UTC (rev 99862)
@@ -1,3 +1,14 @@
+2011-11-10 Florin Malita <[email protected]>
+
+ SVG object covers CSS background in HTML foreignObject
+ https://bugs.webkit.org/show_bug.cgi?id=58417
+
+ Reviewed by Simon Fraser.
+
+ * svg/foreignObject/background-render-phase-expected.png: Added.
+ * svg/foreignObject/background-render-phase-expected.txt: Added.
+ * svg/foreignObject/background-render-phase.html: Added.
+
2011-11-10 Sheriff Bot <[email protected]>
Unreviewed, rolling out r99851.
Added: trunk/LayoutTests/svg/foreignObject/background-render-phase-expected.png (0 => 99862)
--- trunk/LayoutTests/svg/foreignObject/background-render-phase-expected.png (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/background-render-phase-expected.png 2011-11-10 16:47:16 UTC (rev 99862)
@@ -0,0 +1,8 @@
+\x89PNG
+
+
+IHDR X ' )tEXtchecksum 31ef707c2144f777e740b8f7c24fe316z._\x96
+\xB5IDATx\x9C\xED\xD8\xC1 \xC00A;\x8D'\x9D_\x9AX0\x98\x99
+\xF4\\xB4 7 \xC7<\xA7 \xDCF` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @l\xCF\xCC\xE9
+ W\xF1` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4~D\xBA
+\xA9\xE8r\xE9\xB2 IEND\xAEB`\x82
\ No newline at end of file
Added: trunk/LayoutTests/svg/foreignObject/background-render-phase-expected.txt (0 => 99862)
--- trunk/LayoutTests/svg/foreignObject/background-render-phase-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/background-render-phase-expected.txt 2011-11-10 16:47:16 UTC (rev 99862)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 200x50
+ RenderSVGPath {rect} at (0,0) size 100x50 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=100.00] [height=50.00]
+ RenderSVGForeignObject {foreignObject} at (0,0) size 200x50
+ RenderBlock {DIV} at (0,0) size 200x50 [bgcolor=#008000]
+ RenderText {#text} at (0,0) size 4x19
+ text run at (0,0) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
Added: trunk/LayoutTests/svg/foreignObject/background-render-phase.html (0 => 99862)
--- trunk/LayoutTests/svg/foreignObject/background-render-phase.html (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/background-render-phase.html 2011-11-10 16:47:16 UTC (rev 99862)
@@ -0,0 +1,15 @@
+<html>
+<body style="margin: 0;">
+<svg xmlns="http://www.w3.org/2000/svg">
+<!-- The FO/div background should cover the rect element -->
+<rect x="0" y="0" width="100" height="50" fill="red"></rect>
+<foreignObject x="0" y="0" width="200" height="50">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <body style="dmargin: 0;">
+ <div style="background: green; height: 50px;"> </div>
+ </body>
+ </html>
+</foreignObject>
+</svg>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (99861 => 99862)
--- trunk/Source/WebCore/ChangeLog 2011-11-10 16:31:33 UTC (rev 99861)
+++ trunk/Source/WebCore/ChangeLog 2011-11-10 16:47:16 UTC (rev 99862)
@@ -1,3 +1,18 @@
+2011-11-10 Florin Malita <[email protected]>
+
+ SVG object covers CSS background in HTML foreignObject
+ https://bugs.webkit.org/show_bug.cgi?id=58417
+
+ Reviewed by Simon Fraser.
+
+ Test: svg/foreignObject/background-render-phase.html
+
+ * rendering/svg/RenderSVGForeignObject.cpp:
+ (WebCore::RenderSVGForeignObject::paint):
+
+ Paint SVG foreign objects atomically, following the same pattern as
+ http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/InlineBox.cpp#L209.
+
2011-11-10 Sheriff Bot <[email protected]>
Unreviewed, rolling out r99851.
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (99861 => 99862)
--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp 2011-11-10 16:31:33 UTC (rev 99861)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp 2011-11-10 16:47:16 UTC (rev 99862)
@@ -47,7 +47,8 @@
void RenderSVGForeignObject::paint(PaintInfo& paintInfo, const LayoutPoint&)
{
- if (paintInfo.context->paintingDisabled())
+ if (paintInfo.context->paintingDisabled()
+ || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
return;
PaintInfo childPaintInfo(paintInfo);
@@ -61,7 +62,22 @@
if (opacity < 1.0f)
childPaintInfo.context->beginTransparencyLayer(opacity);
+ // Paint all phases of FO elements atomically, as though the FO element established its
+ // own stacking context.
+ bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
+ LayoutPoint childPoint = IntPoint();
+ childPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
RenderBlock::paint(childPaintInfo, IntPoint());
+ if (!preservePhase) {
+ childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseFloat;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseForeground;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseOutline;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ }
if (opacity < 1.0f)
childPaintInfo.context->endTransparencyLayer();