Commit d0b9a4ba authored by David Bokan's avatar David Bokan Committed by Commit Bot

[blink-gen-property-trees] Skip viewport update pre-BGPT

Adding viewport nodes causes a performance regression so this CL turns
off the paint tree update in VisualViewport if BGPT (and SPv2) are off
since the nodes aren't needed.

Bug: 879205
Cq-Include-Trybots: luci.chromium.try:linux-blink-gen-property-trees;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I19060e1d487d50ac9b65ae7bdaa32dba2e5caaa7
Reviewed-on: https://chromium-review.googlesource.com/1228489Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592538}
parent 361cc6fa
...@@ -447,9 +447,15 @@ TEST_P(PaintPropertyTreeBuilderTest, DocScrollingTraditional) { ...@@ -447,9 +447,15 @@ TEST_P(PaintPropertyTreeBuilderTest, DocScrollingTraditional) {
LocalFrameView* frame_view = GetDocument().View(); LocalFrameView* frame_view = GetDocument().View();
frame_view->UpdateAllLifecyclePhases(); frame_view->UpdateAllLifecyclePhases();
EXPECT_EQ(TransformationMatrix(), DocPreTranslation()->Matrix()); EXPECT_EQ(TransformationMatrix(), DocPreTranslation()->Matrix());
EXPECT_EQ( if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() ||
GetDocument().GetPage()->GetVisualViewport().GetScrollTranslationNode(), RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
DocPreTranslation()->Parent()); EXPECT_EQ(
GetDocument().GetPage()->GetVisualViewport().GetScrollTranslationNode(),
DocPreTranslation()->Parent());
} else {
// Pre-BGPT we don't create the visual viewport property nodes.
EXPECT_TRUE(DocPreTranslation()->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -100), EXPECT_EQ(TransformationMatrix().Translate(0, -100),
DocScrollTranslation()->Matrix()); DocScrollTranslation()->Matrix());
EXPECT_EQ(DocPreTranslation(), DocScrollTranslation()->Parent()); EXPECT_EQ(DocPreTranslation(), DocScrollTranslation()->Parent());
...@@ -3785,12 +3791,18 @@ TEST_P(PaintPropertyTreeBuilderTest, PositionedScrollerIsNotNested) { ...@@ -3785,12 +3791,18 @@ TEST_P(PaintPropertyTreeBuilderTest, PositionedScrollerIsNotNested) {
auto* fixed_overflow_scroll_node = fixed_scroll_translation->ScrollNode(); auto* fixed_overflow_scroll_node = fixed_scroll_translation->ScrollNode();
// The fixed position overflow scroll node is parented under the root, not the // The fixed position overflow scroll node is parented under the root, not the
// dom-order parent or frame's scroll. // dom-order parent or frame's scroll.
EXPECT_EQ(GetDocument() if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() ||
.GetPage() RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
->GetVisualViewport() EXPECT_EQ(GetDocument()
.GetScrollTranslationNode() .GetPage()
->ScrollNode(), ->GetVisualViewport()
fixed_overflow_scroll_node->Parent()); .GetScrollTranslationNode()
->ScrollNode(),
fixed_overflow_scroll_node->Parent());
} else {
// Pre-BGPT we don't create the visual viewport property nodes.
EXPECT_TRUE(fixed_overflow_scroll_node->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -43), EXPECT_EQ(TransformationMatrix().Translate(0, -43),
fixed_scroll_translation->Matrix()); fixed_scroll_translation->Matrix());
EXPECT_EQ(IntRect(0, 0, 13, 11), fixed_overflow_scroll_node->ContainerRect()); EXPECT_EQ(IntRect(0, 0, 13, 11), fixed_overflow_scroll_node->ContainerRect());
......
...@@ -268,12 +268,24 @@ TEST_P(PaintPropertyTreeUpdateTest, ...@@ -268,12 +268,24 @@ TEST_P(PaintPropertyTreeUpdateTest,
->ScrollTranslation() ->ScrollTranslation()
->ScrollNode() ->ScrollNode()
->HasBackgroundAttachmentFixedDescendants()); ->HasBackgroundAttachmentFixedDescendants());
EXPECT_EQ(visual_viewport.GetScrollNode(), overflow_b->GetLayoutObject() if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() ||
->FirstFragment() RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
.PaintProperties() EXPECT_EQ(visual_viewport.GetScrollNode(), overflow_b->GetLayoutObject()
->ScrollTranslation() ->FirstFragment()
->ScrollNode() .PaintProperties()
->Parent()); ->ScrollTranslation()
->ScrollNode()
->Parent());
} else {
// Pre-BGPT we don't create the visual viewport property nodes.
EXPECT_TRUE(overflow_b->GetLayoutObject()
->FirstFragment()
.PaintProperties()
->ScrollTranslation()
->ScrollNode()
->Parent()
->IsRoot());
}
// Removing a main thread scrolling reason should update the entire tree. // Removing a main thread scrolling reason should update the entire tree.
overflow_b->removeAttribute("class"); overflow_b->removeAttribute("class");
...@@ -797,6 +809,11 @@ TEST_P(PaintPropertyTreeUpdateTest, ScrollBoundsChange) { ...@@ -797,6 +809,11 @@ TEST_P(PaintPropertyTreeUpdateTest, ScrollBoundsChange) {
// from the viewport's viewable area. // from the viewport's viewable area.
TEST_P(PaintPropertyTreeUpdateTest, TEST_P(PaintPropertyTreeUpdateTest,
ViewportContentsAndContainerRectsIncludeScrollbar) { ViewportContentsAndContainerRectsIncludeScrollbar) {
// Pre-BGPT we don't create the visual viewport property nodes.
if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() &&
!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled())
return;
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<style> <style>
::-webkit-scrollbar {width: 20px; height: 20px} ::-webkit-scrollbar {width: 20px; height: 20px}
......
...@@ -48,9 +48,12 @@ void PrePaintTreeWalk::WalkTree(LocalFrameView& root_frame_view) { ...@@ -48,9 +48,12 @@ void PrePaintTreeWalk::WalkTree(LocalFrameView& root_frame_view) {
if (needs_tree_builder_context_update) if (needs_tree_builder_context_update)
GeometryMapper::ClearCache(); GeometryMapper::ClearCache();
VisualViewportPaintPropertyTreeBuilder::Update( if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled() ||
root_frame_view.GetPage()->GetVisualViewport(), RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) {
*context_storage_.back().tree_builder_context); VisualViewportPaintPropertyTreeBuilder::Update(
root_frame_view.GetPage()->GetVisualViewport(),
*context_storage_.back().tree_builder_context);
}
Walk(root_frame_view); Walk(root_frame_view);
paint_invalidator_.ProcessPendingDelayedPaintInvalidations(); paint_invalidator_.ProcessPendingDelayedPaintInvalidations();
......
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