summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@google.com>2015-06-17 18:33:14 -0700
committerDana Jansens <danakj@google.com>2015-06-18 01:34:04 +0000
commitc46d374132867eceba26a27e346353086436ee03 (patch)
tree3194cd20a23c9c4ae005657be429c59b94deec48 /cc
parentc38dbd49c2f0ccc9b684c5bbcf6be41bca8ea8ae (diff)
downloadchromium_src-c46d374132867eceba26a27e346353086436ee03.zip
chromium_src-c46d374132867eceba26a27e346353086436ee03.tar.gz
chromium_src-c46d374132867eceba26a27e346353086436ee03.tar.bz2
cc: Remove the layer content_bounds() and use bounds() instead.
And remove the content_bounds from DrawProperties. They are always equal now (outside of some legacy tests). R=enne@chromium.org, enne, vmpstr BUG=413479 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1179133004. Cr-Commit-Position: refs/heads/master@{#334979}
Diffstat (limited to 'cc')
-rw-r--r--cc/BUILD.gn3
-rw-r--r--cc/blink/web_layer_impl_fixed_bounds_unittest.cc4
-rw-r--r--cc/cc.gyp2
-rw-r--r--cc/cc_tests.gyp1
-rw-r--r--cc/debug/debug_rect_history.cc37
-rw-r--r--cc/debug/picture_record_benchmark.cc6
-rw-r--r--cc/debug/rasterize_and_record_benchmark_impl.cc4
-rw-r--r--cc/layers/contents_scaling_layer.cc64
-rw-r--r--cc/layers/contents_scaling_layer.h39
-rw-r--r--cc/layers/contents_scaling_layer_unittest.cc83
-rw-r--r--cc/layers/delegated_renderer_layer_impl.cc16
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc52
-rw-r--r--cc/layers/draw_properties.h1
-rw-r--r--cc/layers/io_surface_layer_impl.cc6
-rw-r--r--cc/layers/layer.cc6
-rw-r--r--cc/layers/layer.h1
-rw-r--r--cc/layers/layer_impl.cc63
-rw-r--r--cc/layers/layer_impl.h5
-rw-r--r--cc/layers/layer_impl_unittest.cc6
-rw-r--r--cc/layers/nine_patch_layer_impl.cc4
-rw-r--r--cc/layers/render_surface_impl.cc7
-rw-r--r--cc/layers/scrollbar_layer_unittest.cc6
-rw-r--r--cc/layers/solid_color_layer_impl.cc10
-rw-r--r--cc/layers/solid_color_scrollbar_layer_impl.cc4
-rw-r--r--cc/layers/texture_layer_impl.cc6
-rw-r--r--cc/layers/ui_resource_layer_impl.cc4
-rw-r--r--cc/layers/video_layer_impl.cc2
-rw-r--r--cc/trees/layer_tree_host_common.cc133
-rw-r--r--cc/trees/layer_tree_host_common_perftest.cc6
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc31
-rw-r--r--cc/trees/layer_tree_host_impl.cc3
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc52
-rw-r--r--cc/trees/layer_tree_impl.cc10
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc187
34 files changed, 150 insertions, 714 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 05d52fe..31eab76 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -105,8 +105,6 @@ component("cc") {
"input/top_controls_manager_client.h",
"layers/append_quads_data.h",
"layers/content_layer_client.h",
- "layers/contents_scaling_layer.cc",
- "layers/contents_scaling_layer.h",
"layers/delegated_frame_provider.cc",
"layers/delegated_frame_provider.h",
"layers/delegated_frame_resource_collection.cc",
@@ -730,7 +728,6 @@ test("cc_unittests") {
"debug/frame_timing_tracker_unittest.cc",
"debug/micro_benchmark_controller_unittest.cc",
"input/top_controls_manager_unittest.cc",
- "layers/contents_scaling_layer_unittest.cc",
"layers/delegated_frame_provider_unittest.cc",
"layers/delegated_frame_resource_collection_unittest.cc",
"layers/delegated_renderer_layer_impl_unittest.cc",
diff --git a/cc/blink/web_layer_impl_fixed_bounds_unittest.cc b/cc/blink/web_layer_impl_fixed_bounds_unittest.cc
index b49c0a9..26f445a 100644
--- a/cc/blink/web_layer_impl_fixed_bounds_unittest.cc
+++ b/cc/blink/web_layer_impl_fixed_bounds_unittest.cc
@@ -68,10 +68,10 @@ TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) {
}
void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) {
- gfx::RectF layer1_rect_in_target(layer1->content_bounds());
+ gfx::RectF layer1_rect_in_target(layer1->bounds());
layer1->draw_transform().TransformRect(&layer1_rect_in_target);
- gfx::RectF layer2_rect_in_target(layer2->content_bounds());
+ gfx::RectF layer2_rect_in_target(layer2->bounds());
layer2->draw_transform().TransformRect(&layer2_rect_in_target);
EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target);
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 13ed5cc..ca76e63 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -161,8 +161,6 @@
'input/top_controls_manager_client.h',
'layers/append_quads_data.h',
'layers/content_layer_client.h',
- 'layers/contents_scaling_layer.cc',
- 'layers/contents_scaling_layer.h',
'layers/delegated_frame_provider.cc',
'layers/delegated_frame_provider.h',
'layers/delegated_frame_resource_collection.cc',
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index e21b9cd..6bfc7ea 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -29,7 +29,6 @@
'debug/micro_benchmark_controller_unittest.cc',
'debug/rendering_stats_unittest.cc',
'input/top_controls_manager_unittest.cc',
- 'layers/contents_scaling_layer_unittest.cc',
'layers/delegated_frame_provider_unittest.cc',
'layers/delegated_frame_resource_collection_unittest.cc',
'layers/delegated_renderer_layer_impl_unittest.cc',
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc
index 519fcce..c49294b 100644
--- a/cc/debug/debug_rect_history.cc
+++ b/cc/debug/debug_rect_history.cc
@@ -70,18 +70,10 @@ void DebugRectHistory::SavePaintRects(LayerImpl* layer) {
Region invalidation_region = layer->GetInvalidationRegion();
if (!invalidation_region.IsEmpty() && layer->DrawsContent()) {
- float width_scale = layer->content_bounds().width() /
- static_cast<float>(layer->bounds().width());
- float height_scale = layer->content_bounds().height() /
- static_cast<float>(layer->bounds().height());
-
for (Region::Iterator it(invalidation_region); it.has_rect(); it.next()) {
- gfx::Rect update_content_rect =
- gfx::ScaleToEnclosingRect(it.rect(), width_scale, height_scale);
- debug_rects_.push_back(
- DebugRect(PAINT_RECT_TYPE,
- MathUtil::MapEnclosingClippedRect(
- layer->screen_space_transform(), update_content_rect)));
+ debug_rects_.push_back(DebugRect(
+ PAINT_RECT_TYPE, MathUtil::MapEnclosingClippedRect(
+ layer->screen_space_transform(), it.rect())));
}
}
@@ -114,11 +106,10 @@ void DebugRectHistory::SavePropertyChangedRects(
if (!layer->LayerPropertyChanged())
continue;
- debug_rects_.push_back(
- DebugRect(PROPERTY_CHANGED_RECT_TYPE,
- MathUtil::MapEnclosingClippedRect(
- layer->screen_space_transform(),
- gfx::Rect(layer->content_bounds()))));
+ debug_rects_.push_back(DebugRect(
+ PROPERTY_CHANGED_RECT_TYPE,
+ MathUtil::MapEnclosingClippedRect(layer->screen_space_transform(),
+ gfx::Rect(layer->bounds()))));
}
}
}
@@ -192,10 +183,9 @@ void DebugRectHistory::SaveWheelEventHandlerRectsCallback(LayerImpl* layer) {
if (!layer->have_wheel_event_handlers())
return;
- gfx::Rect wheel_rect =
- gfx::ScaleToEnclosingRect(gfx::Rect(layer->content_bounds()),
- layer->contents_scale_x(),
- layer->contents_scale_y());
+ gfx::Rect wheel_rect = gfx::ScaleToEnclosingRect(gfx::Rect(layer->bounds()),
+ layer->contents_scale_x(),
+ layer->contents_scale_y());
debug_rects_.push_back(
DebugRect(WHEEL_EVENT_HANDLER_RECT_TYPE,
MathUtil::MapEnclosingClippedRect(
@@ -212,10 +202,9 @@ void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) {
if (!layer->have_scroll_event_handlers())
return;
- gfx::Rect scroll_rect =
- gfx::ScaleToEnclosingRect(gfx::Rect(layer->content_bounds()),
- layer->contents_scale_x(),
- layer->contents_scale_y());
+ gfx::Rect scroll_rect = gfx::ScaleToEnclosingRect(gfx::Rect(layer->bounds()),
+ layer->contents_scale_x(),
+ layer->contents_scale_y());
debug_rects_.push_back(
DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE,
MathUtil::MapEnclosingClippedRect(
diff --git a/cc/debug/picture_record_benchmark.cc b/cc/debug/picture_record_benchmark.cc
index d8608c5..0f093ce 100644
--- a/cc/debug/picture_record_benchmark.cc
+++ b/cc/debug/picture_record_benchmark.cc
@@ -85,7 +85,7 @@ void PictureRecordBenchmark::DidUpdateLayers(LayerTreeHost* host) {
void PictureRecordBenchmark::RunOnLayer(PictureLayer* layer) {
ContentLayerClient* painter = layer->client();
- gfx::Size content_bounds = layer->content_bounds();
+ gfx::Size bounds = layer->bounds();
gfx::Size tile_grid_size(kTileGridSize, kTileGridSize);
@@ -94,8 +94,8 @@ void PictureRecordBenchmark::RunOnLayer(PictureLayer* layer) {
int width = dimensions.first;
int height = dimensions.second;
- int y_limit = std::max(1, content_bounds.height() - height);
- int x_limit = std::max(1, content_bounds.width() - width);
+ int y_limit = std::max(1, bounds.height() - height);
+ int x_limit = std::max(1, bounds.width() - width);
for (int y = 0; y < y_limit; y += kPositionIncrement) {
for (int x = 0; x < x_limit; x += kPositionIncrement) {
gfx::Rect rect = gfx::Rect(x, y, width, height);
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc
index 9a9d241..a012f58 100644
--- a/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -163,8 +163,8 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
return;
}
- FixedInvalidationPictureLayerTilingClient client(
- layer, gfx::Rect(layer->content_bounds()));
+ FixedInvalidationPictureLayerTilingClient client(layer,
+ gfx::Rect(layer->bounds()));
// In this benchmark, we will create a local tiling set and measure how long
// it takes to rasterize content. As such, the actual settings used here don't
diff --git a/cc/layers/contents_scaling_layer.cc b/cc/layers/contents_scaling_layer.cc
deleted file mode 100644
index 10d5793..0000000
--- a/cc/layers/contents_scaling_layer.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/layers/contents_scaling_layer.h"
-#include "cc/trees/layer_tree_host.h"
-#include "ui/gfx/geometry/size_conversions.h"
-
-namespace cc {
-
-gfx::Size ContentsScalingLayer::ComputeContentBoundsForScale(
- float scale_x,
- float scale_y) const {
- return gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale_x, scale_y));
-}
-
-ContentsScalingLayer::ContentsScalingLayer(const LayerSettings& settings)
- : Layer(settings),
- last_update_contents_scale_x_(0.f),
- last_update_contents_scale_y_(0.f) {
-}
-
-ContentsScalingLayer::~ContentsScalingLayer() {
-}
-
-void ContentsScalingLayer::CalculateContentsScale(
- float ideal_contents_scale,
- float* contents_scale_x,
- float* contents_scale_y,
- gfx::Size* content_bounds) {
- float old_contents_scale_x = *contents_scale_x;
- float old_contents_scale_y = *contents_scale_y;
- gfx::Size old_content_bounds = *content_bounds;
- *contents_scale_x = ideal_contents_scale;
- *contents_scale_y = ideal_contents_scale;
- *content_bounds = ComputeContentBoundsForScale(
- ideal_contents_scale,
- ideal_contents_scale);
-
- if (!layer_tree_host())
- return;
-
- if (old_contents_scale_x != *contents_scale_x ||
- old_contents_scale_y != *contents_scale_y ||
- old_content_bounds != *content_bounds) {
- layer_tree_host()->property_trees()->needs_rebuild = true;
- }
-}
-
-bool ContentsScalingLayer::Update(ResourceUpdateQueue* queue) {
- bool updated = Layer::Update(queue);
-
- if (draw_properties().contents_scale_x == last_update_contents_scale_x_ &&
- draw_properties().contents_scale_y == last_update_contents_scale_y_)
- return updated;
-
- last_update_contents_scale_x_ = draw_properties().contents_scale_x;
- last_update_contents_scale_y_ = draw_properties().contents_scale_y;
- // Invalidate the whole layer if scale changed.
- SetNeedsDisplayRect(gfx::Rect(paint_properties().bounds));
- return updated;
-}
-
-} // namespace cc
diff --git a/cc/layers/contents_scaling_layer.h b/cc/layers/contents_scaling_layer.h
deleted file mode 100644
index 6ad3f35..0000000
--- a/cc/layers/contents_scaling_layer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_LAYERS_CONTENTS_SCALING_LAYER_H_
-#define CC_LAYERS_CONTENTS_SCALING_LAYER_H_
-
-#include "cc/base/cc_export.h"
-#include "cc/layers/layer.h"
-
-namespace cc {
-
-// Base class for layers that need contents scale.
-// The content bounds are determined by bounds and scale of the contents.
-class CC_EXPORT ContentsScalingLayer : public Layer {
- public:
- void CalculateContentsScale(float ideal_contents_scale,
- float* contents_scale_x,
- float* contents_scale_y,
- gfx::Size* content_bounds) override;
-
- bool Update(ResourceUpdateQueue* queue) override;
-
- protected:
- explicit ContentsScalingLayer(const LayerSettings& settings);
- ~ContentsScalingLayer() override;
-
- gfx::Size ComputeContentBoundsForScale(float scale_x, float scale_y) const;
-
- private:
- float last_update_contents_scale_x_;
- float last_update_contents_scale_y_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentsScalingLayer);
-};
-
-} // namespace cc
-
-#endif // CC_LAYERS_CONTENTS_SCALING_LAYER_H__
diff --git a/cc/layers/contents_scaling_layer_unittest.cc b/cc/layers/contents_scaling_layer_unittest.cc
deleted file mode 100644
index 567b21e..0000000
--- a/cc/layers/contents_scaling_layer_unittest.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/layers/contents_scaling_layer.h"
-
-#include <vector>
-
-#include "cc/test/fake_layer_tree_host.h"
-#include "cc/test/geometry_test_utils.h"
-#include "cc/test/test_task_graph_runner.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cc {
-namespace {
-
-class MockContentsScalingLayer : public ContentsScalingLayer {
- public:
- explicit MockContentsScalingLayer(const LayerSettings& settings)
- : ContentsScalingLayer(settings) {}
-
- void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override {
- last_needs_display_rect_ = dirty_rect;
- ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect);
- }
-
- const gfx::Rect& LastNeedsDisplayRect() const {
- return last_needs_display_rect_;
- }
-
- private:
- ~MockContentsScalingLayer() override {}
-
- gfx::Rect last_needs_display_rect_;
-};
-
-static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) {
- RenderSurfaceLayerList render_surface_layer_list;
- LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
- host->root_layer(), gfx::Size(500, 500), &render_surface_layer_list);
- inputs.device_scale_factor = device_scale_factor;
- LayerTreeHostCommon::CalculateDrawProperties(&inputs);
-}
-
-TEST(ContentsScalingLayerTest, CheckContentsBounds) {
- LayerSettings layer_settings;
-
- FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
- TestTaskGraphRunner task_graph_runner;
- scoped_ptr<FakeLayerTreeHost> host =
- FakeLayerTreeHost::Create(&client, &task_graph_runner);
-
- scoped_refptr<MockContentsScalingLayer> test_layer =
- make_scoped_refptr(new MockContentsScalingLayer(layer_settings));
-
- scoped_refptr<Layer> root = Layer::Create(layer_settings);
- root->AddChild(test_layer);
- host->SetRootLayer(root);
-
- test_layer->SetBounds(gfx::Size(320, 240));
-
- CalcDrawProps(host.get(), 1.f);
- EXPECT_FLOAT_EQ(1.f, test_layer->contents_scale_x());
- EXPECT_FLOAT_EQ(1.f, test_layer->contents_scale_y());
- EXPECT_EQ(320, test_layer->content_bounds().width());
- EXPECT_EQ(240, test_layer->content_bounds().height());
-
- CalcDrawProps(host.get(), 2.f);
- EXPECT_EQ(640, test_layer->content_bounds().width());
- EXPECT_EQ(480, test_layer->content_bounds().height());
-
- test_layer->SetBounds(gfx::Size(10, 20));
- CalcDrawProps(host.get(), 2.f);
- EXPECT_EQ(20, test_layer->content_bounds().width());
- EXPECT_EQ(40, test_layer->content_bounds().height());
-
- CalcDrawProps(host.get(), 1.33f);
- EXPECT_EQ(14, test_layer->content_bounds().width());
- EXPECT_EQ(27, test_layer->content_bounds().height());
-}
-
-} // namespace
-} // namespace cc
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
index e48cab7..01ae74f 100644
--- a/cc/layers/delegated_renderer_layer_impl.cc
+++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -351,22 +351,16 @@ void DelegatedRendererLayerImpl::AppendRainbowDebugBorder(
for (int i = 0;; ++i) {
// For horizontal lines.
int x = kStripeWidth * i;
- int width = std::min(kStripeWidth, content_bounds().width() - x - 1);
+ int width = std::min(kStripeWidth, bounds().width() - x - 1);
// For vertical lines.
int y = kStripeHeight * i;
- int height = std::min(kStripeHeight, content_bounds().height() - y - 1);
+ int height = std::min(kStripeHeight, bounds().height() - y - 1);
gfx::Rect top(x, 0, width, border_width);
- gfx::Rect bottom(x,
- content_bounds().height() - border_width,
- width,
- border_width);
+ gfx::Rect bottom(x, bounds().height() - border_width, width, border_width);
gfx::Rect left(0, y, border_width, height);
- gfx::Rect right(content_bounds().width() - border_width,
- y,
- border_width,
- height);
+ gfx::Rect right(bounds().width() - border_width, y, border_width, height);
if (top.IsEmpty() && left.IsEmpty())
break;
@@ -395,7 +389,7 @@ void DelegatedRendererLayerImpl::AppendRainbowDebugBorder(
colors[i % kNumColors],
static_cast<uint8_t>(SkColorGetA(colors[i % kNumColors]) *
kFillOpacity));
- gfx::Rect fill_rect(x, 0, width, content_bounds().height());
+ gfx::Rect fill_rect(x, 0, width, bounds().height());
solid_quad->SetNew(shared_quad_state, fill_rect, fill_rect, fill_color,
force_anti_aliasing_off);
}
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index eea9237..b5743dd 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -642,7 +642,7 @@ class DelegatedRendererLayerImplTestTransform
RenderPassList delegated_render_passes;
- gfx::Size child_pass_content_bounds(7, 7);
+ gfx::Size child_pass_bounds(7, 7);
gfx::Rect child_pass_rect(20, 20, 7, 7);
gfx::Transform child_pass_transform;
child_pass_transform.Scale(0.8f, 0.8f);
@@ -657,14 +657,10 @@ class DelegatedRendererLayerImplTestTransform
gfx::Transform());
SharedQuadState* shared_quad_state =
pass->CreateAndAppendSharedQuadState();
- shared_quad_state->SetAll(child_pass_transform,
- child_pass_content_bounds,
- child_pass_rect,
- child_pass_clip_rect,
- child_pass_clipped,
- 1.f,
- SkXfermode::kSrcOver_Mode,
- 0);
+ shared_quad_state->SetAll(child_pass_transform, child_pass_bounds,
+ child_pass_rect, child_pass_clip_rect,
+ child_pass_clipped, 1.f,
+ SkXfermode::kSrcOver_Mode, 0);
SolidColorDrawQuad* color_quad;
color_quad = pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
@@ -682,7 +678,7 @@ class DelegatedRendererLayerImplTestTransform
false);
}
- gfx::Size root_pass_content_bounds(100, 100);
+ gfx::Size root_pass_bounds(100, 100);
gfx::Rect root_pass_rect(0, 0, 100, 100);
gfx::Transform root_pass_transform;
root_pass_transform.Scale(1.5, 1.5);
@@ -695,13 +691,9 @@ class DelegatedRendererLayerImplTestTransform
root_pass_rect,
gfx::Transform());
SharedQuadState* shared_quad_state = pass->CreateAndAppendSharedQuadState();
- shared_quad_state->SetAll(root_pass_transform,
- root_pass_content_bounds,
- root_pass_rect,
- root_pass_clip_rect,
- root_pass_clipped,
- 1.f,
- SkXfermode::kSrcOver_Mode,
+ shared_quad_state->SetAll(root_pass_transform, root_pass_bounds,
+ root_pass_rect, root_pass_clip_rect,
+ root_pass_clipped, 1.f, SkXfermode::kSrcOver_Mode,
0);
RenderPassDrawQuad* render_pass_quad =
@@ -1079,7 +1071,7 @@ class DelegatedRendererLayerImplTestClip
RenderPassList delegated_render_passes;
- gfx::Size child_pass_content_bounds(7, 7);
+ gfx::Size child_pass_bounds(7, 7);
gfx::Rect child_pass_rect(20, 20, 7, 7);
gfx::Transform child_pass_transform;
gfx::Rect child_pass_clip_rect(21, 21, 3, 3);
@@ -1092,14 +1084,10 @@ class DelegatedRendererLayerImplTestClip
gfx::Transform());
SharedQuadState* shared_quad_state =
pass->CreateAndAppendSharedQuadState();
- shared_quad_state->SetAll(child_pass_transform,
- child_pass_content_bounds,
- child_pass_rect,
- child_pass_clip_rect,
- child_pass_clipped,
- 1.f,
- SkXfermode::kSrcOver_Mode,
- 0);
+ shared_quad_state->SetAll(child_pass_transform, child_pass_bounds,
+ child_pass_rect, child_pass_clip_rect,
+ child_pass_clipped, 1.f,
+ SkXfermode::kSrcOver_Mode, 0);
SolidColorDrawQuad* color_quad;
color_quad = pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
@@ -1117,7 +1105,7 @@ class DelegatedRendererLayerImplTestClip
false);
}
- gfx::Size root_pass_content_bounds(50, 50);
+ gfx::Size root_pass_bounds(50, 50);
gfx::Rect root_pass_rect(0, 0, 50, 50);
gfx::Transform root_pass_transform;
gfx::Rect root_pass_clip_rect(5, 5, 40, 40);
@@ -1128,13 +1116,9 @@ class DelegatedRendererLayerImplTestClip
root_pass_rect,
gfx::Transform());
SharedQuadState* shared_quad_state = pass->CreateAndAppendSharedQuadState();
- shared_quad_state->SetAll(root_pass_transform,
- root_pass_content_bounds,
- root_pass_rect,
- root_pass_clip_rect,
- root_pass_clipped,
- 1.f,
- SkXfermode::kSrcOver_Mode,
+ shared_quad_state->SetAll(root_pass_transform, root_pass_bounds,
+ root_pass_rect, root_pass_clip_rect,
+ root_pass_clipped, 1.f, SkXfermode::kSrcOver_Mode,
0);
RenderPassDrawQuad* render_pass_quad =
diff --git a/cc/layers/draw_properties.h b/cc/layers/draw_properties.h
index ecb2b66..ab1b166 100644
--- a/cc/layers/draw_properties.h
+++ b/cc/layers/draw_properties.h
@@ -100,7 +100,6 @@ struct CC_EXPORT DrawProperties {
// and not always the one used.
float contents_scale_x;
float contents_scale_y;
- gfx::Size content_bounds;
// Number of descendants with a clip parent that is our ancestor. NB - this
// does not include our clip children because they are clipped by us.
diff --git a/cc/layers/io_surface_layer_impl.cc b/cc/layers/io_surface_layer_impl.cc
index a7da986..234d3f3 100644
--- a/cc/layers/io_surface_layer_impl.cc
+++ b/cc/layers/io_surface_layer_impl.cc
@@ -66,10 +66,10 @@ void IOSurfaceLayerImpl::AppendQuads(
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
+ append_quads_data);
- gfx::Rect quad_rect(content_bounds());
+ gfx::Rect quad_rect(bounds());
gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
gfx::Rect visible_quad_rect =
draw_properties().occlusion_in_content_space.GetUnoccludedContentRect(
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 731ae6e..d1c173e 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -240,12 +240,12 @@ bool Layer::IsPropertyChangeAllowed() const {
return !layer_tree_host_->in_paint_layer_contents();
}
+// TODO(danakj): Remove this after impl_side_painting.
gfx::Rect Layer::LayerRectToContentRect(const gfx::Rect& layer_rect) const {
- gfx::Rect content_rect = gfx::ScaleToEnclosingRect(
- layer_rect, contents_scale_x(), contents_scale_y());
+ gfx::Rect content_rect = layer_rect;
// Intersect with content rect to avoid the extra pixel because for some
// values x and y, ceil((x / y) * y) may be x + 1.
- content_rect.Intersect(gfx::Rect(content_bounds()));
+ content_rect.Intersect(gfx::Rect(bounds()));
return content_rect;
}
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index e7e0f8a..d344c2d 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -400,7 +400,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// subclasses of ContentsScalingLayer.
float contents_scale_x() const { return draw_properties_.contents_scale_x; }
float contents_scale_y() const { return draw_properties_.contents_scale_y; }
- gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
virtual void CalculateContentsScale(float ideal_contents_scale,
float* contents_scale_x,
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 2eb027a..d4b1089 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -283,11 +283,11 @@ void LayerImpl::ClearRenderSurfaceLayerList() {
}
void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const {
- state->SetAll(
- draw_properties_.target_space_transform, draw_properties_.content_bounds,
- draw_properties_.visible_content_rect, draw_properties_.clip_rect,
- draw_properties_.is_clipped, draw_properties_.opacity,
- draw_properties_.blend_mode, sorting_context_id_);
+ state->SetAll(draw_properties_.target_space_transform, bounds(),
+ draw_properties_.visible_content_rect,
+ draw_properties_.clip_rect, draw_properties_.is_clipped,
+ draw_properties_.opacity, draw_properties_.blend_mode,
+ sorting_context_id_);
}
void LayerImpl::PopulateScaledSharedQuadState(SharedQuadState* state,
@@ -295,13 +295,12 @@ void LayerImpl::PopulateScaledSharedQuadState(SharedQuadState* state,
gfx::Transform scaled_draw_transform =
draw_properties_.target_space_transform;
scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
- gfx::Size scaled_content_bounds =
- gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale));
+ gfx::Size scaled_bounds = gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale));
gfx::Rect scaled_visible_content_rect =
gfx::ScaleToEnclosingRect(visible_content_rect(), scale);
- scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds));
+ scaled_visible_content_rect.Intersect(gfx::Rect(scaled_bounds));
- state->SetAll(scaled_draw_transform, scaled_content_bounds,
+ state->SetAll(scaled_draw_transform, scaled_bounds,
scaled_visible_content_rect, draw_properties().clip_rect,
draw_properties().is_clipped, draw_properties().opacity,
draw_properties().blend_mode, sorting_context_id_);
@@ -344,22 +343,18 @@ void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const {
void LayerImpl::AppendDebugBorderQuad(
RenderPass* render_pass,
- const gfx::Size& content_bounds,
+ const gfx::Size& bounds,
const SharedQuadState* shared_quad_state,
AppendQuadsData* append_quads_data) const {
SkColor color;
float width;
GetDebugBorderProperties(&color, &width);
- AppendDebugBorderQuad(render_pass,
- content_bounds,
- shared_quad_state,
- append_quads_data,
- color,
- width);
+ AppendDebugBorderQuad(render_pass, bounds, shared_quad_state,
+ append_quads_data, color, width);
}
void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass,
- const gfx::Size& content_bounds,
+ const gfx::Size& bounds,
const SharedQuadState* shared_quad_state,
AppendQuadsData* append_quads_data,
SkColor color,
@@ -367,7 +362,7 @@ void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass,
if (!ShowDebugBorders())
return;
- gfx::Rect quad_rect(content_bounds);
+ gfx::Rect quad_rect(bounds);
gfx::Rect visible_quad_rect(quad_rect);
DebugBorderDrawQuad* debug_border_quad =
render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>();
@@ -515,13 +510,11 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
return InputHandler::SCROLL_STARTED;
}
+// TODO(danakj): Remove this after impl_side_painting.
gfx::Rect LayerImpl::LayerRectToContentRect(
const gfx::RectF& layer_rect) const {
- gfx::RectF content_rect =
- gfx::ScaleRect(layer_rect, contents_scale_x(), contents_scale_y());
- // Intersect with content rect to avoid the extra pixel because for some
- // values x and y, ceil((x / y) * y) may be x + 1.
- content_rect.Intersect(gfx::Rect(content_bounds()));
+ gfx::RectF content_rect = layer_rect;
+ content_rect.Intersect(gfx::Rect(bounds()));
return gfx::ToEnclosingRect(content_rect);
}
@@ -537,7 +530,7 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetTransformOrigin(transform_origin_);
layer->SetBackgroundColor(background_color_);
layer->SetBounds(bounds_);
- layer->SetContentBounds(content_bounds());
+ layer->SetContentBounds(bounds_);
layer->SetContentsScale(contents_scale_x(), contents_scale_y());
layer->SetDoubleSided(double_sided_);
layer->SetDrawCheckerboardForMissingTiles(
@@ -1155,12 +1148,8 @@ void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) {
damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect);
}
+// TODO(danakj): Remove this after impl_side_painting.
void LayerImpl::SetContentBounds(const gfx::Size& content_bounds) {
- if (this->content_bounds() == content_bounds)
- return;
-
- draw_properties_.content_bounds = content_bounds;
- NoteLayerPropertyChanged();
}
void LayerImpl::SetContentsScale(float contents_scale_x,
@@ -1558,9 +1547,7 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
bool clipped;
gfx::QuadF layer_quad = MathUtil::MapQuad(
- screen_space_transform(),
- gfx::QuadF(gfx::Rect(content_bounds())),
- &clipped);
+ screen_space_transform(), gfx::QuadF(gfx::Rect(bounds())), &clipped);
MathUtil::AddToTracedValue("layer_quad", layer_quad, state);
if (!touch_event_handler_region_.IsEmpty()) {
state->BeginArray("touch_event_handler_region");
@@ -1568,14 +1555,14 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
state->EndArray();
}
if (have_wheel_event_handlers_) {
- gfx::Rect wheel_rect(content_bounds());
+ gfx::Rect wheel_rect(bounds());
Region wheel_region(wheel_rect);
state->BeginArray("wheel_event_handler_region");
wheel_region.AsValueInto(state);
state->EndArray();
}
if (have_scroll_event_handlers_) {
- gfx::Rect scroll_rect(content_bounds());
+ gfx::Rect scroll_rect(bounds());
Region scroll_region(scroll_rect);
state->BeginArray("scroll_event_handler_region");
scroll_region.AsValueInto(state);
@@ -1699,18 +1686,16 @@ Region LayerImpl::GetInvalidationRegion() {
gfx::Rect LayerImpl::GetEnclosingRectInTargetSpace() const {
return MathUtil::MapEnclosingClippedRect(
- draw_properties_.target_space_transform,
- gfx::Rect(draw_properties_.content_bounds));
+ draw_properties_.target_space_transform, gfx::Rect(bounds()));
}
gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const {
gfx::Transform scaled_draw_transform =
draw_properties_.target_space_transform;
scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
- gfx::Size scaled_content_bounds =
- gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
+ gfx::Size scaled_bounds = gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale));
return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
- gfx::Rect(scaled_content_bounds));
+ gfx::Rect(scaled_bounds));
}
} // namespace cc
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 458961a..258e27a 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -422,7 +422,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
gfx::Vector2dF bounds_delta() const { return bounds_delta_; }
void SetContentBounds(const gfx::Size& content_bounds);
- gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
float contents_scale_x() const { return draw_properties_.contents_scale_x; }
float contents_scale_y() const { return draw_properties_.contents_scale_y; }
@@ -672,11 +671,11 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
virtual void GetDebugBorderProperties(SkColor* color, float* width) const;
void AppendDebugBorderQuad(RenderPass* render_pass,
- const gfx::Size& content_bounds,
+ const gfx::Size& bounds,
const SharedQuadState* shared_quad_state,
AppendQuadsData* append_quads_data) const;
void AppendDebugBorderQuad(RenderPass* render_pass,
- const gfx::Size& content_bounds,
+ const gfx::Size& bounds,
const SharedQuadState* shared_quad_state,
AppendQuadsData* append_quads_data,
SkColor color,
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 5a794ab..2255646 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -174,7 +174,6 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform));
// Changing these properties only affects the layer itself.
- EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetContentBounds(arbitrary_size));
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
root->SetContentsScale(arbitrary_number, arbitrary_number));
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true));
@@ -229,8 +228,6 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
root->PushScrollOffsetFromMainThread(
gfx::ScrollOffset(arbitrary_vector2d)));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
- root->SetContentBounds(arbitrary_size));
- EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
root->SetContentsScale(arbitrary_number, arbitrary_number));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number));
@@ -327,7 +324,6 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetDoubleSided(false)); // constructor initializes it to "true".
- VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentBounds(arbitrary_size));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetContentsScale(arbitrary_number, arbitrary_number));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true));
@@ -352,8 +348,6 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetDoubleSided(false)); // constructor initializes it to "true".
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
- layer->SetContentBounds(arbitrary_size));
- VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetContentsScale(arbitrary_number, arbitrary_number));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc
index 117056a..b31382f 100644
--- a/cc/layers/nine_patch_layer_impl.cc
+++ b/cc/layers/nine_patch_layer_impl.cc
@@ -88,8 +88,8 @@ void NinePatchLayerImpl::AppendQuads(
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
+ append_quads_data);
if (!ui_resource_id_)
return;
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc
index 7aa4330..22f311d 100644
--- a/cc/layers/render_surface_impl.cc
+++ b/cc/layers/render_surface_impl.cc
@@ -186,10 +186,9 @@ void RenderSurfaceImpl::AppendQuads(RenderPass* render_pass,
gfx::Vector2dF owning_layer_draw_scale =
MathUtil::ComputeTransform2dScaleComponents(
owning_layer_->draw_transform(), 1.f);
- gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize(
- owning_layer_->content_bounds(),
- owning_layer_draw_scale.x(),
- owning_layer_draw_scale.y());
+ gfx::SizeF unclipped_mask_target_size =
+ gfx::ScaleSize(owning_layer_->bounds(), owning_layer_draw_scale.x(),
+ owning_layer_draw_scale.y());
mask_uv_scale = gfx::Vector2dF(
content_rect_.width() / unclipped_mask_target_size.width(),
content_rect_.height() / unclipped_mask_target_size.height());
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index dc432cc..fca8a8e 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -730,7 +730,6 @@ class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest {
layer_tree_root->SetScrollOffset(gfx::ScrollOffset(10, 20));
layer_tree_root->SetBounds(gfx::Size(100, 200));
content_layer->SetBounds(gfx::Size(100, 200));
- scrollbar_layer->draw_properties().content_bounds = gfx::Size(100, 200);
scrollbar_layer->draw_properties().visible_content_rect =
gfx::Rect(0, 0, 100, 200);
scrollbar_layer->CreateRenderSurface();
@@ -796,7 +795,6 @@ TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TestResourceUpdate) {
layer_tree_root->SetBounds(gfx::Size(100, 200));
content_layer->SetBounds(gfx::Size(100, 200));
- scrollbar_layer->draw_properties().content_bounds = gfx::Size(100, 200);
scrollbar_layer->draw_properties().visible_content_rect =
gfx::Rect(0, 0, 100, 200);
@@ -935,8 +933,6 @@ class ScaledScrollbarLayerTestResourceCreation : public ScrollbarLayerTest {
gfx::ScaleSize(scrollbar_layer->bounds(), test_scale, test_scale);
gfx::PointF scaled_location =
gfx::ScalePoint(scrollbar_layer->position(), test_scale, test_scale);
- scrollbar_layer->draw_properties().content_bounds =
- gfx::Size(scaled_size.width(), scaled_size.height());
scrollbar_layer->draw_properties().contents_scale_x = test_scale;
scrollbar_layer->draw_properties().contents_scale_y = test_scale;
scrollbar_layer->draw_properties().visible_content_rect =
@@ -1007,8 +1003,6 @@ class ScaledScrollbarLayerTestScaledRasterization : public ScrollbarLayerTest {
gfx::ScaleSize(scrollbar_layer->bounds(), test_scale, test_scale);
gfx::PointF scaled_location =
gfx::ScalePoint(scrollbar_layer->position(), test_scale, test_scale);
- scrollbar_layer->draw_properties().content_bounds =
- gfx::Size(scaled_size.width(), scaled_size.height());
scrollbar_layer->draw_properties().contents_scale_x = test_scale;
scrollbar_layer->draw_properties().contents_scale_y = test_scale;
scrollbar_layer->draw_properties().visible_content_rect =
diff --git a/cc/layers/solid_color_layer_impl.cc b/cc/layers/solid_color_layer_impl.cc
index 2762497..b85012a 100644
--- a/cc/layers/solid_color_layer_impl.cc
+++ b/cc/layers/solid_color_layer_impl.cc
@@ -69,14 +69,14 @@ void SolidColorLayerImpl::AppendQuads(
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
+ append_quads_data);
// TODO(hendrikw): We need to pass the visible content rect rather than
- // |content_bounds()| here.
+ // |bounds()| here.
AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space,
- shared_quad_state, gfx::Rect(content_bounds()),
- background_color(), append_quads_data);
+ shared_quad_state, gfx::Rect(bounds()), background_color(),
+ append_quads_data);
}
const char* SolidColorLayerImpl::LayerTypeAsString() const {
diff --git a/cc/layers/solid_color_scrollbar_layer_impl.cc b/cc/layers/solid_color_scrollbar_layer_impl.cc
index fa1849e..0b78de7 100644
--- a/cc/layers/solid_color_scrollbar_layer_impl.cc
+++ b/cc/layers/solid_color_scrollbar_layer_impl.cc
@@ -100,8 +100,8 @@ void SolidColorScrollbarLayerImpl::AppendQuads(
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
+ append_quads_data);
gfx::Rect thumb_quad_rect(ComputeThumbQuadRect());
gfx::Rect visible_quad_rect =
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc
index d0e6b19..ba31c6d 100644
--- a/cc/layers/texture_layer_impl.cc
+++ b/cc/layers/texture_layer_impl.cc
@@ -146,14 +146,14 @@ void TextureLayerImpl::AppendQuads(RenderPass* render_pass,
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
+ append_quads_data);
SkColor bg_color = blend_background_color_ ?
background_color() : SK_ColorTRANSPARENT;
bool opaque = contents_opaque() || (SkColorGetA(bg_color) == 0xFF);
- gfx::Rect quad_rect(content_bounds());
+ gfx::Rect quad_rect(bounds());
gfx::Rect opaque_rect = opaque ? quad_rect : gfx::Rect();
gfx::Rect visible_quad_rect =
draw_properties().occlusion_in_content_space.GetUnoccludedContentRect(
diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc
index 80fd461..9fb703e 100644
--- a/cc/layers/ui_resource_layer_impl.cc
+++ b/cc/layers/ui_resource_layer_impl.cc
@@ -98,8 +98,8 @@ void UIResourceLayerImpl::AppendQuads(
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
+ append_quads_data);
if (!ui_resource_id_)
return;
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 1ef13a0..665541e 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -139,7 +139,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
DCHECK(frame_.get());
gfx::Transform transform = draw_transform();
- gfx::Size rotated_size = content_bounds();
+ gfx::Size rotated_size = bounds();
switch (video_rotation_) {
case media::VIDEO_ROTATION_90:
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 5f081b4..b57177b 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -377,7 +377,7 @@ static gfx::Rect CalculateVisibleContentRect(
DCHECK(layer->render_target());
// Nothing is visible if the layer bounds are empty.
- if (!layer->DrawsContent() || layer->content_bounds().IsEmpty() ||
+ if (!layer->DrawsContent() || layer->bounds().IsEmpty() ||
layer->drawable_content_rect().IsEmpty())
return gfx::Rect();
@@ -403,10 +403,8 @@ static gfx::Rect CalculateVisibleContentRect(
return gfx::Rect();
return CalculateVisibleRectWithCachedLayerRect(
- visible_rect_in_target_surface_space,
- gfx::Rect(layer->content_bounds()),
- layer_rect_in_target_space,
- layer->draw_transform());
+ visible_rect_in_target_surface_space, gfx::Rect(layer->bounds()),
+ layer_rect_in_target_space, layer->draw_transform());
}
static inline bool TransformToParentIsKnown(LayerImpl* layer) { return true; }
@@ -925,94 +923,6 @@ static inline void UpdateLayerScaleDrawProperties(
layer->draw_properties().device_scale_factor = device_scale_factor;
}
-static inline void CalculateContentsScale(LayerImpl* layer,
- float contents_scale) {
- // LayerImpl has all of its content scales and bounds pushed from the Main
- // thread during commit and just uses those values as-is.
-}
-
-static inline void CalculateContentsScale(Layer* layer, float contents_scale) {
- layer->CalculateContentsScale(contents_scale,
- &layer->draw_properties().contents_scale_x,
- &layer->draw_properties().contents_scale_y,
- &layer->draw_properties().content_bounds);
-
- Layer* mask_layer = layer->mask_layer();
- if (mask_layer) {
- mask_layer->CalculateContentsScale(
- contents_scale,
- &mask_layer->draw_properties().contents_scale_x,
- &mask_layer->draw_properties().contents_scale_y,
- &mask_layer->draw_properties().content_bounds);
- }
-
- Layer* replica_mask_layer =
- layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL;
- if (replica_mask_layer) {
- replica_mask_layer->CalculateContentsScale(
- contents_scale,
- &replica_mask_layer->draw_properties().contents_scale_x,
- &replica_mask_layer->draw_properties().contents_scale_y,
- &replica_mask_layer->draw_properties().content_bounds);
- }
-}
-
-static inline void UpdateLayerContentsScale(
- LayerImpl* layer,
- bool can_adjust_raster_scale,
- float ideal_contents_scale,
- float device_scale_factor,
- float page_scale_factor,
- bool animating_transform_to_screen) {
- CalculateContentsScale(layer, ideal_contents_scale);
-}
-
-static inline void UpdateLayerContentsScale(
- Layer* layer,
- bool can_adjust_raster_scale,
- float ideal_contents_scale,
- float device_scale_factor,
- float page_scale_factor,
- bool animating_transform_to_screen) {
- if (can_adjust_raster_scale) {
- float ideal_raster_scale =
- ideal_contents_scale / (device_scale_factor * page_scale_factor);
-
- bool need_to_set_raster_scale = layer->raster_scale_is_unknown();
-
- // If we've previously saved a raster_scale but the ideal changes, things
- // are unpredictable and we should just use 1.
- if (!need_to_set_raster_scale && layer->raster_scale() != 1.f &&
- ideal_raster_scale != layer->raster_scale()) {
- ideal_raster_scale = 1.f;
- need_to_set_raster_scale = true;
- }
-
- if (need_to_set_raster_scale) {
- bool use_and_save_ideal_scale =
- ideal_raster_scale >= 1.f && !animating_transform_to_screen;
- if (use_and_save_ideal_scale)
- layer->set_raster_scale(ideal_raster_scale);
- }
- }
-
- float raster_scale = 1.f;
- if (!layer->raster_scale_is_unknown())
- raster_scale = layer->raster_scale();
-
- gfx::Size old_content_bounds = layer->content_bounds();
- float old_contents_scale_x = layer->contents_scale_x();
- float old_contents_scale_y = layer->contents_scale_y();
-
- float contents_scale = raster_scale * device_scale_factor * page_scale_factor;
- CalculateContentsScale(layer, contents_scale);
-
- if (layer->content_bounds() != old_content_bounds ||
- layer->contents_scale_x() != old_contents_scale_x ||
- layer->contents_scale_y() != old_contents_scale_y)
- layer->SetNeedsPushProperties();
-}
-
static inline void CalculateAnimationContentsScale(
Layer* layer,
bool ancestor_is_animating_scale,
@@ -1529,14 +1439,6 @@ static LayerImplList* GetLayerListForSorting(LayerImplList* layer_list) {
return layer_list;
}
-static inline gfx::Vector2d BoundsDelta(Layer* layer) {
- return gfx::Vector2d();
-}
-
-static inline gfx::Vector2d BoundsDelta(LayerImpl* layer) {
- return gfx::ToCeiledVector2d(layer->bounds_delta());
-}
-
template <typename LayerType, typename GetIndexAndCountType>
static void SortLayerListContributions(
const LayerType& parent,
@@ -1849,13 +1751,6 @@ static void CalculateDrawPropertiesInternal(
? std::max(combined_transform_scales.x(),
combined_transform_scales.y())
: layer_scale_factors;
- UpdateLayerContentsScale(layer, globals.can_adjust_raster_scales,
- ideal_contents_scale, globals.device_scale_factor,
- data_from_ancestor.in_subtree_of_page_scale_layer
- ? globals.page_scale_factor
- : 1.f,
- animating_transform_to_screen);
-
UpdateLayerScaleDrawProperties(
layer, ideal_contents_scale, combined_maximum_animation_contents_scale,
combined_starting_animation_contents_scale,
@@ -2031,7 +1926,7 @@ static void CalculateDrawPropertiesInternal(
layer->mask_layer()->draw_properties();
mask_layer_draw_properties.render_target = layer;
mask_layer_draw_properties.visible_content_rect =
- gfx::Rect(layer->content_bounds());
+ gfx::Rect(layer->bounds());
}
if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
@@ -2039,7 +1934,7 @@ static void CalculateDrawPropertiesInternal(
layer->replica_layer()->mask_layer()->draw_properties();
replica_mask_draw_properties.render_target = layer;
replica_mask_draw_properties.visible_content_rect =
- gfx::Rect(layer->content_bounds());
+ gfx::Rect(layer->bounds());
}
// Ignore occlusion from outside the surface when surface contents need to
@@ -2157,22 +2052,10 @@ static void CalculateDrawPropertiesInternal(
layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text;
- gfx::Size content_size_affected_by_delta(layer->content_bounds());
-
- // Non-zero BoundsDelta imply the contents_scale of 1.0
- // because BoundsDela is only set on Android where
- // ContentScalingLayer is never used.
- DCHECK_IMPLIES(!BoundsDelta(layer).IsZero(),
- (layer->contents_scale_x() == 1.0 &&
- layer->contents_scale_y() == 1.0));
-
- // Thus we can omit contents scale in the following calculation.
- gfx::Vector2d bounds_delta = BoundsDelta(layer);
- content_size_affected_by_delta.Enlarge(bounds_delta.x(), bounds_delta.y());
-
+ // The layer bounds() includes the layer's bounds_delta() which we want
+ // for the clip rect.
gfx::Rect rect_in_target_space = MathUtil::MapEnclosingClippedRect(
- layer->draw_transform(),
- gfx::Rect(content_size_affected_by_delta));
+ layer->draw_transform(), gfx::Rect(layer->bounds()));
if (LayerClipsSubtree(layer)) {
layer_or_ancestor_clips_descendants = true;
diff --git a/cc/trees/layer_tree_host_common_perftest.cc b/cc/trees/layer_tree_host_common_perftest.cc
index 08e5404..e42d87e 100644
--- a/cc/trees/layer_tree_host_common_perftest.cc
+++ b/cc/trees/layer_tree_host_common_perftest.cc
@@ -154,10 +154,8 @@ class BspTreePerfTest : public CalcDrawPropsTest {
for (LayerImplList::iterator it = base_list.begin(); it != base_list.end();
++it) {
DrawPolygon* draw_polygon =
- new DrawPolygon(NULL,
- gfx::RectF((*it)->content_bounds()),
- (*it)->draw_transform(),
- polygon_counter++);
+ new DrawPolygon(NULL, gfx::RectF((*it)->bounds()),
+ (*it)->draw_transform(), polygon_counter++);
polygon_list.push_back(scoped_ptr<DrawPolygon>(draw_polygon));
}
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 55fa3bf..2fc2f6e 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -4111,13 +4111,13 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) {
// The animating layers should have a visible content rect that represents the
// area of the front face that is within the viewport.
EXPECT_EQ(animating_child->visible_content_rect(),
- gfx::Rect(animating_child->content_bounds()));
+ gfx::Rect(animating_child->bounds()));
EXPECT_EQ(animating_surface->visible_content_rect(),
- gfx::Rect(animating_surface->content_bounds()));
+ gfx::Rect(animating_surface->bounds()));
// And layers in the subtree of the animating layer should have valid visible
// content rects also.
EXPECT_EQ(child_of_animating_surface->visible_content_rect(),
- gfx::Rect(child_of_animating_surface->content_bounds()));
+ gfx::Rect(child_of_animating_surface->bounds()));
}
TEST_F(LayerTreeHostCommonTest,
@@ -4302,12 +4302,12 @@ TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) {
parent->draw_transform());
// Verify results of transformed parent rects
- gfx::RectF parent_content_bounds(parent->content_bounds());
+ gfx::RectF parent_bounds(parent->bounds());
gfx::RectF parent_draw_rect =
- MathUtil::MapClippedRect(parent->draw_transform(), parent_content_bounds);
- gfx::RectF parent_screen_space_rect = MathUtil::MapClippedRect(
- parent->screen_space_transform(), parent_content_bounds);
+ MathUtil::MapClippedRect(parent->draw_transform(), parent_bounds);
+ gfx::RectF parent_screen_space_rect =
+ MathUtil::MapClippedRect(parent->screen_space_transform(), parent_bounds);
gfx::RectF expected_parent_draw_rect(parent->bounds());
expected_parent_draw_rect.Scale(device_scale_factor);
@@ -4330,17 +4330,17 @@ TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) {
// Verify results of transformed child and child_empty rects. They should
// match.
- gfx::RectF child_content_bounds(child->content_bounds());
+ gfx::RectF child_bounds(child->bounds());
gfx::RectF child_draw_rect =
- MathUtil::MapClippedRect(child->draw_transform(), child_content_bounds);
- gfx::RectF child_screen_space_rect = MathUtil::MapClippedRect(
- child->screen_space_transform(), child_content_bounds);
+ MathUtil::MapClippedRect(child->draw_transform(), child_bounds);
+ gfx::RectF child_screen_space_rect =
+ MathUtil::MapClippedRect(child->screen_space_transform(), child_bounds);
- gfx::RectF child_empty_draw_rect = MathUtil::MapClippedRect(
- child_empty->draw_transform(), child_content_bounds);
+ gfx::RectF child_empty_draw_rect =
+ MathUtil::MapClippedRect(child_empty->draw_transform(), child_bounds);
gfx::RectF child_empty_screen_space_rect = MathUtil::MapClippedRect(
- child_empty->screen_space_transform(), child_content_bounds);
+ child_empty->screen_space_transform(), child_bounds);
gfx::RectF expected_child_draw_rect(child->position(), child->bounds());
expected_child_draw_rect.Scale(device_scale_factor);
@@ -4692,8 +4692,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) {
duplicate_child_non_owner->screen_space_transform());
EXPECT_EQ(child->drawable_content_rect(),
duplicate_child_non_owner->drawable_content_rect());
- EXPECT_EQ(child->content_bounds(),
- duplicate_child_non_owner->content_bounds());
+ EXPECT_EQ(child->bounds(), duplicate_child_non_owner->bounds());
gfx::Transform expected_render_surface_draw_transform;
expected_render_surface_draw_transform.Translate(
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index f29f3da..2260925 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2879,8 +2879,7 @@ float LayerTreeHostImpl::DeviceSpaceDistanceToLayer(
if (!layer_impl)
return std::numeric_limits<float>::max();
- gfx::Rect layer_impl_bounds(
- layer_impl->content_bounds());
+ gfx::Rect layer_impl_bounds(layer_impl->bounds());
gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect(
layer_impl->screen_space_transform(),
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index e814e70..0dfcd01 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3932,7 +3932,7 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
scoped_ptr<LayerImpl> clip_layer =
LayerImpl::Create(host_impl_->active_tree(), child_clip_layer_id);
scoped_ptr<LayerImpl> child = CreateScrollableLayer(
- child_layer_id, scroll_layer->content_bounds(), clip_layer.get());
+ child_layer_id, scroll_layer->bounds(), clip_layer.get());
gfx::Transform rotate_transform;
rotate_transform.Translate(-50.0, -50.0);
rotate_transform.Rotate(child_layer_angle);
@@ -4727,7 +4727,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Opaque layer, drawn without blending.
layer1->SetContentsOpaque(true);
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4736,7 +4736,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Layer with translucent content and painting, so drawn with blending.
layer1->SetContentsOpaque(false);
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4746,7 +4746,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetOpacity(0.5f);
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4756,7 +4756,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetOpacity(0.5f);
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4774,11 +4774,11 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetOpacity(1.f);
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(true);
layer2->SetOpacity(1.f);
layer2->SetExpectation(false, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4789,9 +4789,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Child layer with opaque content, drawn without blending.
layer1->SetContentsOpaque(false);
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetExpectation(false, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4803,9 +4803,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Child layer with opaque content, drawn without blending.
layer1->SetContentsOpaque(true);
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetExpectation(false, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4821,9 +4821,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpacity(0.5f);
layer1->SetHasRenderSurface(true);
layer1->SetExpectation(false, true);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetExpectation(false, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(
host_impl_->active_tree()->root_layer());
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -4838,11 +4838,11 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetOpacity(1.f);
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(true);
layer2->SetOpacity(0.5f);
layer2->SetExpectation(true, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4853,11 +4853,11 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetOpacity(1.f);
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(false);
layer2->SetOpacity(1.f);
layer2->SetExpectation(true, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4869,11 +4869,11 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetOpacity(1.f);
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(true);
layer2->SetOpacity(1.f);
layer2->SetExpectation(false, false);
- layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4886,7 +4886,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4898,7 +4898,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4910,7 +4910,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(true, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -4923,7 +4923,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(false, false);
- layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
+ layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
EXPECT_TRUE(layer1->quads_appended());
@@ -5354,7 +5354,7 @@ class FakeLayerWithQuads : public LayerImpl {
PopulateSharedQuadState(shared_quad_state);
SkColor gray = SkColorSetRGB(100, 100, 100);
- gfx::Rect quad_rect(content_bounds());
+ gfx::Rect quad_rect(bounds());
gfx::Rect visible_quad_rect(quad_rect);
SolidColorDrawQuad* my_quad =
render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
@@ -5820,12 +5820,12 @@ class LayerTreeHostImplTestWithDelegatingRenderer
ASSERT_EQ(2u, root_render_pass->quad_list.size());
LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
- gfx::RectF expected_child_visible_rect(child->content_bounds());
+ gfx::RectF expected_child_visible_rect(child->bounds());
EXPECT_EQ(expected_child_visible_rect,
root_render_pass->quad_list.front()->visible_rect);
LayerImpl* root = host_impl_->active_tree()->root_layer();
- gfx::RectF expected_root_visible_rect(root->content_bounds());
+ gfx::RectF expected_root_visible_rect(root->bounds());
EXPECT_EQ(expected_root_visible_rect,
root_render_pass->quad_list.ElementAt(1)->visible_rect);
}
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 9efb89c..ce3c3e06 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -503,7 +503,7 @@ gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const {
return gfx::Rect();
LayerImpl* layer = root_scroll_layer->children()[0];
return MathUtil::MapEnclosingClippedRect(layer->screen_space_transform(),
- gfx::Rect(layer->content_bounds()));
+ gfx::Rect(layer->bounds()));
}
void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() {
@@ -1334,10 +1334,8 @@ static bool PointIsClippedBySurfaceOrClipRect(
return true;
if (LayerClipsSubtree(layer) &&
- !PointHitsRect(screen_space_point,
- layer->screen_space_transform(),
- gfx::Rect(layer->content_bounds()),
- NULL))
+ !PointHitsRect(screen_space_point, layer->screen_space_transform(),
+ gfx::Rect(layer->bounds()), NULL))
return true;
}
@@ -1349,7 +1347,7 @@ static bool PointIsClippedBySurfaceOrClipRect(
static bool PointHitsLayer(const LayerImpl* layer,
const gfx::PointF& screen_space_point,
float* distance_to_intersection) {
- gfx::RectF content_rect(layer->content_bounds());
+ gfx::RectF content_rect(layer->bounds());
if (!PointHitsRect(screen_space_point,
layer->screen_space_transform(),
content_rect,
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 11ce4bc..4811893 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -380,87 +380,6 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) {
EXPECT_EQ(12345, result_layer->id());
}
-TEST_F(LayerTreeImplTest, HitTestingForSingleLayerWithScaledContents) {
- // A layer's visible content rect is actually in the layer's content space.
- // The screen space transform converts from the layer's origin space to screen
- // space. This test makes sure that hit testing works correctly accounts for
- // the contents scale. A contents scale that is not 1 effectively forces a
- // non-identity transform between layer's content space and layer's origin
- // space. The hit testing code must take this into account.
- //
- // To test this, the layer is positioned at (25, 25), and is size (50, 50). If
- // contents scale is ignored, then hit testing will mis-interpret the visible
- // content rect as being larger than the actual bounds of the layer.
- //
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
-
- gfx::Transform identity_matrix;
- gfx::Point3F transform_origin;
-
- SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
- gfx::PointF(), gfx::Size(100, 100), true, false,
- true);
- {
- gfx::PointF position(25.f, 25.f);
- gfx::Size bounds(50, 50);
- scoped_ptr<LayerImpl> test_layer =
- LayerImpl::Create(host_impl().active_tree(), 12345);
- SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
- transform_origin, position, bounds, true,
- false, false);
-
- // override content bounds and contents scale
- test_layer->SetContentBounds(gfx::Size(100, 100));
- test_layer->SetContentsScale(2, 2);
-
- test_layer->SetDrawsContent(true);
- root->AddChild(test_layer.Pass());
- }
-
- host_impl().SetViewportSize(root->bounds());
- host_impl().active_tree()->SetRootLayer(root.Pass());
- host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
-
- // Sanity check the scenario we just created.
- // The visible content rect for test_layer is actually 100x100, even though
- // its layout size is 50x50, positioned at 25x25.
- LayerImpl* test_layer =
- host_impl().active_tree()->root_layer()->children()[0];
- EXPECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect());
- ASSERT_EQ(1u, RenderSurfaceLayerList().size());
- ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
-
- // Hit testing for a point outside the layer should return a null pointer (the
- // root layer does not draw content, so it will not be hit tested either).
- gfx::Point test_point(101, 101);
- LayerImpl* result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(24, 24);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(76, 76);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- EXPECT_FALSE(result_layer);
-
- // Hit testing for a point inside should return the test layer.
- test_point = gfx::Point(26, 26);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(12345, result_layer->id());
-
- test_point = gfx::Point(74, 74);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(12345, result_layer->id());
-}
-
TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
// Test that hit-testing will only work for the visible portion of a layer,
// and not the entire layer bounds. Here we just test the simple axis-aligned
@@ -1500,110 +1419,6 @@ TEST_F(LayerTreeImplTest,
}
TEST_F(LayerTreeImplTest,
- HitCheckingTouchHandlerRegionsForSingleLayerWithScaledContents) {
- // A layer's visible content rect is actually in the layer's content space.
- // The screen space transform converts from the layer's origin space to screen
- // space. This test makes sure that hit testing works correctly accounts for
- // the contents scale. A contents scale that is not 1 effectively forces a
- // non-identity transform between layer's content space and layer's origin
- // space. The hit testing code must take this into account.
- //
- // To test this, the layer is positioned at (25, 25), and is size (50, 50). If
- // contents scale is ignored, then hit checking will mis-interpret the visible
- // content rect as being larger than the actual bounds of the layer.
- //
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
-
- gfx::Transform identity_matrix;
- gfx::Point3F transform_origin;
-
- SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
- gfx::PointF(), gfx::Size(100, 100), true, false,
- true);
- {
- Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
- gfx::PointF position(25.f, 25.f);
- gfx::Size bounds(50, 50);
- scoped_ptr<LayerImpl> test_layer =
- LayerImpl::Create(host_impl().active_tree(), 12345);
- SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
- transform_origin, position, bounds, true,
- false, false);
-
- // override content bounds and contents scale
- test_layer->SetContentBounds(gfx::Size(100, 100));
- test_layer->SetContentsScale(2, 2);
-
- test_layer->SetDrawsContent(true);
- test_layer->SetTouchEventHandlerRegion(touch_handler_region);
- root->AddChild(test_layer.Pass());
- }
-
- host_impl().SetViewportSize(root->bounds());
- host_impl().active_tree()->SetRootLayer(root.Pass());
- host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
-
- // Sanity check the scenario we just created.
- // The visible content rect for test_layer is actually 100x100, even though
- // its layout size is 50x50, positioned at 25x25.
- LayerImpl* test_layer =
- host_impl().active_tree()->root_layer()->children()[0];
- EXPECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect());
- ASSERT_EQ(1u, RenderSurfaceLayerList().size());
- ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
-
- // Hit checking for a point outside the layer should return a null pointer
- // (the root layer does not draw content, so it will not be tested either).
- gfx::Point test_point(76, 76);
- LayerImpl* result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- EXPECT_FALSE(result_layer);
-
- // Hit checking for a point inside the layer, but outside the touch handler
- // region should return a null pointer.
- test_point = gfx::Point(26, 26);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(34, 34);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(65, 65);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(74, 74);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- EXPECT_FALSE(result_layer);
-
- // Hit checking for a point inside the touch event handler region should
- // return the root layer.
- test_point = gfx::Point(35, 35);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(12345, result_layer->id());
-
- test_point = gfx::Point(64, 64);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(12345, result_layer->id());
-}
-
-TEST_F(LayerTreeImplTest,
HitCheckingTouchHandlerRegionsForSingleLayerWithDeviceScale) {
// The layer's device_scale_factor and page_scale_factor should scale the
// content rect and we should be able to hit the touch handler region by
@@ -1655,7 +1470,7 @@ TEST_F(LayerTreeImplTest,
ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
// Check whether the child layer fits into the root after scaled.
- EXPECT_EQ(gfx::Rect(test_layer->content_bounds()),
+ EXPECT_EQ(gfx::Rect(test_layer->bounds()),
test_layer->visible_content_rect());
// Hit checking for a point outside the layer should return a null pointer