WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 20:03:17 +0000 (20:03 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 20:03:17 +0000 (20:03 +0000)
        Reviewed by Antti Koivisto.

        - fix a bug in invisible layer culling: dynamically changing a
          descendant of an invisible layer to be visible did not work

        Test: fast/layers/layer-content-visibility-change.html

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::setHasVisibleContent): If we got visible content,
        make sure that our stacking context rebuilds its z-order lists to
        include us.

LayoutTests:

        Reviewed by Antti Koivisto.

        - test that dynamically changing a descendant of an invisible layer to
          be visible works

        * fast/layers/layer-content-visibility-change.html: Added.
        * platform/mac/fast/layers/layer-content-visibility-change-expected.checksum: Added.
        * platform/mac/fast/layers/layer-content-visibility-change-expected.png: Added.
        * platform/mac/fast/layers/layer-content-visibility-change-expected.txt: Added.

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

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

index 217bd38db188f5941e3731a3170f53d81049974b..8a93c4d1c805f552cef5059636da6ff5e1e5e702 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-09  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Antti Koivisto.
+
+        - test that dynamically changing a descendant of an invisible layer to
+          be visible works
+
+        * fast/layers/layer-content-visibility-change.html: Added.
+        * platform/mac/fast/layers/layer-content-visibility-change-expected.checksum: Added.
+        * platform/mac/fast/layers/layer-content-visibility-change-expected.png: Added.
+        * platform/mac/fast/layers/layer-content-visibility-change-expected.txt: Added.
+
 2007-11-09  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Oliver.
diff --git a/LayoutTests/fast/layers/layer-content-visibility-change.html b/LayoutTests/fast/layers/layer-content-visibility-change.html
new file mode 100644 (file)
index 0000000..4949a27
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="position: relative;">
+    <div style="width: 100px; height: 100px; background-color: red;"></div>
+    <div style="visibility: hidden; position: absolute; top: 0;">
+        <div id="inner" style="width: 100px; height: 100px; background-color: green;"></div>
+    </div>
+</div>
+<script>
+    function test()
+    {
+        document.getElementById("inner").style.visibility = "visible";
+    }
+    if (window.layoutTestController) {
+        document.body.offsetTop;
+        layoutTestController.display();
+        test();
+    } else
+        setTimeout(test, 0);
+</script>
diff --git a/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.checksum b/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.checksum
new file mode 100644 (file)
index 0000000..77e97b1
--- /dev/null
@@ -0,0 +1 @@
+e1a695f3d1889abdff11e18becb6e3f0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.png b/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.png
new file mode 100644 (file)
index 0000000..3ab9f1a
Binary files /dev/null and b/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.txt b/LayoutTests/platform/mac/fast/layers/layer-content-visibility-change-expected.txt
new file mode 100644 (file)
index 0000000..c43ee5e
--- /dev/null
@@ -0,0 +1,11 @@
+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
+layer at (8,8) size 784x100
+  RenderBlock (relative positioned) {DIV} at (0,0) size 784x100
+    RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+layer at (8,8) size 100x100
+  RenderBlock (positioned) {DIV} at (0,0) size 100x100
+    RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#008000]
index 89321209908074a2b9033dfa8ed2bf6e3f411a84..ed73f16af7d1859a26d00766bd78d03464b98eac 100644 (file)
@@ -1,3 +1,17 @@
+2007-11-09  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Antti Koivisto.
+
+        - fix a bug in invisible layer culling: dynamically changing a 
+          descendant of an invisible layer to be visible did not work
+
+        Test: fast/layers/layer-content-visibility-change.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::setHasVisibleContent): If we got visible content,
+        make sure that our stacking context rebuilds its z-order lists to
+        include us.
+
 2007-11-09  David Hyatt  <hyatt@apple.com>
 
         Clean up matrix() parsing.  Make sure the first four arguments can be lengths or numbers.  The last two
index ac9f034ec30e55c7529a753c037f269dcf92d6b2..b5bdba8a67029e920443b53d963073cfac777cdc 100644 (file)
@@ -245,7 +245,7 @@ void RenderLayer::updateTransform()
     }
 }
 
-void RenderLayer::setHasVisibleContent(bool b) 
+void RenderLayer::setHasVisibleContent(bool b)
 { 
     if (m_hasVisibleContent == b && !m_visibleContentStatusDirty)
         return;
@@ -254,6 +254,10 @@ void RenderLayer::setHasVisibleContent(bool b)
     if (m_hasVisibleContent) {
         m_repaintRect = renderer()->absoluteClippedOverflowRect();
         m_outlineBox = renderer()->absoluteOutlineBox();
+        if (!isOverflowOnly()) {
+            if (RenderLayer* sc = stackingContext())
+                sc->dirtyZOrderLists();
+        }
     }
     if (parent())
         parent()->childVisibilityChanged(m_hasVisibleContent);