Commit 38c20f78 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Remove extra calls to SetNeedsGraphicsLayerUpdate

In non-BGPT mode, we only need to do a kGraphicsLayerUpdateLocal update,
and in BGPT mode, we now call SetNeedsCommit() directly from
PropertyTreeManager::EnsureCompositorTransformNode, so no graphics layer
update is needed at all.

Bug: 895109
Change-Id: I970b29bc05a43720cfb9747bfcfa50e42dc8639e
Reviewed-on: https://chromium-review.googlesource.com/c/1403639Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622979}
parent e0fce9bd
...@@ -765,6 +765,13 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -765,6 +765,13 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
std::string ToString() const; std::string ToString() const;
// Called when a property has been modified in a way that the layer knows
// immediately that a commit is required. This implies SetNeedsPushProperties
// to push that property.
// This is public, so that it can be called directly when needed, for example
// in PropertyTreeManager when handling scroll offsets.
void SetNeedsCommit();
protected: protected:
friend class LayerImpl; friend class LayerImpl;
friend class TreeSynchronizer; friend class TreeSynchronizer;
...@@ -773,11 +780,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -773,11 +780,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
virtual ~Layer(); virtual ~Layer();
// These SetNeeds functions are in order of severity of update: // These SetNeeds functions are in order of severity of update:
//
// Called when a property has been modified in a way that the layer knows // See SetNeedsCommit() above - it belongs here in the order of severity.
// immediately that a commit is required. This implies SetNeedsPushProperties
// to push that property.
void SetNeedsCommit();
// Called when there's been a change in layer structure. Implies // Called when there's been a change in layer structure. Implies
// SetNeedsCommit and property tree rebuld, but not SetNeedsPushProperties // SetNeedsCommit and property tree rebuld, but not SetNeedsPushProperties
......
...@@ -199,6 +199,11 @@ TEST_P(ScrollingCoordinatorTest, fastScrollingByDefault) { ...@@ -199,6 +199,11 @@ TEST_P(ScrollingCoordinatorTest, fastScrollingByDefault) {
TEST_P(ScrollingCoordinatorTest, fastFractionalScrollingDiv) { TEST_P(ScrollingCoordinatorTest, fastFractionalScrollingDiv) {
ScopedFractionalScrollOffsetsForTest fractional_scroll_offsets(true); ScopedFractionalScrollOffsetsForTest fractional_scroll_offsets(true);
// TODO(920417): Re-enable this test when main thread scrolling supports
// fractional scroll offsets.
if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled())
return;
RegisterMockedHttpURLLoad("fractional-scroll-div.html"); RegisterMockedHttpURLLoad("fractional-scroll-div.html");
NavigateTo(base_url_ + "fractional-scroll-div.html"); NavigateTo(base_url_ + "fractional-scroll-div.html");
ForceFullCompositingUpdate(); ForceFullCompositingUpdate();
......
...@@ -2162,8 +2162,15 @@ void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() { ...@@ -2162,8 +2162,15 @@ void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() {
scrolling_coordinator->UpdateCompositedScrollOffset(this); scrolling_coordinator->UpdateCompositedScrollOffset(this);
if (!handled_scroll) { if (!handled_scroll) {
Layer()->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate( if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
kGraphicsLayerUpdateSubtree); // In non-BGPT mode, we need to do a full sub-tree update here, because
// we need to update the position property to compute
// offset_to_transform_parent. For more context, see the comment from
// chrishtr@ here:
// https://chromium-review.googlesource.com/c/chromium/src/+/1403639/6/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
Layer()->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate(
kGraphicsLayerUpdateSubtree);
}
compositor->SetNeedsCompositingUpdate( compositor->SetNeedsCompositingUpdate(
kCompositingUpdateAfterGeometryChange); kCompositingUpdateAfterGeometryChange);
} }
......
...@@ -885,8 +885,10 @@ void PaintArtifactCompositor::Update( ...@@ -885,8 +885,10 @@ void PaintArtifactCompositor::Update(
// Calling |PropertyTreeStateChanged| for every pending layer is // Calling |PropertyTreeStateChanged| for every pending layer is
// O(|property nodes|^2) and could be optimized by caching the lookup of // O(|property nodes|^2) and could be optimized by caching the lookup of
// nodes known to be changed/unchanged. // nodes known to be changed/unchanged.
if (PropertyTreeStateChanged(property_state)) if (PropertyTreeStateChanged(property_state)) {
layer->SetSubtreePropertyChanged(); layer->SetSubtreePropertyChanged();
root_layer_->SetNeedsCommit();
}
} }
property_tree_manager.Finalize(); property_tree_manager.Finalize();
content_layer_clients_.swap(new_content_layer_clients); content_layer_clients_.swap(new_content_layer_clients);
......
...@@ -14,7 +14,7 @@ overflowwithhandler: layer(0,10 273x52) has hit test rect (0,0 273x52) ...@@ -14,7 +14,7 @@ overflowwithhandler: layer(0,10 273x52) has hit test rect (0,0 273x52)
overflowwithborder: layer(13,365 290x70) has hit test rect (0,0 290x70) overflowwithborder: layer(13,365 290x70) has hit test rect (0,0 290x70)
overflowwithborder: layer(0,0 263x124) has hit test rect (4,4 255x116) overflowwithborder: layer(0,0 263x124) has hit test rect (4,4 255x116)
withTransform: layer(15,435 271x12) has hit test rect (0,0 271x12) withTransform: layer(15,455 271x12) has hit test rect (0,0 271x12)
withTransform: layer(0,0 282x77) has hit test rect (0,13 273x14) withTransform: layer(0,0 282x77) has hit test rect (0,13 273x14)
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
}, },
{ {
"name": "LayoutBlockFlow (relative positioned) DIV id='neg-z'", "name": "LayoutBlockFlow (relative positioned) DIV id='neg-z'",
"position": [9, -81], "position": [9, 19],
"bounds": [100, 410], "bounds": [100, 410],
"backfaceVisibility": "hidden" "backfaceVisibility": "hidden"
}, },
......
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutBlockFlow HTML",
"bounds": [800, 318]
},
{
"name": "LayoutBlockFlow (relative positioned) DIV id='neg-z'",
"position": [9, -81],
"bounds": [100, 410]
},
{
"name": "LayoutBlockFlow HTML (foreground) Layer",
"bounds": [800, 318]
},
{
"name": "LayoutBlockFlow (relative positioned) DIV id='container'",
"position": [8, 8],
"bounds": [102, 302],
"backfaceVisibility": "hidden"
},
{
"name": "Scrolling Layer",
"position": [9, 9],
"bounds": [100, 300],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"position": [9, 9],
"bounds": [100, 430],
"drawsContent": false,
"transform": 1
},
{
"name": "Overflow Controls Host Layer",
"position": [8, 8],
"bounds": [102, 302],
"drawsContent": false,
"backfaceVisibility": "hidden"
},
{
"name": "Horizontal Scrollbar Layer",
"position": [9, 309],
"bounds": [100, 0]
},
{
"name": "Vertical Scrollbar Layer",
"position": [109, 9],
"bounds": [0, 300]
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, -100, 0, 1]
],
"flattenInheritedTransform": false
}
]
}
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