Diff
Copied: branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png (from rev 109060, trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png) (0 => 109794)
--- branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png (rev 0)
+++ branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png 2012-03-05 21:44:05 UTC (rev 109794)
@@ -0,0 +1,4 @@
+\x89PNG
+
+
+IHDR X \x9Av\x82p )tEXtchecksum 38db6661a8f7b1efa64f4cb51638e167Krjk \x81IDATx\x9C\xED\xD91\x84@A\x96\x8F#^n\xD2/\xEA\xA2\xEA\x938hy\xCD\xCC\xBCκ\xD7\xEE \xFC\x98\xCB \xFC\xE3\xDC= \xF8 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90Y33\xBBG \xDF\xE0 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 d \x90 @\xE6cZ\xA7\xBF\xBE` IEND\xAEB`\x82
\ No newline at end of file
Copied: branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt (from rev 109060, trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt) (0 => 109794)
--- branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt (rev 0)
+++ branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt 2012-03-05 21:44:05 UTC (rev 109794)
@@ -0,0 +1,30 @@
+(GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 100.00 100.00)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [110.00 0.00 0.00 1.00])
+ (children 1
+ (GraphicsLayer
+ (bounds 100.00 100.00)
+ (children 2
+ (GraphicsLayer
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Copied: branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html (from rev 109060, trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html) (0 => 109794)
--- branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html (rev 0)
+++ branches/chromium/1025/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html 2012-03-05 21:44:05 UTC (rev 109794)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0px);
+ }
+
+ .clips {
+ overflow: hidden;
+ }
+
+ .container {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ overflow: hidden;
+ -webkit-transform: translateX(110px);
+ }
+
+ .under {
+ background-color: red;
+ position:absolute;
+ left: 0px;
+ top: 0px;
+ }
+
+ .over {
+ background-color: green;
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ }
+
+ #layertree {
+ position: absolute;
+ left: 10000px;
+ top: 0px;
+ }
+
+ body {
+ overflow: hidden;
+ }
+</style>
+
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText(true);
+ window.addEventListener('load', function() {
+ document.getElementById("layertree").innerText = layoutTestController.layerTreeAsText();
+ }, false);
+ }
+</script>
+</head>
+
+<body>
+ <!-- Tests that CSS transforms and clipping work properly together. -->
+ <!-- This reproduces an error reported in https://bugs.webkit.org/show_bug.cgi?id=76486
+ where the clipRect was not accounting for transforms. As a result, in the overlapMap,
+ the intersection of clipRect and layer bounds becomes empty, and layers on top do not
+ get properly composited. If this happens, the red "under composited" layer will be
+ exposed, because the "over" div does not become a composited layer. -->
+ <div class="container clips">
+ <div class="under composited"></div>
+ <div class="over"></div>
+ </div>
+
+ <pre id="layertree"></pre>
+
+</body>
+
+</html>
Modified: branches/chromium/1025/Source/WebCore/rendering/RenderLayer.cpp (109793 => 109794)
--- branches/chromium/1025/Source/WebCore/rendering/RenderLayer.cpp 2012-03-05 21:42:21 UTC (rev 109793)
+++ branches/chromium/1025/Source/WebCore/rendering/RenderLayer.cpp 2012-03-05 21:44:05 UTC (rev 109794)
@@ -3637,8 +3637,12 @@
// Update the clip rects that will be passed to child layers.
if (renderer()->hasOverflowClip() || renderer()->hasClip()) {
// This layer establishes a clip of some kind.
+
+ // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
+ // some transformed layer boundary, for example, in the RenderLayerCompositor overlapMap, where
+ // clipRects are needed in view space.
LayoutPoint offset;
- convertToLayerCoords(rootLayer, offset);
+ offset = roundedIntPoint(renderer()->localToContainerPoint(FloatPoint(), rootLayer->renderer()));
RenderView* view = renderer()->view();
ASSERT(view);
if (view && clipRects.fixed() && rootLayer->renderer() == view) {
Modified: branches/chromium/1025/Source/WebCore/rendering/RenderObject.cpp (109793 => 109794)
--- branches/chromium/1025/Source/WebCore/rendering/RenderObject.cpp 2012-03-05 21:42:21 UTC (rev 109793)
+++ branches/chromium/1025/Source/WebCore/rendering/RenderObject.cpp 2012-03-05 21:44:05 UTC (rev 109794)
@@ -2077,6 +2077,15 @@
return transformState.lastPlanarQuad();
}
+FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, RenderBoxModelObject* repaintContainer, bool fixed, bool* wasFixed) const
+{
+ TransformState transformState(TransformState::ApplyTransformDirection, localPoint);
+ mapLocalToContainer(repaintContainer, fixed, true, transformState, wasFixed);
+ transformState.flatten();
+
+ return transformState.lastPlanarPoint();
+}
+
LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
{
ASSERT(o == container());
Modified: branches/chromium/1025/Source/WebCore/rendering/RenderObject.h (109793 => 109794)
--- branches/chromium/1025/Source/WebCore/rendering/RenderObject.h 2012-03-05 21:42:21 UTC (rev 109793)
+++ branches/chromium/1025/Source/WebCore/rendering/RenderObject.h 2012-03-05 21:44:05 UTC (rev 109794)
@@ -643,8 +643,10 @@
{
return localToContainerQuad(quad, 0, fixed, wasFixed);
}
+
// Convert a local quad into the coordinate system of container, taking transforms into account.
FloatQuad localToContainerQuad(const FloatQuad&, RenderBoxModelObject* repaintContainer, bool fixed = false, bool* wasFixed = 0) const;
+ FloatPoint localToContainerPoint(const FloatPoint&, RenderBoxModelObject* repaintContainer, bool fixed = false, bool* wasFixed = 0) const;
// Return the offset from the container() renderer (excluding transforms). In multi-column layout,
// different offsets apply at different points, so return the offset that applies to the given point.