Commit 1683f4e0 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Don't report layout shift when printing or painting preview

The bug is caused by integer overflow and DCHECK/CHECK failure when
calculating the area of a layout shift region containing rects with
geometry values like 2^31-1. The situation happens only during
printing when layout shifts should not be reported because in normal
cases the viewport clip limits the geometry of the region.

Bug: 1151591
Change-Id: I3fd080eab1be31815668486dc555c227ff2cf4f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557883
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830770}
parent bfff3740
...@@ -154,6 +154,9 @@ bool LayoutShiftTracker::NeedsToTrack(const LayoutObject& object) const { ...@@ -154,6 +154,9 @@ bool LayoutShiftTracker::NeedsToTrack(const LayoutObject& object) const {
if (!is_active_) if (!is_active_)
return false; return false;
if (object.GetDocument().IsPrintingOrPaintingPreview())
return false;
// SVG elements don't participate in the normal layout algorithms and are // SVG elements don't participate in the normal layout algorithms and are
// more likely to be used for animations. // more likely to be used for animations.
if (object.IsSVGChild()) if (object.IsSVGChild())
......
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