Commit 257000c9 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[BlinkGenPropertyTrees] Fix under-invalidation of backface-visibility

Backface visibility does not depend on having a PaintLayer but the
invalidation logic did. This patch extracts out the invalidation of
paint properties into LayoutBoxModelObject::StyleDidChange. This patch
also removes outdated code that caused repaints for backface visibility
changes.

Bug: 946541
Change-Id: Ib6790b9c7d442d8e8971185c2eda2a99f10e8506
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553168Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648263}
parent 20363ece
......@@ -437,30 +437,30 @@ void LayoutBoxModelObject::StyleDidChange(StyleDifference diff,
}
}
if (old_style && HasLayer() && !Layer()->NeedsRepaint()) {
if (old_style->BackfaceVisibility() != StyleRef().BackfaceVisibility()) {
// We need to repaint the layer to update the backface visibility value of
// the paint chunk.
if (old_style &&
old_style->BackfaceVisibility() != StyleRef().BackfaceVisibility()) {
SetNeedsPaintPropertyUpdate();
}
if (old_style && HasLayer() && !Layer()->NeedsRepaint() &&
diff.TransformChanged() &&
(RuntimeEnabledFeatures::CompositeAfterPaintEnabled() ||
!Layer()->HasStyleDeterminedDirectCompositingReasons())) {
// PaintLayerPainter::PaintLayerWithAdjustedRoot skips painting of a layer
// whose transform is not invertible, so we need to repaint the layer when
// invertible status changes.
TransformationMatrix old_transform;
TransformationMatrix new_transform;
old_style->ApplyTransform(
old_transform, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
ComputedStyle::kExcludeMotionPath,
ComputedStyle::kIncludeIndependentTransformProperties);
StyleRef().ApplyTransform(
new_transform, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
ComputedStyle::kExcludeMotionPath,
ComputedStyle::kIncludeIndependentTransformProperties);
if (old_transform.IsInvertible() != new_transform.IsInvertible())
Layer()->SetNeedsRepaint();
} else if (diff.TransformChanged() &&
(RuntimeEnabledFeatures::CompositeAfterPaintEnabled() ||
!Layer()->HasStyleDeterminedDirectCompositingReasons())) {
// PaintLayerPainter::PaintLayerWithAdjustedRoot skips painting of a layer
// whose transform is not invertible, so we need to repaint the layer when
// invertible status changes.
TransformationMatrix old_transform;
TransformationMatrix new_transform;
old_style->ApplyTransform(
old_transform, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
ComputedStyle::kExcludeMotionPath,
ComputedStyle::kIncludeIndependentTransformProperties);
StyleRef().ApplyTransform(
new_transform, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
ComputedStyle::kExcludeMotionPath,
ComputedStyle::kIncludeIndependentTransformProperties);
if (old_transform.IsInvertible() != new_transform.IsInvertible())
Layer()->SetNeedsRepaint();
}
}
}
......
......@@ -1688,4 +1688,13 @@ TEST_P(PaintPropertyTreeUpdateTest, ChangeDuringAnimation) {
EXPECT_TRUE(paint_artifact_compositor->NeedsUpdate());
}
TEST_P(PaintPropertyTreeUpdateTest, BackfaceVisibilityInvalidatesProperties) {
SetBodyInnerHTML("<span id='span'>a</span>");
auto* span = GetDocument().getElementById("span");
span->setAttribute(html_names::kStyleAttr, "backface-visibility: hidden;");
GetDocument().View()->UpdateLifecycleToLayoutClean();
EXPECT_TRUE(span->GetLayoutObject()->NeedsPaintPropertyUpdate());
}
} // 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