diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-11 11:06:35 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-11 10:19:37 +0000 |
commit | 47c928e8a4986fa683c5763762fa0069c9b3debe (patch) | |
tree | 6e4893678bde0f02995d1a66639eccd24f947a47 /chromium/cc/trees | |
parent | 98a0061b881063a62c1941ccb67af6660ca89062 (diff) | |
download | qtwebengine-chromium-47c928e8a4986fa683c5763762fa0069c9b3debe.tar.gz |
BASELINE: Update Chromium to 49.0.2623.48
Change-Id: I684541113ff518e3a7d51dfd0b31962b06d10af1
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/cc/trees')
-rw-r--r-- | chromium/cc/trees/draw_property_utils.cc | 49 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_host_common_unittest.cc | 19 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_host_impl.cc | 2 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_host_impl_unittest.cc | 34 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_impl.cc | 1 | ||||
-rw-r--r-- | chromium/cc/trees/layer_tree_impl_unittest.cc | 8 |
6 files changed, 97 insertions, 16 deletions
diff --git a/chromium/cc/trees/draw_property_utils.cc b/chromium/cc/trees/draw_property_utils.cc index 07270db1dbd..f79f18001cb 100644 --- a/chromium/cc/trees/draw_property_utils.cc +++ b/chromium/cc/trees/draw_property_utils.cc @@ -85,18 +85,32 @@ void CalculateVisibleRects(const std::vector<LayerType*>& visible_layer_list, // necessarily have the same target (the root). if (clip_node->data.target_id != target_node->id && non_root_surfaces_enabled) { - // In this case, layer has a clip parent (or shares the target with an - // ancestor layer that has clip parent) and the clip parent's target is - // different from the layer's target. As the layer's target has - // unclippped descendants, it is unclippped. + // In this case, layer has a clip parent or scroll parent (or shares the + // target with an ancestor layer that has clip parent) and the clip + // parent's target is different from the layer's target. As the layer's + // target has unclippped descendants, it is unclippped. if (!clip_node->data.layers_are_clipped) { layer->set_visible_rect_from_property_trees(gfx::Rect(layer_bounds)); layer->set_clip_rect_in_target_space_from_property_trees(gfx::Rect()); continue; } gfx::Transform clip_to_target; - success = transform_tree.ComputeTransform( - clip_node->data.target_id, target_node->id, &clip_to_target); + if (clip_node->data.target_id > target_node->id) { + // In this case, layer has a scroll parent. We need to keep the scale + // at the layer's target but remove the scale at the scroll parent's + // target. + success = transform_tree.ComputeTransformWithDestinationSublayerScale( + clip_node->data.target_id, target_node->id, &clip_to_target); + const TransformNode* source_node = + transform_tree.Node(clip_node->data.target_id); + if (source_node->data.sublayer_scale.x() != 0.f && + source_node->data.sublayer_scale.y() != 0.f) + clip_to_target.Scale(1.0f / source_node->data.sublayer_scale.x(), + 1.0f / source_node->data.sublayer_scale.y()); + } else { + success = transform_tree.ComputeTransform( + clip_node->data.target_id, target_node->id, &clip_to_target); + } if (!success) { // An animated singular transform may become non-singular during the // animation, so we still need to compute a visible rect. In this @@ -105,19 +119,28 @@ void CalculateVisibleRects(const std::vector<LayerType*>& visible_layer_list, layer->set_clip_rect_in_target_space_from_property_trees(gfx::Rect()); continue; } - DCHECK_LT(clip_node->data.target_id, target_node->id); // We use the clip node's clip_in_target_space (and not // combined_clip_in_target_space) here because we want to clip // with respect to clip parent's local clip and not its combined clip as // the combined clip has even the clip parent's target's clip baked into // it and as our target is different, we don't want to use it in our // visible rect computation. - combined_clip_rect_in_target_space = - gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( - clip_to_target, clip_node->data.clip_in_target_space)); - clip_rect_in_target_space = - gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( - clip_to_target, clip_node->data.clip_in_target_space)); + if (clip_node->data.target_id < target_node->id) { + combined_clip_rect_in_target_space = + gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( + clip_to_target, clip_node->data.clip_in_target_space)); + clip_rect_in_target_space = + gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( + clip_to_target, clip_node->data.clip_in_target_space)); + } else { + combined_clip_rect_in_target_space = + gfx::ToEnclosingRect(MathUtil::MapClippedRect( + clip_to_target, clip_node->data.clip_in_target_space)); + clip_rect_in_target_space = + gfx::ToEnclosingRect(MathUtil::MapClippedRect( + clip_to_target, clip_node->data.clip_in_target_space)); + } + } else { clip_rect_in_target_space = gfx::ToEnclosingRect(clip_node->data.clip_in_target_space); diff --git a/chromium/cc/trees/layer_tree_host_common_unittest.cc b/chromium/cc/trees/layer_tree_host_common_unittest.cc index 54f55342680..2287f50a5df 100644 --- a/chromium/cc/trees/layer_tree_host_common_unittest.cc +++ b/chromium/cc/trees/layer_tree_host_common_unittest.cc @@ -6437,10 +6437,23 @@ TEST_F(LayerTreeHostCommonTest, ScrollChildAndScrollParentDifferentTargets) { gfx::Size(50, 50), true, false, true); SetLayerPropertiesForTesting(scroll_parent, identity_transform, gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), - true, false, true); + true, false, false); + scroll_parent_target->SetMasksToBounds(true); - ExecuteCalculateDrawProperties(root); - EXPECT_EQ(scroll_child->DrawTransform(), identity_transform); + float device_scale_factor = 1.5f; + LayerImplList render_surface_layer_list_impl; + root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); + LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( + root, root->bounds(), identity_transform, &render_surface_layer_list_impl, + root->layer_tree_impl()->current_render_surface_list_id()); + inputs.device_scale_factor = device_scale_factor; + LayerTreeHostCommon::CalculateDrawProperties(&inputs); + + EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40)); + EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75)); + gfx::Transform scale; + scale.Scale(1.5f, 1.5f); + EXPECT_EQ(scroll_child->DrawTransform(), scale); } TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { diff --git a/chromium/cc/trees/layer_tree_host_impl.cc b/chromium/cc/trees/layer_tree_host_impl.cc index 96c1d684fd3..e9240a18872 100644 --- a/chromium/cc/trees/layer_tree_host_impl.cc +++ b/chromium/cc/trees/layer_tree_host_impl.cc @@ -1495,6 +1495,8 @@ void LayerTreeHostImpl::SetExternalTilePriorityConstraints( if (tile_priority_params_changed) { active_tree_->set_needs_update_draw_properties(); + if (pending_tree_) + pending_tree_->set_needs_update_draw_properties(); // Compositor, not OutputSurface, is responsible for setting damage and // triggering redraw for constraint changes. diff --git a/chromium/cc/trees/layer_tree_host_impl_unittest.cc b/chromium/cc/trees/layer_tree_host_impl_unittest.cc index e1aa12df7e5..3026401a36c 100644 --- a/chromium/cc/trees/layer_tree_host_impl_unittest.cc +++ b/chromium/cc/trees/layer_tree_host_impl_unittest.cc @@ -8984,6 +8984,40 @@ TEST_F(ResourcelessSoftwareLayerTreeHostImplTest, EXPECT_FALSE(did_request_prepare_tiles_); } +TEST_F(LayerTreeHostImplTest, ExternalTileConstraintReflectedInPendingTree) { + EXPECT_FALSE(host_impl_->CommitToActiveTree()); + const gfx::Size layer_size(100, 100); + host_impl_->SetViewportSize(layer_size); + bool update_lcd_text = false; + + // Set up active and pending tree. + host_impl_->CreatePendingTree(); + host_impl_->pending_tree()->SetRootLayer( + LayerImpl::Create(host_impl_->pending_tree(), 1)); + host_impl_->pending_tree()->BuildPropertyTreesForTesting(); + host_impl_->pending_tree()->UpdateDrawProperties(update_lcd_text); + + host_impl_->ActivateSyncTree(); + host_impl_->active_tree()->BuildPropertyTreesForTesting(); + host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); + + host_impl_->CreatePendingTree(); + host_impl_->pending_tree()->UpdateDrawProperties(update_lcd_text); + host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); + + EXPECT_FALSE(host_impl_->pending_tree()->needs_update_draw_properties()); + EXPECT_FALSE(host_impl_->active_tree()->needs_update_draw_properties()); + + // Update external constraints should set_needs_update_draw_properties on + // both trees. + gfx::Transform external_transform; + gfx::Rect external_viewport(10, 20); + host_impl_->SetExternalTilePriorityConstraints(external_viewport, + external_transform); + EXPECT_TRUE(host_impl_->pending_tree()->needs_update_draw_properties()); + EXPECT_TRUE(host_impl_->active_tree()->needs_update_draw_properties()); +} + TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) { const gfx::Size layer_size(100, 100); SetupScrollAndContentsLayers(layer_size); diff --git a/chromium/cc/trees/layer_tree_impl.cc b/chromium/cc/trees/layer_tree_impl.cc index 6e00daba720..c16792c1b2f 100644 --- a/chromium/cc/trees/layer_tree_impl.cc +++ b/chromium/cc/trees/layer_tree_impl.cc @@ -599,6 +599,7 @@ void LayerTreeImpl::SetDeviceScaleFactor(float device_scale_factor) { return; device_scale_factor_ = device_scale_factor; + set_needs_update_draw_properties(); if (IsActiveTree()) layer_tree_host_impl_->SetFullRootLayerDamage(); } diff --git a/chromium/cc/trees/layer_tree_impl_unittest.cc b/chromium/cc/trees/layer_tree_impl_unittest.cc index 5298ed9c410..393266e9d7f 100644 --- a/chromium/cc/trees/layer_tree_impl_unittest.cc +++ b/chromium/cc/trees/layer_tree_impl_unittest.cc @@ -2370,5 +2370,13 @@ TEST_F(LayerTreeImplTest, NumLayersSmallTree) { EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); } +TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { + host_impl().active_tree()->SetDeviceScaleFactor(1.f); + host_impl().active_tree()->UpdateDrawProperties(false); + EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); + host_impl().active_tree()->SetDeviceScaleFactor(2.f); + EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); +} + } // namespace } // namespace cc |