Commit de6644e3 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[CompositeAfterPaint] Plumb the will-change: transform hint to cc::Layer

This patch plumbs the will-change: transform hint to cc::Layer if it is
a compositing reason on the immediate transform node.

Bug: 1031165
Change-Id: Ifc27d303d48fa957c8f0b4860058dfffabf70262
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1953340Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722546}
parent a2fc68fb
...@@ -239,6 +239,23 @@ TEST_P(WebLayerListTest, FrameViewScroll) { ...@@ -239,6 +239,23 @@ TEST_P(WebLayerListTest, FrameViewScroll) {
EXPECT_EQ(ScrollOffset(0, 1), scrollable_area->GetScrollOffset()); EXPECT_EQ(ScrollOffset(0, 1), scrollable_area->GetScrollOffset());
} }
TEST_P(WebLayerListTest, WillChangeTransformHint) {
InitializeWithHTML(*WebView()->MainFrameImpl()->GetFrame(), R"HTML(
<style>
#willChange {
width: 100px;
height: 100px;
will-change: transform;
background: blue;
}
</style>
<div id="willChange"></div>
)HTML");
UpdateAllLifecyclePhases();
auto* layer = ContentLayerAt(ContentLayerCount() - 1);
EXPECT_TRUE(layer->has_will_change_transform_hint());
}
class WebLayerListSimTest : public PaintTestConfigurations, public SimTest { class WebLayerListSimTest : public PaintTestConfigurations, public SimTest {
public: public:
void InitializeWithHTML(const String& html) { void InitializeWithHTML(const String& html) {
......
...@@ -1182,6 +1182,9 @@ void PaintArtifactCompositor::Update( ...@@ -1182,6 +1182,9 @@ void PaintArtifactCompositor::Update(
bool backface_hidden = property_state.Transform().IsBackfaceHidden(); bool backface_hidden = property_state.Transform().IsBackfaceHidden();
layer->SetDoubleSided(!backface_hidden); layer->SetDoubleSided(!backface_hidden);
layer->SetShouldCheckBackfaceVisibility(backface_hidden); layer->SetShouldCheckBackfaceVisibility(backface_hidden);
bool has_will_change_transform =
property_state.Transform().RequiresCompositingForWillChangeTransform();
layer->SetHasWillChangeTransformHint(has_will_change_transform);
// If the property tree state has changed between the layer and the root, // If the property tree state has changed between the layer and the root,
// we need to inform the compositor so damage can be calculated. Calling // we need to inform the compositor so damage can be calculated. Calling
......
...@@ -381,6 +381,11 @@ class PLATFORM_EXPORT TransformPaintPropertyNode ...@@ -381,6 +381,11 @@ class PLATFORM_EXPORT TransformPaintPropertyNode
return state_.direct_compositing_reasons & CompositingReason::kRootScroller; return state_.direct_compositing_reasons & CompositingReason::kRootScroller;
} }
bool RequiresCompositingForWillChangeTransform() const {
return state_.direct_compositing_reasons &
CompositingReason::kWillChangeTransform;
}
const CompositorElementId& GetCompositorElementId() const { const CompositorElementId& GetCompositorElementId() const {
return state_.compositor_element_id; return state_.compositor_element_id;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment