WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Dec 2007 00:11:46 +0000 (00:11 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Dec 2007 00:11:46 +0000 (00:11 +0000)
        Reviewed by Dave Hyatt and Sam Weinig.

        - fix <rdar://problem/5605937> Inspector: Disclosure triangle not drawn in node's properties panel until click

        Test: fast/layers/add-layer-with-nested-stacking.html
        Test: fast/layers/remove-layer-with-nested-stacking.html

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::addChild): If the new child is overflow-only
        but has children of its own, dirty the stacking context's z-order lists
        since the grandchildren might need to be in them.
        (WebCore::RenderLayer::removeChild): Similarly for the old child.

LayoutTests:

        Reviewed by Dave Hyatt and Sam Weinig.

        - pixel tests for <rdar://problem/5605937> Inspector: Disclosure triangle not drawn in node's properties panel until click

        * fast/layers/add-layer-with-nested-stacking.html: Added.
        * fast/layers/remove-layer-with-nested-stacking.html: Added.
        * platform/mac/fast/layers/add-layer-with-nested-stacking-expected.checksum: Added.
        * platform/mac/fast/layers/add-layer-with-nested-stacking-expected.png: Added.
        * platform/mac/fast/layers/add-layer-with-nested-stacking-expected.txt: Added.
        * platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.checksum: Added.
        * platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.png: Added.
        * platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/layers/add-layer-with-nested-stacking.html [new file with mode: 0644]
LayoutTests/fast/layers/remove-layer-with-nested-stacking.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderLayer.cpp

index a0981edebfd9563e800e4deaa5b5604328c39bb8..6bb36590f3c2e991842559752a355c15c23f2476 100644 (file)
@@ -1,3 +1,18 @@
+2007-12-27  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt and Sam Weinig.
+
+        - pixel tests for <rdar://problem/5605937> Inspector: Disclosure triangle not drawn in node's properties panel until click
+
+        * fast/layers/add-layer-with-nested-stacking.html: Added.
+        * fast/layers/remove-layer-with-nested-stacking.html: Added.
+        * platform/mac/fast/layers/add-layer-with-nested-stacking-expected.checksum: Added.
+        * platform/mac/fast/layers/add-layer-with-nested-stacking-expected.png: Added.
+        * platform/mac/fast/layers/add-layer-with-nested-stacking-expected.txt: Added.
+        * platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.checksum: Added.
+        * platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.png: Added.
+        * platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.txt: Added.
+
 2007-12-27  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Sam.
diff --git a/LayoutTests/fast/layers/add-layer-with-nested-stacking.html b/LayoutTests/fast/layers/add-layer-with-nested-stacking.html
new file mode 100644 (file)
index 0000000..4b5f8cf
--- /dev/null
@@ -0,0 +1,29 @@
+<style>
+#test {
+    overflow: hidden; /* Required to reproduce. */
+}
+
+#test::before {
+    content: "";  /* Some content required to reproduce. */
+    opacity: 0.999; /* Required to reproduce. */
+    display: block;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+</style>
+<div id="test" style="display: none"></div>
+<script type="text/javascript">
+    function test()
+    {
+        document.getElementById("test").style.display = "block";
+    }
+
+    if (!window.layoutTestController)
+        setTimeout(test, 0);
+    else {
+        document.body.offsetTop;
+        layoutTestController.display();
+        test();
+    }
+</script>
diff --git a/LayoutTests/fast/layers/remove-layer-with-nested-stacking.html b/LayoutTests/fast/layers/remove-layer-with-nested-stacking.html
new file mode 100644 (file)
index 0000000..d1efdd8
--- /dev/null
@@ -0,0 +1,21 @@
+The square should be a uniform shade of green.
+<div style="width: 100px; height: 50px; background-color: green; opacity: 0.5;"></div>
+<span style="opacity: 0.9">
+    <div id="inner" style="float: left; width: 100px; height: 100px; overflow: hidden;">
+        <span style="display: inline-block; width: 100px; height: 50px; background-color: green; opacity: 0.5;"></span>
+    </div>
+</span>
+<script>
+    function test()
+    {
+        document.getElementById("inner").style.float = "none";
+    }
+
+    if (!window.layoutTestController)
+        setTimeout(test, 0);
+    else {
+        document.body.offsetTop;
+        layoutTestController.display();
+        test();
+    }
+</script>
diff --git a/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.checksum b/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.checksum
new file mode 100644 (file)
index 0000000..49e73cc
--- /dev/null
@@ -0,0 +1 @@
+66f7ab9da2ff72a42906052c1a4737d8
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.png b/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.png
new file mode 100644 (file)
index 0000000..abf8388
Binary files /dev/null and b/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.txt b/LayoutTests/platform/mac/fast/layers/add-layer-with-nested-stacking-expected.txt
new file mode 100644 (file)
index 0000000..ddfcc69
--- /dev/null
@@ -0,0 +1,10 @@
+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 {DIV} at (0,0) size 784x100
+layer at (8,8) size 100x100
+  RenderBlock (generated) at (0,0) size 100x100 [bgcolor=#008000]
+    RenderText at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.checksum b/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.checksum
new file mode 100644 (file)
index 0000000..ca1fc61
--- /dev/null
@@ -0,0 +1 @@
+f1c461b643ce606552ea16a280cdf583
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.png b/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.png
new file mode 100644 (file)
index 0000000..3ce6e53
Binary files /dev/null and b/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.txt b/LayoutTests/platform/mac/fast/layers/remove-layer-with-nested-stacking-expected.txt
new file mode 100644 (file)
index 0000000..b7ba8af
--- /dev/null
@@ -0,0 +1,20 @@
+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
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 300x18
+          text run at (0,0) width 300: "The square should be a uniform shade of green."
+      RenderBlock (anonymous) at (0,68) size 784x0
+      RenderBlock (anonymous) at (0,68) size 784x100
+      RenderBlock (anonymous) at (0,168) size 784x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,76) size 100x100
+  RenderBlock {DIV} at (0,0) size 100x100
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,26) size 100x50
+  RenderBlock {DIV} at (0,18) size 100x50 [bgcolor=#008000]
+layer at (8,76) size 100x50
+  RenderBlock {SPAN} at (0,0) size 100x50 [bgcolor=#008000]
index 7f157289b0e0604daff6cc22201946741aeda28d..5705ff2f176b8771dde6b2baffa0712a077d16fb 100644 (file)
@@ -1,3 +1,18 @@
+2007-12-27  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt and Sam Weinig.
+
+        - fix <rdar://problem/5605937> Inspector: Disclosure triangle not drawn in node's properties panel until click
+
+        Test: fast/layers/add-layer-with-nested-stacking.html
+        Test: fast/layers/remove-layer-with-nested-stacking.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::addChild): If the new child is overflow-only
+        but has children of its own, dirty the stacking context's z-order lists
+        since the grandchildren might need to be in them.
+        (WebCore::RenderLayer::removeChild): Similarly for the old child.
+
 2007-12-27  Jan Michael Alonzo  <jmalonzo@unpluggable.com>
 
         Reviewed by Alp Toker.
index 8e02467fc81a31a81ef71db0f3218082ed9c1029..d9d034bf1830d1cb03e77d1e884c6e6bdab2fbbb 100644 (file)
@@ -521,28 +521,27 @@ void RenderLayer::destroy(RenderArena* renderArena)
     renderArena->free(*(size_t *)this, this);
 }
 
-void RenderLayer::addChild(RenderLayer *child, RenderLayer* beforeChild)
+void RenderLayer::addChild(RenderLayerchild, RenderLayer* beforeChild)
 {
     RenderLayer* prevSibling = beforeChild ? beforeChild->previousSibling() : lastChild();
     if (prevSibling) {
         child->setPreviousSibling(prevSibling);
         prevSibling->setNextSibling(child);
-    }
-    else
+    } else
         setFirstChild(child);
 
     if (beforeChild) {
         beforeChild->setPreviousSibling(child);
         child->setNextSibling(beforeChild);
-    }
-    else
+    } else
         setLastChild(child);
-   
+
     child->setParent(this);
 
     if (child->isOverflowOnly())
         dirtyOverflowList();
-    else {
+
+    if (!child->isOverflowOnly() || child->firstChild()) {
         // Dirty the z-order list in which we are contained.  The stackingContext() can be null in the
         // case where we're building up generated content layers.  This is ok, since the lists will start
         // off dirty in that case anyway.
@@ -550,7 +549,7 @@ void RenderLayer::addChild(RenderLayer *child, RenderLayer* beforeChild)
         if (stackingContext)
             stackingContext->dirtyZOrderLists();
     }
-    
+
     child->updateVisibilityStatus();
     if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
         childVisibilityChanged(true);
@@ -571,7 +570,7 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
 
     if (oldChild->isOverflowOnly())
         dirtyOverflowList();
-    else { 
+    if (!oldChild->isOverflowOnly() || oldChild->firstChild()) { 
         // Dirty the z-order list in which we are contained.  When called via the
         // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
         // from the main layer tree, so we need to null-check the |stackingContext| value.