Diff
Modified: trunk/LayoutTests/ChangeLog (108493 => 108494)
--- trunk/LayoutTests/ChangeLog 2012-02-22 14:21:23 UTC (rev 108493)
+++ trunk/LayoutTests/ChangeLog 2012-02-22 14:49:46 UTC (rev 108494)
@@ -1,5 +1,37 @@
2012-02-22 Nikolas Zimmermann <[email protected]>
+ REGRESSION(58212): html foreignObjects with positions other than static not hidden correctly when parent has display:none
+ https://bugs.webkit.org/show_bug.cgi?id=41386
+
+ Reviewed by Zoltan Herczeg.
+
+ Add new tests covering <foreignObject> content inside a <g display="none">.
+
+ * platform/chromium/test_expectations.txt:
+ * platform/mac/svg/foreignObject/fO-display-none-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-display-none-expected.txt: Added.
+ * platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.txt: Added.
+ * platform/mac/svg/foreignObject/fO-parent-display-changes-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-parent-display-changes-expected.txt: Added.
+ * platform/mac/svg/foreignObject/fO-parent-display-none-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-parent-display-none-expected.txt: Added.
+ * platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.txt: Added.
+ * platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.txt: Added.
+ * platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.png: Added.
+ * platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.txt: Added.
+ * svg/foreignObject/fO-display-none-with-relative-pos-content.svg: Added.
+ * svg/foreignObject/fO-display-none.svg: Added.
+ * svg/foreignObject/fO-parent-display-changes.svg: Added.
+ * svg/foreignObject/fO-parent-display-none-with-relative-pos-content.svg: Added.
+ * svg/foreignObject/fO-parent-display-none.svg: Added.
+ * svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content.svg: Added.
+ * svg/foreignObject/fO-parent-of-parent-display-none.svg: Added.
+
+2012-02-22 Nikolas Zimmermann <[email protected]>
+
Not reviewed. Fix SVG pixel test results, which now show up as hash failures, since DRT was fixed to report these.
* platform/mac/svg/W3C-SVG-1.1/coords-units-03-b-expected.png:
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (108493 => 108494)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-22 14:21:23 UTC (rev 108493)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -4186,6 +4186,18 @@
BUGWK65072 : svg/text/exs-display-none.svg = IMAGE IMAGE+TEXT
BUGWK65072 : svg/text/ems-display-none.svg = IMAGE IMAGE+TEXT
+// Needs new baselines.
+BUGWK41386 : svg/foreignObject/fO-display-none-with-relative-pos-content.svg = IMAGE+TEXT
+BUGWK41386 : svg/foreignObject/fO-display-none.svg = IMAGE+TEXT
+BUGWK41386 : svg/foreignObject/fO-parent-display-none-with-relative-pos-content.svg = IMAGE+TEXT
+BUGWK41386 : svg/foreignObject/fO-parent-display-none.svg = IMAGE+TEXT
+BUGWK41386 : svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content.svg = IMAGE+TEXT
+BUGWK41386 : svg/foreignObject/fO-parent-of-parent-display-none.svg = IMAGE+TEXT
+BUGWK41386 : svg/foreignObject/fO-parent-display-changes.svg = IMAGE+TEXT
+
+// Started failing http://trac.webkit.org/log/?verbose=on&rev=107837&stop_rev=107836
+BUGWK78755 : compositing/culling/scrolled-within-boxshadow.html = IMAGE
+
// Need rebaselining.
BUGWK69210 MAC : fast/encoding/utf-16-big-endian.html = IMAGE+TEXT
BUGWK69210 MAC : fast/encoding/utf-16-little-endian.html = IMAGE+TEXT
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-display-none-with-relative-pos-content-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-changes-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-changes-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-changes-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-changes-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-changes-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderSVGForeignObject {foreignObject} at (0,0) size 0x0
+ RenderBlock {html} at (0,0) size 0x100
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
+layer at (0,0) size 100x100
+ RenderBody {body} at (0,0) size 100x100 [color=#FFFFFF]
+ RenderText {#text} at (0,0) size 39x18
+ text run at (0,0) width 39: "PASS"
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGHiddenContainer {g} at (0,0) size 0x0
+ RenderSVGForeignObject {foreignObject} at (0,0) size 0x0
+ RenderBlock {html} at (0,0) size 0x100
+ RenderBody {body} at (0,0) size 100x100 [color=#FF0000]
+ RenderText {#text} at (0,0) size 76x36
+ text run at (0,0) width 76: "FAILED IF"
+ text run at (0,18) width 62: "VISIBLE"
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-display-none-with-relative-pos-content-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGHiddenContainer {g} at (0,0) size 0x0
+ RenderSVGForeignObject {foreignObject} at (0,0) size 0x0
+ RenderBlock {html} at (0,0) size 0x100
+ RenderBody {body} at (0,0) size 100x100 [color=#FF0000]
+ RenderText {#text} at (0,0) size 76x36
+ text run at (0,0) width 76: "FAILED IF"
+ text run at (0,18) width 62: "VISIBLE"
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGHiddenContainer {g} at (0,0) size 0x0
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderSVGForeignObject {foreignObject} at (0,0) size 0x0
+ RenderBlock {html} at (0,0) size 0x100
+ RenderBody {body} at (0,0) size 100x100 [color=#FF0000]
+ RenderText {#text} at (0,0) size 76x36
+ text run at (0,0) width 76: "FAILED IF"
+ text run at (0,18) width 62: "VISIBLE"
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.txt (0 => 108494)
--- trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content-expected.txt 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x90
+ RenderSVGHiddenContainer {g} at (0,0) size 0x0
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderSVGForeignObject {foreignObject} at (0,0) size 0x0
+ RenderBlock {html} at (0,0) size 0x100
+ RenderBody {body} at (0,0) size 100x100 [color=#FF0000]
+ RenderText {#text} at (0,0) size 76x36
+ text run at (0,0) width 76: "FAILED IF"
+ text run at (0,18) width 62: "VISIBLE"
+ RenderSVGRect {rect} at (0,0) size 100x90 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=90.00]
Added: trunk/LayoutTests/svg/foreignObject/fO-display-none-with-relative-pos-content.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-display-none-with-relative-pos-content.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-display-none-with-relative-pos-content.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <foreignObject style="display: none">
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FF0000; position: relative" id="databody" >FAILED IF VISIBLE</body>
+ </html>
+ </foreignObject>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Added: trunk/LayoutTests/svg/foreignObject/fO-display-none.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-display-none.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-display-none.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <foreignObject style="display: none">
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FF0000;" id="databody" >FAILED IF VISIBLE</body>
+ </html>
+ </foreignObject>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Added: trunk/LayoutTests/svg/foreignObject/fO-parent-display-changes.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-parent-display-changes.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-parent-display-changes.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" _onload_="runRepaintTest()">
+ <script xlink:href=""
+ <script>
+ function repaintTest() {
+ document.getElementsByTagName("g")[0].setAttribute("style", "display: block");
+ }
+ </script>
+
+ <g style="display:none;" >
+ <foreignObject>
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FFFFFF; position: relative" id="databody" >PASS</body>
+ </html>
+ </foreignObject>
+ </g>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Added: trunk/LayoutTests/svg/foreignObject/fO-parent-display-none-with-relative-pos-content.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-parent-display-none-with-relative-pos-content.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-parent-display-none-with-relative-pos-content.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <g style="display:none;" >
+ <foreignObject>
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FF0000; position: relative" id="databody" >FAILED IF VISIBLE</body>
+ </html>
+ </foreignObject>
+ </g>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Added: trunk/LayoutTests/svg/foreignObject/fO-parent-display-none.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-parent-display-none.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-parent-display-none.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <g style="display:none;" >
+ <foreignObject>
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FF0000;" id="databody" >FAILED IF VISIBLE</body>
+ </html>
+ </foreignObject>
+ </g>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Added: trunk/LayoutTests/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <g style="display:none;" >
+ <g style="display: block">
+ <foreignObject>
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FF0000; position: relative" id="databody" >FAILED IF VISIBLE</body>
+ </html>
+ </foreignObject>
+ </g>
+ </g>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Added: trunk/LayoutTests/svg/foreignObject/fO-parent-of-parent-display-none.svg (0 => 108494)
--- trunk/LayoutTests/svg/foreignObject/fO-parent-of-parent-display-none.svg (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/fO-parent-of-parent-display-none.svg 2012-02-22 14:49:46 UTC (rev 108494)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <g style="display:none;" >
+ <g style="display: block">
+ <foreignObject>
+ <html xmlns="http://www.w3.org/1999/xhtml" >
+ <body style="width: 100px; height: 100px;margin:0; color: #FF0000;" id="databody" >FAILED IF VISIBLE</body>
+ </html>
+ </foreignObject>
+ </g>
+ </g>
+ <rect x='0' y='0' width='100' height='90' fill='green' ></rect>
+</svg>
Modified: trunk/Source/WebCore/ChangeLog (108493 => 108494)
--- trunk/Source/WebCore/ChangeLog 2012-02-22 14:21:23 UTC (rev 108493)
+++ trunk/Source/WebCore/ChangeLog 2012-02-22 14:49:46 UTC (rev 108494)
@@ -1,3 +1,38 @@
+2012-02-22 Nikolas Zimmermann <[email protected]>
+
+ REGRESSION(58212): html foreignObjects with positions other than static not hidden correctly when parent has display:none
+ https://bugs.webkit.org/show_bug.cgi?id=41386
+
+ Reviewed by Zoltan Herczeg.
+
+ r58212 gave SVGGElements a renderer, regardless if "display: none" was set or not, for various reasons (see change set).
+ The <g> renderer for such cases is a RenderSVGHiddenContainer. We make sure in SVG that such subtrees are never used
+ for painting & hittesting - they only exist for the purpose of SVG DOM (query getCTM, etc..) and to create renderers
+ for child resources, like <g display="none"><linearGradient>.
+
+ This concept still works fine for: <g display="none"><foreignObject><body>Foobar</body></foreignObject></g>, as
+ RenderSVGForeignObject::paint is never called thus we never paint the subtree of the <fO>. If the <body> elements
+ contains "position: relative" a new layer is created for the <body>. When the document paints we have two seperated
+ layers, and the <body> layer doesn't know that it's actually inside a "SVG hidden subtree", and gets painted, where it
+ shouldn't. HTML doesn't have this problems, as a display: none object, never creates a renderer.
+
+ The fix is to disallow layer creation in hidden SVG subtrees, to mimic what would happen if we'd follow HTML rules
+ to not create renderers for display: none objects. This avoids any indirections - as no layers are created anymore.
+
+ Tests: svg/foreignObject/fO-display-none-with-relative-pos-content.svg
+ svg/foreignObject/fO-display-none.svg
+ svg/foreignObject/fO-parent-display-changes.svg
+ svg/foreignObject/fO-parent-display-none-with-relative-pos-content.svg
+ svg/foreignObject/fO-parent-display-none.svg
+ svg/foreignObject/fO-parent-of-parent-display-none-with-relative-pos-content.svg
+ svg/foreignObject/fO-parent-of-parent-display-none.svg
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::styleDidChange): Only create layers, if its allowed -- layerCreationAllowedForSubtree() will always return true for HTML, and only false for layers inside a hidden SVG subtree.
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::addChild): Only create layers, if its allowed.
+ * rendering/RenderObject.h: Add inline layerCreationAllowedForSubtree() helper, that craws the tree to find a RenderSVGHiddenContainer ancestor, if not present, return true.
+
2012-02-22 Zoltan Herczeg <[email protected]>
Drop clipToImageBuffer from RenderBoxModelObject
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (108493 => 108494)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-02-22 14:21:23 UTC (rev 108493)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-02-22 14:49:46 UTC (rev 108494)
@@ -358,7 +358,7 @@
updateBoxModelInfoFromStyle();
if (requiresLayer()) {
- if (!layer()) {
+ if (!layer() && layerCreationAllowedForSubtree()) {
if (s_wasFloating && isFloating())
setChildNeedsLayout(true);
m_layer = new (renderArena()) RenderLayer(this);
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (108493 => 108494)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-02-22 14:21:23 UTC (rev 108493)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-02-22 14:49:46 UTC (rev 108494)
@@ -335,6 +335,17 @@
toRenderText(newChild)->setText(textToTransform.release(), true);
}
+ // SVG creates renderers for <g display="none">, as SVG requires children of hidden
+ // <g>s to have renderers - at least that's how our implementation works. Consider:
+ // <g display="none"><foreignObject><body style="position: relative">FOO...
+ // - requiresLayer() would return true for the <body>, creating a new RenderLayer
+ // - when the document is painted, both layers are painted. The <body> layer doesn't
+ // know that it's inside a "hidden SVG subtree", and thus paints, even if it shouldn't.
+ // To avoid the problem alltogether, detect early if we're inside a hidden SVG subtree
+ // and stop creating layers at all for these cases - they're not used anyways.
+ if (newChild->hasLayer() && !layerCreationAllowedForSubtree())
+ toRenderBoxModelObject(newChild)->layer()->removeOnlyThisLayer();
+
if (beforeChildHasBeforeAndAfterContent)
children->updateBeforeAfterContent(this, BEFORE);
}
Modified: trunk/Source/WebCore/rendering/RenderObject.h (108493 => 108494)
--- trunk/Source/WebCore/rendering/RenderObject.h 2012-02-22 14:21:23 UTC (rev 108493)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2012-02-22 14:49:46 UTC (rev 108494)
@@ -862,6 +862,8 @@
RenderObject* rendererForRootBackground();
protected:
+ inline bool layerCreationAllowedForSubtree() const;
+
// Overrides should call the superclass at the end
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
// Overrides should call the superclass at the start
@@ -1113,6 +1115,20 @@
return style()->preserveNewline();
}
+inline bool RenderObject::layerCreationAllowedForSubtree() const
+{
+#if ENABLE(SVG)
+ RenderObject* parentRenderer = parent();
+ while (parentRenderer) {
+ if (parentRenderer->isSVGHiddenContainer())
+ return false;
+ parentRenderer = parentRenderer->parent();
+ }
+#endif
+
+ return true;
+}
+
inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering)
{
#if !ENABLE(3D_RENDERING)