summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_unittest_damage.cc
diff options
context:
space:
mode:
authorwjmaclean@chromium.org <wjmaclean@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-31 00:49:47 +0000
committerwjmaclean@chromium.org <wjmaclean@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-31 00:49:47 +0000
commitadeda57080446a169b93bd361978de3dbbed0f40 (patch)
tree500ac498f8b929eaa8ce263909a4889e397128ba /cc/trees/layer_tree_host_unittest_damage.cc
parenta09d53ce62c9f35c9816a24e3b940ebbc33fb518 (diff)
downloadchromium_src-adeda57080446a169b93bd361978de3dbbed0f40.zip
chromium_src-adeda57080446a169b93bd361978de3dbbed0f40.tar.gz
chromium_src-adeda57080446a169b93bd361978de3dbbed0f40.tar.bz2
Pinch/Zoom Infrastructure & Plumbing CL
This CL supplies the necessary changes to CC to support the inner/outer viewport model for pinch-zoom and fixed-position elements. The specification for these changes is contained in the document "Layer-based Solution for Pinch Zoom / Fixed Position". It incorporates a change to how scrollbar parameters are computed (removes the notion of max_scroll_offset as a quantity set be the embedder, and instead inferred from the relative sizes of a clip layer w.r.t. the scroll layer). Scrollbars are generalized so that a layer may have more than two scrollbars, and the parameters of the scrollbar are set w.r.t. the sizes and positions of a clip and a scroll layer. Further, changes to the scrip/scroll layer automatically notify any attached scrollbars. The CL also removes existing references to root_scroll_layer from LTH, LTI and LTHI and replaces them with either Inner/OuterViewportScrollLayer (dual-layer operation only exists at present if the --enable-pinch-virtual-viewport flag is specified, otherwise behavior is unchanged). Logic is added to (i) combine scroll offsets for the two viewports before passing it to the embedder, and (ii) splitting any offsets received from the embedder appropriately between the two viewports. This CL relies on https://codereview.chromium.org/138453004/ for changes in Blink to support it. BUG=148816 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=246812 R=aelias@chromium.org, enne@chromium.org, joi@chromium.org, piman@chromium.org, sky@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=247684 Review URL: https://codereview.chromium.org/23983047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees/layer_tree_host_unittest_damage.cc')
-rw-r--r--cc/trees/layer_tree_host_unittest_damage.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc
index 9c1c912..eb91e53 100644
--- a/cc/trees/layer_tree_host_unittest_damage.cc
+++ b/cc/trees/layer_tree_host_unittest_damage.cc
@@ -433,17 +433,23 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest {
root_layer->SetMasksToBounds(true);
layer_tree_host()->SetRootLayer(root_layer);
+ scoped_refptr<Layer> scroll_clip_layer = Layer::Create();
scoped_refptr<Layer> content_layer = FakeContentLayer::Create(&client_);
- content_layer->SetScrollable(true);
+ content_layer->SetScrollClipLayerId(scroll_clip_layer->id());
content_layer->SetScrollOffset(gfx::Vector2d(10, 20));
- content_layer->SetMaxScrollOffset(gfx::Vector2d(30, 50));
content_layer->SetBounds(gfx::Size(100, 200));
- root_layer->AddChild(content_layer);
+ scroll_clip_layer->SetBounds(
+ gfx::Size(content_layer->bounds().width() - 30,
+ content_layer->bounds().height() - 50));
+ scroll_clip_layer->AddChild(content_layer);
+ root_layer->AddChild(scroll_clip_layer);
scoped_refptr<Layer> scrollbar_layer =
FakePaintedScrollbarLayer::Create(false, true, content_layer->id());
scrollbar_layer->SetPosition(gfx::Point(300, 300));
scrollbar_layer->SetBounds(gfx::Size(10, 100));
+ scrollbar_layer->ToScrollbarLayer()->SetClipLayer(scroll_clip_layer->id());
+ scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(content_layer->id());
root_layer->AddChild(scrollbar_layer);
gfx::RectF content_rect(content_layer->position(),
@@ -502,7 +508,8 @@ class LayerTreeHostDamageTestScrollbarDoesDamage
++did_swaps_;
EXPECT_TRUE(result);
LayerImpl* root = host_impl->active_tree()->root_layer();
- LayerImpl* scroll_layer = root->children()[0];
+ LayerImpl* scroll_clip_layer = root->children()[0];
+ LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
switch (did_swaps_) {
case 1:
// Test that modifying the position of the content layer (not
@@ -516,7 +523,8 @@ class LayerTreeHostDamageTestScrollbarDoesDamage
host_impl->SetNeedsRedraw();
break;
case 3:
- scroll_layer->SetMaxScrollOffset(gfx::Vector2d(60, 100));
+ scroll_layer->SetBounds(gfx::Size(root->bounds().width() + 60,
+ root->bounds().height() + 100));
host_impl->SetNeedsRedraw();
break;
}
@@ -576,7 +584,8 @@ class LayerTreeHostDamageTestScrollbarCommitDoesNoDamage
++did_swaps_;
EXPECT_TRUE(result);
LayerImpl* root = host_impl->active_tree()->root_layer();
- LayerImpl* scroll_layer = root->children()[0];
+ LayerImpl* scroll_clip_layer = root->children()[0];
+ LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
switch (did_swaps_) {
case 1:
// Scroll on the thread. This should damage the scrollbar for the