diff options
author | bokan <bokan@chromium.org> | 2014-10-07 03:33:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-07 10:33:28 +0000 |
commit | c7935852d9590e2456e92c4ad2d0b48c816ec5ed (patch) | |
tree | 6ab0e88b8d6df69b953d99fb21ee5d021d4202c5 /cc/trees | |
parent | 72b343fbeb63c67cd80c1cfa5a866b3360f9ca92 (diff) | |
download | chromium_src-c7935852d9590e2456e92c4ad2d0b48c816ec5ed.zip chromium_src-c7935852d9590e2456e92c4ad2d0b48c816ec5ed.tar.gz chromium_src-c7935852d9590e2456e92c4ad2d0b48c816ec5ed.tar.bz2 |
Converted LayerImpl::bounds() to return SizeF.
Since bounds includes bounds_delta, which is SizeF, it makes sense to return
the floating point sum of these two values. In call sites broken by the
change, the returned value is converted to Size using ToCeiledSize to
preserve the current snapping behavior, though in most (all?) these cases
the layer bounds are expected to be integral anyway.
BUG=
Review URL: https://codereview.chromium.org/634683003
Cr-Commit-Position: refs/heads/master@{#298439}
Diffstat (limited to 'cc/trees')
-rw-r--r-- | cc/trees/damage_tracker.cc | 7 | ||||
-rw-r--r-- | cc/trees/damage_tracker_unittest.cc | 17 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common_unittest.cc | 142 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 12 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_scroll.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.h | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl_unittest.cc | 44 | ||||
-rw-r--r-- | cc/trees/occlusion_tracker_unittest.cc | 11 | ||||
-rw-r--r-- | cc/trees/tree_synchronizer_unittest.cc | 2 |
12 files changed, 171 insertions, 84 deletions
diff --git a/cc/trees/damage_tracker.cc b/cc/trees/damage_tracker.cc index 866f09d..2b80c4c 100644 --- a/cc/trees/damage_tracker.cc +++ b/cc/trees/damage_tracker.cc @@ -14,6 +14,7 @@ #include "cc/trees/layer_tree_host_common.h" #include "cc/trees/layer_tree_impl.h" #include "ui/gfx/geometry/rect_conversions.h" +#include "ui/gfx/geometry/size_conversions.h" namespace cc { @@ -209,7 +210,8 @@ gfx::Rect DamageTracker::TrackDamageFromSurfaceMask( // expected to be a common case. if (target_surface_mask_layer->LayerPropertyChanged() || !target_surface_mask_layer->update_rect().IsEmpty()) { - damage_rect = gfx::Rect(target_surface_mask_layer->bounds()); + damage_rect = gfx::Rect( + gfx::ToCeiledSize(target_surface_mask_layer->bounds())); } return damage_rect; @@ -378,7 +380,8 @@ void DamageTracker::ExtendDamageForRenderSurface( const gfx::Transform& replica_draw_transform = render_surface->replica_draw_transform(); gfx::Rect replica_mask_layer_rect = MathUtil::MapEnclosingClippedRect( - replica_draw_transform, gfx::Rect(replica_mask_layer->bounds())); + replica_draw_transform, + gfx::Rect(gfx::ToCeiledSize(replica_mask_layer->bounds()))); data.Update(replica_mask_layer_rect, mailboxId_); // In the current implementation, a change in the replica mask damages the diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc index b6a4409..56d990e 100644 --- a/cc/trees/damage_tracker_unittest.cc +++ b/cc/trees/damage_tracker_unittest.cc @@ -18,6 +18,7 @@ #include "third_party/skia/include/effects/SkBlurImageFilter.h" #include "ui/gfx/geometry/quad_f.h" #include "ui/gfx/geometry/rect_conversions.h" +#include "ui/gfx/geometry/size_conversions.h" namespace cc { namespace { @@ -32,7 +33,7 @@ void ExecuteCalculateDrawProperties(LayerImpl* root, FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root, root->bounds(), render_surface_layer_list); + root, gfx::ToCeiledSize(root->bounds()), render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); } @@ -1137,8 +1138,8 @@ TEST_F(DamageTrackerTest, VerifyDamageForMask) { scoped_ptr<LayerImpl> mask_layer = LayerImpl::Create(host_impl_.active_tree(), 3); mask_layer->SetPosition(child->position()); - mask_layer->SetBounds(child->bounds()); - mask_layer->SetContentBounds(child->bounds()); + mask_layer->SetBounds(gfx::ToCeiledSize(child->bounds())); + mask_layer->SetContentBounds(gfx::ToCeiledSize(child->bounds())); child->SetMaskLayer(mask_layer.Pass()); } LayerImpl* mask_layer = child->mask_layer(); @@ -1241,8 +1242,9 @@ TEST_F(DamageTrackerTest, VerifyDamageForReplicaMask) { scoped_ptr<LayerImpl> replica_mask_layer = LayerImpl::Create(host_impl_.active_tree(), 7); replica_mask_layer->SetPosition(gfx::PointF()); - replica_mask_layer->SetBounds(grand_child1->bounds()); - replica_mask_layer->SetContentBounds(grand_child1->bounds()); + replica_mask_layer->SetBounds(gfx::ToCeiledSize(grand_child1->bounds())); + replica_mask_layer->SetContentBounds( + gfx::ToCeiledSize(grand_child1->bounds())); grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); } LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); @@ -1319,8 +1321,9 @@ TEST_F(DamageTrackerTest, VerifyDamageForReplicaMaskWithTransformOrigin) { LayerImpl::Create(host_impl_.active_tree(), 7); replica_mask_layer->SetPosition(gfx::PointF()); // Note: this is not the transform origin being tested. - replica_mask_layer->SetBounds(grand_child1->bounds()); - replica_mask_layer->SetContentBounds(grand_child1->bounds()); + replica_mask_layer->SetBounds(gfx::ToCeiledSize(grand_child1->bounds())); + replica_mask_layer->SetContentBounds( + gfx::ToCeiledSize(grand_child1->bounds())); grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); } LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 9efcaea..2157210 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -30,6 +30,7 @@ #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/quad_f.h" #include "ui/gfx/transform.h" @@ -1158,7 +1159,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), translate, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + translate, + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(translate, root->draw_properties().target_space_transform); @@ -1173,7 +1177,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), scale, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + scale, + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(scale, root->draw_properties().target_space_transform); @@ -1188,7 +1195,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), rotate, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + rotate, + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(rotate, root->draw_properties().target_space_transform); @@ -1205,7 +1215,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), composite, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + composite, + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(composite, root->draw_properties().target_space_transform); @@ -1219,7 +1232,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), translate, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + translate, + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -1241,7 +1257,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), translate, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + translate, + &render_surface_layer_list); inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); inputs.can_adjust_raster_scales = true; @@ -1262,7 +1281,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), composite, &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + composite, + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); gfx::Transform compositeSquared = composite; @@ -4471,7 +4493,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4514,7 +4538,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4542,7 +4568,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4567,7 +4595,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4655,7 +4685,9 @@ TEST_F(LayerTreeHostCommonTest, float page_scale_factor = 1.f; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(), @@ -4737,7 +4769,9 @@ TEST_F(LayerTreeHostCommonTest, SmallContentsScale) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4763,7 +4797,9 @@ TEST_F(LayerTreeHostCommonTest, SmallContentsScale) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4884,7 +4920,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -5085,7 +5123,9 @@ TEST_F(LayerTreeHostCommonTest, SkMScalar device_scale_factor = 5.0; SkMScalar page_scale_factor = 7.0; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -5230,7 +5270,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForAnimatingLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5246,7 +5288,9 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForAnimatingLayer) { { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5657,7 +5701,9 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5867,7 +5913,9 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5923,7 +5971,9 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5981,7 +6031,9 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6036,7 +6088,9 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6148,7 +6202,9 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6257,7 +6313,9 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6317,7 +6375,9 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6946,7 +7006,9 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { LayerImplList render_surface_layer_list; FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_render_to_separate_surface = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6956,7 +7018,9 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); inputs.can_render_to_separate_surface = false; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7501,7 +7565,7 @@ TEST_F(LayerTreeHostCommonTest, OutOfOrderClippingRequiresRSLLSorting) { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( root.get(), - root->bounds(), + gfx::ToCeiledSize(root->bounds()), identity_transform, &render_surface_layer_list); @@ -7637,7 +7701,9 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7732,7 +7798,9 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7755,7 +7823,9 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7780,7 +7850,9 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7804,7 +7876,9 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list); + root.get(), + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_VECTOR_EQ( diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 77ebfdf..5cdc155 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -2657,7 +2657,9 @@ bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, if (!layer_impl->HasScrollbar(VERTICAL)) continue; - float height = layer_impl->clip_height(); + float height = layer_impl->scroll_clip_layer() + ? layer_impl->scroll_clip_layer()->bounds().height() + : 0; // These magical values match WebKit and are designed to scroll nearly the // entire visible content height but leave a bit of overlap. diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 335fa8a..6b1b97b 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -898,7 +898,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { EXPECT_EQ(scroll_layer, host_impl_->InnerViewportScrollLayer()); LayerImpl* container_layer = scroll_layer->scroll_clip_layer(); - EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); + EXPECT_EQ(gfx::SizeF(50, 50), container_layer->bounds()); float min_page_scale = 1.f, max_page_scale = 4.f; float page_scale_factor = 1.f; @@ -929,7 +929,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { EXPECT_FALSE(did_request_animate_); EXPECT_TRUE(did_request_redraw_); EXPECT_TRUE(did_request_commit_); - EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); + EXPECT_EQ(gfx::SizeF(50, 50), container_layer->bounds()); scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); @@ -3817,7 +3817,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); root->SetBounds(gfx::Size(10, 10)); - root->SetContentBounds(root->bounds()); + root->SetContentBounds(gfx::ToCeiledSize(root->bounds())); root->SetDrawsContent(false); host_impl_->active_tree()->SetRootLayer(root.Pass()); } @@ -4733,7 +4733,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( root->CreateRenderSurface(); root->SetPosition(root_rect.origin()); root->SetBounds(root_rect.size()); - root->SetContentBounds(root->bounds()); + root->SetContentBounds(gfx::ToCeiledSize(root->bounds())); root->draw_properties().visible_content_rect = root_rect; root->SetDrawsContent(false); root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); @@ -4741,14 +4741,14 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); child->SetOpacity(0.5f); child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); - child->SetContentBounds(child->bounds()); + child->SetContentBounds(gfx::ToCeiledSize(child->bounds())); child->draw_properties().visible_content_rect = child_rect; child->SetDrawsContent(false); child->SetForceRenderSurface(true); grand_child->SetPosition(grand_child_rect.origin()); grand_child->SetBounds(grand_child_rect.size()); - grand_child->SetContentBounds(grand_child->bounds()); + grand_child->SetContentBounds(gfx::ToCeiledSize(grand_child->bounds())); grand_child->draw_properties().visible_content_rect = grand_child_rect; grand_child->SetDrawsContent(true); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index d8b8b3e..0c25e06 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -200,7 +200,7 @@ class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { case DONE: break; case BOUNDS: - EXPECT_EQ(gfx::Size(20, 20).ToString(), layer->bounds().ToString()); + EXPECT_EQ(gfx::SizeF(20, 20).ToString(), layer->bounds().ToString()); break; case HIDE_LAYER_AND_SUBTREE: EXPECT_TRUE(layer->hide_layer_and_subtree()); @@ -2423,10 +2423,10 @@ class LayerTreeHostTestChangeLayerPropertiesInPaintContents num_commits_++; if (num_commits_ == 1) { LayerImpl* root_layer = host_impl->active_tree()->root_layer(); - EXPECT_SIZE_EQ(gfx::Size(1, 1), root_layer->bounds()); + EXPECT_SIZE_EQ(gfx::SizeF(1, 1), root_layer->bounds()); } else { LayerImpl* root_layer = host_impl->active_tree()->root_layer(); - EXPECT_SIZE_EQ(gfx::Size(2, 2), root_layer->bounds()); + EXPECT_SIZE_EQ(gfx::SizeF(2, 2), root_layer->bounds()); EndTest(); } } @@ -4070,7 +4070,7 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { switch (impl->active_tree()->source_frame_number()) { case 1: - EXPECT_EQ(gfx::Size(5, 5).ToString(), child->bounds().ToString()); + EXPECT_EQ(gfx::SizeF(5, 5).ToString(), child->bounds().ToString()); break; } } diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 82cee89..a185391 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -1055,7 +1055,7 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset InputHandler::Gesture)); // Set max_scroll_offset = (0, 0). - scroll_layer->SetBounds(root->bounds()); + scroll_layer->SetBounds(gfx::ToCeiledSize(root->bounds())); EXPECT_EQ(InputHandler::ScrollIgnored, scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 161b361..3195352 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -570,12 +570,12 @@ const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { return render_surface_layer_list_; } -gfx::Size LayerTreeImpl::ScrollableSize() const { +gfx::SizeF LayerTreeImpl::ScrollableSize() const { LayerImpl* root_scroll_layer = OuterViewportScrollLayer() ? OuterViewportScrollLayer() : InnerViewportScrollLayer(); if (!root_scroll_layer || root_scroll_layer->children().empty()) - return gfx::Size(); + return gfx::SizeF(); return root_scroll_layer->children()[0]->bounds(); } diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 95a9bac..51ae456 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -209,7 +209,7 @@ class CC_EXPORT LayerTreeImpl { // These return the size of the root scrollable area and the size of // the user-visible scrolling viewport, in CSS layout coordinates. - gfx::Size ScrollableSize() const; + gfx::SizeF ScrollableSize() const; gfx::SizeF ScrollableViewportSize() const; gfx::Rect RootScrollLayerDeviceViewportBounds() const; diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index 7fc1645..211262c 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc @@ -59,7 +59,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -183,7 +183,7 @@ TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); // Sanity check the scenario we just created. @@ -249,7 +249,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePositionedLayer) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -305,7 +305,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -374,7 +374,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -454,7 +454,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerWithScaledContents) { root->AddChild(test_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -545,7 +545,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) { root->AddChild(clipping_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -670,7 +670,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) { root->AddChild(child.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -793,7 +793,7 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) { root->AddChild(intermediate_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -901,7 +901,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) { LayerImpl* child2 = root->children()[1]; LayerImpl* grand_child1 = child1->children()[0]; - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1049,7 +1049,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) { LayerImpl* child2 = root->children()[1]; LayerImpl* grand_child1 = child1->children()[0]; - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1167,7 +1167,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) { root->AddChild(child.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1242,7 +1242,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) { root->AddChild(child.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1335,7 +1335,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) { LayerImpl* child2 = root->children()[1]; LayerImpl* grand_child1 = child1->children()[0]; - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1425,7 +1425,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1514,7 +1514,7 @@ TEST_F(LayerTreeImplTest, root->SetDrawsContent(true); root->SetTouchEventHandlerRegion(touch_handler_region); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1592,7 +1592,7 @@ TEST_F(LayerTreeImplTest, root->SetDrawsContent(true); root->SetTouchEventHandlerRegion(touch_handler_region); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1688,7 +1688,7 @@ TEST_F(LayerTreeImplTest, root->AddChild(test_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1927,7 +1927,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) { root->AddChild(clipping_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2025,7 +2025,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) { root->AddChild(notouch_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2087,7 +2087,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) { false); root->SetDrawsContent(true); - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2194,7 +2194,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) { root->AddChild(clipping_layer.Pass()); } - host_impl().SetViewportSize(root->bounds()); + host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index 6ab3397..007226d 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -22,6 +22,7 @@ #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/transform.h" namespace cc { @@ -309,7 +310,9 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test { Types::RecursiveUpdateNumChildren(root); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root, root->bounds(), &render_surface_layer_list_impl_); + root, + gfx::ToCeiledSize(root->bounds()), + &render_surface_layer_list_impl_); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -323,7 +326,9 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test { render_surface_layer_list_.reset(new RenderSurfaceLayerList); LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root, root->bounds(), render_surface_layer_list_.get()); + root, + gfx::ToCeiledSize(root->bounds()), + render_surface_layer_list_.get()); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -413,7 +418,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test { const gfx::Size& bounds) { SetBaseProperties(layer, transform, position, bounds); - layer->SetContentBounds(layer->bounds()); + layer->SetContentBounds(gfx::ToCeiledSize(layer->bounds())); } void SetReplica(Layer* owning_layer, scoped_refptr<Layer> layer) { diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index faa86ce..fcc7cd6 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc @@ -361,7 +361,7 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndProperties) { EXPECT_EQ(first_child_opacity, layer_impl_tree_root->children()[0]->opacity()); - gfx::Size second_layer_impl_child_bounds = + gfx::SizeF second_layer_impl_child_bounds = layer_impl_tree_root->children()[1]->bounds(); EXPECT_EQ(second_child_bounds.width(), second_layer_impl_child_bounds.width()); |