[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Wed Apr 7 23:37:11 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 7e99770d2946f6fd63b8118d5f587e038954cd11
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 13 04:36:56 2009 +0000

    2009-11-12  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Transformed reflected elements are clipped inside element with opacity
            https://bugs.webkit.org/show_bug.cgi?id=30957
    
            transparencyClipBox() attemped to minimize the size of the transparency layer by mapping
            each clip rect into painting space before taking the unions. This, however, did not work
            correctly with combinations of reflections and transforms. Fixed by unioning the
            clipRect and mapping through transforms along the way.
    
            Also leave some #ifdeffed code in beginTransparencyLayers() that makes it easy to see
            where the transparency layers are.
    
            Test: fast/reflections/opacity-reflection-transform.html
    
            * rendering/RenderLayer.cpp:
            (WebCore::expandClipRectForDescendantsAndReflection):
            (WebCore::transparencyClipBox):
            (WebCore::RenderLayer::beginTransparencyLayers):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50925 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9adda7d..292d068 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2009-11-12  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Transformed reflected elements are clipped inside element with opacity
+        https://bugs.webkit.org/show_bug.cgi?id=30957
+        
+        Testcase for reflected and transformed elements inside an opacity layer.
+
+        * fast/reflections/opacity-reflection-transform.html: Added.
+        * platform/mac/fast/reflections/opacity-reflection-transform-expected.checksum: Added.
+        * platform/mac/fast/reflections/opacity-reflection-transform-expected.png: Added.
+        * platform/mac/fast/reflections/opacity-reflection-transform-expected.txt: Added.
+
 2009-11-12  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/LayoutTests/fast/reflections/opacity-reflection-transform.html b/LayoutTests/fast/reflections/opacity-reflection-transform.html
new file mode 100644
index 0000000..7ca289d
--- /dev/null
+++ b/LayoutTests/fast/reflections/opacity-reflection-transform.html
@@ -0,0 +1,32 @@
+<!DOCTYPE>
+<html>
+  <head>
+    <style type="text/css" media="screen">
+      .box {
+        width: 100px;
+        height: 100px;
+      }
+
+      .alpha {
+        margin: 20px 100px;
+        opacity: 0.9;
+        border: 1px solid black;
+      }
+      
+      .reflected {
+        width: 200px;
+        background-color: green;
+        -webkit-transform-origin: top left;
+        -webkit-transform: rotate(20deg);
+        -webkit-box-reflect: right 20px;
+      }
+      
+    </style>
+  </head>
+
+  <p>Test that opacity doesn't cause clipping of transformed, reflected content. You should see a rotated green box and its full reflection.</p>
+  <div class="alpha box">
+    <div class="reflected box">
+    </div>
+  </div>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.checksum b/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.checksum
new file mode 100644
index 0000000..bbda15a
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.checksum
@@ -0,0 +1 @@
+066b17e3fc809e80f83c4b4ef57b01f2
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png b/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png
new file mode 100644
index 0000000..0051ba3
Binary files /dev/null and b/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.txt b/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.txt
new file mode 100644
index 0000000..ae919ae
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/reflections/opacity-reflection-transform-expected.txt
@@ -0,0 +1,13 @@
+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 784x572
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 755x36
+          text run at (0,0) width 755: "Test that opacity doesn't cause clipping of transformed, reflected content. You should see a rotated green box and its full"
+          text run at (0,18) width 63: "reflection."
+layer at (108,64) size 102x102
+  RenderBlock {DIV} at (100,56) size 102x102 [border: (1px solid #000000)]
+layer at (109,65) size 200x100
+  RenderBlock {DIV} at (1,1) size 200x100 [bgcolor=#008000]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 712459c..82f2ac8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-11-12  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Transformed reflected elements are clipped inside element with opacity
+        https://bugs.webkit.org/show_bug.cgi?id=30957
+        
+        transparencyClipBox() attemped to minimize the size of the transparency layer by mapping
+        each clip rect into painting space before taking the unions. This, however, did not work
+        correctly with combinations of reflections and transforms. Fixed by unioning the
+        clipRect and mapping through transforms along the way.
+        
+        Also leave some #ifdeffed code in beginTransparencyLayers() that makes it easy to see
+        where the transparency layers are.
+
+        Test: fast/reflections/opacity-reflection-transform.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::expandClipRectForDescendantsAndReflection):
+        (WebCore::transparencyClipBox):
+        (WebCore::RenderLayer::beginTransparencyLayers):
+
 2009-11-12  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 292545a..94a831f 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -719,46 +719,18 @@ RenderLayer* RenderLayer::transparentPaintingAncestor()
     return 0;
 }
 
-static IntRect transparencyClipBox(const TransformationMatrix& enclosingTransform, const RenderLayer* l, const RenderLayer* rootLayer)
-{
-    // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
-    // paintDirtyRect, and that should cut down on the amount we have to paint.  Still it
-    // would be better to respect clips.
-    
-    if (rootLayer != l && l->paintsWithTransform()) {
-        // The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass
-        // the transformed layer and all of its children.
-        int x = 0;
-        int y = 0;
-        l->convertToLayerCoords(rootLayer, x, y);
+static IntRect transparencyClipBox(const RenderLayer* l, const RenderLayer* rootLayer);
 
-        TransformationMatrix transform;
-        transform.translate(x, y);
-        transform = *l->transform() * transform;
-        transform = transform * enclosingTransform;
-
-        // We now have a transform that will produce a rectangle in our view's space.
-        IntRect clipRect = transform.mapRect(l->boundingBox(l));
-        
-        // Now shift the root layer to be us and pass down the new enclosing transform.
-        for (RenderLayer* curr = l->firstChild(); curr; curr = curr->nextSibling()) {
-            if (!l->reflection() || l->reflectionLayer() != curr)
-                clipRect.unite(transparencyClipBox(transform, curr, l));
-        }
-            
-        return clipRect;
-    }
-    
-    // Note: we don't have to walk z-order lists since transparent elements always establish
-    // a stacking context.  This means we can just walk the layer tree directly.
-    IntRect clipRect = l->boundingBox(rootLayer);
-    
+static void expandClipRectForDescendantsAndReflection(IntRect& clipRect, const RenderLayer* l, const RenderLayer* rootLayer)
+{
     // If we have a mask, then the clip is limited to the border box area (and there is
     // no need to examine child layers).
     if (!l->renderer()->hasMask()) {
+        // Note: we don't have to walk z-order lists since transparent elements always establish
+        // a stacking context.  This means we can just walk the layer tree directly.
         for (RenderLayer* curr = l->firstChild(); curr; curr = curr->nextSibling()) {
             if (!l->reflection() || l->reflectionLayer() != curr)
-                clipRect.unite(transparencyClipBox(enclosingTransform, curr, rootLayer));
+                clipRect.unite(transparencyClipBox(curr, rootLayer));
         }
     }
 
@@ -774,9 +746,33 @@ static IntRect transparencyClipBox(const TransformationMatrix& enclosingTransfor
         clipRect.unite(l->renderBox()->reflectedRect(clipRect));
         clipRect.move(deltaX, deltaY);
     }
+}
 
-    // Now map the clipRect via the enclosing transform
-    return enclosingTransform.mapRect(clipRect);
+static IntRect transparencyClipBox(const RenderLayer* l, const RenderLayer* rootLayer)
+{
+    // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
+    // paintDirtyRect, and that should cut down on the amount we have to paint.  Still it
+    // would be better to respect clips.
+    
+    if (rootLayer != l && l->paintsWithTransform()) {
+        // The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass
+        // the transformed layer and all of its children.
+        int x = 0;
+        int y = 0;
+        l->convertToLayerCoords(rootLayer, x, y);
+
+        TransformationMatrix transform;
+        transform.translate(x, y);
+        transform = *l->transform() * transform;
+
+        IntRect clipRect = l->boundingBox(l);
+        expandClipRectForDescendantsAndReflection(clipRect, l, l);
+        return transform.mapRect(clipRect);
+    }
+    
+    IntRect clipRect = l->boundingBox(rootLayer);
+    expandClipRectForDescendantsAndReflection(clipRect, l, rootLayer);
+    return clipRect;
 }
 
 void RenderLayer::beginTransparencyLayers(GraphicsContext* p, const RenderLayer* rootLayer)
@@ -791,8 +787,13 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext* p, const RenderLayer*
     if (paintsWithTransparency()) {
         m_usedTransparency = true;
         p->save();
-        p->clip(transparencyClipBox(TransformationMatrix(), this, rootLayer));
+        IntRect clipRect = transparencyClipBox(this, rootLayer);
+        p->clip(clipRect);
         p->beginTransparencyLayer(renderer()->opacity());
+#ifdef REVEAL_TRANSPARENCY_LAYERS
+        p->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f));
+        p->fillRect(clipRect);
+#endif
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list