summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorbokan <bokan@chromium.org>2014-10-07 03:33:05 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-07 10:33:28 +0000
commitc7935852d9590e2456e92c4ad2d0b48c816ec5ed (patch)
tree6ab0e88b8d6df69b953d99fb21ee5d021d4202c5 /cc
parent72b343fbeb63c67cd80c1cfa5a866b3360f9ca92 (diff)
downloadchromium_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')
-rw-r--r--cc/debug/debug_rect_history.cc4
-rw-r--r--cc/layers/delegated_renderer_layer_impl.cc2
-rw-r--r--cc/layers/heads_up_display_layer_impl.cc6
-rw-r--r--cc/layers/layer_impl.cc9
-rw-r--r--cc/layers/layer_impl.h5
-rw-r--r--cc/layers/layer_impl_unittest.cc4
-rw-r--r--cc/layers/painted_scrollbar_layer_impl.cc1
-rw-r--r--cc/layers/picture_image_layer_impl_unittest.cc8
-rw-r--r--cc/layers/picture_layer.cc4
-rw-r--r--cc/layers/picture_layer_impl.cc10
-rw-r--r--cc/layers/picture_layer_unittest.cc2
-rw-r--r--cc/layers/ui_resource_layer_impl.cc3
-rw-r--r--cc/layers/ui_resource_layer_impl_unittest.cc5
-rw-r--r--cc/test/layer_tree_json_parser.cc6
-rw-r--r--cc/trees/damage_tracker.cc7
-rw-r--r--cc/trees/damage_tracker_unittest.cc17
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc142
-rw-r--r--cc/trees/layer_tree_host_impl.cc4
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc12
-rw-r--r--cc/trees/layer_tree_host_unittest.cc8
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc4
-rw-r--r--cc/trees/layer_tree_impl.h2
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc44
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc11
-rw-r--r--cc/trees/tree_synchronizer_unittest.cc2
26 files changed, 208 insertions, 116 deletions
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc
index e8792e7..71611a6 100644
--- a/cc/debug/debug_rect_history.cc
+++ b/cc/debug/debug_rect_history.cc
@@ -78,9 +78,9 @@ void DebugRectHistory::SavePaintRects(LayerImpl* layer) {
if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) {
float width_scale = layer->content_bounds().width() /
- static_cast<float>(layer->bounds().width());
+ layer->bounds().width();
float height_scale = layer->content_bounds().height() /
- static_cast<float>(layer->bounds().height());
+ layer->bounds().height();
gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect(
gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale);
debug_rects_.push_back(
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
index 84c06a6..c7c6468 100644
--- a/cc/layers/delegated_renderer_layer_impl.cc
+++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -149,7 +149,7 @@ void DelegatedRendererLayerImpl::SetFrameData(
gfx::RectF damage_in_layer = damage_in_frame;
damage_in_layer.Scale(inverse_device_scale_factor_);
SetUpdateRect(gfx::IntersectRects(
- gfx::UnionRects(update_rect(), damage_in_layer), gfx::Rect(bounds())));
+ gfx::UnionRects(update_rect(), damage_in_layer), gfx::RectF(bounds())));
SetRenderPasses(&render_pass_list);
have_render_passes_to_push_ = true;
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index ab9e8a4..7272725 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -360,7 +360,7 @@ SkRect HeadsUpDisplayLayerImpl::DrawFPSDisplay(
int width = kGraphWidth + kHistogramWidth + 4 * kPadding;
int height = kFontHeight + kGraphHeight + 4 * kPadding + 2;
- int left = bounds().width() - width - right;
+ int left = ceil(bounds().width()) - width - right;
SkRect area = SkRect::MakeXYWH(left, top, width, height);
SkPaint paint = CreatePaint();
@@ -492,7 +492,7 @@ SkRect HeadsUpDisplayLayerImpl::DrawMemoryDisplay(SkCanvas* canvas,
const int kFontHeight = 13;
const int height = 3 * kFontHeight + 4 * kPadding;
- const int left = bounds().width() - width - right;
+ const int left = ceil(bounds().width()) - width - right;
const SkRect area = SkRect::MakeXYWH(left, top, width, height);
const double megabyte = 1024.0 * 1024.0;
@@ -547,7 +547,7 @@ SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay(
const int width = kGraphWidth + 2 * kPadding;
const int height =
kFontHeight + kGraphHeight + 4 * kPadding + 2 + kFontHeight + kPadding;
- const int left = bounds().width() - width - right;
+ const int left = ceil(bounds().width()) - width - right;
const SkRect area = SkRect::MakeXYWH(left, top, width, height);
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 3e0e009..0c66ad4 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -622,7 +622,7 @@ gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const {
// (w/s',h/s') - (w/s,h/s) = (w,h)(1/s' - 1/s) = (w,h)(1 - ds)/(s ds)
//
gfx::Vector2dF delta_from_pinch =
- gfx::Rect(scroll_clip_layer_->bounds()).bottom_right() - gfx::PointF();
+ gfx::RectF(scroll_clip_layer_->bounds()).bottom_right() - gfx::PointF();
delta_from_pinch.Scale((1.f - scale_delta) / (scale * scale_delta));
return delta_from_scroll + delta_from_pinch;
@@ -633,8 +633,8 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
result->SetString("LayerType", LayerTypeAsString());
base::ListValue* list = new base::ListValue;
- list->AppendInteger(bounds().width());
- list->AppendInteger(bounds().height());
+ list->AppendDouble(bounds().width());
+ list->AppendDouble(bounds().height());
result->Set("Bounds", list);
list = new base::ListValue;
@@ -771,8 +771,7 @@ bool LayerImpl::IsActive() const {
return layer_tree_impl_->IsActiveTree();
}
-// TODO(aelias): Convert so that bounds returns SizeF.
-gfx::Size LayerImpl::bounds() const {
+gfx::SizeF LayerImpl::bounds() const {
return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(),
bounds_.height() + bounds_delta_.y()));
}
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 0af74b7..ec97aea 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -364,7 +364,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
// them from the other values.
void SetBounds(const gfx::Size& bounds);
- gfx::Size bounds() const;
+ gfx::SizeF bounds() const;
void SetBoundsDelta(const gfx::Vector2dF& bounds_delta);
gfx::Vector2dF bounds_delta() const { return bounds_delta_; }
@@ -514,9 +514,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
void RemoveScrollbar(ScrollbarLayerImplBase* layer);
bool HasScrollbar(ScrollbarOrientation orientation) const;
void ScrollbarParametersDidChange();
- int clip_height() {
- return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
- }
gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 1d8289f..d9cfd92 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -682,7 +682,7 @@ TEST_F(LayerImplScrollTest, SetNewScrollbarParameters) {
vertical_scrollbar->SetScrollLayerAndClipLayerByIds(
layer()->id(), tree()->root_layer()->id());
- int expected_vertical_maximum =
+ float expected_vertical_maximum =
layer()->bounds().height() - tree()->root_layer()->bounds().height();
EXPECT_EQ(expected_vertical_maximum, vertical_scrollbar->maximum());
EXPECT_EQ(scroll_offset.y(), vertical_scrollbar->current_pos());
@@ -692,7 +692,7 @@ TEST_F(LayerImplScrollTest, SetNewScrollbarParameters) {
horizontal_scrollbar->SetScrollLayerAndClipLayerByIds(
layer()->id(), tree()->root_layer()->id());
- int expected_horizontal_maximum =
+ float expected_horizontal_maximum =
layer()->bounds().width() - tree()->root_layer()->bounds().width();
EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum());
EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos());
diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc
index 16196dd..180c26d 100644
--- a/cc/layers/painted_scrollbar_layer_impl.cc
+++ b/cc/layers/painted_scrollbar_layer_impl.cc
@@ -75,7 +75,6 @@ void PaintedScrollbarLayerImpl::AppendQuads(
bool flipped = false;
gfx::PointF uv_top_left(0.f, 0.f);
gfx::PointF uv_bottom_right(1.f, 1.f);
- gfx::Rect bounds_rect(bounds());
gfx::Rect content_bounds_rect(content_bounds());
SharedQuadState* shared_quad_state =
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 831e3b09..08f7c9c 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -16,6 +16,7 @@
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/geometry/size_conversions.h"
namespace cc {
namespace {
@@ -64,8 +65,9 @@ class PictureImageLayerImplTest : public testing::Test {
new TestablePictureImageLayerImpl(tree, id);
layer->SetBounds(gfx::Size(100, 200));
layer->SetContentBounds(gfx::Size(100, 200));
- layer->tilings_.reset(new PictureLayerTilingSet(&tiling_client_,
- layer->bounds()));
+ layer->tilings_.reset(
+ new PictureLayerTilingSet(&tiling_client_,
+ gfx::ToCeiledSize(layer->bounds())));
layer->pile_ = tiling_client_.GetPile();
return make_scoped_ptr(layer);
}
@@ -146,7 +148,7 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
// Draw.
active_layer->draw_properties().visible_content_rect =
- gfx::Rect(active_layer->bounds());
+ gfx::Rect(gfx::ToCeiledSize(active_layer->bounds()));
MockOcclusionTracker<LayerImpl> occlusion_tracker;
scoped_ptr<RenderPass> render_pass = RenderPass::Create();
AppendQuadsData data;
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 68d24ba..d86aef7 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -9,6 +9,7 @@
#include "cc/layers/picture_layer_impl.h"
#include "cc/trees/layer_tree_impl.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
+#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/rect_conversions.h"
namespace cc {
@@ -46,7 +47,8 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
// TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect
// is identical to the layer_rect.
// If update called, then pile size must match bounds pushed to impl layer.
- DCHECK_EQ(layer_impl->bounds().ToString(), pile_->tiling_size().ToString());
+ DCHECK_EQ(gfx::ToCeiledSize(layer_impl->bounds()).ToString(),
+ pile_->tiling_size().ToString());
}
// Unlike other properties, invalidation must always be set on layer_impl.
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 09c541e..ebaf3be 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -743,7 +743,10 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
bool synced_high_res_tiling = false;
if (CanHaveTilings()) {
synced_high_res_tiling = tilings_->SyncTilings(
- *other->tilings_, bounds(), invalidation_, MinimumContentsScale());
+ *other->tilings_,
+ gfx::ToCeiledSize(bounds()),
+ invalidation_,
+ MinimumContentsScale());
} else {
RemoveAllTilings();
}
@@ -961,7 +964,8 @@ void PictureLayerImpl::DoPostCommitInitialization() {
DCHECK(layer_tree_impl()->IsPendingTree());
if (!tilings_)
- tilings_.reset(new PictureLayerTilingSet(this, bounds()));
+ tilings_.reset(new PictureLayerTilingSet(this,
+ gfx::ToCeiledSize(bounds())));
DCHECK(!twin_layer_);
twin_layer_ = static_cast<PictureLayerImpl*>(
@@ -1302,7 +1306,7 @@ float PictureLayerImpl::MinimumContentsScale() const {
// then it will end up having less than one pixel of content in that
// dimension. Bump the minimum contents scale up in this case to prevent
// this from happening.
- int min_dimension = std::min(bounds().width(), bounds().height());
+ float min_dimension = std::min(bounds().width(), bounds().height());
if (!min_dimension)
return setting_min;
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc
index 0e3d8fa..12e1de3 100644
--- a/cc/layers/picture_layer_unittest.cc
+++ b/cc/layers/picture_layer_unittest.cc
@@ -63,7 +63,7 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) {
layer->PushPropertiesTo(layer_impl.get());
EXPECT_FALSE(layer_impl->CanHaveTilings());
- EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0));
+ EXPECT_TRUE(layer_impl->bounds() == gfx::SizeF(0, 0));
EXPECT_EQ(gfx::Size(), layer_impl->pile()->tiling_size());
EXPECT_FALSE(layer_impl->pile()->HasRecordings());
}
diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc
index 8a7d3df..4116377 100644
--- a/cc/layers/ui_resource_layer_impl.cc
+++ b/cc/layers/ui_resource_layer_impl.cc
@@ -10,6 +10,7 @@
#include "cc/quads/texture_draw_quad.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/occlusion_tracker.h"
+#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/rect_f.h"
namespace cc {
@@ -119,7 +120,7 @@ void UIResourceLayerImpl::AppendQuads(
bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) ||
contents_opaque();
- gfx::Rect quad_rect(bounds());
+ gfx::Rect quad_rect(gfx::ToCeiledSize(bounds()));
gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect());
gfx::Rect visible_quad_rect =
occlusion_tracker.GetCurrentOcclusionForLayer(
diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc
index 66db321..5826394 100644
--- a/cc/layers/ui_resource_layer_impl_unittest.cc
+++ b/cc/layers/ui_resource_layer_impl_unittest.cc
@@ -15,6 +15,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 {
@@ -122,7 +123,7 @@ TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) {
layer_size,
opaque,
uid);
- expected_opaque_bounds = gfx::Rect(layer->bounds());
+ expected_opaque_bounds = gfx::Rect(gfx::ToCeiledSize(layer->bounds()));
OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds);
}
@@ -144,7 +145,7 @@ TEST(UIResourceLayerImplTest, VerifySetOpaqueOnLayer) {
layer = GenerateUIResourceLayer(
&host_impl, bitmap_size, layer_size, skbitmap_opaque, uid);
layer->SetContentsOpaque(true);
- expected_opaque_bounds = gfx::Rect(layer->bounds());
+ expected_opaque_bounds = gfx::Rect(gfx::ToCeiledSize(layer->bounds()));
OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds);
}
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index 1514d83..b9fba49 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -26,9 +26,9 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
success &= dict->GetString("LayerType", &layer_type);
base::ListValue* list;
success &= dict->GetList("Bounds", &list);
- int width, height;
- success &= list->GetInteger(0, &width);
- success &= list->GetInteger(1, &height);
+ double width, height;
+ success &= list->GetDouble(0, &width);
+ success &= list->GetDouble(1, &height);
success &= dict->GetList("Position", &list);
double position_x, position_y;
success &= list->GetDouble(0, &position_x);
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());