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

Side by Side Diff: cc/scrollbar_layer_impl.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
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 "config.h" 5 #include "config.h"
6 6
7 #include "CCScrollbarLayerImpl.h" 7 #include "CCScrollbarLayerImpl.h"
8 8
9 #include "CCQuadSink.h" 9 #include "CCQuadSink.h"
10 #include "CCScrollbarAnimationController.h" 10 #include "CCScrollbarAnimationController.h"
11 #include "CCTextureDrawQuad.h" 11 #include "CCTextureDrawQuad.h"
12 12
13 using WebKit::WebRect; 13 using WebKit::WebRect;
14 using WebKit::WebScrollbar; 14 using WebKit::WebScrollbar;
15 15
16 namespace cc { 16 namespace cc {
17 17
18 scoped_ptr<CCScrollbarLayerImpl> CCScrollbarLayerImpl::create(int id) 18 scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(int id)
19 { 19 {
20 return make_scoped_ptr(new CCScrollbarLayerImpl(id)); 20 return make_scoped_ptr(new ScrollbarLayerImpl(id));
21 } 21 }
22 22
23 CCScrollbarLayerImpl::CCScrollbarLayerImpl(int id) 23 ScrollbarLayerImpl::ScrollbarLayerImpl(int id)
24 : CCLayerImpl(id) 24 : LayerImpl(id)
25 , m_scrollbar(this) 25 , m_scrollbar(this)
26 , m_backTrackResourceId(0) 26 , m_backTrackResourceId(0)
27 , m_foreTrackResourceId(0) 27 , m_foreTrackResourceId(0)
28 , m_thumbResourceId(0) 28 , m_thumbResourceId(0)
29 , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault) 29 , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault)
30 , m_orientation(WebScrollbar::Horizontal) 30 , m_orientation(WebScrollbar::Horizontal)
31 , m_controlSize(WebScrollbar::RegularScrollbar) 31 , m_controlSize(WebScrollbar::RegularScrollbar)
32 , m_pressedPart(WebScrollbar::NoPart) 32 , m_pressedPart(WebScrollbar::NoPart)
33 , m_hoveredPart(WebScrollbar::NoPart) 33 , m_hoveredPart(WebScrollbar::NoPart)
34 , m_isScrollableAreaActive(false) 34 , m_isScrollableAreaActive(false)
35 , m_isScrollViewScrollbar(false) 35 , m_isScrollViewScrollbar(false)
36 , m_enabled(false) 36 , m_enabled(false)
37 , m_isCustomScrollbar(false) 37 , m_isCustomScrollbar(false)
38 , m_isOverlayScrollbar(false) 38 , m_isOverlayScrollbar(false)
39 { 39 {
40 } 40 }
41 41
42 CCScrollbarLayerImpl::~CCScrollbarLayerImpl() 42 ScrollbarLayerImpl::~ScrollbarLayerImpl()
43 { 43 {
44 } 44 }
45 45
46 void CCScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<CCScrollbarGeometryFi xedThumb> geometry) 46 void ScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<ScrollbarGeometryFixedT humb> geometry)
47 { 47 {
48 m_geometry = geometry.Pass(); 48 m_geometry = geometry.Pass();
49 } 49 }
50 50
51 void CCScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar) 51 void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar)
52 { 52 {
53 m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle(); 53 m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle();
54 m_orientation = scrollbar->orientation(); 54 m_orientation = scrollbar->orientation();
55 m_controlSize = scrollbar->controlSize(); 55 m_controlSize = scrollbar->controlSize();
56 m_pressedPart = scrollbar->pressedPart(); 56 m_pressedPart = scrollbar->pressedPart();
57 m_hoveredPart = scrollbar->hoveredPart(); 57 m_hoveredPart = scrollbar->hoveredPart();
58 m_isScrollableAreaActive = scrollbar->isScrollableAreaActive(); 58 m_isScrollableAreaActive = scrollbar->isScrollableAreaActive();
59 m_isScrollViewScrollbar = scrollbar->isScrollViewScrollbar(); 59 m_isScrollViewScrollbar = scrollbar->isScrollViewScrollbar();
60 m_enabled = scrollbar->enabled(); 60 m_enabled = scrollbar->enabled();
61 m_isCustomScrollbar = scrollbar->isCustomScrollbar(); 61 m_isCustomScrollbar = scrollbar->isCustomScrollbar();
62 m_isOverlayScrollbar = scrollbar->isOverlay(); 62 m_isOverlayScrollbar = scrollbar->isOverlay();
63 63
64 scrollbar->getTickmarks(m_tickmarks); 64 scrollbar->getTickmarks(m_tickmarks);
65 65
66 m_geometry->update(scrollbar); 66 m_geometry->update(scrollbar);
67 } 67 }
68 68
69 static FloatRect toUVRect(const WebRect& r, const IntRect& bounds) 69 static FloatRect toUVRect(const WebRect& r, const IntRect& bounds)
70 { 70 {
71 return FloatRect(static_cast<float>(r.x) / bounds.width(), static_cast<float >(r.y) / bounds.height(), 71 return FloatRect(static_cast<float>(r.x) / bounds.width(), static_cast<float >(r.y) / bounds.height(),
72 static_cast<float>(r.width) / bounds.width(), static_cast<f loat>(r.height) / bounds.height()); 72 static_cast<float>(r.width) / bounds.width(), static_cast<f loat>(r.height) / bounds.height());
73 } 73 }
74 74
75 void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) 75 void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append QuadsData)
76 { 76 {
77 bool premultipledAlpha = false; 77 bool premultipledAlpha = false;
78 bool flipped = false; 78 bool flipped = false;
79 FloatRect uvRect(0, 0, 1, 1); 79 FloatRect uvRect(0, 0, 1, 1);
80 IntRect boundsRect(IntPoint(), bounds()); 80 IntRect boundsRect(IntPoint(), bounds());
81 IntRect contentBoundsRect(IntPoint(), contentBounds()); 81 IntRect contentBoundsRect(IntPoint(), contentBounds());
82 82
83 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare dQuadState()); 83 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ uadState());
84 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); 84 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
85 85
86 WebRect thumbRect, backTrackRect, foreTrackRect; 86 WebRect thumbRect, backTrackRect, foreTrackRect;
87 m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), ba ckTrackRect, thumbRect, foreTrackRect); 87 m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), ba ckTrackRect, thumbRect, foreTrackRect);
88 if (!m_geometry->hasThumb(&m_scrollbar)) 88 if (!m_geometry->hasThumb(&m_scrollbar))
89 thumbRect = WebRect(); 89 thumbRect = WebRect();
90 90
91 if (m_thumbResourceId && !thumbRect.isEmpty()) { 91 if (m_thumbResourceId && !thumbRect.isEmpty()) {
92 scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQua dState, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvRect, flipped); 92 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedQuadSta te, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvR ect, flipped);
93 quad->setNeedsBlending(); 93 quad->setNeedsBlending();
94 quadSink.append(quad.PassAs<CCDrawQuad>(), appendQuadsData); 94 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
95 } 95 }
96 96
97 if (!m_backTrackResourceId) 97 if (!m_backTrackResourceId)
98 return; 98 return;
99 99
100 // We only paint the track in two parts if we were given a texture for the f orward track part. 100 // We only paint the track in two parts if we were given a texture for the f orward track part.
101 if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) 101 if (m_foreTrackResourceId && !foreTrackRect.isEmpty())
102 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, layerRectToCo ntentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(for eTrackRect, boundsRect), flipped).PassAs<CCDrawQuad>(), appendQuadsData); 102 quadSink.append(TextureDrawQuad::create(sharedQuadState, layerRectToCont entRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreT rackRect, boundsRect), flipped).PassAs<DrawQuad>(), appendQuadsData);
103 103
104 // Order matters here: since the back track texture is being drawn to the en tire contents rect, we must append it after the thumb and 104 // Order matters here: since the back track texture is being drawn to the en tire contents rect, we must append it after the thumb and
105 // fore track quads. The back track texture contains (and displays) the butt ons. 105 // fore track quads. The back track texture contains (and displays) the butt ons.
106 if (!contentBoundsRect.isEmpty()) 106 if (!contentBoundsRect.isEmpty())
107 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(conte ntBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs <CCDrawQuad>(), appendQuadsData); 107 quadSink.append(TextureDrawQuad::create(sharedQuadState, IntRect(content BoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<D rawQuad>(), appendQuadsData);
108 } 108 }
109 109
110 void CCScrollbarLayerImpl::didLoseContext() 110 void ScrollbarLayerImpl::didLoseContext()
111 { 111 {
112 m_backTrackResourceId = 0; 112 m_backTrackResourceId = 0;
113 m_foreTrackResourceId = 0; 113 m_foreTrackResourceId = 0;
114 m_thumbResourceId = 0; 114 m_thumbResourceId = 0;
115 } 115 }
116 116
117 bool CCScrollbarLayerImpl::CCScrollbar::isOverlay() const 117 bool ScrollbarLayerImpl::Scrollbar::isOverlay() const
118 { 118 {
119 return m_owner->m_isOverlayScrollbar; 119 return m_owner->m_isOverlayScrollbar;
120 } 120 }
121 121
122 int CCScrollbarLayerImpl::CCScrollbar::value() const 122 int ScrollbarLayerImpl::Scrollbar::value() const
123 { 123 {
124 return m_owner->m_currentPos; 124 return m_owner->m_currentPos;
125 } 125 }
126 126
127 WebKit::WebPoint CCScrollbarLayerImpl::CCScrollbar::location() const 127 WebKit::WebPoint ScrollbarLayerImpl::Scrollbar::location() const
128 { 128 {
129 return WebKit::WebPoint(); 129 return WebKit::WebPoint();
130 } 130 }
131 131
132 WebKit::WebSize CCScrollbarLayerImpl::CCScrollbar::size() const 132 WebKit::WebSize ScrollbarLayerImpl::Scrollbar::size() const
133 { 133 {
134 return WebKit::WebSize(m_owner->bounds().width(), m_owner->bounds().height() ); 134 return WebKit::WebSize(m_owner->bounds().width(), m_owner->bounds().height() );
135 } 135 }
136 136
137 bool CCScrollbarLayerImpl::CCScrollbar::enabled() const 137 bool ScrollbarLayerImpl::Scrollbar::enabled() const
138 { 138 {
139 return m_owner->m_enabled; 139 return m_owner->m_enabled;
140 } 140 }
141 141
142 int CCScrollbarLayerImpl::CCScrollbar::maximum() const 142 int ScrollbarLayerImpl::Scrollbar::maximum() const
143 { 143 {
144 return m_owner->m_maximum; 144 return m_owner->m_maximum;
145 } 145 }
146 146
147 int CCScrollbarLayerImpl::CCScrollbar::totalSize() const 147 int ScrollbarLayerImpl::Scrollbar::totalSize() const
148 { 148 {
149 return m_owner->m_totalSize; 149 return m_owner->m_totalSize;
150 } 150 }
151 151
152 bool CCScrollbarLayerImpl::CCScrollbar::isScrollViewScrollbar() const 152 bool ScrollbarLayerImpl::Scrollbar::isScrollViewScrollbar() const
153 { 153 {
154 return m_owner->m_isScrollViewScrollbar; 154 return m_owner->m_isScrollViewScrollbar;
155 } 155 }
156 156
157 bool CCScrollbarLayerImpl::CCScrollbar::isScrollableAreaActive() const 157 bool ScrollbarLayerImpl::Scrollbar::isScrollableAreaActive() const
158 { 158 {
159 return m_owner->m_isScrollableAreaActive; 159 return m_owner->m_isScrollableAreaActive;
160 } 160 }
161 161
162 void CCScrollbarLayerImpl::CCScrollbar::getTickmarks(WebKit::WebVector<WebRect>& tickmarks) const 162 void ScrollbarLayerImpl::Scrollbar::getTickmarks(WebKit::WebVector<WebRect>& tic kmarks) const
163 { 163 {
164 tickmarks = m_owner->m_tickmarks; 164 tickmarks = m_owner->m_tickmarks;
165 } 165 }
166 166
167 WebScrollbar::ScrollbarControlSize CCScrollbarLayerImpl::CCScrollbar::controlSiz e() const 167 WebScrollbar::ScrollbarControlSize ScrollbarLayerImpl::Scrollbar::controlSize() const
168 { 168 {
169 return m_owner->m_controlSize; 169 return m_owner->m_controlSize;
170 } 170 }
171 171
172 WebScrollbar::ScrollbarPart CCScrollbarLayerImpl::CCScrollbar::pressedPart() con st 172 WebScrollbar::ScrollbarPart ScrollbarLayerImpl::Scrollbar::pressedPart() const
173 { 173 {
174 return m_owner->m_pressedPart; 174 return m_owner->m_pressedPart;
175 } 175 }
176 176
177 WebScrollbar::ScrollbarPart CCScrollbarLayerImpl::CCScrollbar::hoveredPart() con st 177 WebScrollbar::ScrollbarPart ScrollbarLayerImpl::Scrollbar::hoveredPart() const
178 { 178 {
179 return m_owner->m_hoveredPart; 179 return m_owner->m_hoveredPart;
180 } 180 }
181 181
182 WebScrollbar::ScrollbarOverlayStyle CCScrollbarLayerImpl::CCScrollbar::scrollbar OverlayStyle() const 182 WebScrollbar::ScrollbarOverlayStyle ScrollbarLayerImpl::Scrollbar::scrollbarOver layStyle() const
183 { 183 {
184 return m_owner->m_scrollbarOverlayStyle; 184 return m_owner->m_scrollbarOverlayStyle;
185 } 185 }
186 186
187 WebScrollbar::Orientation CCScrollbarLayerImpl::CCScrollbar::orientation() const 187 WebScrollbar::Orientation ScrollbarLayerImpl::Scrollbar::orientation() const
188 { 188 {
189 return m_owner->m_orientation; 189 return m_owner->m_orientation;
190 } 190 }
191 191
192 bool CCScrollbarLayerImpl::CCScrollbar::isCustomScrollbar() const 192 bool ScrollbarLayerImpl::Scrollbar::isCustomScrollbar() const
193 { 193 {
194 return m_owner->m_isCustomScrollbar; 194 return m_owner->m_isCustomScrollbar;
195 } 195 }
196 196
197 const char* CCScrollbarLayerImpl::layerTypeAsString() const 197 const char* ScrollbarLayerImpl::layerTypeAsString() const
198 { 198 {
199 return "ScrollbarLayer"; 199 return "ScrollbarLayer";
200 } 200 }
201 201
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698