Commit c1e70f67 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[CompositeAfterPaint] Prefer composited scrolling of composited iframe

If an iframe has direct compositing reason, then prefer composited
scrolling for the content LayoutView.

Change-Id: Id257a5253ad792a4fc2acec8860940a612bc43f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107612Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752311}
parent 84af0e4a
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/local_frame_view.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/fullscreen/fullscreen.h" #include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_video.h" #include "third_party/blink/renderer/core/layout/layout_video.h"
#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
...@@ -138,6 +139,15 @@ CompositingReasons CompositingReasonFinder::DirectReasonsForPaintProperties( ...@@ -138,6 +139,15 @@ CompositingReasons CompositingReasonFinder::DirectReasonsForPaintProperties(
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) { if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
bool force_prefer_compositing_to_lcd_text = bool force_prefer_compositing_to_lcd_text =
reasons != CompositingReason::kNone; reasons != CompositingReason::kNone;
if (!force_prefer_compositing_to_lcd_text && object.IsLayoutView()) {
if (auto* owner_object = object.GetFrame()->OwnerLayoutObject()) {
force_prefer_compositing_to_lcd_text =
DirectReasonsForPaintProperties(*owner_object) !=
CompositingReason::kNone;
}
}
if (scrollable_area->ComputeNeedsCompositedScrolling( if (scrollable_area->ComputeNeedsCompositedScrolling(
force_prefer_compositing_to_lcd_text)) { force_prefer_compositing_to_lcd_text)) {
reasons |= CompositingReason::kOverflowScrolling; reasons |= CompositingReason::kOverflowScrolling;
......
...@@ -384,7 +384,8 @@ void PaintArtifactCompositor::UpdateNonFastScrollableRegions( ...@@ -384,7 +384,8 @@ void PaintArtifactCompositor::UpdateNonFastScrollableRegions(
cc::Layer* layer, cc::Layer* layer,
const gfx::Vector2dF& layer_offset, const gfx::Vector2dF& layer_offset,
const PropertyTreeState& layer_state, const PropertyTreeState& layer_state,
const PaintChunkSubset& paint_chunks) { const PaintChunkSubset& paint_chunks,
PropertyTreeManager* property_tree_manager) {
cc::Region non_fast_scrollable_regions_in_layer_space; cc::Region non_fast_scrollable_regions_in_layer_space;
for (const auto& chunk : paint_chunks) { for (const auto& chunk : paint_chunks) {
// Add any non-fast scrollable hit test data from the paint chunk. // Add any non-fast scrollable hit test data from the paint chunk.
...@@ -402,6 +403,12 @@ void PaintArtifactCompositor::UpdateNonFastScrollableRegions( ...@@ -402,6 +403,12 @@ void PaintArtifactCompositor::UpdateNonFastScrollableRegions(
auto scroll_element_id = scroll_node.GetCompositorElementId(); auto scroll_element_id = scroll_node.GetCompositorElementId();
if (layer->element_id() == scroll_element_id) if (layer->element_id() == scroll_element_id)
continue; continue;
// Ensure the cc scroll node to prepare for possible descendant nodes
// referenced by later composited layers. This can't be done by ensuring
// parent transform node in EnsureCompositorTransformNode() if the
// transform tree and the scroll tree have different topologies.
DCHECK(property_tree_manager);
property_tree_manager->EnsureCompositorScrollNode(*scroll_translation);
} }
} }
...@@ -1245,9 +1252,9 @@ void PaintArtifactCompositor::Update( ...@@ -1245,9 +1252,9 @@ void PaintArtifactCompositor::Update(
pending_layer.paint_chunk_indices); pending_layer.paint_chunk_indices);
UpdateTouchActionRects(layer.get(), layer->offset_to_transform_parent(), UpdateTouchActionRects(layer.get(), layer->offset_to_transform_parent(),
property_state, paint_chunks); property_state, paint_chunks);
UpdateNonFastScrollableRegions(layer.get(), UpdateNonFastScrollableRegions(
layer->offset_to_transform_parent(), layer.get(), layer->offset_to_transform_parent(), property_state,
property_state, paint_chunks); paint_chunks, &property_tree_manager);
} }
layer->SetLayerTreeHost(root_layer_->layer_tree_host()); layer->SetLayerTreeHost(root_layer_->layer_tree_host());
......
...@@ -40,6 +40,7 @@ namespace blink { ...@@ -40,6 +40,7 @@ namespace blink {
class ContentLayerClientImpl; class ContentLayerClientImpl;
class JSONObject; class JSONObject;
class PaintArtifact; class PaintArtifact;
class PropertyTreeManager;
class SynthesizedClip; class SynthesizedClip;
struct PaintChunk; struct PaintChunk;
...@@ -196,7 +197,8 @@ class PLATFORM_EXPORT PaintArtifactCompositor final ...@@ -196,7 +197,8 @@ class PLATFORM_EXPORT PaintArtifactCompositor final
cc::Layer*, cc::Layer*,
const gfx::Vector2dF& layer_offset, const gfx::Vector2dF& layer_offset,
const PropertyTreeState& layer_state, const PropertyTreeState& layer_state,
const PaintChunkSubset& paint_chunks); const PaintChunkSubset& paint_chunks,
PropertyTreeManager* = nullptr);
void SetNeedsUpdate() { needs_update_ = true; } void SetNeedsUpdate() { needs_update_ = true; }
bool NeedsUpdate() const { return needs_update_; } bool NeedsUpdate() const { return needs_update_; }
......
...@@ -132,10 +132,6 @@ http/tests/devtools/layers/layer-compositing-reasons.js [ Failure ] ...@@ -132,10 +132,6 @@ http/tests/devtools/layers/layer-compositing-reasons.js [ Failure ]
# Missing WheelEventHandler # Missing WheelEventHandler
http/tests/devtools/layers/layer-scroll-rects-get.js [ Failure ] http/tests/devtools/layers/layer-scroll-rects-get.js [ Failure ]
# CAP doesn't force compositing of iframe containing composited content.
compositing/rtl/rtl-iframe-absolute-overflow-scrolled.html [ Failure ]
compositing/rtl/rtl-iframe-fixed-overflow-scrolled.html [ Failure ]
# Wrong contentsOpaque of the scrollbar layer with transparent track. # Wrong contentsOpaque of the scrollbar layer with transparent track.
fast/frames/transparent-scrollbar.html [ Failure ] fast/frames/transparent-scrollbar.html [ Failure ]
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
iframe { iframe {
position: absolute; position: absolute;
will-change: transform;
top: 0px; top: 0px;
left: 0px; left: 0px;
width: 400px; width: 400px;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
iframe { iframe {
position: absolute; position: absolute;
will-change: transform;
top: 0px; top: 0px;
left: 0px; left: 0px;
width: 400px; width: 400px;
......
...@@ -12,6 +12,19 @@ ...@@ -12,6 +12,19 @@
"bounds": [390, 240], "bounds": [390, 240],
"transform": 1 "transform": 1
}, },
{
"name": "Scrolling background of LayoutView #document",
"bounds": [285, 230],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 2
},
{
"name": "VerticalScrollbar",
"position": [285, 0],
"bounds": [15, 150],
"transform": 2
},
{ {
"name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'", "name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'",
"bounds": [210, 210], "bounds": [210, 210],
......
...@@ -12,6 +12,19 @@ ...@@ -12,6 +12,19 @@
"bounds": [390, 240], "bounds": [390, 240],
"transform": 1 "transform": 1
}, },
{
"name": "Scrolling background of LayoutView #document",
"bounds": [285, 230],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 2
},
{
"name": "VerticalScrollbar",
"position": [285, 0],
"bounds": [15, 150],
"transform": 2
},
{ {
"name": "LayoutNGBlockFlow DIV id='test' class='composited box'", "name": "LayoutNGBlockFlow DIV id='test' class='composited box'",
"bounds": [210, 210], "bounds": [210, 210],
......
...@@ -12,6 +12,19 @@ ...@@ -12,6 +12,19 @@
"bounds": [390, 240], "bounds": [390, 240],
"transform": 1 "transform": 1
}, },
{
"name": "Scrolling background of LayoutView #document",
"bounds": [285, 230],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 2
},
{
"name": "VerticalScrollbar",
"position": [285, 0],
"bounds": [15, 150],
"transform": 2
},
{ {
"name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'", "name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'",
"bounds": [210, 210], "bounds": [210, 210],
......
...@@ -12,6 +12,19 @@ ...@@ -12,6 +12,19 @@
"bounds": [390, 240], "bounds": [390, 240],
"transform": 1 "transform": 1
}, },
{
"name": "Scrolling background of LayoutView #document",
"bounds": [285, 230],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 2
},
{
"name": "VerticalScrollbar",
"position": [285, 0],
"bounds": [15, 150],
"transform": 2
},
{ {
"name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'", "name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'",
"bounds": [210, 210], "bounds": [210, 210],
......
...@@ -12,12 +12,31 @@ ...@@ -12,12 +12,31 @@
"backgroundColor": "#9A9A9A", "backgroundColor": "#9A9A9A",
"transform": 1 "transform": 1
}, },
{
"name": "Scrolling background of LayoutView #document",
"bounds": [285, 230],
"contentsOpaque": true,
"backgroundColor": "#C0C0C0",
"transform": 2
},
{
"name": "VerticalScrollbar",
"position": [285, 0],
"bounds": [15, 150],
"transform": 2
},
{ {
"name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'", "name": "LayoutNGBlockFlow DIV id='iframe-content' class='box'",
"bounds": [210, 210], "bounds": [210, 210],
"contentsOpaque": true, "contentsOpaque": true,
"backgroundColor": "#0000FF", "backgroundColor": "#0000FF",
"transform": 3 "transform": 3
},
{
"name": "Scroll corner of LayoutIFrame IFRAME class='container'",
"position": [287, 137],
"bounds": [15, 15],
"transform": 1
} }
], ],
"transforms": [ "transforms": [
......
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling background of LayoutView #document",
"position": [15, 0],
"bounds": [1000, 1000],
"contentsOpaque": true,
"backgroundColor": "#FF0000",
"transform": 1
},
{
"name": "HorizontalScrollbar",
"position": [15, 385],
"bounds": [385, 15]
},
{
"name": "VerticalScrollbar",
"bounds": [15, 385]
},
{
"name": "Scroll corner of LayoutView #document",
"position": [0, 385],
"bounds": [15, 15]
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='layer' class='positioned'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 2
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[-615, 0, 0, 1]
]
},
{
"id": 2,
"parent": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[66, 50, 0, 1]
]
}
]
}
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling background of LayoutView #document",
"position": [15, 0],
"bounds": [1000, 1000],
"contentsOpaque": true,
"backgroundColor": "#FF0000",
"transform": 1
},
{
"name": "HorizontalScrollbar",
"position": [15, 385],
"bounds": [385, 15]
},
{
"name": "VerticalScrollbar",
"bounds": [15, 385]
},
{
"name": "Scroll corner of LayoutView #document",
"position": [0, 385],
"bounds": [15, 15]
},
{
"name": "LayoutNGBlockFlow (positioned) DIV class='positioned indicator'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#FF0000",
"transform": 2
},
{
"name": "LayoutNGBlockFlow (positioned) DIV class='positioned layer'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 3
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[-615, 0, 0, 1]
]
},
{
"id": 2,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[65, 50, 0, 1]
]
},
{
"id": 3,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[65, 50, 0, 1]
]
}
]
}
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