diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h')
-rw-r--r-- | chromium/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/chromium/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h b/chromium/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h index 1b3a89b2fba..9c6a9173b98 100644 --- a/chromium/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h +++ b/chromium/third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h @@ -18,15 +18,27 @@ namespace blink { // Clips can use FloatRect::Intersect or FloatRect::InclusiveIntersect. enum InclusiveIntersectOrNot { kNonInclusiveIntersect, kInclusiveIntersect }; -// Whether to expand the visual or clip rect to infinity when we meet any -// animating transform or filter when walking from a descendant state to an +// When performing overlap testing during compositing, we may need to expand the +// visual rect in two cases when mapping from descendant state to ancestor +// state: mapping through a fixed transform node to the viewport it is attached +// to, and mapping through an animating transform or filter. +// +// This allows for a more conservative overlap test that assumes potentially +// more overlap than we'd encounter otherwise, in order to reduce the need to +// re-run overlap testing in response to things like scrolling. +// +// The expansion for fixed covers all coordinates where the fixed content may +// end up when the scroller is at the end of the extents. +// +// For animation, the visual or clip rect is expanded to infinity when we meet +// any animating transform or filter when walking from a descendant state to an // ancestor state, when mapping a visual rect or getting the accumulated clip // rect. After we expanded the rect, we will still apply ancestor clips when // continuing walking up the tree. TODO(crbug.com/1026653): Consider animation // bounds instead of using infinite rect. -enum ExpandVisualRectForAnimationOrNot { - kDontExpandVisualRectForAnimation, - kExpandVisualRectForAnimation, +enum ExpandVisualRectForCompositingOverlapOrNot { + kDontExpandVisualRectForCompositingOverlap, + kExpandVisualRectForCompositingOverlap, }; // GeometryMapper is a helper class for fast computations of transformed and @@ -186,9 +198,10 @@ class PLATFORM_EXPORT GeometryMapper { } bool has_animation = false; + bool has_fixed = false; bool success = false; const auto& source_to_destination = SourceToDestinationProjectionInternal( - source, destination, has_animation, success); + source, destination, has_animation, has_fixed, success); if (!success) mapping_rect = Rect(); else @@ -263,11 +276,11 @@ class PLATFORM_EXPORT GeometryMapper { FloatClipRect& mapping_rect, OverlayScrollbarClipBehavior clip = kIgnoreOverlayScrollbarSize, InclusiveIntersectOrNot intersect = kNonInclusiveIntersect, - ExpandVisualRectForAnimationOrNot animation = - kDontExpandVisualRectForAnimation) { + ExpandVisualRectForCompositingOverlapOrNot expand = + kDontExpandVisualRectForCompositingOverlap) { return LocalToAncestorVisualRect(local_state.Unalias(), ancestor_state.Unalias(), mapping_rect, - clip, intersect, animation); + clip, intersect, expand); } static bool LocalToAncestorVisualRect( const PropertyTreeState& local_state, @@ -275,7 +288,8 @@ class PLATFORM_EXPORT GeometryMapper { FloatClipRect& mapping_rect, OverlayScrollbarClipBehavior = kIgnoreOverlayScrollbarSize, InclusiveIntersectOrNot = kNonInclusiveIntersect, - ExpandVisualRectForAnimationOrNot = kDontExpandVisualRectForAnimation); + ExpandVisualRectForCompositingOverlapOrNot = + kDontExpandVisualRectForCompositingOverlap); static void ClearCache(); @@ -289,6 +303,7 @@ class PLATFORM_EXPORT GeometryMapper { const TransformPaintPropertyNode& source, const TransformPaintPropertyNode& destination, bool& has_animation, + bool& has_fixed, bool& success); static FloatClipRect LocalToAncestorClipRectInternal( @@ -297,7 +312,7 @@ class PLATFORM_EXPORT GeometryMapper { const TransformPaintPropertyNode& ancestor_transform, OverlayScrollbarClipBehavior, InclusiveIntersectOrNot, - ExpandVisualRectForAnimationOrNot, + ExpandVisualRectForCompositingOverlapOrNot, bool& success); // The return value has the same meaning as that for @@ -308,7 +323,7 @@ class PLATFORM_EXPORT GeometryMapper { FloatClipRect& mapping_rect, OverlayScrollbarClipBehavior, InclusiveIntersectOrNot, - ExpandVisualRectForAnimationOrNot, + ExpandVisualRectForCompositingOverlapOrNot, bool& success); // The return value has the same meaning as that for @@ -319,7 +334,7 @@ class PLATFORM_EXPORT GeometryMapper { FloatClipRect& mapping_rect, OverlayScrollbarClipBehavior, InclusiveIntersectOrNot, - ExpandVisualRectForAnimationOrNot, + ExpandVisualRectForCompositingOverlapOrNot, bool& success); static void MoveRect(FloatRect& rect, const FloatSize& delta) { |