Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 2468423004: Left side vertical MD scrollbars grow toward right. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl_unittest.cc ('k') | cc/test/fake_painted_scrollbar_layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/scrollbar_layer_unittest.cc
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 86356770a250846458c773b5648b8040ce548d67..7de81339bdc2001b9448faf37879c3e919efbc43 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -401,6 +401,56 @@ TEST_F(ScrollbarLayerTest, ThumbRect) {
scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
}
+TEST_F(ScrollbarLayerTest, ThumbRectForOverlayLeftSideVerticalScrollbar) {
+ scoped_refptr<Layer> root_clip_layer = Layer::Create();
+ scoped_refptr<Layer> root_layer = Layer::Create();
+ // Create an overlay left side vertical scrollbar.
+ scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
+ FakePaintedScrollbarLayer::Create(false, true, VERTICAL, true, true,
+ root_layer->id());
+ root_layer->SetScrollClipLayerId(root_clip_layer->id());
+ root_clip_layer->SetBounds(gfx::Size(50, 20));
+ root_layer->SetBounds(gfx::Size(50, 100));
+
+ layer_tree_->SetRootLayer(root_clip_layer);
+ root_clip_layer->AddChild(root_layer);
+ root_layer->AddChild(scrollbar_layer);
+
+ root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
+ scrollbar_layer->SetBounds(gfx::Size(10, 20));
+ scrollbar_layer->SetScrollLayer(root_layer->id());
+ scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(0, 0, 10, 20));
+ scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10);
+ scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
+ layer_tree_host_->UpdateLayers();
+ LayerImpl* root_clip_layer_impl = nullptr;
+ PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr;
+
+ // Thumb is at the edge of the scrollbar (should be inset to
+ // the start of the track within the scrollbar layer's
+ // position).
+ UPDATE_AND_EXTRACT_LAYER_POINTERS();
+ EXPECT_EQ(gfx::Rect(0, 0, 10, 4).ToString(),
+ scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
+
+ // Change thumb thickness scale factor.
+ scrollbar_layer_impl->SetThumbThicknessScaleFactor(0.5);
+ UPDATE_AND_EXTRACT_LAYER_POINTERS();
+ // For overlay scrollbars thumb_rect.width = thumb_thickness *
+ // thumb_thickness_scale_factor.
+ EXPECT_EQ(gfx::Rect(0, 0, 5, 4).ToString(),
+ scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
+
+ // Change thumb thickness and length.
+ scrollbar_layer->fake_scrollbar()->set_thumb_thickness(4);
+ scrollbar_layer->fake_scrollbar()->set_thumb_length(6);
+ UPDATE_AND_EXTRACT_LAYER_POINTERS();
+ // For left side vertical scrollbars thumb_rect.x = bounds.width() -
+ // thumb_thickness.
+ EXPECT_EQ(gfx::Rect(6, 0, 2, 6).ToString(),
+ scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
+}
+
TEST_F(ScrollbarLayerTest, SolidColorDrawQuads) {
const int kThumbThickness = 3;
const int kTrackStart = 1;
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl_unittest.cc ('k') | cc/test/fake_painted_scrollbar_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698