Commit 1d97c60d authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Disable paint under-invalidation checking for indeterminate progress

We paint an indeterminate progress based on the position calculated
from the animation progress. The painted result may change without
invalidation if the paint is not scheduled for animation update.
The under-invalidation is harmless.

Bug: 1048185
Change-Id: If0a16a46b414ac601e1762add5d6260996681b51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062885Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742915}
parent c78f00a9
...@@ -142,17 +142,9 @@ void BoxPainter::PaintBoxDecorationBackgroundWithRect( ...@@ -142,17 +142,9 @@ void BoxPainter::PaintBoxDecorationBackgroundWithRect(
const ComputedStyle& style = layout_box_.StyleRef(); const ComputedStyle& style = layout_box_.StyleRef();
base::Optional<DisplayItemCacheSkipper> cache_skipper; base::Optional<DisplayItemCacheSkipper> cache_skipper;
// Disable cache in under-invalidation checking mode for MediaSliderPart
// because we always paint using the latest data (buffered ranges, current
// time and duration) which may be different from the cached data, and for
// delayed-invalidation object because it may change before it's actually
// invalidated. Note that we still report harmless under-invalidation of
// non-delayed-invalidation animated background, which should be ignored.
if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() &&
(style.EffectiveAppearance() == kMediaSliderPart || BoxPainterBase::ShouldSkipPaintUnderInvalidationChecking(layout_box_))
layout_box_.ShouldDelayFullPaintInvalidation())) {
cache_skipper.emplace(paint_info.context); cache_skipper.emplace(paint_info.context);
}
BoxDecorationData box_decoration_data(paint_info, layout_box_); BoxDecorationData box_decoration_data(paint_info, layout_box_);
if (!box_decoration_data.ShouldPaint()) if (!box_decoration_data.ShouldPaint())
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h"
#include "third_party/blink/renderer/core/layout/layout_progress.h"
#include "third_party/blink/renderer/core/paint/background_image_geometry.h" #include "third_party/blink/renderer/core/paint/background_image_geometry.h"
#include "third_party/blink/renderer/core/paint/box_border_painter.h" #include "third_party/blink/renderer/core/paint/box_border_painter.h"
#include "third_party/blink/renderer/core/paint/image_element_timing.h" #include "third_party/blink/renderer/core/paint/image_element_timing.h"
...@@ -952,4 +953,31 @@ void BoxPainterBase::PaintMaskImages(const PaintInfo& paint_info, ...@@ -952,4 +953,31 @@ void BoxPainterBase::PaintMaskImages(const PaintInfo& paint_info,
include_logical_right_edge); include_logical_right_edge);
} }
bool BoxPainterBase::ShouldSkipPaintUnderInvalidationChecking(
const LayoutBox& box) {
DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled());
// Disable paint under-invalidation checking for cases that under-invalidation
// is intensional and/or harmless.
// A box having delayed-invalidation may change before it's actually
// invalidated. Note that we still report harmless under-invalidation of
// non-delayed-invalidation animated background, which should be ignored.
if (box.ShouldDelayFullPaintInvalidation())
return true;
// We always paint a MediaSliderPart using the latest data (buffered ranges,
// current time and duration) which may be different from the cached data.
if (box.StyleRef().EffectiveAppearance() == kMediaSliderPart)
return true;
// We paint an indeterminate progress based on the position calculated from
// the animation progress. Harmless under-invalidatoin may happen during a
// paint that is not scheduled for animation.
if (box.IsProgress() && !ToLayoutProgress(box).IsDeterminate())
return true;
return false;
}
} // namespace blink } // namespace blink
...@@ -24,6 +24,7 @@ class FloatRoundedRect; ...@@ -24,6 +24,7 @@ class FloatRoundedRect;
class GraphicsContext; class GraphicsContext;
class ImageResourceObserver; class ImageResourceObserver;
class IntRect; class IntRect;
class LayoutBox;
struct PaintInfo; struct PaintInfo;
struct PhysicalOffset; struct PhysicalOffset;
struct PhysicalRect; struct PhysicalRect;
...@@ -103,6 +104,8 @@ class BoxPainterBase { ...@@ -103,6 +104,8 @@ class BoxPainterBase {
FillLayerOcclusionOutputList& reversed_paint_list, FillLayerOcclusionOutputList& reversed_paint_list,
const FillLayer&); const FillLayer&);
static bool ShouldSkipPaintUnderInvalidationChecking(const LayoutBox&);
struct FillLayerInfo { struct FillLayerInfo {
STACK_ALLOCATED(); STACK_ALLOCATED();
......
...@@ -833,17 +833,9 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackgroundWithRect( ...@@ -833,17 +833,9 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackgroundWithRect(
const ComputedStyle& style = box_fragment_.Style(); const ComputedStyle& style = box_fragment_.Style();
base::Optional<DisplayItemCacheSkipper> cache_skipper; base::Optional<DisplayItemCacheSkipper> cache_skipper;
// Disable cache in under-invalidation checking mode for MediaSliderPart
// because we always paint using the latest data (buffered ranges, current
// time and duration) which may be different from the cached data, and for
// delayed-invalidation object because it may change before it's actually
// invalidated. Note that we still report harmless under-invalidation of
// non-delayed-invalidation animated background, which should be ignored.
if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() &&
(style.EffectiveAppearance() == kMediaSliderPart || ShouldSkipPaintUnderInvalidationChecking(layout_box))
layout_box.ShouldDelayFullPaintInvalidation())) {
cache_skipper.emplace(paint_info.context); cache_skipper.emplace(paint_info.context);
}
BoxDecorationData box_decoration_data(paint_info, PhysicalFragment()); BoxDecorationData box_decoration_data(paint_info, PhysicalFragment());
if (!box_decoration_data.ShouldPaint()) if (!box_decoration_data.ShouldPaint())
......
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