Commit bf8135d0 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[PE] Avoid null pointer for objects with reflection but no effect

Reflection only has effect if we create layer for the object. Some
objects (e.g. SVG text) having reflection style but doesn't create
layers. Should check for the condition.

Bug: 792727,777259
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I09528df085002f8d30e1f20fd07a7e7b3f2d3cf1
Reviewed-on: https://chromium-review.googlesource.com/814894
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522661}
parent 74a43173
......@@ -245,6 +245,11 @@ void LayoutBox::StyleDidChange(StyleDifference diff,
LayoutBoxModelObject::StyleDidChange(diff, old_style);
// Reflection works through PaintLayer. Some child classes e.g. LayoutSVGBlock
// don't create layers and ignore reflections.
if (HasReflection() && !HasLayer())
SetHasReflection(false);
if (IsFloatingOrOutOfFlowPositioned() && old_style &&
!old_style->IsFloating() && !old_style->HasOutOfFlowPosition() &&
Parent() && Parent()->IsLayoutBlockFlow())
......
......@@ -1455,6 +1455,7 @@ static void SetNeedsPaintPropertyUpdateIfNeeded(const LayoutObject& object) {
// The filter generated for reflection depends on box size.
if (box.HasReflection()) {
DCHECK(box.HasLayer());
box.Layer()->SetFilterOnEffectNodeDirty();
box.GetMutableForPainting().SetNeedsPaintPropertyUpdate();
}
......
......@@ -4212,4 +4212,13 @@ TEST_P(PaintPropertyTreeBuilderTest, FrameBorderRadius) {
EXPECT_EQ(nullptr, properties->OverflowClip());
}
TEST_P(PaintPropertyTreeBuilderTest, NoPropertyForSVGTextWithReflection) {
SetBodyInnerHTML(R"HTML(
<svg>
<text id='target' style='-webkit-box-reflect: below 2px'>X</text>
</svg>
)HTML");
EXPECT_FALSE(PaintPropertiesForElement("target"));
}
} // 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