LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jan 2007 09:00:33 +0000 (09:00 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jan 2007 09:00:33 +0000 (09:00 +0000)
        Reviewed by hyatt.

        Test for http://bugs.webkit.org/show_bug.cgi?id=12109
        layer visibility incorrect in some cases

        * fast/layers/layer-visibility-sublayer-expected.checksum: Added.
        * fast/layers/layer-visibility-sublayer-expected.png: Added.
        * fast/layers/layer-visibility-sublayer-expected.txt: Added.
        * fast/layers/layer-visibility-sublayer.html: Added.

WebCore:

        Reviewed by hyatt.

        http://bugs.webkit.org/show_bug.cgi?id=12109

        Fix layer visibility in some cases with nested layers.

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::updateVisibilityStatus):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18616 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/layers/layer-visibility-sublayer-expected.checksum [new file with mode: 0644]
LayoutTests/fast/layers/layer-visibility-sublayer-expected.png [new file with mode: 0644]
LayoutTests/fast/layers/layer-visibility-sublayer-expected.txt [new file with mode: 0644]
LayoutTests/fast/layers/layer-visibility-sublayer.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderLayer.cpp

index 96b0b7f8a9fdfe17bb936fdb89329057c19870d3..49d9f182cab95a056fa725f4664dc7f2b8db43f2 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-05  Antti Koivisto  <koivisto@iki.fi>
+
+        Reviewed by hyatt.
+        
+        Test for http://bugs.webkit.org/show_bug.cgi?id=12109
+        layer visibility incorrect in some cases
+
+        * fast/layers/layer-visibility-sublayer-expected.checksum: Added.
+        * fast/layers/layer-visibility-sublayer-expected.png: Added.
+        * fast/layers/layer-visibility-sublayer-expected.txt: Added.
+        * fast/layers/layer-visibility-sublayer.html: Added.
+
 2007-01-04  Adam Roben  <aroben@apple.com>
 
         Reviewed by Geoff.
diff --git a/LayoutTests/fast/layers/layer-visibility-sublayer-expected.checksum b/LayoutTests/fast/layers/layer-visibility-sublayer-expected.checksum
new file mode 100644 (file)
index 0000000..f2e1499
--- /dev/null
@@ -0,0 +1 @@
+dcad0378994307f902191e22b50949c9
\ No newline at end of file
diff --git a/LayoutTests/fast/layers/layer-visibility-sublayer-expected.png b/LayoutTests/fast/layers/layer-visibility-sublayer-expected.png
new file mode 100644 (file)
index 0000000..46291fd
Binary files /dev/null and b/LayoutTests/fast/layers/layer-visibility-sublayer-expected.png differ
diff --git a/LayoutTests/fast/layers/layer-visibility-sublayer-expected.txt b/LayoutTests/fast/layers/layer-visibility-sublayer-expected.txt
new file mode 100644 (file)
index 0000000..a02915e
--- /dev/null
@@ -0,0 +1,53 @@
+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 (8,8) size 784x584
+      RenderBR {BR} at (0,0) size 0x18
+      RenderBR {BR} at (0,18) size 0x18
+      RenderBR {BR} at (0,36) size 0x18
+      RenderBR {BR} at (0,54) size 0x18
+      RenderText {#text} at (0,72) size 180x18
+        text run at (0,72) width 180: "24 green box with word ok: "
+      RenderText {#text} at (0,0) size 0x0
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBR {BR} at (0,90) size 0x18
+      RenderBR {BR} at (0,108) size 0x18
+      RenderBR {BR} at (0,126) size 0x18
+      RenderText {#text} at (0,144) size 180x18
+        text run at (0,144) width 180: "25 green box with word ok: "
+      RenderText {#text} at (0,0) size 0x0
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBR {BR} at (0,162) size 0x18
+      RenderBR {BR} at (0,180) size 0x18
+      RenderBR {BR} at (0,198) size 0x18
+      RenderText {#text} at (0,216) size 180x18
+        text run at (0,216) width 180: "26 green box with word ok: "
+      RenderText {#text} at (0,0) size 0x0
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBR {BR} at (0,234) size 0x18
+      RenderBR {BR} at (0,252) size 0x18
+      RenderBR {BR} at (0,270) size 0x18
+layer at (0,98) size 800x34
+  RenderBlock (positioned) {DIV} at (0,98) size 800x34 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,2) size 796x4 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,6) size 796x22 [border: (2px solid #008000)]
+      RenderText {#text} at (2,2) size 16x18
+        text run at (2,2) width 16: "ok"
+layer at (0,170) size 800x34
+  RenderBlock (positioned) {DIV} at (0,170) size 800x34 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,2) size 796x4 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,6) size 796x4 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,10) size 796x22 [border: (2px solid #008000)]
+      RenderText {#text} at (2,2) size 16x18
+        text run at (2,2) width 16: "ok"
+layer at (0,242) size 800x50
+  RenderBlock (positioned) {DIV} at (0,242) size 800x34 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,2) size 796x22 [border: (2px solid #FF0000)]
+      RenderBlock {DIV} at (2,2) size 792x18
+        RenderText {#text} at (0,0) size 27x18
+          text run at (0,0) width 27: "blah"
+    RenderBlock {DIV} at (2,24) size 796x4 [border: (2px solid #FF0000)]
+    RenderBlock {DIV} at (2,28) size 796x22 [border: (2px solid #008000)]
+      RenderText {#text} at (2,2) size 16x18
+        text run at (2,2) width 16: "ok"
diff --git a/LayoutTests/fast/layers/layer-visibility-sublayer.html b/LayoutTests/fast/layers/layer-visibility-sublayer.html
new file mode 100644 (file)
index 0000000..8fc5661
--- /dev/null
@@ -0,0 +1,94 @@
+<html>
+<style>
+.red { border: 2px solid red }
+.green { border: 2px solid green }
+.visible { visibility: visible}
+.invisible { visibility: hidden}
+//.invisible:hover { visibility: visible}
+.abstop { position: absolute; left:0; right:0; height:30px   }
+.abs { position: absolute; left:0; right:0; top:0; bottom:0 }
+</style>
+
+<script>
+var node1;
+var node2;
+function dotest()
+{
+
+//24
+document.getElementById('24c').style.setProperty('visibility','hidden','');
+document.getElementById('24a').removeChild(document.getElementById('24b'));
+
+//25
+document.getElementById('25c').style.setProperty('visibility','hidden','');
+document.getElementById('25a').removeChild(document.getElementById('25b'));
+
+//26
+document.getElementById('26c').style.setProperty('visibility','hidden','');
+document.getElementById('26a').removeChild(document.getElementById('26b'));
+setTimeout(dotest2,20);
+}
+
+function dotest2()
+{
+
+//xx
+//document.getElementById('23').style.setProperty('visibility','hidden','');
+}
+
+</script>
+</head>
+<body onload="setTimeout(dotest,20)">
+<br><br><br><br>
+24 green box with word ok:
+<div id="24a" class="invisible abstop red">
+<div class="abs invisible red">
+<span>blah</span>
+</div>
+<div id="24b" class="abs invisible red">
+</div>
+<div id="24c" class="visible red">
+</div>
+<div class="visible green">
+ok
+</div>
+</div>
+<br><br><br><br>
+
+25 green box with word ok:
+<div id="25a" class="invisible abstop red">
+<div class="invisible red">
+</div>
+<div class="abs invisible red">
+</div>
+<div id="25b" class="abs invisible red">
+<span>blah</span>
+</div>
+<div id="25c" class="visible red">
+</div>
+<div class="visible green">
+ok
+</div>
+</div>
+<br><br><br><br>
+
+26 green box with word ok:
+<div id="26a" class="invisible abstop red">
+<div class="invisible red">
+<div>blah</div>
+</div>
+<div class="abs invisible red">
+<span>blah</span>
+</div>
+<div id="26b" class="abs invisible red">
+<span>blah</span>
+</div>
+<div id="26c" class="visible red">
+</div>
+<div class="visible green">
+ok
+</div>
+</div>
+<br><br><br><br>
+</body>
+</html>
index 51722cc1d39d4fb2ce417447361bb9f4fa4b1092..142d71c9957a537ef7ed2b4cb36c317c6d3169e1 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-05  Antti Koivisto  <koivisto@iki.fi>
+
+        Reviewed by hyatt.
+        
+        http://bugs.webkit.org/show_bug.cgi?id=12109
+        
+        Fix layer visibility in some cases with nested layers.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateVisibilityStatus):
+
 2007-01-05  Lars Knoll <lars@trolltech.com>
 
         Make it compile with gcc 4.1
index 2205db5e1901437e8fe890de04f825c691a27959..8e43627c026313444905db1fff0275c98b74854f 100644 (file)
@@ -292,20 +292,20 @@ void RenderLayer::updateVisibilityStatus()
             m_hasVisibleContent = false;
             RenderObject* r = m_object->firstChild();
             while (r) {
-                if (r->style()->visibility() == VISIBLE) {
+                if (r->style()->visibility() == VISIBLE && !r->layer()) {
                     m_hasVisibleContent = true;
                     break;
                 }
-                if (r->firstChild() && !r->firstChild()->layer())
+                if (r->firstChild() && !r->layer())
                     r = r->firstChild();
-                else if (r->nextSibling() && !r->nextSibling()->layer())
+                else if (r->nextSibling())
                     r = r->nextSibling();
                 else {
-                    while (r && (!r->nextSibling() || r->nextSibling()->layer())) {
+                    do {
                         r = r->parent();
                         if (r==m_object)
                             r = 0;
-                    }
+                    } while (r && !r->nextSibling());
                     if (r)
                         r = r->nextSibling();
                 }