Commit 556cf9a4 authored by Tien-Ren Chen's avatar Tien-Ren Chen Committed by Commit Bot

[Blink] Correctly derive context when no property changed

There was a mistake in PaintPropertyTreeBuilder::UpdateClipPathClip()
to early exit when properties didn't change. However in that case we
still have to update the context for descendants to inherit. This CL
removed the early exit.

BUG=836127

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I38b229b86bd9c2106ac32bf54d520d39cb892e0c
Reviewed-on: https://chromium-review.googlesource.com/1038705Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Tien-Ren Chen <trchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555275}
parent a0f22afa
......@@ -1046,9 +1046,6 @@ void FragmentPaintPropertyTreeBuilder::UpdateCssClip() {
void FragmentPaintPropertyTreeBuilder::UpdateClipPathClip(
bool spv1_compositing_specific_pass) {
if (!NeedsPaintPropertyUpdate())
return;
// In SPv1*, composited path-based clip-path applies to a mask paint chunk
// instead of actual contents. We have to delay until mask clip node has been
// created first so we can parent under it.
......@@ -1058,16 +1055,18 @@ void FragmentPaintPropertyTreeBuilder::UpdateClipPathClip(
if (is_spv1_composited != spv1_compositing_specific_pass)
return;
if (!NeedsClipPathClip(object_)) {
OnClearClip(properties_->ClearClipPathClip());
} else {
ClipPaintPropertyNode::State state;
state.local_transform_space = context_.current.transform;
state.clip_rect =
FloatRoundedRect(FloatRect(*fragment_data_.ClipPathBoundingBox()));
state.clip_path = fragment_data_.ClipPathPath();
OnUpdateClip(properties_->UpdateClipPathClip(context_.current.clip,
std::move(state)));
if (NeedsPaintPropertyUpdate()) {
if (!NeedsClipPathClip(object_)) {
OnClearClip(properties_->ClearClipPathClip());
} else {
ClipPaintPropertyNode::State state;
state.local_transform_space = context_.current.transform;
state.clip_rect =
FloatRoundedRect(FloatRect(*fragment_data_.ClipPathBoundingBox()));
state.clip_path = fragment_data_.ClipPathPath();
OnUpdateClip(properties_->UpdateClipPathClip(context_.current.clip,
std::move(state)));
}
}
if (properties_->ClipPathClip() && !spv1_compositing_specific_pass) {
......
......@@ -5501,4 +5501,25 @@ TEST_P(PaintPropertyTreeBuilderTest, ClipHitTestChangeDoesNotCauseFullRepaint) {
EXPECT_FALSE(child_layer->NeedsRepaint());
}
TEST_P(PaintPropertyTreeBuilderTest, ClipPathInheritanceWithoutMutation) {
// This test verifies we properly included the path-based clip-path in
// context when the clipping element didn't need paint property update.
SetBodyInnerHTML(R"HTML(
<div style="clip-path:circle();">
<div id="child" style="position:relative; width:100px; height:100px; background:green;"></div>
</div>
)HTML");
auto* child = ToLayoutBox(GetLayoutObjectByElementId("child"));
const auto* old_clip_state =
child->FirstFragment().LocalBorderBoxProperties().Clip();
child->SetNeedsPaintPropertyUpdate();
GetDocument().View()->UpdateAllLifecyclePhases();
const auto* new_clip_state =
child->FirstFragment().LocalBorderBoxProperties().Clip();
EXPECT_EQ(old_clip_state, new_clip_state);
}
} // namespace blink
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