REGRESSION (tile cache layers): bits of tiled layers are missing with certain 3D...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2012 19:01:40 +0000 (19:01 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2012 19:01:40 +0000 (19:01 +0000)
commit84ecc59d6b0b559d8756291398b49b17964398d1
tree6f1c8e974d273883f12794074a96278aa778e687
parent5b163135fb5cf376542e8895ce52d3e5449db677
REGRESSION (tile cache layers): bits of tiled layers are missing with certain 3D transforms
https://bugs.webkit.org/show_bug.cgi?id=100808
<rdar://problem/12562541>

Reviewed by Dean Jackson.

Source/WebCore:

When projecting rects down into transformed layers, the projection can fail with severe
3D rotations if the computed w component in TransformationMatrix::projectPoint() is negative.
In this case we already clamp, but the fact that we clamped doesn't make it out to
GraphicsLayerCA::computeVisibleRect() which resulted in incorrect visible rects being
computed.

Fix by propagating the fact that clamping occurred out of the TransformState functions
which can clamp. In computeVisibleRect(), simply consider the entire layer bounds
to be visible if clamping occurred.

Tests: compositing/tiling/rotated-tiled-clamped.html
       compositing/tiling/rotated-tiled-preserve3d-clamped.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::computeVisibleRect): If either the applyTransform()
or the state.mappedQuad() clamped, use our bounds as the visible rect.
* platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::applyTransform): Pass out clamping state.
(WebCore::TransformState::flatten): Ditto.
(WebCore::TransformState::mappedPoint): Ditto.
(WebCore::TransformState::mappedQuad): Ditto.
(WebCore::TransformState::flattenWithTransform): Ditto. No need to initialize
wasClamped, since this function is internal.
* platform/graphics/transforms/TransformState.h:
(TransformState):
* platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::TransformationMatrix::projectQuad): If any point projection clamped,
set the flag to say we clamped.
* platform/graphics/transforms/TransformationMatrix.h:
(TransformationMatrix):

LayoutTests:

Two tests for visible rect computation under clamping, one of which tests 'applyWasClamped',
and the other 'mapWasClamped'.

* compositing/tiling/rotated-tiled-clamped-expected.png: Added.
* compositing/tiling/rotated-tiled-clamped-expected.txt: Added.
* compositing/tiling/rotated-tiled-clamped.html: Added.
* compositing/tiling/rotated-tiled-preserve3d-clamped-expected.png: Added.
* compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt: Added.
* compositing/tiling/rotated-tiled-preserve3d-clamped.html: Added.
* platform/chromium/TestExpectations:
* platform/mac/compositing/tiling/rotated-tiled-clamped-expected.txt: Added.
* platform/mac/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133056 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/tiling/rotated-tiled-clamped-expected.png [new file with mode: 0644]
LayoutTests/compositing/tiling/rotated-tiled-clamped-expected.txt [new file with mode: 0644]
LayoutTests/compositing/tiling/rotated-tiled-clamped.html [new file with mode: 0644]
LayoutTests/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.png [new file with mode: 0644]
LayoutTests/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt [new file with mode: 0644]
LayoutTests/compositing/tiling/rotated-tiled-preserve3d-clamped.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/compositing/tiling/rotated-tiled-clamped-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/transforms/TransformState.cpp
Source/WebCore/platform/graphics/transforms/TransformState.h
Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
Source/WebCore/platform/graphics/transforms/TransformationMatrix.h