Commit 19cff519 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[SPv175] Use clipping container's clip state for squashing layer

In the current layer squashing algorithm, all squashed layers under
a squashing layer have a common clip ancestor which is the squashing
layer's ClippingContainer() which doesn't include control clips.

For SPv175, when we set layer state of a squashing layer, we should
use the clip state of the ClippingContainer to skip any control
clips on the squashing layer's object that should not apply on
squashed layers.

[1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/paint/compositing/CompositingLayerAssigner.cpp?rcl=5909b5622777f87eb25763ccd8ff349413422742&l=165

TBR= # for enabling a temporarily disabled test

Bug: 813221
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ie395f025935028f29b2f5de25674698227550b93
Reviewed-on: https://chromium-review.googlesource.com/927001
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538968}
parent 59820dfe
...@@ -97,13 +97,9 @@ TEST_F('PrintPreviewSettingsSectionsTest', 'SetPages', function() { ...@@ -97,13 +97,9 @@ TEST_F('PrintPreviewSettingsSectionsTest', 'SetPages', function() {
this.runMochaTest(settings_sections_tests.TestNames.SetPages); this.runMochaTest(settings_sections_tests.TestNames.SetPages);
}); });
/*
TODO(crbug.com/813221): This test crashes with SlimmingPaintV175.
Will fix it asap.
TEST_F('PrintPreviewSettingsSectionsTest', 'SetCopies', function() { TEST_F('PrintPreviewSettingsSectionsTest', 'SetCopies', function() {
this.runMochaTest(settings_sections_tests.TestNames.SetCopies); this.runMochaTest(settings_sections_tests.TestNames.SetCopies);
}); });
*/
TEST_F('PrintPreviewSettingsSectionsTest', 'SetLayout', function() { TEST_F('PrintPreviewSettingsSectionsTest', 'SetLayout', function() {
this.runMochaTest(settings_sections_tests.TestNames.SetLayout); this.runMochaTest(settings_sections_tests.TestNames.SetLayout);
......
<!DOCTYPE html>
<div style="position: absolute; top: 0; width: 100px; height: 100px; background: green"></div>
<!DOCTYPE html>
<style>
::-webkit-inner-spin-button {
opacity: 0.9;
will-change: transform;
}
</style>
<!-- The spin button establishes a squashing layer. The control clip (established
by the input) over the spin button should be skipped in the layer state of
the squashing layer because it doesn't apply on the squashed layers. -->
<input type="number" style="width: 30px; height: 30px">
<div id="target" style="position: absolute; top: 0; width: 100px; height: 100px; background: green"></div>
...@@ -160,8 +160,6 @@ CompositingLayerAssigner::GetReasonsPreventingSquashing( ...@@ -160,8 +160,6 @@ CompositingLayerAssigner::GetReasonsPreventingSquashing(
squashing_layer.GetLayoutObject().Style()->HasBlendMode()) squashing_layer.GetLayoutObject().Style()->HasBlendMode())
return SquashingDisallowedReason::kSquashingBlendingIsDisallowed; return SquashingDisallowedReason::kSquashingBlendingIsDisallowed;
// FIXME: this is not efficient, since it walks up the tree. We should store
// these values on the CompositingInputsCache.
if (layer->ClippingContainer() != squashing_layer.ClippingContainer() && if (layer->ClippingContainer() != squashing_layer.ClippingContainer() &&
!squashing_layer.GetCompositedLayerMapping()->ContainingSquashedLayer( !squashing_layer.GetCompositedLayerMapping()->ContainingSquashedLayer(
layer->ClippingContainer(), layer->ClippingContainer(),
......
...@@ -18,8 +18,8 @@ void CompositingLayerPropertyUpdater::Update(const LayoutObject& object) { ...@@ -18,8 +18,8 @@ void CompositingLayerPropertyUpdater::Update(const LayoutObject& object) {
if (!object.HasLayer()) if (!object.HasLayer())
return; return;
CompositedLayerMapping* mapping = const auto* paint_layer = ToLayoutBoxModelObject(object).Layer();
ToLayoutBoxModelObject(object).Layer()->GetCompositedLayerMapping(); const auto* mapping = paint_layer->GetCompositedLayerMapping();
if (!mapping) if (!mapping)
return; return;
...@@ -74,8 +74,18 @@ void CompositingLayerPropertyUpdater::Update(const LayoutObject& object) { ...@@ -74,8 +74,18 @@ void CompositingLayerPropertyUpdater::Update(const LayoutObject& object) {
} }
if (auto* squashing_layer = mapping->SquashingLayer()) { if (auto* squashing_layer = mapping->SquashingLayer()) {
auto state = fragment_data.PreEffectProperties();
// The squashing layer's ClippingContainer is the common ancestor of clip
// state of all squashed layers, so we should use its clip state. This skips
// any control clips on the squashing layer's object which should not apply
// on squashed layers.
const auto* clipping_container = paint_layer->ClippingContainer();
state.SetClip(
clipping_container
? clipping_container->FirstFragment().ContentsProperties().Clip()
: ClipPaintPropertyNode::Root());
squashing_layer->SetLayerState( squashing_layer->SetLayerState(
fragment_data.PreEffectProperties(), state,
snapped_paint_offset + mapping->SquashingLayerOffsetFromLayoutObject()); snapped_paint_offset + mapping->SquashingLayerOffsetFromLayoutObject());
} }
......
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