Hardware-backed renderLayer could avoid repainting during a positioned movement layout
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2011 17:55:47 +0000 (17:55 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2011 17:55:47 +0000 (17:55 +0000)
commit985bf3ab6f1d1381d987c305f071a05856473382
tree6601e0bc04d591e38a2d1862425951989263b0e5
parent9435b44122d9b7548953076d7558f79446b481fb
Hardware-backed renderLayer could avoid repainting during a positioned movement layout
https://bugs.webkit.org/show_bug.cgi?id=74370

Reviewed by Simon Fraser.

Source/WebCore:

Tests: compositing/absolute-position-changed-in-composited-layer.html
       compositing/absolute-position-changed-with-composited-parent-layer.html
       compositing/fixed-position-changed-in-composited-layer.html
       compositing/fixed-position-changed-within-composited-parent-layer.html

To be able to properly skip repainting after a positioned movement layout only, we
needed to add more state to the current |setNeedsFullRepaint| method. As part of that
we refactored the callers and internal fields to better match the new meaning.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::styleDidChange):
Explicitely gave the RepaintStatus to setRepaintStatus.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::removeOnlyThisLayer):
Updated those function after the renamings.

(WebCore::RenderLayer::updateLayerPositions):
Ditto. Also added a sholdRepaintAfterLayout check.

(WebCore::RenderLayer::shouldRepaintAfterLayout):
Heart of the optimization, if we just did a positioned movement layout of composited RenderLayer,
then don't repaint. All the other cases should still trigger a repaint.

* rendering/RenderLayer.h:
(WebCore::RenderLayer::setRepaintStatus):
Renamed setNeedsFullRepaint to setRepaintStatus. Also added a new enum RepaintStatus.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::setLayerNeedsFullRepaint):
Updated after the renamings.

(WebCore::RenderObject::setLayerNeedsFullRepaintForPositionedMovementLayout):
New method that pass a new value to the RenderLayer.

* rendering/RenderObject.h:
(WebCore::RenderObject::setNeedsPositionedMovementLayout):
Switched the call to the dedicated method.

LayoutTests:

I did not find any test covering positioned movement layout with composited layers
so I added some testing.

* compositing/absolute-position-changed-in-composited-layer-expected.png: Added.
* compositing/absolute-position-changed-in-composited-layer-expected.txt: Added.
* compositing/absolute-position-changed-in-composited-layer.html: Added.
* compositing/absolute-position-changed-with-composited-parent-layer-expected.png: Added.
* compositing/absolute-position-changed-with-composited-parent-layer-expected.txt: Added.
* compositing/absolute-position-changed-with-composited-parent-layer.html: Added.
* compositing/fixed-position-changed-in-composited-layer-expected.png: Added.
* compositing/fixed-position-changed-in-composited-layer-expected.txt: Added.
* compositing/fixed-position-changed-in-composited-layer.html: Added.
* compositing/fixed-position-changed-within-composited-parent-layer-expected.png: Added.
* compositing/fixed-position-changed-within-composited-parent-layer-expected.txt: Added.
* compositing/fixed-position-changed-within-composited-parent-layer.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/absolute-position-changed-in-composited-layer-expected.png [new file with mode: 0644]
LayoutTests/compositing/absolute-position-changed-in-composited-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/absolute-position-changed-in-composited-layer.html [new file with mode: 0755]
LayoutTests/compositing/absolute-position-changed-with-composited-parent-layer-expected.png [new file with mode: 0644]
LayoutTests/compositing/absolute-position-changed-with-composited-parent-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/absolute-position-changed-with-composited-parent-layer.html [new file with mode: 0755]
LayoutTests/compositing/fixed-position-changed-in-composited-layer-expected.png [new file with mode: 0644]
LayoutTests/compositing/fixed-position-changed-in-composited-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/fixed-position-changed-in-composited-layer.html [new file with mode: 0755]
LayoutTests/compositing/fixed-position-changed-within-composited-parent-layer-expected.png [new file with mode: 0644]
LayoutTests/compositing/fixed-position-changed-within-composited-parent-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/fixed-position-changed-within-composited-parent-layer.html [new file with mode: 0755]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h