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

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: Make OpacityIsAnimating() virtual. 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"
11 #include "cc/layer_tree_host.h" 11 #include "cc/layer_tree_host.h"
12 #include "cc/prioritized_resource.h" 12 #include "cc/prioritized_resource.h"
13 #include "cc/resource_update_queue.h" 13 #include "cc/resource_update_queue.h"
14 #include "cc/scrollbar_layer_impl.h" 14 #include "cc/scrollbar_layer_impl.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
16 #include "ui/gfx/rect_conversions.h" 16 #include "ui/gfx/rect_conversions.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 scoped_ptr<LayerImpl> ScrollbarLayer::CreateLayerImpl( 20 scoped_ptr<LayerImpl> ScrollbarLayer::CreateLayerImpl(
21 LayerTreeImpl* tree_impl) { 21 LayerTreeImpl* tree_impl) {
22 return ScrollbarLayerImpl::Create( 22 scoped_ptr<LayerImpl> scroll_layer_impl =
23 tree_impl, 23 ScrollbarLayerImpl::Create(
24 id(), 24 tree_impl,
25 ScrollbarGeometryFixedThumb::create(make_scoped_ptr(geometry_->clone()))) 25 id(),
26 .PassAs<LayerImpl>(); 26 ScrollbarGeometryFixedThumb::create(
27 make_scoped_ptr(geometry_->clone()))).PassAs<LayerImpl>();
28
29 if (scroll_layer_id_ == Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID)
30 scroll_layer_impl->ToScrollbarLayer()->SetOpacity(0);
enne (OOO) 2013/03/12 21:10:08 Why are opacity updates blocked and this is requir
wjmaclean 2013/03/12 22:02:22 The call to "ToScrollbarLayer()" is not necessary,
31
32 return scroll_layer_impl.Pass();
27 } 33 }
28 34
29 scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create( 35 scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create(
30 scoped_ptr<WebKit::WebScrollbar> scrollbar, 36 scoped_ptr<WebKit::WebScrollbar> scrollbar,
31 scoped_ptr<ScrollbarThemePainter> painter, 37 scoped_ptr<ScrollbarThemePainter> painter,
32 scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, 38 scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry,
33 int scrollLayerId) { 39 int scrollLayerId) {
34 return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), 40 return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(),
35 painter.Pass(), 41 painter.Pass(),
36 geometry.Pass(), 42 geometry.Pass(),
(...skipping 17 matching lines...) Expand all
54 ScrollbarLayer::~ScrollbarLayer() {} 60 ScrollbarLayer::~ScrollbarLayer() {}
55 61
56 void ScrollbarLayer::SetScrollLayerId(int id) { 62 void ScrollbarLayer::SetScrollLayerId(int id) {
57 if (id == scroll_layer_id_) 63 if (id == scroll_layer_id_)
58 return; 64 return;
59 65
60 scroll_layer_id_ = id; 66 scroll_layer_id_ = id;
61 SetNeedsFullTreeSync(); 67 SetNeedsFullTreeSync();
62 } 68 }
63 69
70 bool ScrollbarLayer::OpacityIsAnimating() const {
71 return Layer::OpacityIsAnimating() ||
enne (OOO) 2013/03/12 21:10:08 Maybe just return Layer::OpacityIsAnimating || isO
wjmaclean 2013/03/12 22:02:22 Sure, though Clank also uses overlay scrollbars, a
72 scroll_layer_id_ == Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID;
73 }
74
64 WebKit::WebScrollbar::Orientation ScrollbarLayer::Orientation() const { 75 WebKit::WebScrollbar::Orientation ScrollbarLayer::Orientation() const {
65 return scrollbar_->orientation(); 76 return scrollbar_->orientation();
66 } 77 }
67 78
68 int ScrollbarLayer::MaxTextureSize() { 79 int ScrollbarLayer::MaxTextureSize() {
69 DCHECK(layer_tree_host()); 80 DCHECK(layer_tree_host());
70 return layer_tree_host()->rendererCapabilities().maxTextureSize; 81 return layer_tree_host()->rendererCapabilities().maxTextureSize;
71 } 82 }
72 83
73 float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) { 84 float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 thumb_.get(), 433 thumb_.get(),
423 origin_thumb_rect, 434 origin_thumb_rect,
424 queue, 435 queue,
425 stats); 436 stats);
426 } 437 }
427 438
428 dirty_rect_ = gfx::RectF(); 439 dirty_rect_ = gfx::RectF();
429 } 440 }
430 441
431 } // namespace cc 442 } // 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