summaryrefslogtreecommitdiff
path: root/chromium/cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-02-01 15:42:22 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-02-01 15:55:43 +0000
commit98a0061b881063a62c1941ccb67af6660ca89062 (patch)
tree5e77cc6ad4735e53db0d7a8766ed26ca726f9373 /chromium/cc
parent6c91641271e536ffaa88a1dff5127e42ee99a91e (diff)
downloadqtwebengine-chromium-98a0061b881063a62c1941ccb67af6660ca89062.tar.gz
BASELINE: Update Chromium to 49.0.2623.34
Change-Id: I89af6c0074347d4415cc1ce35a6d54a3760e6ad2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'chromium/cc')
-rw-r--r--chromium/cc/layers/picture_image_layer_impl_unittest.cc3
-rw-r--r--chromium/cc/layers/picture_layer_impl.cc19
-rw-r--r--chromium/cc/layers/picture_layer_impl.h12
-rw-r--r--chromium/cc/layers/picture_layer_impl_unittest.cc181
-rw-r--r--chromium/cc/tiles/tile_manager_perftest.cc15
-rw-r--r--chromium/cc/trees/layer_tree_host_impl.cc16
-rw-r--r--chromium/cc/trees/layer_tree_host_impl_unittest.cc121
-rw-r--r--chromium/cc/trees/layer_tree_impl.cc9
8 files changed, 180 insertions, 196 deletions
diff --git a/chromium/cc/layers/picture_image_layer_impl_unittest.cc b/chromium/cc/layers/picture_image_layer_impl_unittest.cc
index 53b0061b05c..238683963c8 100644
--- a/chromium/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/chromium/cc/layers/picture_image_layer_impl_unittest.cc
@@ -92,8 +92,7 @@ class PictureImageLayerImplTest : public testing::Test {
layer->draw_properties().screen_space_transform_is_animating =
animating_transform_to_screen;
layer->draw_properties().visible_layer_rect = viewport_rect;
- bool resourceless_software_draw = false;
- layer->UpdateTiles(resourceless_software_draw);
+ layer->UpdateTiles();
}
protected:
diff --git a/chromium/cc/layers/picture_layer_impl.cc b/chromium/cc/layers/picture_layer_impl.cc
index 04ac9ad59a7..0ec6ed79d43 100644
--- a/chromium/cc/layers/picture_layer_impl.cc
+++ b/chromium/cc/layers/picture_layer_impl.cc
@@ -412,12 +412,7 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
CleanUpTilingsOnActiveLayer(last_append_quads_tilings_);
}
-bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) {
- if (!resourceless_software_draw) {
- visible_rect_for_tile_priority_ = visible_layer_rect();
- screen_space_transform_for_tile_priority_ = ScreenSpaceTransform();
- }
-
+bool PictureLayerImpl::UpdateTiles() {
if (!CanHaveTilings()) {
ideal_page_scale_ = 0.f;
ideal_device_scale_ = 0.f;
@@ -494,17 +489,17 @@ bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) {
}
void PictureLayerImpl::UpdateViewportRectForTilePriorityInContentSpace() {
- // If visible_rect_for_tile_priority_ is empty or
- // viewport_rect_for_tile_priority is set to be different from the device
- // viewport, try to inverse project the viewport into layer space and use
- // that. Otherwise just use visible_rect_for_tile_priority_
- gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_;
+ // If visible_layer_rect() is empty or viewport_rect_for_tile_priority is
+ // set to be different from the device viewport, try to inverse project the
+ // viewport into layer space and use that. Otherwise just use
+ // visible_layer_rect().
+ gfx::Rect visible_rect_in_content_space = visible_layer_rect();
gfx::Rect viewport_rect_for_tile_priority =
layer_tree_impl()->ViewportRectForTilePriority();
if (visible_rect_in_content_space.IsEmpty() ||
layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) {
gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization);
- if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) {
+ if (ScreenSpaceTransform().GetInverse(&view_to_layer)) {
// Transform from view space to content space.
visible_rect_in_content_space = MathUtil::ProjectEnclosingClippedRect(
view_to_layer, viewport_rect_for_tile_priority);
diff --git a/chromium/cc/layers/picture_layer_impl.h b/chromium/cc/layers/picture_layer_impl.h
index 8a2465a15bc..03316dcd011 100644
--- a/chromium/cc/layers/picture_layer_impl.h
+++ b/chromium/cc/layers/picture_layer_impl.h
@@ -71,7 +71,7 @@ class CC_EXPORT PictureLayerImpl
void UpdateRasterSource(scoped_refptr<DisplayListRasterSource> raster_source,
Region* new_invalidation,
const PictureLayerTilingSet* pending_set);
- bool UpdateTiles(bool resourceless_software_draw);
+ bool UpdateTiles();
void UpdateCanUseLCDTextAfterCommit();
bool RasterSourceUsesLCDText() const;
WhichTree GetTree() const;
@@ -156,15 +156,9 @@ class CC_EXPORT PictureLayerImpl
bool nearest_neighbor_;
- // Any draw properties derived from |transform|, |viewport|, and |clip|
- // parameters in LayerTreeHostImpl::OnDraw are not valid for prioritizing
- // tiles during resourceless software draws. This is because resourceless
- // software draws can have wildly different transforms/viewports from regular
- // draws. Save a copy of the required draw properties of the last frame that
- // has a valid viewport for prioritizing tiles.
- gfx::Rect visible_rect_for_tile_priority_;
+ // Use this instead of |visible_layer_rect()| for tiling calculations. This
+ // takes external viewport and transform for tile priority into account.
gfx::Rect viewport_rect_for_tile_priority_in_content_space_;
- gfx::Transform screen_space_transform_for_tile_priority_;
gfx::Size gpu_raster_max_texture_size_;
diff --git a/chromium/cc/layers/picture_layer_impl_unittest.cc b/chromium/cc/layers/picture_layer_impl_unittest.cc
index 5d16d8f6919..9d1bbc90c54 100644
--- a/chromium/cc/layers/picture_layer_impl_unittest.cc
+++ b/chromium/cc/layers/picture_layer_impl_unittest.cc
@@ -267,14 +267,13 @@ class PictureLayerImplTest : public testing::Test {
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
}
- void SetupDrawPropertiesAndUpdateTiles(
- FakePictureLayerImpl* layer,
- float ideal_contents_scale,
- float device_scale_factor,
- float page_scale_factor,
- float maximum_animation_contents_scale,
- float starting_animation_contents_scale,
- bool animating_transform_to_screen) {
+ void SetupDrawProperties(FakePictureLayerImpl* layer,
+ float ideal_contents_scale,
+ float device_scale_factor,
+ float page_scale_factor,
+ float maximum_animation_contents_scale,
+ float starting_animation_contents_scale,
+ bool animating_transform_to_screen) {
layer->layer_tree_impl()->SetDeviceScaleFactor(device_scale_factor);
host_impl_.active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
@@ -288,9 +287,23 @@ class PictureLayerImplTest : public testing::Test {
starting_animation_contents_scale;
layer->draw_properties().screen_space_transform_is_animating =
animating_transform_to_screen;
- bool resourceless_software_draw = false;
- layer->UpdateTiles(resourceless_software_draw);
}
+
+ void SetupDrawPropertiesAndUpdateTiles(
+ FakePictureLayerImpl* layer,
+ float ideal_contents_scale,
+ float device_scale_factor,
+ float page_scale_factor,
+ float maximum_animation_contents_scale,
+ float starting_animation_contents_scale,
+ bool animating_transform_to_screen) {
+ SetupDrawProperties(layer, ideal_contents_scale, device_scale_factor,
+ page_scale_factor, maximum_animation_contents_scale,
+ starting_animation_contents_scale,
+ animating_transform_to_screen);
+ layer->UpdateTiles();
+ }
+
static void VerifyAllPrioritizedTilesExistAndHaveRasterSource(
const PictureLayerTiling* tiling,
DisplayListRasterSource* raster_source) {
@@ -546,89 +559,6 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
}
}
-TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
- host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
- gfx::Size layer_bounds(400, 400);
- SetupDefaultTrees(layer_bounds);
-
- SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
- false);
-
- // UpdateTiles with valid viewport. Should update tile viewport.
- // Note viewport is considered invalid if and only if in resourceless
- // software draw.
- bool resourceless_software_draw = false;
- gfx::Rect viewport = gfx::Rect(layer_bounds);
- gfx::Transform draw_transform;
- gfx::Transform tile_priority_transform;
- host_impl_.SetExternalTilePriorityConstraints(viewport,
- tile_priority_transform);
- active_layer_->draw_properties().visible_layer_rect = viewport;
- active_layer_->draw_properties().screen_space_transform = draw_transform;
- active_layer_->UpdateTiles(resourceless_software_draw);
-
- gfx::Rect visible_rect_for_tile_priority =
- active_layer_->visible_rect_for_tile_priority();
- EXPECT_FALSE(visible_rect_for_tile_priority.IsEmpty());
- gfx::Transform screen_space_transform_for_tile_priority =
- active_layer_->draw_properties().screen_space_transform;
-
- // Expand viewport and set it as invalid for prioritizing tiles.
- // Should update viewport and transform, but not update visible rect.
- host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
- resourceless_software_draw = true;
- viewport = gfx::ScaleToEnclosingRect(viewport, 2);
- tile_priority_transform.Translate(1.f, 0.f);
- draw_transform.Translate(0.f, 1.f);
- active_layer_->draw_properties().visible_layer_rect = viewport;
- active_layer_->draw_properties().screen_space_transform = draw_transform;
- host_impl_.SetExternalTilePriorityConstraints(viewport,
- tile_priority_transform);
- active_layer_->UpdateTiles(resourceless_software_draw);
-
- // Transform for tile priority is not updated.
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- screen_space_transform_for_tile_priority,
- active_layer_->screen_space_transform_for_tile_priority());
- // Visible rect for tile priority retains old value.
- EXPECT_EQ(visible_rect_for_tile_priority,
- active_layer_->visible_rect_for_tile_priority());
- ASSERT_GT(active_layer_->picture_layer_tiling_set()->num_tilings(), 0u);
- EXPECT_EQ(active_layer_->viewport_rect_for_tile_priority_in_content_space(),
- active_layer_->picture_layer_tiling_set()
- ->tiling_at(0)
- ->GetCurrentVisibleRectForTesting());
-
- // Keep expanded viewport but mark it valid. Should update tile viewport.
- host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
- resourceless_software_draw = false;
- host_impl_.SetExternalTilePriorityConstraints(viewport,
- tile_priority_transform);
- active_layer_->UpdateTiles(resourceless_software_draw);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- draw_transform,
- active_layer_->screen_space_transform_for_tile_priority());
- EXPECT_EQ(viewport, active_layer_->visible_rect_for_tile_priority());
-
- gfx::RectF visible_rect_in_content_space(viewport);
- gfx::Transform inverse_draw_transform;
- gfx::Transform inverse_tile_priority_transform;
- EXPECT_TRUE(draw_transform.GetInverse(&inverse_draw_transform));
- EXPECT_TRUE(
- tile_priority_transform.GetInverse(&inverse_tile_priority_transform));
- visible_rect_in_content_space = MathUtil::ProjectClippedRect(
- inverse_tile_priority_transform, visible_rect_in_content_space);
- visible_rect_in_content_space = MathUtil::ProjectClippedRect(
- inverse_draw_transform, visible_rect_in_content_space);
-
- ASSERT_GT(active_layer_->picture_layer_tiling_set()->num_tilings(), 0u);
- EXPECT_EQ(gfx::ToEnclosingRect(visible_rect_in_content_space),
- active_layer_->picture_layer_tiling_set()
- ->tiling_at(0)
- ->GetCurrentVisibleRectForTesting());
-}
-
TEST_F(PictureLayerImplTest, ViewportRectForTilePriorityIsCached) {
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
gfx::Size layer_bounds(400, 400);
@@ -1811,7 +1741,6 @@ TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) {
gfx::Size layer_bounds(200, 200);
gfx::Transform transform;
- bool resourceless_software_draw = false;
gfx::Rect viewport(0, 0, 100, 200);
host_impl_.SetExternalTilePriorityConstraints(viewport, transform);
@@ -1826,7 +1755,7 @@ TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) {
base::TimeTicks time_ticks;
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
- pending_layer_->UpdateTiles(resourceless_software_draw);
+ pending_layer_->UpdateTiles();
int num_visible = 0;
int num_offscreen = 0;
@@ -1867,7 +1796,6 @@ TEST_F(NoLowResPictureLayerImplTest,
gfx::Rect viewport = gfx::Rect(layer_bounds);
gfx::Transform transform;
gfx::Transform transform_for_tile_priority;
- bool resourceless_software_draw = false;
host_impl_.SetExternalTilePriorityConstraints(
external_viewport_for_tile_priority, transform_for_tile_priority);
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
@@ -1878,7 +1806,7 @@ TEST_F(NoLowResPictureLayerImplTest,
// external_viewport_for_tile_priority.
pending_layer_->draw_properties().visible_layer_rect = visible_layer_rect;
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
- pending_layer_->UpdateTiles(resourceless_software_draw);
+ pending_layer_->UpdateTiles();
// Intersect the two rects. Any tile outside should not be required for
// activation.
@@ -3107,8 +3035,7 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueue) {
pending_layer_->draw_properties().visible_layer_rect =
gfx::Rect(1100, 1100, 500, 500);
- bool resourceless_software_draw = false;
- pending_layer_->UpdateTiles(resourceless_software_draw);
+ pending_layer_->UpdateTiles();
unique_tiles.clear();
high_res_tile_count = 0u;
@@ -3137,7 +3064,7 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueue) {
pending_layer_->draw_properties().visible_layer_rect =
gfx::Rect(0, 0, 500, 500);
- pending_layer_->UpdateTiles(resourceless_software_draw);
+ pending_layer_->UpdateTiles();
std::vector<Tile*> high_res_tiles =
pending_layer_->HighResTiling()->AllTilesForTesting();
@@ -3669,60 +3596,6 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
AssertNoTilesRequired(pending_layer_->LowResTiling());
}
-TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
- host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
- gfx::Size layer_bounds(400, 400);
- SetupDefaultTrees(layer_bounds);
-
- SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
- false);
-
- // UpdateTiles with valid viewport. Should update tile viewport.
- // Note viewport is considered invalid if and only if in resourceless
- // software draw.
- bool resourceless_software_draw = false;
- gfx::Rect viewport = gfx::Rect(layer_bounds);
- gfx::Transform transform;
- host_impl_.SetExternalTilePriorityConstraints(viewport, transform);
- active_layer_->draw_properties().visible_layer_rect = viewport;
- active_layer_->draw_properties().screen_space_transform = transform;
- active_layer_->UpdateTiles(resourceless_software_draw);
-
- gfx::Rect visible_rect_for_tile_priority =
- active_layer_->visible_rect_for_tile_priority();
- EXPECT_FALSE(visible_rect_for_tile_priority.IsEmpty());
- gfx::Transform screen_space_transform_for_tile_priority =
- active_layer_->draw_properties().screen_space_transform;
-
- // Expand viewport and set it as invalid for prioritizing tiles.
- // Should update viewport and transform, but not update visible rect.
- host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
- resourceless_software_draw = true;
- viewport = gfx::ScaleToEnclosingRect(viewport, 2);
- transform.Translate(1.f, 1.f);
- active_layer_->draw_properties().visible_layer_rect = viewport;
- active_layer_->draw_properties().screen_space_transform = transform;
- host_impl_.SetExternalTilePriorityConstraints(viewport, transform);
- active_layer_->UpdateTiles(resourceless_software_draw);
-
- // Transform for tile priority is updated.
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- transform, active_layer_->draw_properties().screen_space_transform);
- // Visible rect for tile priority retains old value.
- EXPECT_EQ(visible_rect_for_tile_priority,
- active_layer_->visible_rect_for_tile_priority());
-
- // Keep expanded viewport but mark it valid. Should update tile viewport.
- host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
- resourceless_software_draw = false;
- host_impl_.SetExternalTilePriorityConstraints(viewport, transform);
- active_layer_->UpdateTiles(resourceless_software_draw);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- transform, active_layer_->draw_properties().screen_space_transform);
- EXPECT_EQ(viewport, active_layer_->visible_rect_for_tile_priority());
-}
-
TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
gfx::Size layer_bounds(1300, 1900);
std::vector<PictureLayerTiling*> used_tilings;
diff --git a/chromium/cc/tiles/tile_manager_perftest.cc b/chromium/cc/tiles/tile_manager_perftest.cc
index 07bbb2b618c..53b7ba819ba 100644
--- a/chromium/cc/tiles/tile_manager_perftest.cc
+++ b/chromium/cc/tiles/tile_manager_perftest.cc
@@ -187,9 +187,8 @@ class TileManagerPerfTest : public testing::Test {
int priority_count = 0;
std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10);
- bool resourceless_software_draw = false;
for (const auto& layer : layers)
- layer->UpdateTiles(resourceless_software_draw);
+ layer->UpdateTiles();
timer_.Reset();
do {
@@ -215,9 +214,8 @@ class TileManagerPerfTest : public testing::Test {
NEW_CONTENT_TAKES_PRIORITY};
std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100);
- bool resourceless_software_draw = false;
for (const auto& layer : layers)
- layer->UpdateTiles(resourceless_software_draw);
+ layer->UpdateTiles();
int priority_count = 0;
timer_.Reset();
@@ -251,9 +249,8 @@ class TileManagerPerfTest : public testing::Test {
int priority_count = 0;
std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10);
- bool resourceless_software_draw = false;
for (const auto& layer : layers) {
- layer->UpdateTiles(resourceless_software_draw);
+ layer->UpdateTiles();
for (size_t i = 0; i < layer->num_tilings(); ++i) {
tile_manager()->InitializeTilesWithResourcesForTesting(
layer->tilings()->tiling_at(i)->AllTilesForTesting());
@@ -286,9 +283,8 @@ class TileManagerPerfTest : public testing::Test {
std::vector<FakePictureLayerImpl*> layers =
CreateLayers(layer_count, tile_count);
- bool resourceless_software_draw = false;
for (const auto& layer : layers) {
- layer->UpdateTiles(resourceless_software_draw);
+ layer->UpdateTiles();
for (size_t i = 0; i < layer->num_tilings(); ++i) {
tile_manager()->InitializeTilesWithResourcesForTesting(
layer->tilings()->tiling_at(i)->AllTilesForTesting());
@@ -396,11 +392,10 @@ class TileManagerPerfTest : public testing::Test {
CreateLayers(layer_count, approximate_tile_count_per_layer);
timer_.Reset();
- bool resourceless_software_draw = false;
do {
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
for (const auto& layer : layers)
- layer->UpdateTiles(resourceless_software_draw);
+ layer->UpdateTiles();
GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest());
tile_manager()->PrepareTiles(global_state);
diff --git a/chromium/cc/trees/layer_tree_host_impl.cc b/chromium/cc/trees/layer_tree_host_impl.cc
index 057228f0369..96c1d684fd3 100644
--- a/chromium/cc/trees/layer_tree_host_impl.cc
+++ b/chromium/cc/trees/layer_tree_host_impl.cc
@@ -2632,7 +2632,12 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta) {
if (LayerImpl* layer_impl = CurrentlyScrollingLayer()) {
- return ScrollAnimationUpdateTarget(layer_impl, scroll_delta)
+ gfx::Vector2dF delta = scroll_delta;
+ if (!layer_impl->user_scrollable(ScrollbarOrientation::HORIZONTAL))
+ delta.set_x(0);
+ if (!layer_impl->user_scrollable(ScrollbarOrientation::VERTICAL))
+ delta.set_y(0);
+ return ScrollAnimationUpdateTarget(layer_impl, delta)
? SCROLL_STARTED
: SCROLL_IGNORED;
}
@@ -2659,6 +2664,15 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
target_offset.SetToMin(layer_impl->MaxScrollOffset());
gfx::Vector2dF actual_delta = target_offset.DeltaFrom(current_offset);
+ if (!layer_impl->user_scrollable(ScrollbarOrientation::HORIZONTAL)) {
+ actual_delta.set_x(0);
+ target_offset.set_x(current_offset.x());
+ }
+ if (!layer_impl->user_scrollable(ScrollbarOrientation::VERTICAL)) {
+ actual_delta.set_y(0);
+ target_offset.set_y(current_offset.y());
+ }
+
const float kEpsilon = 0.1f;
bool can_layer_scroll = (std::abs(actual_delta.x()) > kEpsilon ||
std::abs(actual_delta.y()) > kEpsilon);
diff --git a/chromium/cc/trees/layer_tree_host_impl_unittest.cc b/chromium/cc/trees/layer_tree_host_impl_unittest.cc
index 814279ebc22..e1aa12df7e5 100644
--- a/chromium/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/chromium/cc/trees/layer_tree_host_impl_unittest.cc
@@ -8945,6 +8945,45 @@ TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
EXPECT_FALSE(last_on_draw_frame_->has_no_damage);
}
+TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
+ ResourcelessSoftwareDrawSkipsUpdateTiles) {
+ const gfx::Size viewport_size(100, 100);
+ host_impl_->SetViewportSize(viewport_size);
+
+ host_impl_->CreatePendingTree();
+ scoped_refptr<FakeDisplayListRasterSource> raster_source(
+ FakeDisplayListRasterSource::CreateFilled(viewport_size));
+ scoped_ptr<FakePictureLayerImpl> layer(
+ FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(),
+ 11, raster_source));
+ layer->SetBounds(viewport_size);
+ layer->SetDrawsContent(true);
+ host_impl_->pending_tree()->SetRootLayer(std::move(layer));
+
+ host_impl_->pending_tree()->BuildPropertyTreesForTesting();
+ host_impl_->ActivateSyncTree();
+
+ const gfx::Transform draw_transform;
+ const gfx::Rect draw_viewport(viewport_size);
+ const gfx::Rect clip(viewport_size);
+ bool resourceless_software_draw = false;
+
+ // Regular draw causes UpdateTiles.
+ did_request_prepare_tiles_ = false;
+ host_impl_->OnDraw(draw_transform, draw_viewport, clip,
+ resourceless_software_draw);
+ EXPECT_TRUE(did_request_prepare_tiles_);
+ host_impl_->PrepareTiles();
+
+ // Resourceless draw skips UpdateTiles.
+ const gfx::Rect new_draw_viewport(50, 50);
+ resourceless_software_draw = true;
+ did_request_prepare_tiles_ = false;
+ host_impl_->OnDraw(draw_transform, new_draw_viewport, clip,
+ resourceless_software_draw);
+ EXPECT_FALSE(did_request_prepare_tiles_);
+}
+
TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) {
const gfx::Size layer_size(100, 100);
SetupScrollAndContentsLayers(layer_size);
@@ -9143,7 +9182,10 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
// Test that a smooth scroll offset animation is aborted when followed by a
// non-smooth scroll offset animation.
TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) {
- SetupScrollAndContentsLayers(gfx::Size(100, 200));
+ const gfx::Size content_size(1000, 1000);
+ const gfx::Size viewport_size(500, 500);
+ CreateBasicVirtualViewportLayers(viewport_size, content_size);
+
DrawFrame();
base::TimeTicks start_time =
@@ -9208,7 +9250,10 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) {
// Evolved from LayerTreeHostImplTest.ScrollAnimated.
TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) {
- SetupScrollAndContentsLayers(gfx::Size(100, 200));
+ const gfx::Size content_size(1000, 1000);
+ const gfx::Size viewport_size(500, 500);
+ CreateBasicVirtualViewportLayers(viewport_size, content_size);
+
DrawFrame();
base::TimeTicks start_time =
@@ -9221,7 +9266,6 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) {
host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)));
LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer();
-
begin_frame_args.frame_time = start_time;
host_impl_->WillBeginImplFrame(begin_frame_args);
host_impl_->Animate();
@@ -9267,6 +9311,77 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) {
host_impl_->DidFinishImplFrame();
}
+// Test that smooth scroll offset animation doesn't happen for non user
+// scrollable layers.
+TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedNotUserScrollable) {
+ const gfx::Size content_size(1000, 1000);
+ const gfx::Size viewport_size(500, 500);
+ CreateBasicVirtualViewportLayers(viewport_size, content_size);
+
+ host_impl_->OuterViewportScrollLayer()->set_user_scrollable_vertical(true);
+ host_impl_->OuterViewportScrollLayer()->set_user_scrollable_horizontal(false);
+
+ DrawFrame();
+
+ base::TimeTicks start_time =
+ base::TimeTicks() + base::TimeDelta::FromMilliseconds(100);
+
+ BeginFrameArgs begin_frame_args =
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
+
+ EXPECT_EQ(
+ InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(50, 50)));
+
+ LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer();
+ begin_frame_args.frame_time = start_time;
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ host_impl_->Animate();
+ host_impl_->UpdateAnimationState(true);
+
+ EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
+ host_impl_->DidFinishImplFrame();
+
+ begin_frame_args.frame_time =
+ start_time + base::TimeDelta::FromMilliseconds(50);
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ host_impl_->Animate();
+ host_impl_->UpdateAnimationState(true);
+
+ // Should not have scrolled horizontally.
+ EXPECT_EQ(0, scrolling_layer->CurrentScrollOffset().x());
+ float y = scrolling_layer->CurrentScrollOffset().y();
+ EXPECT_TRUE(y > 1 && y < 49);
+
+ // Update target.
+ EXPECT_EQ(
+ InputHandler::SCROLL_STARTED,
+ host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(50, 50)));
+ host_impl_->DidFinishImplFrame();
+
+ begin_frame_args.frame_time =
+ start_time + base::TimeDelta::FromMilliseconds(200);
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ host_impl_->Animate();
+ host_impl_->UpdateAnimationState(true);
+
+ y = scrolling_layer->CurrentScrollOffset().y();
+ EXPECT_TRUE(y > 50 && y < 100);
+ EXPECT_EQ(scrolling_layer, host_impl_->CurrentlyScrollingLayer());
+ host_impl_->DidFinishImplFrame();
+
+ begin_frame_args.frame_time =
+ start_time + base::TimeDelta::FromMilliseconds(250);
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ host_impl_->Animate();
+ host_impl_->UpdateAnimationState(true);
+
+ EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100),
+ scrolling_layer->CurrentScrollOffset());
+ EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer());
+ host_impl_->DidFinishImplFrame();
+}
+
TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) {
host_impl_->CreatePendingTree();
diff --git a/chromium/cc/trees/layer_tree_impl.cc b/chromium/cc/trees/layer_tree_impl.cc
index 513ce5e5bd5..6e00daba720 100644
--- a/chromium/cc/trees/layer_tree_impl.cc
+++ b/chromium/cc/trees/layer_tree_impl.cc
@@ -836,20 +836,19 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
layer->UpdateCanUseLCDTextAfterCommit();
}
- {
+ // Resourceless draw do not need tiles and should not affect existing tile
+ // priorities.
+ if (layer_tree_host_impl_->GetDrawMode() != DRAW_MODE_RESOURCELESS_SOFTWARE) {
TRACE_EVENT_BEGIN2("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles",
"IsActive", IsActiveTree(), "SourceFrameNumber",
source_frame_number_);
- const bool resourceless_software_draw =
- (layer_tree_host_impl_->GetDrawMode() ==
- DRAW_MODE_RESOURCELESS_SOFTWARE);
size_t layers_updated_count = 0;
bool tile_priorities_updated = false;
for (PictureLayerImpl* layer : picture_layers_) {
if (!layer->IsDrawnRenderSurfaceLayerListMember())
continue;
++layers_updated_count;
- tile_priorities_updated |= layer->UpdateTiles(resourceless_software_draw);
+ tile_priorities_updated |= layer->UpdateTiles();
}
if (tile_priorities_updated)