2008-07-11 Simon Fraser <simon.fraser@apple.com>
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jul 2008 22:34:42 +0000 (22:34 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jul 2008 22:34:42 +0000 (22:34 +0000)
        Reviewed by Dave Hyatt

        Bug 18885: RenderLayer::enclosingPositionedAncestor() should
        look for transforms, since transforms create containing
        blocks.
        <https://bugs.webkit.org/show_bug.cgi?id=18885>

        Test: fast/transforms/transform-positioned-ancestor.html

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::stackingContext):
        (WebCore::RenderLayer::enclosingPositionedAncestor):
        (WebCore::RenderLayer::enclosingTransformedAncestor):

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

LayoutTests/ChangeLog
LayoutTests/fast/transforms/transform-positioned-ancestor.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transform-positioned-ancestor-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderLayer.cpp

index 19f548e33543cde415579c2fab39f86c6ea8ee3d..6be00e14bcfddeb45e13a16c8c536783e9802231 100644 (file)
@@ -1,3 +1,13 @@
+2008-07-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt
+
+        Test for <https://bugs.webkit.org/show_bug.cgi?id=18885>
+        (requires visual inspection or pixel test).
+        
+        * fast/transforms/transform-positioned-ancestor.html: Added.
+        * platform/mac/fast/transforms/transform-positioned-ancestor-expected.txt: Added.
+
 2008-07-11  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Anders.
diff --git a/LayoutTests/fast/transforms/transform-positioned-ancestor.html b/LayoutTests/fast/transforms/transform-positioned-ancestor.html
new file mode 100644 (file)
index 0000000..d6a8ac8
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Transform and positioned ancestor</title>
+  <style type="text/css" media="screen">
+  
+    #wrapper {
+      border: 1px solid black;
+      position: relative;
+      width: 300px;
+    }
+    .container {
+      height: 200px;
+      width: 200px;
+      margin: 50px;
+      background-color: gray;
+      -webkit-transform: rotate(0);
+    }
+    .box {
+      position: absolute;
+      left: 50px;
+      top: 50px;
+      height: 100px;
+      width: 100px;
+      background-color: red;
+    }
+    
+    .green-box {
+      position: absolute;
+      left: 100px;
+      top: 100px;
+      height: 100px;
+      width: 100px;
+      background-color: green;
+    }
+
+  </style>
+</head>
+<body>
+
+<p>You should see a green box inside a gray box. If you see red, the test has failed. <a href="https://bugs.webkit.org/show_bug.cgi?id=18885">https://bugs.webkit.org/show_bug.cgi?id=18885</a>
+</p>
+<div id="wrapper">
+
+  <div class="container">
+    <div class="box"></div>
+  </div>
+  <div class="green-box"></div>
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/transforms/transform-positioned-ancestor-expected.txt b/LayoutTests/platform/mac/fast/transforms/transform-positioned-ancestor-expected.txt
new file mode 100644 (file)
index 0000000..fe826cd
--- /dev/null
@@ -0,0 +1,21 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x378
+  RenderBlock {HTML} at (0,0) size 800x378
+    RenderBody {BODY} at (8,16) size 784x354
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 506x18
+          text run at (0,0) width 506: "You should see a green box inside a gray box. If you see red, the test has failed. "
+        RenderInline {A} at (0,0) size 750x36 [color=#0000EE]
+          RenderText {#text} at (506,0) size 750x36
+            text run at (506,0) width 244: "https://bugs.webkit.org/show_bug.cgi?"
+            text run at (0,18) width 61: "id=18885"
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,68) size 302x302
+  RenderBlock (relative positioned) {DIV} at (0,52) size 302x302 [border: (1px solid #000000)]
+layer at (59,119) size 200x200
+  RenderBlock {DIV} at (51,51) size 200x200 [bgcolor=#808080]
+layer at (109,169) size 100x100
+  RenderBlock (positioned) {DIV} at (50,50) size 100x100 [bgcolor=#FF0000]
+layer at (109,169) size 100x100
+  RenderBlock (positioned) {DIV} at (101,101) size 100x100 [bgcolor=#008000]
index a2672c2d6f24fd822ee41d31b836923d9cc2a6be..7cf760a33739b9bd3629dbe3541991c50b591159 100644 (file)
@@ -1,3 +1,19 @@
+2008-07-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt
+
+        Bug 18885: RenderLayer::enclosingPositionedAncestor() should
+        look for transforms, since transforms create containing
+        blocks.
+        <https://bugs.webkit.org/show_bug.cgi?id=18885>
+
+        Test: fast/transforms/transform-positioned-ancestor.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::stackingContext):
+        (WebCore::RenderLayer::enclosingPositionedAncestor):
+        (WebCore::RenderLayer::enclosingTransformedAncestor):
+
 2008-07-11  Jacob Refstrup  <jacob.refstrup@hp.com>
 
         Reviewed by Darin Adler
index 437754f55edfeba83faddf43aaf395571a97eaab..83ccf1c6d64be71f2d0000280a7ef0f820ab4745 100644 (file)
@@ -425,15 +425,15 @@ RenderLayer *RenderLayer::stackingContext() const
     RenderLayer* curr = parent();
     for ( ; curr && !curr->m_object->isRenderView() && !curr->m_object->isRoot() &&
           curr->m_object->style()->hasAutoZIndex();
-          curr = curr->parent()) { };
+          curr = curr->parent()) { }
     return curr;
 }
 
 RenderLayer* RenderLayer::enclosingPositionedAncestor() const
 {
     RenderLayer* curr = parent();
-    for ( ; curr && !curr->m_object->isRenderView() && !curr->m_object->isPositioned() && !curr->m_object->isRelPositioned();
-         curr = curr->parent()) { };
+    for ( ; curr && !curr->m_object->isRenderView() && !curr->m_object->isPositioned() && !curr->m_object->isRelPositioned() && !curr->m_object->hasTransform();
+         curr = curr->parent()) { }
     return curr;
 }
 
@@ -441,7 +441,7 @@ RenderLayer* RenderLayer::enclosingTransformedAncestor() const
 {
     RenderLayer* curr = parent();
     for ( ; curr && !curr->m_object->isRenderView() && !curr->transform(); curr = curr->parent())
-        { };
+        { }
     return curr;
 }