[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

simon.fraser at apple.com simon.fraser at apple.com
Thu Feb 4 21:25:40 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 6e1613a5158f5d6aea11a5f03d7cfdd5e99c345a
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 23 01:17:35 2010 +0000

    2010-01-22  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            REGRESSION (r53110): Find My iPhone message dialog is offset from original position once it gets focus
            https://bugs.webkit.org/show_bug.cgi?id=33821
    
            Fix an issue with the geometry of fixed position, composited layers inside other
            composited layers. If we called convertToLayerCoords() on a fixed layer with an ancestor
            layer which is not the root, then we assumed that the fixed layer had a positioning root.
            However, this is not always the case, since the fixed layer may have a compositing ancestor
            which is not a fixed container.
    
            Test: compositing/geometry/fixed-in-composited.html
    
            * rendering/RenderLayer.cpp:
            (WebCore::isFixedPositionedContainer): Utility function to test whether a layer acts
            as a fixed position container.
    
            (WebCore::RenderLayer::convertToLayerCoords): When called on a fixed position layer
            for an ancestor layer that is not the root, compute the correct offsets by looking for
            the fixed position container, and computing offsets relative to that. If the ancestorLayer
            is the fixed position container, fall through to the existing code that is shared
            with absolutely positioned layers.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53742 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f635723..10a517f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -28,6 +28,20 @@
 
         Reviewed by Dan Bernstein.
 
+        REGRESSION (r53110): Find My iPhone message dialog is offset from original position once it gets focus
+        https://bugs.webkit.org/show_bug.cgi?id=33821
+        
+        Testcase with various configurations of fixed position inside compositing layers.
+
+        * compositing/geometry/fixed-in-composited.html: Added.
+        * platform/mac/compositing/geometry/fixed-in-composited-expected.checksum: Added.
+        * platform/mac/compositing/geometry/fixed-in-composited-expected.png: Added.
+        * platform/mac/compositing/geometry/fixed-in-composited-expected.txt: Added.
+
+2010-01-22  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
         webkitConvertPointFromNodeToPage doesn't take into account most recent transform style
         https://bugs.webkit.org/show_bug.cgi?id=34023
         
diff --git a/LayoutTests/compositing/geometry/fixed-in-composited.html b/LayoutTests/compositing/geometry/fixed-in-composited.html
new file mode 100644
index 0000000..2218dba
--- /dev/null
+++ b/LayoutTests/compositing/geometry/fixed-in-composited.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    body {
+      margin: 0;
+      height: 1000px;
+    }
+
+    .container {
+      position: absolute;
+      z-index: 1;
+      left: 95px;
+      top: 145px;
+      width: 50px;
+      height: 50px;
+      outline: 4px solid black;
+    }
+    
+    .fixed {
+      position: fixed;
+      background-color: green;
+      height: 100px;
+      width: 100px;
+      top: 20px;
+      left: 20px;
+    }
+    
+    .composited {
+      -webkit-transform: translateZ(0);
+    }
+    
+    .container.two {
+      left: 200px;
+      top: 100px;
+    }
+    
+    .container.three {
+      left: 400px;
+      top: 100px;
+    }
+    
+    .box {
+      width: 100px;
+      height: 100px;
+    }
+
+    .composited.box {
+      width: 60px;
+      height: 60px;
+    }
+    
+    .transformed {
+      -webkit-transform: translate(0, 0);
+    }
+    
+    .indicator {
+      position: absolute;
+      background-color: red;
+      left: 20px;
+      top: 70px;
+    }
+    
+    .indicator.two {
+      left: 220px;
+      top: 120px;
+    }
+
+    .indicator.three {
+      left: 420px;
+      top: 120px;
+    }
+    
+    p {
+      margin-top: 150px;
+    }
+  </style>
+  <script type="text/javascript" charset="utf-8">
+    window.addEventListener('load', function() {
+      window.scrollBy(50, 50);
+    }, false);
+  </script>
+</head>
+<body>
+
+  <div class="indicator box"></div>
+  <div class="indicator box two"></div>
+  <div class="indicator box three"></div>
+  <div class="composited box" style="background-color: rgba(0, 0, 255, 0.2)"></div>
+
+  <div class="container">
+    <div class="fixed">
+    </div>
+  </div>
+
+  <div class="container composited two">
+    <div class="fixed">
+    </div>
+  </div>
+  
+  <div class="container three">
+    <div class="transformed box">
+      <div class="fixed"></div>
+    </div>
+  </div>
+  
+  <p>You should see no red above.</p>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.checksum b/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.checksum
new file mode 100644
index 0000000..57f0beb
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.checksum
@@ -0,0 +1 @@
+188ad29aa97ac107f7f491995e38f7e9
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.png b/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.png
new file mode 100644
index 0000000..05ecca7
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.txt b/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.txt
new file mode 100644
index 0000000..5470277
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/fixed-in-composited-expected.txt
@@ -0,0 +1,31 @@
+layer at (0,0) size 785x1000
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1000
+  RenderBlock {HTML} at (0,0) size 785x1000
+    RenderBody {BODY} at (0,0) size 785x1000
+      RenderBlock {P} at (0,210) size 785x18
+        RenderText {#text} at (0,0) size 188x18
+          text run at (0,0) width 188: "You should see no red above."
+layer at (20,70) size 100x100
+  RenderBlock (positioned) {DIV} at (20,70) size 100x100 [bgcolor=#FF0000]
+layer at (220,120) size 100x100
+  RenderBlock (positioned) {DIV} at (220,120) size 100x100 [bgcolor=#FF0000]
+layer at (420,120) size 100x100
+  RenderBlock (positioned) {DIV} at (420,120) size 100x100 [bgcolor=#FF0000]
+layer at (0,0) size 60x60
+  RenderBlock {DIV} at (0,0) size 60x60 [bgcolor=#0000FF33]
+layer at (95,145) size 50x50
+  RenderBlock (positioned) zI: 1 {DIV} at (95,145) size 50x50
+layer at (20,70) size 100x100
+  RenderBlock (positioned) {DIV} at (20,20) size 100x100 [bgcolor=#008000]
+layer at (200,100) size 50x50
+  RenderBlock (positioned) zI: 1 {DIV} at (200,100) size 50x50
+layer at (220,120) size 100x100
+  RenderBlock (positioned) {DIV} at (20,20) size 100x100 [bgcolor=#008000]
+layer at (400,100) size 50x50
+  RenderBlock (positioned) zI: 1 {DIV} at (400,100) size 50x50
+layer at (400,100) size 100x100
+  RenderBlock {DIV} at (0,0) size 100x100
+layer at (420,120) size 100x100
+  RenderBlock (positioned) {DIV} at (20,20) size 100x100 [bgcolor=#008000]
+scrolled to 0,50
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4cb1e36..5d6b32f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,31 @@
 
         Reviewed by Dan Bernstein.
 
+        REGRESSION (r53110): Find My iPhone message dialog is offset from original position once it gets focus
+        https://bugs.webkit.org/show_bug.cgi?id=33821
+
+        Fix an issue with the geometry of fixed position, composited layers inside other
+        composited layers. If we called convertToLayerCoords() on a fixed layer with an ancestor
+        layer which is not the root, then we assumed that the fixed layer had a positioning root.
+        However, this is not always the case, since the fixed layer may have a compositing ancestor
+        which is not a fixed container.
+        
+        Test: compositing/geometry/fixed-in-composited.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::isFixedPositionedContainer): Utility function to test whether a layer acts
+        as a fixed position container.
+        
+        (WebCore::RenderLayer::convertToLayerCoords): When called on a fixed position layer
+        for an ancestor layer that is not the root, compute the correct offsets by looking for
+        the fixed position container, and computing offsets relative to that. If the ancestorLayer
+        is the fixed position container, fall through to the existing code that is shared
+        with absolutely positioned layers.
+
+2010-01-22  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
         webkitConvertPointFromNodeToPage doesn't take into account most recent transform style
         https://bugs.webkit.org/show_bug.cgi?id=34023
 
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 7729ac8..86b31ee 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -657,6 +657,12 @@ static inline bool isPositionedContainer(RenderLayer* layer)
     return o->isRenderView() || o->isPositioned() || o->isRelPositioned() || layer->hasTransform();
 }
 
+static inline bool isFixedPositionedContainer(RenderLayer* layer)
+{
+    RenderObject* o = layer->renderer();
+    return o->isRenderView() || layer->hasTransform();
+}
+
 RenderLayer* RenderLayer::enclosingPositionedAncestor() const
 {
     RenderLayer* curr = parent();
@@ -997,10 +1003,41 @@ RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, int& xPos, i
         return;
     }
  
+    if (position == FixedPosition) {
+        // For a fixed layers, we need to walk up to the root to see if there's a fixed position container
+        // (e.g. a transformed layer). It's an error to call convertToLayerCoords() across a layer with a transform,
+        // so we should always find the ancestor at or before we find the fixed position container.
+        RenderLayer* fixedPositionContainerLayer = 0;
+        bool foundAncestor = false;
+        for (RenderLayer* currLayer = parent(); currLayer; currLayer = currLayer->parent()) {
+            if (currLayer == ancestorLayer)
+                foundAncestor = true;
+
+            if (isFixedPositionedContainer(currLayer)) {
+                fixedPositionContainerLayer = currLayer;
+                ASSERT(foundAncestor);
+                break;
+            }
+        }
+        
+        ASSERT(fixedPositionContainerLayer); // We should have hit the RenderView's layer at least.
+
+        if (fixedPositionContainerLayer != ancestorLayer) {
+            int fixedContainerX = 0;
+            int fixedContainerY = 0;
+            convertToLayerCoords(fixedPositionContainerLayer, fixedContainerX, fixedContainerY);
+            
+            int ancestorX = 0;
+            int ancestorY = 0;
+            ancestorLayer->convertToLayerCoords(fixedPositionContainerLayer, ancestorX, ancestorY);
+        
+            xPos += (fixedContainerX - ancestorX);
+            yPos += (fixedContainerY - ancestorY);
+            return;
+        }
+    }
+    
     RenderLayer* parentLayer;
-    // For a fixed layer, if we're asking for coords relative to some other ancestor, then it must be
-    // enclosed in a fixed position container (e.g. a transformed element), so it behaves like an absolutely
-    // positioned element.
     if (position == AbsolutePosition || position == FixedPosition) {
         // Do what enclosingPositionedAncestor() does, but check for ancestorLayer along the way.
         parentLayer = parent();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list