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

[Blink] Workaround nullptr properties on mask layers

This CL workaround https://crbug.com/856818 . We don't know how we ended
up having a mask layer without an applicable mask or clip-path being
found during property tree building, but at least we should not crash.

BUG=856818

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ib62e0ebd6fad4f52a05a57bb4277b4411f3fecfd
Reviewed-on: https://chromium-review.googlesource.com/1178988Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Tien-Ren Chen <trchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583903}
parent f417428a
......@@ -612,14 +612,26 @@ void FragmentPaintPropertyTreeBuilder::UpdateEffect() {
object_, context_.current.paint_offset);
bool has_clip_path =
style.ClipPath() && fragment_data_.ClipPathBoundingBox();
bool has_spv1_composited_clip_path =
has_clip_path && object_.HasLayer() &&
bool is_spv1_composited =
object_.HasLayer() &&
ToLayoutBoxModelObject(object_).Layer()->GetCompositedLayerMapping();
bool has_spv1_composited_clip_path = has_clip_path && is_spv1_composited;
bool has_mask_based_clip_path =
has_clip_path && !fragment_data_.ClipPathPath();
base::Optional<IntRect> clip_path_clip;
if (has_spv1_composited_clip_path || has_mask_based_clip_path) {
clip_path_clip = fragment_data_.ClipPathBoundingBox();
} else if (!mask_clip && is_spv1_composited &&
ToLayoutBoxModelObject(object_)
.Layer()
->GetCompositedLayerMapping()
->MaskLayer()) {
// TODO(crbug.com/856818): This should never happen.
// This is a band-aid to avoid nullptr properties on the mask layer
// crashing the renderer, but will result in incorrect rendering.
NOTREACHED();
has_spv1_composited_clip_path = true;
clip_path_clip = IntRect();
}
if (mask_clip || clip_path_clip) {
IntRect combined_clip = mask_clip ? *mask_clip : *clip_path_clip;
......
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