Commit 9e3f1763 authored by David Bokan's avatar David Bokan Committed by Commit Bot

[BlinkGenPropertyTrees] Update viewport only with flag

It seems this code may be responsible for performance regression in the
linked bug. This CL makes the code conditional on the blink gen property
trees flag (it's unneeded without the flag) to make sure its really the
cause of the regression. We can investigate performance improvements if
it's confirmed.

Bug: 868927
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I5a868f1f57429fe82cd01446b24d8466cc009e38
Reviewed-on: https://chromium-review.googlesource.com/1161205Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581237}
parent bcb12a7a
...@@ -145,12 +145,18 @@ TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) { ...@@ -145,12 +145,18 @@ TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) {
auto* positioned_scroll_translation = auto* positioned_scroll_translation =
positioned_scroll_properties->ScrollTranslation(); positioned_scroll_properties->ScrollTranslation();
auto* positioned_scroll_node = positioned_scroll_translation->ScrollNode(); auto* positioned_scroll_node = positioned_scroll_translation->ScrollNode();
EXPECT_EQ(GetDocument() // TODO(bokan): Viewport property node generation has been disabled
.GetPage() // temporarily with the flag off to diagnose https//crbug.com/868927.
->GetVisualViewport() if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
.GetScrollTranslationNode() EXPECT_EQ(GetDocument()
->ScrollNode(), .GetPage()
positioned_scroll_node->Parent()); ->GetVisualViewport()
.GetScrollTranslationNode()
->ScrollNode(),
positioned_scroll_node->Parent());
} else {
EXPECT_TRUE(positioned_scroll_node->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -3), EXPECT_EQ(TransformationMatrix().Translate(0, -3),
positioned_scroll_translation->Matrix()); positioned_scroll_translation->Matrix());
EXPECT_EQ(nullptr, target1_properties->ScrollTranslation()); EXPECT_EQ(nullptr, target1_properties->ScrollTranslation());
...@@ -177,12 +183,18 @@ TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) { ...@@ -177,12 +183,18 @@ TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) {
auto* transformed_scroll_translation = auto* transformed_scroll_translation =
transformed_scroll_properties->ScrollTranslation(); transformed_scroll_properties->ScrollTranslation();
auto* transformed_scroll_node = transformed_scroll_translation->ScrollNode(); auto* transformed_scroll_node = transformed_scroll_translation->ScrollNode();
EXPECT_EQ(GetDocument() // TODO(bokan): Viewport property node generation has been disabled
.GetPage() // temporarily with the flag off to diagnose https//crbug.com/868927.
->GetVisualViewport() if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
.GetScrollTranslationNode() EXPECT_EQ(GetDocument()
->ScrollNode(), .GetPage()
transformed_scroll_node->Parent()); ->GetVisualViewport()
.GetScrollTranslationNode()
->ScrollNode(),
transformed_scroll_node->Parent());
} else {
EXPECT_TRUE(transformed_scroll_node->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -5), EXPECT_EQ(TransformationMatrix().Translate(0, -5),
transformed_scroll_translation->Matrix()); transformed_scroll_translation->Matrix());
EXPECT_EQ(nullptr, target2_properties->ScrollTranslation()); EXPECT_EQ(nullptr, target2_properties->ScrollTranslation());
...@@ -386,9 +398,15 @@ TEST_P(PaintPropertyTreeBuilderTest, DocScrollingTraditional) { ...@@ -386,9 +398,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( // TODO(bokan): Viewport property node generation has been disabled
GetDocument().GetPage()->GetVisualViewport().GetScrollTranslationNode(), // temporarily with the flag off to diagnose https//crbug.com/868927.
DocPreTranslation()->Parent()); if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
EXPECT_EQ(
GetDocument().GetPage()->GetVisualViewport().GetScrollTranslationNode(),
DocPreTranslation()->Parent());
} else {
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());
...@@ -3307,12 +3325,18 @@ TEST_P(PaintPropertyTreeBuilderTest, NestedScrollProperties) { ...@@ -3307,12 +3325,18 @@ TEST_P(PaintPropertyTreeBuilderTest, NestedScrollProperties) {
auto* scroll_a_translation = auto* scroll_a_translation =
overflow_a_scroll_properties->ScrollTranslation(); overflow_a_scroll_properties->ScrollTranslation();
auto* overflow_a_scroll_node = scroll_a_translation->ScrollNode(); auto* overflow_a_scroll_node = scroll_a_translation->ScrollNode();
EXPECT_EQ(GetDocument() // TODO(bokan): Viewport property node generation has been disabled
.GetPage() // temporarily with the flag off to diagnose https//crbug.com/868927.
->GetVisualViewport() if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
.GetScrollTranslationNode() EXPECT_EQ(GetDocument()
->ScrollNode(), .GetPage()
overflow_a_scroll_node->Parent()); ->GetVisualViewport()
.GetScrollTranslationNode()
->ScrollNode(),
overflow_a_scroll_node->Parent());
} else {
EXPECT_TRUE(overflow_a_scroll_node->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -37), EXPECT_EQ(TransformationMatrix().Translate(0, -37),
scroll_a_translation->Matrix()); scroll_a_translation->Matrix());
EXPECT_EQ(IntRect(0, 0, 5, 3), overflow_a_scroll_node->ContainerRect()); EXPECT_EQ(IntRect(0, 0, 5, 3), overflow_a_scroll_node->ContainerRect());
...@@ -3429,12 +3453,16 @@ TEST_P(PaintPropertyTreeBuilderTest, PositionedScrollerIsNotNested) { ...@@ -3429,12 +3453,16 @@ 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::BlinkGenPropertyTreesEnabled()) {
.GetPage() EXPECT_EQ(GetDocument()
->GetVisualViewport() .GetPage()
.GetScrollTranslationNode() ->GetVisualViewport()
->ScrollNode(), .GetScrollTranslationNode()
fixed_overflow_scroll_node->Parent()); ->ScrollNode(),
fixed_overflow_scroll_node->Parent());
} else {
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());
...@@ -3490,12 +3518,18 @@ TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) { ...@@ -3490,12 +3518,18 @@ TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) {
auto* scroll_a_translation = auto* scroll_a_translation =
overflow_a_scroll_properties->ScrollTranslation(); overflow_a_scroll_properties->ScrollTranslation();
auto* overflow_a_scroll_node = scroll_a_translation->ScrollNode(); auto* overflow_a_scroll_node = scroll_a_translation->ScrollNode();
EXPECT_EQ(GetDocument() // TODO(bokan): Viewport property node generation has been disabled
.GetPage() // temporarily with the flag off to diagnose https//crbug.com/868927.
->GetVisualViewport() if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
.GetScrollTranslationNode() EXPECT_EQ(GetDocument()
->ScrollNode(), .GetPage()
overflow_a_scroll_node->Parent()); ->GetVisualViewport()
.GetScrollTranslationNode()
->ScrollNode(),
overflow_a_scroll_node->Parent());
} else {
EXPECT_TRUE(overflow_a_scroll_node->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -37), EXPECT_EQ(TransformationMatrix().Translate(0, -37),
scroll_a_translation->Matrix()); scroll_a_translation->Matrix());
EXPECT_EQ(IntRect(0, 0, 20, 20), overflow_a_scroll_node->ContainerRect()); EXPECT_EQ(IntRect(0, 0, 20, 20), overflow_a_scroll_node->ContainerRect());
...@@ -4749,12 +4783,18 @@ TEST_P(PaintPropertyTreeBuilderTest, ScrollBoundsOffset) { ...@@ -4749,12 +4783,18 @@ TEST_P(PaintPropertyTreeBuilderTest, ScrollBoundsOffset) {
auto* scroll_translation = scroll_properties->ScrollTranslation(); auto* scroll_translation = scroll_properties->ScrollTranslation();
auto* paint_offset_translation = scroll_properties->PaintOffsetTranslation(); auto* paint_offset_translation = scroll_properties->PaintOffsetTranslation();
auto* scroll_node = scroll_translation->ScrollNode(); auto* scroll_node = scroll_translation->ScrollNode();
EXPECT_EQ(GetDocument() // TODO(bokan): Viewport property node generation has been disabled
.GetPage() // temporarily with the flag off to diagnose https//crbug.com/868927.
->GetVisualViewport() if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
.GetScrollTranslationNode() EXPECT_EQ(GetDocument()
->ScrollNode(), .GetPage()
scroll_node->Parent()); ->GetVisualViewport()
.GetScrollTranslationNode()
->ScrollNode(),
scroll_node->Parent());
} else {
EXPECT_TRUE(scroll_node->Parent()->IsRoot());
}
EXPECT_EQ(TransformationMatrix().Translate(0, -42), EXPECT_EQ(TransformationMatrix().Translate(0, -42),
scroll_translation->Matrix()); scroll_translation->Matrix());
// The paint offset node should be offset by the margin. // The paint offset node should be offset by the margin.
......
...@@ -268,12 +268,25 @@ TEST_P(PaintPropertyTreeUpdateTest, ...@@ -268,12 +268,25 @@ TEST_P(PaintPropertyTreeUpdateTest,
->ScrollTranslation() ->ScrollTranslation()
->ScrollNode() ->ScrollNode()
->HasBackgroundAttachmentFixedDescendants()); ->HasBackgroundAttachmentFixedDescendants());
EXPECT_EQ(visual_viewport.GetScrollNode(), overflow_b->GetLayoutObject()
->FirstFragment() // TODO(bokan): Viewport property node generation has been disabled
.PaintProperties() // temporarily with the flag off to diagnose https//crbug.com/868927.
->ScrollTranslation() if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
->ScrollNode() EXPECT_EQ(visual_viewport.GetScrollNode(), overflow_b->GetLayoutObject()
->Parent()); ->FirstFragment()
.PaintProperties()
->ScrollTranslation()
->ScrollNode()
->Parent());
} else {
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");
......
...@@ -46,9 +46,11 @@ void PrePaintTreeWalk::WalkTree(LocalFrameView& root_frame_view) { ...@@ -46,9 +46,11 @@ 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(), VisualViewportPaintPropertyTreeBuilder::Update(
*context_storage_.back().tree_builder_context); 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