// Choose bounds to give max_scroll_offset = (30, 50).
layer_tree_root->SetBounds(gfx::Size(70, 150));
scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
- scroll_layer->SetScrollOffset(gfx::Vector2d(10, 20));
+ scroll_layer->SetScrollOffset(gfx::ScrollOffset(10, 20));
scroll_layer->SetBounds(gfx::Size(100, 200));
content_layer->SetBounds(gfx::Size(100, 200));
layer_tree_root->SetBounds(gfx::Size(700, 1500));
layer_tree_root->SavePaintProperties();
scroll_layer->SetBounds(gfx::Size(1000, 2000));
- scroll_layer->SetScrollOffset(gfx::Vector2d(100, 200));
+ scroll_layer->SetScrollOffset(gfx::ScrollOffset(100, 200));
scroll_layer->SavePaintProperties();
content_layer->SetBounds(gfx::Size(1000, 2000));
content_layer->SavePaintProperties();
root_layer_impl = root_clip_layer_impl->children()[0]; \
scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( \
root_layer_impl->children()[1]); \
- scrollbar_layer_impl->ScrollbarParametersDidChange(); \
+ scrollbar_layer_impl->ScrollbarParametersDidChange(false); \
} while (false)
TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
root_layer->AddChild(content_layer);
root_layer->AddChild(scrollbar_layer);
- root_layer->SetScrollOffset(gfx::Vector2d(0, 0));
+ root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
scrollbar_layer->SetBounds(gfx::Size(70, 10));
scrollbar_layer->SetScrollLayer(root_layer->id());
scrollbar_layer->SetClipLayer(root_clip_layer->id());
scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
scrollbar_layer->UpdateThumbAndTrackGeometry();
- LayerImpl* root_clip_layer_impl = NULL;
- LayerImpl* root_layer_impl = NULL;
- PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL;
+ LayerImpl* root_clip_layer_impl = nullptr;
+ LayerImpl* root_layer_impl = nullptr;
+ PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr;
UPDATE_AND_EXTRACT_LAYER_POINTERS();
EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
root_layer->AddChild(content_layer);
root_layer->AddChild(scrollbar_layer);
- root_layer->SetScrollOffset(gfx::Vector2d(0, 0));
+ root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
scrollbar_layer->SetBounds(gfx::Size(70, 10));
scrollbar_layer->SetScrollLayer(root_layer->id());
scrollbar_layer->SetClipLayer(root_clip_layer->id());
scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10);
scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
scrollbar_layer->UpdateThumbAndTrackGeometry();
- LayerImpl* root_clip_layer_impl = NULL;
- LayerImpl* root_layer_impl = NULL;
- PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL;
+ LayerImpl* root_clip_layer_impl = nullptr;
+ LayerImpl* root_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
scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
// Under-scroll (thumb position should clamp and be unchanged).
- root_layer->SetScrollOffset(gfx::Vector2d(-5, 0));
+ root_layer->SetScrollOffset(gfx::ScrollOffset(-5, 0));
UPDATE_AND_EXTRACT_LAYER_POINTERS();
EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
// Over-scroll (thumb position should clamp on the far side).
- root_layer->SetScrollOffset(gfx::Vector2d(85, 0));
+ root_layer->SetScrollOffset(gfx::ScrollOffset(85, 0));
UPDATE_AND_EXTRACT_LAYER_POINTERS();
EXPECT_EQ(gfx::Rect(56, 0, 4, 10).ToString(),
// Thickness should be overridden to 3.
{
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
scoped_ptr<RenderPass> render_pass = RenderPass::Create();
AppendQuadsData data;
- scrollbar_layer_impl->AppendQuads(
- render_pass.get(), occlusion_tracker, &data);
+ scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
const QuadList& quads = render_pass->quad_list;
ASSERT_EQ(1u, quads.size());
scrollbar_layer_impl->draw_properties().contents_scale_x = 2.f;
scrollbar_layer_impl->draw_properties().contents_scale_y = 2.f;
{
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
scoped_ptr<RenderPass> render_pass = RenderPass::Create();
AppendQuadsData data;
- scrollbar_layer_impl->AppendQuads(
- render_pass.get(), occlusion_tracker, &data);
+ scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
const QuadList& quads = render_pass->quad_list;
ASSERT_EQ(1u, quads.size());
// current viewport state.
scrollbar_layer_impl->SetVisibleToTotalLengthRatio(0.2f);
{
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
scoped_ptr<RenderPass> render_pass = RenderPass::Create();
AppendQuadsData data;
- scrollbar_layer_impl->AppendQuads(
- render_pass.get(), occlusion_tracker, &data);
+ scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
const QuadList& quads = render_pass->quad_list;
ASSERT_EQ(1u, quads.size());
scrollbar_layer_impl->SetCurrentPos(0.f);
scrollbar_layer_impl->SetMaximum(0);
{
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
scoped_ptr<RenderPass> render_pass = RenderPass::Create();
AppendQuadsData data;
- scrollbar_layer_impl->AppendQuads(
- render_pass.get(), occlusion_tracker, &data);
+ scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
const QuadList& quads = render_pass->quad_list;
ASSERT_EQ(1u, quads.size());
scrollbar_layer_impl->SetMaximum(8);
{
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
scoped_ptr<RenderPass> render_pass = RenderPass::Create();
AppendQuadsData data;
- scrollbar_layer_impl->AppendQuads(
- render_pass.get(), occlusion_tracker, &data);
+ scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
const QuadList& quads = render_pass->quad_list;
ASSERT_EQ(1u, quads.size());
void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; }
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
scroll_layer_ = Layer::Create();
layer_tree_host()->root_layer()->AddChild(scroll_layer_);
PostSetNeedsCommitToMainThread();
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
const int kMaxTextureSize =
layer_tree_host()->GetRendererCapabilities().max_texture_size;
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
scoped_refptr<PaintedScrollbarLayer> scrollbar_layer_;
public:
FakeLayerTreeHost(FakeLayerTreeHostClient* client,
const LayerTreeSettings& settings)
- : LayerTreeHost(client, NULL, settings),
+ : LayerTreeHost(client, nullptr, nullptr, settings),
next_id_(1),
total_ui_resource_created_(0),
total_ui_resource_deleted_(0) {
InitializeSingleThreaded(client, base::MessageLoopProxy::current());
}
- virtual UIResourceId CreateUIResource(UIResourceClient* content) OVERRIDE {
+ UIResourceId CreateUIResource(UIResourceClient* content) override {
total_ui_resource_created_++;
UIResourceId nid = next_id_++;
ui_resource_bitmap_map_.insert(
}
// Deletes a UI resource. May safely be called more than once.
- virtual void DeleteUIResource(UIResourceId id) OVERRIDE {
+ void DeleteUIResource(UIResourceId id) override {
UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id);
if (iter != ui_resource_bitmap_map_.end()) {
ui_resource_bitmap_map_.erase(iter);
UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id);
if (iter != ui_resource_bitmap_map_.end())
return &iter->second;
- return NULL;
+ return nullptr;
}
private:
scrollbar_layer->SetIsDrawable(true);
scrollbar_layer->SetBounds(gfx::Size(100, 100));
- layer_tree_root->SetScrollOffset(gfx::Vector2d(10, 20));
+ 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);