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

Side by Side Diff: cc/scrollbar_layer.cc

Issue 11550035: Implement pinch-zoom scaling for main-frame scrollbars and pinch-zoom overlay scrollbars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to fix collision with solid colour scrollbars patch. Created 7 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/scrollbar_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scrollbar_layer.h" 5 #include "cc/scrollbar_layer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/caching_bitmap_content_layer_updater.h" 9 #include "cc/caching_bitmap_content_layer_updater.h"
10 #include "cc/layer_painter.h" 10 #include "cc/layer_painter.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 ScrollbarLayer::~ScrollbarLayer() {} 54 ScrollbarLayer::~ScrollbarLayer() {}
55 55
56 void ScrollbarLayer::SetScrollLayerId(int id) { 56 void ScrollbarLayer::SetScrollLayerId(int id) {
57 if (id == scroll_layer_id_) 57 if (id == scroll_layer_id_)
58 return; 58 return;
59 59
60 scroll_layer_id_ = id; 60 scroll_layer_id_ = id;
61 SetNeedsFullTreeSync(); 61 SetNeedsFullTreeSync();
62 } 62 }
63 63
64 bool ScrollbarLayer::OpacityCanAnimateOnImplThread() const {
65 return scrollbar_->isOverlay();
66 }
67
64 WebKit::WebScrollbar::Orientation ScrollbarLayer::Orientation() const { 68 WebKit::WebScrollbar::Orientation ScrollbarLayer::Orientation() const {
65 return scrollbar_->orientation(); 69 return scrollbar_->orientation();
66 } 70 }
67 71
68 int ScrollbarLayer::MaxTextureSize() { 72 int ScrollbarLayer::MaxTextureSize() {
69 DCHECK(layer_tree_host()); 73 DCHECK(layer_tree_host());
70 return layer_tree_host()->GetRendererCapabilities().max_texture_size; 74 return layer_tree_host()->GetRendererCapabilities().max_texture_size;
71 } 75 }
72 76
73 float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) { 77 float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 scrollbar_layer->set_fore_track_resource_id( 126 scrollbar_layer->set_fore_track_resource_id(
123 fore_track_->texture()->resourceId()); 127 fore_track_->texture()->resourceId());
124 } else { 128 } else {
125 scrollbar_layer->set_fore_track_resource_id(0); 129 scrollbar_layer->set_fore_track_resource_id(0);
126 } 130 }
127 131
128 if (thumb_ && thumb_->texture()->haveBackingTexture()) 132 if (thumb_ && thumb_->texture()->haveBackingTexture())
129 scrollbar_layer->set_thumb_resource_id(thumb_->texture()->resourceId()); 133 scrollbar_layer->set_thumb_resource_id(thumb_->texture()->resourceId());
130 else 134 else
131 scrollbar_layer->set_thumb_resource_id(0); 135 scrollbar_layer->set_thumb_resource_id(0);
136
137 // Pinch zoom scrollbarLayerImpl does not get its scroll_layer_id_
138 // set in LayerImpl, so we need to push it here.
139 if (scroll_layer_id_ == Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID)
140 scrollbar_layer->set_scroll_layer_id(scroll_layer_id_);
132 } 141 }
133 142
134 ScrollbarLayer* ScrollbarLayer::ToScrollbarLayer() { 143 ScrollbarLayer* ScrollbarLayer::ToScrollbarLayer() {
135 return this; 144 return this;
136 } 145 }
137 146
138 class ScrollbarBackgroundPainter : public LayerPainter { 147 class ScrollbarBackgroundPainter : public LayerPainter {
139 public: 148 public:
140 static scoped_ptr<ScrollbarBackgroundPainter> Create( 149 static scoped_ptr<ScrollbarBackgroundPainter> Create(
141 WebKit::WebScrollbar* scrollbar, 150 WebKit::WebScrollbar* scrollbar,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 thumb_.get(), 432 thumb_.get(),
424 origin_thumb_rect, 433 origin_thumb_rect,
425 queue, 434 queue,
426 stats); 435 stats);
427 } 436 }
428 437
429 dirty_rect_ = gfx::RectF(); 438 dirty_rect_ = gfx::RectF();
430 } 439 }
431 440
432 } // namespace cc 441 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/scrollbar_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698