Commit 91c206e0 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Chromium LUCI CQ

Revert "Add CullRect::ApplyPaintProperties()"

This reverts commit 6f895b07.

Reason for revert: The reverted CL is supposed not to affect
production, but it seems to cause crbug.com/1166540.

Original change's description:
> Add CullRect::ApplyPaintProperties()
>
> It will be called to map a cull rect from parent space to local space
> in cull rect update during PrePaint. The purpose is to mark PaintLayers
> needing repaint on cull rect changes before paint, instead of checking
> interest rect / cull rect changes during paint, to avoid setting
> PaintLayer needing repaint unnecessarily, especially for CAP during
> composited scrolling.
>
> Besides the original features of CullRect::ApplyTransforms() which is
> used in cull rect mapping for CompositeAfterPaint, it also implements
> the following features to be on par with CompositedLayerMapping::
> ReComputeInterestRect():
>
> - Considering clips in additional to scroll clips,
> - Clipping expanded cull rect by scrolling contents rect for composited
>   scroll translations,
> - Clamping extreme geometry values,
> - Adaptive expansion distance for composited transforms.
>
> The next steps are:
> 1. Add CullRectUpdater which updates cull rects during PrePaint when
>    runtime feature CullRectUpdate is enabled.
> 2. Use the updated cull rect to replace interest rect in pre-CAP and
>    cull rect in CAP and pre-CAP, still behind the runtime feature.
> 3. Enable CullRectUpdate for CAP
> 4. Enable CullRectUpdate for pre-CAP.
> 5. Remove old interest rect / cull rect code.
>
> Bug: 1046544
> Change-Id: I6e7e9f85bc0b4640e67de1732744e647b6f7e230
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620090
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#843304}

TBR=szager@chromium.org,wangxianzhu@chromium.org,pdr@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Idc3374d3d426b9f571e417b1acbbc18227fdf274
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1046544, 1166540
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628021Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843592}
parent d36ee928
...@@ -18,7 +18,6 @@ class AffineTransform; ...@@ -18,7 +18,6 @@ class AffineTransform;
class FloatRect; class FloatRect;
class LayoutRect; class LayoutRect;
class LayoutUnit; class LayoutUnit;
class PropertyTreeState;
class TransformPaintPropertyNode; class TransformPaintPropertyNode;
class PLATFORM_EXPORT CullRect { class PLATFORM_EXPORT CullRect {
...@@ -48,9 +47,9 @@ class PLATFORM_EXPORT CullRect { ...@@ -48,9 +47,9 @@ class PLATFORM_EXPORT CullRect {
// 1. it's clipped by the container rect, // 1. it's clipped by the container rect,
// 2. transformed by inverse of the scroll translation, // 2. transformed by inverse of the scroll translation,
// 3. expanded by thousands of pixels for composited scrolling. // 3. expanded by thousands of pixels for composited scrolling.
// 4. clipped by the contents rect. void ApplyTransform(const TransformPaintPropertyNode& transform) {
// TODO(wangxianzhu): Remove this function for CullRectUpdate. ApplyTransformInternal(transform);
void ApplyTransform(const TransformPaintPropertyNode&); }
// For CompositeAfterPaint only. Applies transforms from |source| (not // For CompositeAfterPaint only. Applies transforms from |source| (not
// included) to |destination| (included). For each scroll translation, the // included) to |destination| (included). For each scroll translation, the
...@@ -59,21 +58,10 @@ class PLATFORM_EXPORT CullRect { ...@@ -59,21 +58,10 @@ class PLATFORM_EXPORT CullRect {
// doesn't cover the whole scrolling contents, and the new cull rect doesn't // doesn't cover the whole scrolling contents, and the new cull rect doesn't
// change enough (by hundreds of pixels) from |old_cull_rect|, the cull rect // change enough (by hundreds of pixels) from |old_cull_rect|, the cull rect
// will be set to |old_cull_rect| to avoid repaint on each composited scroll. // will be set to |old_cull_rect| to avoid repaint on each composited scroll.
// TODO(wangxianzhu): Remove this function for CullRectUpdate.
void ApplyTransforms(const TransformPaintPropertyNode& source, void ApplyTransforms(const TransformPaintPropertyNode& source,
const TransformPaintPropertyNode& destination, const TransformPaintPropertyNode& destination,
const base::Optional<CullRect>& old_cull_rect); const base::Optional<CullRect>& old_cull_rect);
// For CullRectUpdate only. Similar to the above but also applies clips and
// expands for all directly composited transforms (including scrolling and
// non-scrolling ones). |root| is used to calculate the expansion distance in
// the local space, to make the expansion distance approximately the same in
// the root space.
void ApplyPaintProperties(const PropertyTreeState& root,
const PropertyTreeState& source,
const PropertyTreeState& destination,
const base::Optional<CullRect>& old_cull_rect);
const IntRect& Rect() const { return rect_; } const IntRect& Rect() const { return rect_; }
String ToString() const { return rect_.ToString(); } String ToString() const { return rect_.ToString(); }
...@@ -94,17 +82,10 @@ class PLATFORM_EXPORT CullRect { ...@@ -94,17 +82,10 @@ class PLATFORM_EXPORT CullRect {
// doesn't cover the whole scrolling contents. // doesn't cover the whole scrolling contents.
kExpandedForPartialScrollingContents, kExpandedForPartialScrollingContents,
}; };
ApplyTransformResult ApplyScrollTranslation( ApplyTransformResult ApplyTransformInternal(
const TransformPaintPropertyNode& root_transform, const TransformPaintPropertyNode&);
const TransformPaintPropertyNode& scroll_translation);
void ApplyTransformWithoutExpansion(const TransformPaintPropertyNode&);
void ApplyPaintPropertiesWithoutExpansion(
const PropertyTreeState& source,
const PropertyTreeState& destination);
bool ChangedEnough(const CullRect& old_cull_rect, bool ChangedEnough(const CullRect& old_cull_rect) const;
const IntSize* bounds) const;
IntRect rect_; IntRect rect_;
}; };
......
...@@ -653,9 +653,6 @@ ...@@ -653,9 +653,6 @@
name: "CSSVariables2TransformValues", name: "CSSVariables2TransformValues",
status: "test", status: "test",
}, },
{
name: "CullRectUpdate",
},
{ {
name: "CustomElementDefaultStyle", name: "CustomElementDefaultStyle",
status: "experimental", status: "experimental",
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h"
#include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h"
#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" #include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h"
#include "third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h"
#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h"
#include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h" #include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h"
...@@ -24,9 +23,6 @@ inline const ClipPaintPropertyNode& c0() { ...@@ -24,9 +23,6 @@ inline const ClipPaintPropertyNode& c0() {
inline const EffectPaintPropertyNode& e0() { inline const EffectPaintPropertyNode& e0() {
return EffectPaintPropertyNode::Root(); return EffectPaintPropertyNode::Root();
} }
inline const ScrollPaintPropertyNode& s0() {
return ScrollPaintPropertyNode::Root();
}
constexpr int c0_id = 1; constexpr int c0_id = 1;
constexpr int e0_id = 1; constexpr int e0_id = 1;
...@@ -221,28 +217,6 @@ inline scoped_refptr<TransformPaintPropertyNode> CreateScrollTranslation( ...@@ -221,28 +217,6 @@ inline scoped_refptr<TransformPaintPropertyNode> CreateScrollTranslation(
return TransformPaintPropertyNode::Create(parent, std::move(state)); return TransformPaintPropertyNode::Create(parent, std::move(state));
} }
inline scoped_refptr<TransformPaintPropertyNode> CreateScrollTranslation(
const TransformPaintPropertyNodeOrAlias& parent,
float offset_x,
float offset_y,
const IntRect& container_rect,
const IntSize& contents_size,
CompositingReasons compositing_reasons = CompositingReason::kNone) {
const auto* parent_scroll_translation = &parent.Unalias();
while (!parent_scroll_translation->ScrollNode())
parent_scroll_translation = parent_scroll_translation->UnaliasedParent();
ScrollPaintPropertyNode::State scroll_state;
scroll_state.container_rect = container_rect;
scroll_state.contents_size = contents_size;
TransformPaintPropertyNode::State translation_state{
FloatSize(offset_x, offset_y)};
translation_state.direct_compositing_reasons = compositing_reasons;
translation_state.scroll = ScrollPaintPropertyNode::Create(
*parent_scroll_translation->ScrollNode(), std::move(scroll_state));
return TransformPaintPropertyNode::Create(parent,
std::move(translation_state));
}
inline scoped_refptr<TransformPaintPropertyNode> inline scoped_refptr<TransformPaintPropertyNode>
CreateCompositedScrollTranslation( CreateCompositedScrollTranslation(
const TransformPaintPropertyNodeOrAlias& parent, const TransformPaintPropertyNodeOrAlias& parent,
...@@ -253,46 +227,6 @@ CreateCompositedScrollTranslation( ...@@ -253,46 +227,6 @@ CreateCompositedScrollTranslation(
CompositingReason::kOverflowScrolling); CompositingReason::kOverflowScrolling);
} }
inline scoped_refptr<TransformPaintPropertyNode>
CreateCompositedScrollTranslation(
const TransformPaintPropertyNodeOrAlias& parent,
float offset_x,
float offset_y,
const IntRect& container_rect,
const IntSize& contents_size) {
return CreateScrollTranslation(parent, offset_x, offset_y, container_rect,
contents_size,
CompositingReason::kOverflowScrolling);
}
inline RefCountedPropertyTreeState CreateScrollTranslationState(
const PropertyTreeState& parent_state,
float offset_x,
float offset_y,
const IntRect& container_rect,
const IntSize& contents_size,
CompositingReasons compositing_reasons = CompositingReason::kNone) {
return RefCountedPropertyTreeState(PropertyTreeState(
*CreateScrollTranslation(parent_state.Transform(), offset_x, offset_y,
container_rect, contents_size,
compositing_reasons),
*CreateClip(parent_state.Clip(), parent_state.Transform(),
FloatRoundedRect(container_rect)),
e0()));
}
inline RefCountedPropertyTreeState CreateCompositedScrollTranslationState(
const PropertyTreeState& parent_state,
float offset_x,
float offset_y,
const IntRect& container_rect,
const IntSize& contents_size,
CompositingReasons compositing_reasons = CompositingReason::kNone) {
return CreateScrollTranslationState(parent_state, offset_x, offset_y,
container_rect, contents_size,
CompositingReason::kOverflowScrolling);
}
inline PropertyTreeState DefaultPaintChunkProperties() { inline PropertyTreeState DefaultPaintChunkProperties() {
return PropertyTreeState::Root(); return PropertyTreeState::Root();
} }
......
...@@ -7,11 +7,29 @@ Layer tree when the fixed elements are out-of-view (should have just a root laye ...@@ -7,11 +7,29 @@ Layer tree when the fixed elements are out-of-view (should have just a root laye
"contentsOpaque": true, "contentsOpaque": true,
"backgroundColor": "#FFFFFF" "backgroundColor": "#FFFFFF"
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV id='fixed1'",
"bounds": [10, 10],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 1
},
{ {
"name": "VerticalScrollbar", "name": "VerticalScrollbar",
"position": [785, 0], "position": [785, 0],
"bounds": [15, 600] "bounds": [15, 600]
} }
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[100, -100, 0, 1]
]
}
] ]
} }
......
...@@ -13,6 +13,20 @@ ...@@ -13,6 +13,20 @@
"backgroundColor": "#C0C0C0", "backgroundColor": "#C0C0C0",
"transform": 1 "transform": 1
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 2
},
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 3
},
{ {
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'", "name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10], "bounds": [10, 10],
...@@ -34,6 +48,24 @@ ...@@ -34,6 +48,24 @@
[0, 0, 1, 0], [0, 0, 1, 0],
[8, 1013, 0, 1] [8, 1013, 0, 1]
] ]
},
{
"id": 2,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, -100, 0, 1]
]
},
{
"id": 3,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1000, 0, 0, 1]
]
} }
] ]
} }
......
...@@ -29,6 +29,13 @@ Not scaled: ...@@ -29,6 +29,13 @@ Not scaled:
"backgroundColor": "#C0C0C0", "backgroundColor": "#C0C0C0",
"transform": 4 "transform": 4
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 5
},
{ {
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'", "name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10], "bounds": [10, 10],
...@@ -56,7 +63,7 @@ Not scaled: ...@@ -56,7 +63,7 @@ Not scaled:
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
[0, 0, 1, 0], [0, 0, 1, 0],
[8, 1008, 0, 1] [8, -100, 0, 1]
] ]
}, },
{ {
...@@ -66,12 +73,22 @@ Not scaled: ...@@ -66,12 +73,22 @@ Not scaled:
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
[0, 0, 1, 0], [0, 0, 1, 0],
[1000, 0, 0, 1] [8, 1008, 0, 1]
] ]
}, },
{ {
"id": 4, "id": 4,
"parent": 1, "parent": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1000, 0, 0, 1]
]
},
{
"id": 5,
"parent": 1,
"transform": [ "transform": [
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
...@@ -113,6 +130,13 @@ Scale=0.5: ...@@ -113,6 +130,13 @@ Scale=0.5:
"backgroundColor": "#C0C0C0", "backgroundColor": "#C0C0C0",
"transform": 4 "transform": 4
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 5
},
{ {
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'", "name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10], "bounds": [10, 10],
...@@ -140,7 +164,7 @@ Scale=0.5: ...@@ -140,7 +164,7 @@ Scale=0.5:
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
[0, 0, 1, 0], [0, 0, 1, 0],
[8, 1008, 0, 1] [8, -100, 0, 1]
] ]
}, },
{ {
...@@ -150,12 +174,22 @@ Scale=0.5: ...@@ -150,12 +174,22 @@ Scale=0.5:
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
[0, 0, 1, 0], [0, 0, 1, 0],
[1000, 0, 0, 1] [8, 1008, 0, 1]
] ]
}, },
{ {
"id": 4, "id": 4,
"parent": 1, "parent": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1000, 0, 0, 1]
]
},
{
"id": 5,
"parent": 1,
"transform": [ "transform": [
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
...@@ -197,6 +231,13 @@ Scale=1.5: ...@@ -197,6 +231,13 @@ Scale=1.5:
"backgroundColor": "#C0C0C0", "backgroundColor": "#C0C0C0",
"transform": 4 "transform": 4
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 5
},
{ {
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'", "name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10], "bounds": [10, 10],
...@@ -224,7 +265,7 @@ Scale=1.5: ...@@ -224,7 +265,7 @@ Scale=1.5:
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
[0, 0, 1, 0], [0, 0, 1, 0],
[8, 1008, 0, 1] [8, -100, 0, 1]
] ]
}, },
{ {
...@@ -234,12 +275,22 @@ Scale=1.5: ...@@ -234,12 +275,22 @@ Scale=1.5:
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
[0, 0, 1, 0], [0, 0, 1, 0],
[1000, 0, 0, 1] [8, 1008, 0, 1]
] ]
}, },
{ {
"id": 4, "id": 4,
"parent": 1, "parent": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1000, 0, 0, 1]
]
},
{
"id": 5,
"parent": 1,
"transform": [ "transform": [
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
......
...@@ -11,6 +11,16 @@ ...@@ -11,6 +11,16 @@
"bounds": [10, 10], "bounds": [10, 10],
"transform": 1 "transform": 1
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"transform": 2
},
{
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10],
"transform": 3
},
{ {
"name": "LayoutNGBlockFlow (positioned) DIV class='fixed'", "name": "LayoutNGBlockFlow (positioned) DIV class='fixed'",
"bounds": [10, 10] "bounds": [10, 10]
...@@ -30,6 +40,24 @@ ...@@ -30,6 +40,24 @@
[0, 0, 1, 0], [0, 0, 1, 0],
[8, 1013, 0, 1] [8, 1013, 0, 1]
] ]
},
{
"id": 2,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, -100, 0, 1]
]
},
{
"id": 3,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1000, 0, 0, 1]
]
} }
] ]
} }
......
...@@ -9,11 +9,18 @@ ...@@ -9,11 +9,18 @@
}, },
{ {
"name": "LayoutNGBlockFlow (positioned) DIV", "name": "LayoutNGBlockFlow (positioned) DIV",
"bounds": [99, 99], "bounds": [88, 88],
"contentsOpaque": true, "contentsOpaque": true,
"backgroundColor": "#C0C0C0", "backgroundColor": "#C0C0C0",
"transform": 2 "transform": 2
}, },
{
"name": "LayoutNGBlockFlow (positioned) DIV",
"bounds": [99, 99],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 3
},
{ {
"name": "VerticalScrollbar", "name": "VerticalScrollbar",
"position": [785, 0], "position": [785, 0],
...@@ -32,6 +39,15 @@ ...@@ -32,6 +39,15 @@
}, },
{ {
"id": 2, "id": 2,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[100, -300, 0, 1]
]
},
{
"id": 3,
"transform": [ "transform": [
[1, 0, 0, 0], [1, 0, 0, 0],
[0, 1, 0, 0], [0, 1, 0, 0],
......
...@@ -6,9 +6,8 @@ ...@@ -6,9 +6,8 @@
"contentsOpaque": true, "contentsOpaque": true,
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"invalidations": [ "invalidations": [
[450, 0, 218, 236], [0, 0, 668, 236],
[704, 0, 214, 232], [704, 0, 214, 232],
[0, 0, 214, 232],
[700, 217, 4, 19] [700, 217, 4, 19]
] ]
}, },
......
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