Diff
Modified: trunk/LayoutTests/ChangeLog (109059 => 109060)
--- trunk/LayoutTests/ChangeLog 2012-02-28 02:35:29 UTC (rev 109059)
+++ trunk/LayoutTests/ChangeLog 2012-02-28 02:36:59 UTC (rev 109060)
@@ -1,3 +1,14 @@
+2012-02-27 Shawn Singh <shawnsi...@chromium.org>
+
+ RenderLayer ClipRect not accounting for transforms
+ https://bugs.webkit.org/show_bug.cgi?id=76486
+
+ Reviewed by Simon Fraser.
+
+ * compositing/layer-creation/overlap-transformed-and-clipped-expected.png: Added.
+ * compositing/layer-creation/overlap-transformed-and-clipped-expected.txt: Added.
+ * compositing/layer-creation/overlap-transformed-and-clipped.html: Added.
+
2012-02-27 Adam Klein <ad...@chromium.org>
[MutationObservers] Clear pending mutation records on disconnect()
Added: trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png (0 => 109060)
--- trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.png 2012-02-28 02:36:59 UTC (rev 109060)
@@ -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
Added: trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt (0 => 109060)
--- trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped-expected.txt 2012-02-28 02:36:59 UTC (rev 109060)
@@ -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)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html (0 => 109060)
--- trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-transformed-and-clipped.html 2012-02-28 02:36:59 UTC (rev 109060)
@@ -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: trunk/Source/WebCore/ChangeLog (109059 => 109060)
--- trunk/Source/WebCore/ChangeLog 2012-02-28 02:35:29 UTC (rev 109059)
+++ trunk/Source/WebCore/ChangeLog 2012-02-28 02:36:59 UTC (rev 109060)
@@ -1,3 +1,26 @@
+2012-02-27 Shawn Singh <shawnsi...@chromium.org>
+
+ RenderLayer ClipRect not accounting for transforms
+ https://bugs.webkit.org/show_bug.cgi?id=76486
+
+ Reviewed by Simon Fraser.
+
+ Test: compositing/layer-creation/overlap-transformed-and-clipped.html
+
+ This patch changes calculateClipRects() so that the clipRect
+ offset is allowed to be converted across layers with
+ transforms. This is necessary because the RenderLayerCompositor
+ needs clipRects in document space, rather than with respect to
+ some local clipping layer.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::localToContainerPoint):
+ (WebCore):
+ * rendering/RenderObject.h:
+ (RenderObject):
+
2012-02-27 Adam Klein <ad...@chromium.org>
[MutationObservers] Clear pending mutation records on disconnect()
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (109059 => 109060)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-02-28 02:35:29 UTC (rev 109059)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-02-28 02:36:59 UTC (rev 109060)
@@ -3653,8 +3653,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: trunk/Source/WebCore/rendering/RenderObject.cpp (109059 => 109060)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-02-28 02:35:29 UTC (rev 109059)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-02-28 02:36:59 UTC (rev 109060)
@@ -2094,6 +2094,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: trunk/Source/WebCore/rendering/RenderObject.h (109059 => 109060)
--- trunk/Source/WebCore/rendering/RenderObject.h 2012-02-28 02:35:29 UTC (rev 109059)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2012-02-28 02:36:59 UTC (rev 109060)
@@ -644,8 +644,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.