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

Side by Side Diff: cc/scrollbar_layer_impl.cc

Issue 11573015: Create abstract common base class for impl scrollbars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased for landing Created 8 years 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_impl.h ('k') | cc/scrollbar_layer_impl_base.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_impl.h" 5 #include "cc/scrollbar_layer_impl.h"
6 6
7 #include "cc/quad_sink.h" 7 #include "cc/quad_sink.h"
8 #include "cc/scrollbar_animation_controller.h" 8 #include "cc/scrollbar_animation_controller.h"
9 #include "cc/texture_draw_quad.h" 9 #include "cc/texture_draw_quad.h"
10 #include "ui/gfx/rect_conversions.h" 10 #include "ui/gfx/rect_conversions.h"
11 11
12 using WebKit::WebRect; 12 using WebKit::WebRect;
13 using WebKit::WebScrollbar; 13 using WebKit::WebScrollbar;
14 14
15 namespace cc { 15 namespace cc {
16 16
17 scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(LayerTreeImpl* treeImp l, int id) 17 scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(LayerTreeImpl* treeImp l, int id)
18 { 18 {
19 return make_scoped_ptr(new ScrollbarLayerImpl(treeImpl, id)); 19 return make_scoped_ptr(new ScrollbarLayerImpl(treeImpl, id));
20 } 20 }
21 21
22 ScrollbarLayerImpl::ScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) 22 ScrollbarLayerImpl::ScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id)
23 : LayerImpl(treeImpl, id) 23 : ScrollbarLayerImplBase(treeImpl, id)
24 , m_scrollbar(this) 24 , m_scrollbar(this)
25 , m_backTrackResourceId(0) 25 , m_backTrackResourceId(0)
26 , m_foreTrackResourceId(0) 26 , m_foreTrackResourceId(0)
27 , m_thumbResourceId(0) 27 , m_thumbResourceId(0)
28 , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault) 28 , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault)
29 , m_orientation(WebScrollbar::Horizontal) 29 , m_orientation(WebScrollbar::Horizontal)
30 , m_controlSize(WebScrollbar::RegularScrollbar) 30 , m_controlSize(WebScrollbar::RegularScrollbar)
31 , m_pressedPart(WebScrollbar::NoPart) 31 , m_pressedPart(WebScrollbar::NoPart)
32 , m_hoveredPart(WebScrollbar::NoPart) 32 , m_hoveredPart(WebScrollbar::NoPart)
33 , m_isScrollableAreaActive(false) 33 , m_isScrollableAreaActive(false)
(...skipping 24 matching lines...) Expand all
58 m_isScrollViewScrollbar = scrollbar->isScrollViewScrollbar(); 58 m_isScrollViewScrollbar = scrollbar->isScrollViewScrollbar();
59 m_enabled = scrollbar->enabled(); 59 m_enabled = scrollbar->enabled();
60 m_isCustomScrollbar = scrollbar->isCustomScrollbar(); 60 m_isCustomScrollbar = scrollbar->isCustomScrollbar();
61 m_isOverlayScrollbar = scrollbar->isOverlay(); 61 m_isOverlayScrollbar = scrollbar->isOverlay();
62 62
63 scrollbar->getTickmarks(m_tickmarks); 63 scrollbar->getTickmarks(m_tickmarks);
64 64
65 m_geometry->update(scrollbar); 65 m_geometry->update(scrollbar);
66 } 66 }
67 67
68 float ScrollbarLayerImpl::currentPos() const
69 {
70 return m_currentPos;
71 }
72
73 int ScrollbarLayerImpl::totalSize() const
74 {
75 return m_totalSize;
76 }
77
78 int ScrollbarLayerImpl::maximum() const
79 {
80 return m_maximum;
81 }
82
83 WebKit::WebScrollbar::Orientation ScrollbarLayerImpl::orientation() const
84 {
85 return m_orientation;
86 }
87
68 static gfx::RectF toUVRect(const gfx::Rect& r, const gfx::Rect& bounds) 88 static gfx::RectF toUVRect(const gfx::Rect& r, const gfx::Rect& bounds)
69 { 89 {
70 return gfx::ScaleRect(r, 1.0 / bounds.width(), 1.0 / bounds.height()); 90 return gfx::ScaleRect(r, 1.0 / bounds.width(), 1.0 / bounds.height());
71 } 91 }
72 92
73 gfx::Rect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const gfx::Rect& l ayerRect) const 93 gfx::Rect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const gfx::Rect& l ayerRect) const
74 { 94 {
75 // Don't intersect with the bounds as in layerRectToContentRect() because 95 // Don't intersect with the bounds as in layerRectToContentRect() because
76 // layerRect here might be in coordinates of the containing layer. 96 // layerRect here might be in coordinates of the containing layer.
77 gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), content sScaleY()); 97 gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), content sScaleY());
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 { 234 {
215 return m_owner->m_isCustomScrollbar; 235 return m_owner->m_isCustomScrollbar;
216 } 236 }
217 237
218 const char* ScrollbarLayerImpl::layerTypeAsString() const 238 const char* ScrollbarLayerImpl::layerTypeAsString() const
219 { 239 {
220 return "ScrollbarLayer"; 240 return "ScrollbarLayer";
221 } 241 }
222 242
223 } // namespace cc 243 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scrollbar_layer_impl.h ('k') | cc/scrollbar_layer_impl_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698