Commit 87a37bfd authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Commit Bot

Stricter layout checks in LayoutSVGResourceClipper/Masker

We should no longer call the ResourceBoundingBox() method on the above
classes during layout, so make the checking stricter by removing the
SelfNeedsLayout() check and adding a DCHECK on NeedsLayout().

Bug: 1028061
Change-Id: I00f406e760f5a15a70575e24f6232da4389b7f92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466240Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#816252}
parent 6a8f2c54
...@@ -270,9 +270,7 @@ bool LayoutSVGResourceClipper::HitTestClipContent( ...@@ -270,9 +270,7 @@ bool LayoutSVGResourceClipper::HitTestClipContent(
FloatRect LayoutSVGResourceClipper::ResourceBoundingBox( FloatRect LayoutSVGResourceClipper::ResourceBoundingBox(
const FloatRect& reference_box) { const FloatRect& reference_box) {
NOT_DESTROYED(); NOT_DESTROYED();
// The resource has not been layouted yet. Return the reference box. DCHECK(!NeedsLayout());
if (SelfNeedsLayout())
return reference_box;
if (local_clip_bounds_.IsEmpty()) if (local_clip_bounds_.IsEmpty())
CalculateLocalClipBounds(); CalculateLocalClipBounds();
......
...@@ -105,6 +105,7 @@ FloatRect LayoutSVGResourceMasker::ResourceBoundingBox( ...@@ -105,6 +105,7 @@ FloatRect LayoutSVGResourceMasker::ResourceBoundingBox(
const FloatRect& reference_box, const FloatRect& reference_box,
float reference_box_zoom) { float reference_box_zoom) {
NOT_DESTROYED(); NOT_DESTROYED();
DCHECK(!NeedsLayout());
auto* mask_element = To<SVGMaskElement>(GetElement()); auto* mask_element = To<SVGMaskElement>(GetElement());
DCHECK(mask_element); DCHECK(mask_element);
...@@ -117,10 +118,6 @@ FloatRect LayoutSVGResourceMasker::ResourceBoundingBox( ...@@ -117,10 +118,6 @@ FloatRect LayoutSVGResourceMasker::ResourceBoundingBox(
if (mask_units == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) if (mask_units == SVGUnitTypes::kSvgUnitTypeUserspaceonuse)
mask_boundaries.Scale(reference_box_zoom); mask_boundaries.Scale(reference_box_zoom);
// Resource was not layouted yet. Give back clipping rect of the mask.
if (SelfNeedsLayout())
return mask_boundaries;
if (mask_content_boundaries_.IsEmpty()) if (mask_content_boundaries_.IsEmpty())
CalculateMaskContentVisualRect(); CalculateMaskContentVisualRect();
......
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