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

Side by Side Diff: sky/engine/platform/scroll/Scrollbar.cpp

Issue 685003003: Remove a lot of dead Scrollbar methods. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/platform/scroll/Scrollbar.h ('k') | sky/engine/public/platform/WebScrollbar.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 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 , m_currentPos(0) 62 , m_currentPos(0)
63 , m_dragOrigin(0) 63 , m_dragOrigin(0)
64 , m_hoveredPart(NoPart) 64 , m_hoveredPart(NoPart)
65 , m_pressedPart(NoPart) 65 , m_pressedPart(NoPart)
66 , m_pressedPos(0) 66 , m_pressedPos(0)
67 , m_scrollPos(0) 67 , m_scrollPos(0)
68 , m_documentDragPos(0) 68 , m_documentDragPos(0)
69 , m_enabled(true) 69 , m_enabled(true)
70 , m_scrollTimer(this, &Scrollbar::autoscrollTimerFired) 70 , m_scrollTimer(this, &Scrollbar::autoscrollTimerFired)
71 , m_overlapsResizer(false) 71 , m_overlapsResizer(false)
72 , m_suppressInvalidation(false)
73 , m_isAlphaLocked(false)
74 { 72 {
75 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for 73 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for
76 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar 74 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar
77 // alone when sizing). 75 // alone when sizing).
78 int thickness = scrollbarThickness(); 76 int thickness = scrollbarThickness();
79 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); 77 Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
80 78
81 m_currentPos = scrollableAreaCurrentPos(); 79 m_currentPos = scrollableAreaCurrentPos();
82 } 80 }
83 81
(...skipping 11 matching lines...) Expand all
95 { 93 {
96 if (m_scrollableArea) 94 if (m_scrollableArea)
97 m_scrollableArea->getTickmarks(tickmarks); 95 m_scrollableArea->getTickmarks(tickmarks);
98 } 96 }
99 97
100 bool Scrollbar::isScrollableAreaActive() const 98 bool Scrollbar::isScrollableAreaActive() const
101 { 99 {
102 return m_scrollableArea && m_scrollableArea->isActive(); 100 return m_scrollableArea && m_scrollableArea->isActive();
103 } 101 }
104 102
105 bool Scrollbar::isScrollViewScrollbar() const
106 {
107 // FIXME(sky): Remove
108 return false;
109 }
110
111 bool Scrollbar::isLeftSideVerticalScrollbar() const 103 bool Scrollbar::isLeftSideVerticalScrollbar() const
112 { 104 {
113 if (m_orientation == VerticalScrollbar && m_scrollableArea) 105 if (m_orientation == VerticalScrollbar && m_scrollableArea)
114 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); 106 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft();
115 return false; 107 return false;
116 } 108 }
117 109
118 void Scrollbar::offsetDidChange() 110 void Scrollbar::offsetDidChange()
119 { 111 {
120 ASSERT(m_scrollableArea); 112 ASSERT(m_scrollableArea);
121 113
122 float position = scrollableAreaCurrentPos(); 114 float position = scrollableAreaCurrentPos();
123 if (position == m_currentPos) 115 if (position == m_currentPos)
124 return; 116 return;
125 117
126 int oldThumbPosition = theme()->thumbPosition(); 118 int oldThumbPosition = thumbPosition();
127 m_currentPos = position; 119 m_currentPos = position;
128 updateThumbPosition(); 120 updateThumb();
129 if (m_pressedPart == ThumbPart) 121 if (m_pressedPart == ThumbPart)
130 setPressedPos(m_pressedPos + theme()->thumbPosition() - oldThumbPosition ); 122 setPressedPos(m_pressedPos + thumbPosition() - oldThumbPosition);
131 } 123 }
132 124
133 void Scrollbar::setProportion(int visibleSize, int totalSize) 125 void Scrollbar::setProportion(int visibleSize, int totalSize)
134 { 126 {
135 if (visibleSize == m_visibleSize && totalSize == m_totalSize) 127 if (visibleSize == m_visibleSize && totalSize == m_totalSize)
136 return; 128 return;
137 129
138 m_visibleSize = visibleSize; 130 m_visibleSize = visibleSize;
139 m_totalSize = totalSize; 131 m_totalSize = totalSize;
140 132
141 updateThumbProportion(); 133 updateThumb();
142 } 134 }
143 135
144 void Scrollbar::updateThumb() 136 void Scrollbar::updateThumb()
145 { 137 {
146 #ifdef THUMB_POSITION_AFFECTS_BUTTONS 138 #ifdef THUMB_POSITION_AFFECTS_BUTTONS
147 invalidate(); 139 invalidate();
148 #else 140 #else
149 theme()->invalidateParts(); 141 invalidateParts();
150 #endif 142 #endif
151 } 143 }
152 144
153 void Scrollbar::updateThumbPosition()
154 {
155 updateThumb();
156 }
157
158 void Scrollbar::updateThumbProportion()
159 {
160 updateThumb();
161 }
162
163 void Scrollbar::paint(GraphicsContext* context, const IntRect& damageRect) 145 void Scrollbar::paint(GraphicsContext* context, const IntRect& damageRect)
164 { 146 {
165 if (!frameRect().intersects(damageRect)) 147 if (!frameRect().intersects(damageRect))
166 return; 148 return;
167 149
168 IntRect startTrackRect; 150 IntRect startTrackRect;
169 IntRect thumbRect; 151 IntRect thumbRect;
170 IntRect endTrackRect; 152 IntRect endTrackRect;
171 splitTrack(trackRect(), startTrackRect, thumbRect, endTrackRect); 153 splitTrack(trackRect(), startTrackRect, thumbRect, endTrackRect);
172 if (damageRect.intersects(thumbRect)) 154 if (damageRect.intersects(thumbRect))
173 paintThumb(context, thumbRect); 155 paintThumb(context, thumbRect);
174 } 156 }
175 157
176 void Scrollbar::autoscrollTimerFired(Timer<Scrollbar>*) 158 void Scrollbar::autoscrollTimerFired(Timer<Scrollbar>*)
177 { 159 {
178 autoscrollPressedPart(theme()->autoscrollTimerDelay()); 160 autoscrollPressedPart(autoscrollTimerDelay());
179 } 161 }
180 162
181 static bool thumbUnderMouse(Scrollbar* scrollbar) 163 static bool thumbUnderMouse(Scrollbar* scrollbar)
182 { 164 {
183 int thumbPos = scrollbar->theme()->trackPosition() + scrollbar->theme()->thu mbPosition(); 165 int thumbPos = scrollbar->trackPosition() + scrollbar->thumbPosition();
184 int thumbLength = scrollbar->theme()->thumbLength(); 166 int thumbLength = scrollbar->thumbLength();
185 return scrollbar->pressedPos() >= thumbPos && scrollbar->pressedPos() < thum bPos + thumbLength; 167 return scrollbar->pressedPos() >= thumbPos && scrollbar->pressedPos() < thum bPos + thumbLength;
186 } 168 }
187 169
188 void Scrollbar::autoscrollPressedPart(double delay) 170 void Scrollbar::autoscrollPressedPart(double delay)
189 { 171 {
190 // Don't do anything for the thumb or if nothing was pressed. 172 // Don't do anything for the thumb or if nothing was pressed.
191 if (m_pressedPart == ThumbPart || m_pressedPart == NoPart) 173 if (m_pressedPart == ThumbPart || m_pressedPart == NoPart)
192 return; 174 return;
193 175
194 // Handle the track. 176 // Handle the track.
195 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) { 177 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) {
196 theme()->invalidatePart(m_pressedPart); 178 invalidatePart(m_pressedPart);
197 setHoveredPart(ThumbPart); 179 setHoveredPart(ThumbPart);
198 return; 180 return;
199 } 181 }
200 182
201 // Handle the arrows and track. 183 // Handle the arrows and track.
202 if (m_scrollableArea && m_scrollableArea->scroll(pressedPartScrollDirection( ), pressedPartScrollGranularity())) 184 if (m_scrollableArea && m_scrollableArea->scroll(pressedPartScrollDirection( ), pressedPartScrollGranularity()))
203 startTimerIfNeeded(delay); 185 startTimerIfNeeded(delay);
204 } 186 }
205 187
206 void Scrollbar::startTimerIfNeeded(double delay) 188 void Scrollbar::startTimerIfNeeded(double delay)
207 { 189 {
208 // Don't do anything for the thumb. 190 // Don't do anything for the thumb.
209 if (m_pressedPart == ThumbPart) 191 if (m_pressedPart == ThumbPart)
210 return; 192 return;
211 193
212 // Handle the track. We halt track scrolling once the thumb is level 194 // Handle the track. We halt track scrolling once the thumb is level
213 // with us. 195 // with us.
214 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) { 196 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) {
215 theme()->invalidatePart(m_pressedPart); 197 invalidatePart(m_pressedPart);
216 setHoveredPart(ThumbPart); 198 setHoveredPart(ThumbPart);
217 return; 199 return;
218 } 200 }
219 201
220 // We can't scroll if we've hit the beginning or end. 202 // We can't scroll if we've hit the beginning or end.
221 ScrollDirection dir = pressedPartScrollDirection(); 203 ScrollDirection dir = pressedPartScrollDirection();
222 if (dir == ScrollUp || dir == ScrollLeft) { 204 if (dir == ScrollUp || dir == ScrollLeft) {
223 if (m_currentPos == 0) 205 if (m_currentPos == 0)
224 return; 206 return;
225 } else { 207 } else {
(...skipping 30 matching lines...) Expand all
256 } 238 }
257 239
258 void Scrollbar::moveThumb(int pos) 240 void Scrollbar::moveThumb(int pos)
259 { 241 {
260 if (!m_scrollableArea) 242 if (!m_scrollableArea)
261 return; 243 return;
262 244
263 int delta = pos - m_pressedPos; 245 int delta = pos - m_pressedPos;
264 246
265 // Drag the thumb. 247 // Drag the thumb.
266 int thumbPos = theme()->thumbPosition(); 248 int thumbPos = thumbPosition();
267 int thumbLen = theme()->thumbLength(); 249 int thumbLen = thumbLength();
268 int trackLen = theme()->trackLength(); 250 int trackLen = trackLength();
269 if (delta > 0) 251 if (delta > 0)
270 delta = std::min(trackLen - thumbLen - thumbPos, delta); 252 delta = std::min(trackLen - thumbLen - thumbPos, delta);
271 else if (delta < 0) 253 else if (delta < 0)
272 delta = std::max(-thumbPos, delta); 254 delta = std::max(-thumbPos, delta);
273 255
274 float minPos = m_scrollableArea->minimumScrollPosition(m_orientation); 256 float minPos = m_scrollableArea->minimumScrollPosition(m_orientation);
275 float maxPos = m_scrollableArea->maximumScrollPosition(m_orientation); 257 float maxPos = m_scrollableArea->maximumScrollPosition(m_orientation);
276 if (delta) { 258 if (delta) {
277 float newPosition = static_cast<float>(thumbPos + delta) * (maxPos - min Pos) / (trackLen - thumbLen) + minPos; 259 float newPosition = static_cast<float>(thumbPos + delta) * (maxPos - min Pos) / (trackLen - thumbLen) + minPos;
278 m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, newPosit ion); 260 m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, newPosit ion);
279 } 261 }
280 } 262 }
281 263
282 void Scrollbar::setHoveredPart(ScrollbarPart part) 264 void Scrollbar::setHoveredPart(ScrollbarPart part)
283 { 265 {
284 if (part == m_hoveredPart) 266 if (part == m_hoveredPart)
285 return; 267 return;
286 268
287 if (m_pressedPart == NoPart) { // When there's a pressed part, we don't dra w a hovered state, so there's no reason to invalidate. 269 if (m_pressedPart == NoPart) { // When there's a pressed part, we don't dra w a hovered state, so there's no reason to invalidate.
288 theme()->invalidatePart(part); 270 invalidatePart(part);
289 theme()->invalidatePart(m_hoveredPart); 271 invalidatePart(m_hoveredPart);
290 } 272 }
291 m_hoveredPart = part; 273 m_hoveredPart = part;
292 } 274 }
293 275
294 void Scrollbar::setPressedPart(ScrollbarPart part) 276 void Scrollbar::setPressedPart(ScrollbarPart part)
295 { 277 {
296 if (m_pressedPart != NoPart) 278 if (m_pressedPart != NoPart)
297 theme()->invalidatePart(m_pressedPart); 279 invalidatePart(m_pressedPart);
298 m_pressedPart = part; 280 m_pressedPart = part;
299 if (m_pressedPart != NoPart) 281 if (m_pressedPart != NoPart)
300 theme()->invalidatePart(m_pressedPart); 282 invalidatePart(m_pressedPart);
301 else if (m_hoveredPart != NoPart) // When we no longer have a pressed part, we can start drawing a hovered state on the hovered part. 283 else if (m_hoveredPart != NoPart) // When we no longer have a pressed part, we can start drawing a hovered state on the hovered part.
302 theme()->invalidatePart(m_hoveredPart); 284 invalidatePart(m_hoveredPart);
303 } 285 }
304 286
305 bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt) 287 bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt)
306 { 288 {
307 switch (evt.type()) { 289 switch (evt.type()) {
308 case PlatformEvent::GestureTapDown: 290 case PlatformEvent::GestureTapDown:
309 // FIXME(sky): Is setting the pressed part needed since we only have ove rlay scrollbars? 291 // FIXME(sky): Is setting the pressed part needed since we only have ove rlay scrollbars?
310 setPressedPart(NoPart); 292 setPressedPart(NoPart);
311 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContain ingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y(); 293 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContain ingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y();
312 return true; 294 return true;
(...skipping 29 matching lines...) Expand all
342 } 324 }
343 default: 325 default:
344 // By default, we assume that gestures don't deselect the scrollbar. 326 // By default, we assume that gestures don't deselect the scrollbar.
345 return true; 327 return true;
346 } 328 }
347 } 329 }
348 330
349 void Scrollbar::mouseMoved(const PlatformMouseEvent& evt) 331 void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
350 { 332 {
351 if (m_pressedPart == ThumbPart) { 333 if (m_pressedPart == ThumbPart) {
352 if (theme()->shouldSnapBackToDragOrigin(evt)) { 334 if (shouldSnapBackToDragOrigin(evt)) {
353 if (m_scrollableArea) 335 if (m_scrollableArea)
354 m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation)); 336 m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation));
355 } else { 337 } else {
356 moveThumb(m_orientation == HorizontalScrollbar ? 338 moveThumb(m_orientation == HorizontalScrollbar ?
357 convertFromContainingWindow(evt.position()).x() : 339 convertFromContainingWindow(evt.position()).x() :
358 convertFromContainingWindow(evt.position()).y()); 340 convertFromContainingWindow(evt.position()).y());
359 } 341 }
360 return; 342 return;
361 } 343 }
362 344
363 if (m_pressedPart != NoPart) 345 if (m_pressedPart != NoPart)
364 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContain ingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y(); 346 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContain ingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y();
365 347
366 // FIXME(sky): Cleanup this code now that part is always NoPart. 348 // FIXME(sky): Cleanup this code now that part is always NoPart.
367 ScrollbarPart part = NoPart; 349 ScrollbarPart part = NoPart;
368 if (part != m_hoveredPart) { 350 if (part != m_hoveredPart) {
369 if (m_pressedPart != NoPart) { 351 if (m_pressedPart != NoPart) {
370 if (part == m_pressedPart) { 352 if (part == m_pressedPart) {
371 // The mouse is moving back over the pressed part. We 353 // The mouse is moving back over the pressed part. We
372 // need to start up the timer action again. 354 // need to start up the timer action again.
373 startTimerIfNeeded(theme()->autoscrollTimerDelay()); 355 startTimerIfNeeded(autoscrollTimerDelay());
374 theme()->invalidatePart(m_pressedPart); 356 invalidatePart(m_pressedPart);
375 } else if (m_hoveredPart == m_pressedPart) { 357 } else if (m_hoveredPart == m_pressedPart) {
376 // The mouse is leaving the pressed part. Kill our timer 358 // The mouse is leaving the pressed part. Kill our timer
377 // if needed. 359 // if needed.
378 stopTimerIfNeeded(); 360 stopTimerIfNeeded();
379 theme()->invalidatePart(m_pressedPart); 361 invalidatePart(m_pressedPart);
380 } 362 }
381 } 363 }
382 364
383 setHoveredPart(part); 365 setHoveredPart(part);
384 } 366 }
385 367
386 return; 368 return;
387 } 369 }
388 370
389 void Scrollbar::mouseEntered() 371 void Scrollbar::mouseEntered()
(...skipping 25 matching lines...) Expand all
415 void Scrollbar::mouseDown(const PlatformMouseEvent& evt) 397 void Scrollbar::mouseDown(const PlatformMouseEvent& evt)
416 { 398 {
417 // Early exit for right click 399 // Early exit for right click
418 if (evt.button() == RightButton) 400 if (evt.button() == RightButton)
419 return; 401 return;
420 402
421 // FIXME(sky): Do we still need setPressedPart now that we only set it to No Part? 403 // FIXME(sky): Do we still need setPressedPart now that we only set it to No Part?
422 setPressedPart(NoPart); 404 setPressedPart(NoPart);
423 int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainin gWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y(); 405 int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainin gWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y();
424 406
425 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(evt)) { 407 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && shouldCenterOnThumb(evt)) {
426 setHoveredPart(ThumbPart); 408 setHoveredPart(ThumbPart);
427 setPressedPart(ThumbPart); 409 setPressedPart(ThumbPart);
428 m_dragOrigin = m_currentPos; 410 m_dragOrigin = m_currentPos;
429 int thumbLen = theme()->thumbLength(); 411 int thumbLen = thumbLength();
430 int desiredPos = pressedPos; 412 int desiredPos = pressedPos;
431 // Set the pressed position to the middle of the thumb so that when we d o the move, the delta 413 // Set the pressed position to the middle of the thumb so that when we d o the move, the delta
432 // will be from the current pixel position of the thumb to the new desir ed position for the thumb. 414 // will be from the current pixel position of the thumb to the new desir ed position for the thumb.
433 m_pressedPos = theme()->trackPosition() + theme()->thumbPosition() + thu mbLen / 2; 415 m_pressedPos = trackPosition() + thumbPosition() + thumbLen / 2;
434 moveThumb(desiredPos); 416 moveThumb(desiredPos);
435 return; 417 return;
436 } else if (m_pressedPart == ThumbPart) 418 } else if (m_pressedPart == ThumbPart)
437 m_dragOrigin = m_currentPos; 419 m_dragOrigin = m_currentPos;
438 420
439 m_pressedPos = pressedPos; 421 m_pressedPos = pressedPos;
440 422
441 autoscrollPressedPart(theme()->initialAutoscrollTimerDelay()); 423 autoscrollPressedPart(initialAutoscrollTimerDelay());
442 } 424 }
443 425
444 void Scrollbar::setEnabled(bool e) 426 void Scrollbar::setEnabled(bool e)
445 { 427 {
446 if (m_enabled == e) 428 if (m_enabled == e)
447 return; 429 return;
448 m_enabled = e; 430 m_enabled = e;
449 invalidate(); 431 invalidate();
450 } 432 }
451 433
452 bool Scrollbar::isOverlayScrollbar() const 434 bool Scrollbar::isOverlayScrollbar() const
453 { 435 {
454 // FIXME(sky): Remove 436 // FIXME(sky): Remove
455 return true; 437 return true;
456 } 438 }
457 439
458 bool Scrollbar::shouldParticipateInHitTesting() 440 bool Scrollbar::shouldParticipateInHitTesting()
459 { 441 {
460 // Non-overlay scrollbars should always participate in hit testing. 442 // Non-overlay scrollbars should always participate in hit testing.
461 if (!isOverlayScrollbar()) 443 if (!isOverlayScrollbar())
462 return true; 444 return true;
463 return m_scrollableArea->scrollAnimator()->shouldScrollbarParticipateInHitTe sting(this); 445 return m_scrollableArea->scrollAnimator()->shouldScrollbarParticipateInHitTe sting(this);
464 } 446 }
465 447
466 bool Scrollbar::isWindowActive() const
467 {
468 return m_scrollableArea && m_scrollableArea->isActive();
469 }
470
471 void Scrollbar::invalidateRect(const IntRect& rect) 448 void Scrollbar::invalidateRect(const IntRect& rect)
472 { 449 {
473 if (suppressInvalidation())
474 return;
475
476 if (m_scrollableArea) 450 if (m_scrollableArea)
477 m_scrollableArea->invalidateScrollbar(this, rect); 451 m_scrollableArea->invalidateScrollbar(this, rect);
478 } 452 }
479 453
480 IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const 454 IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const
481 { 455 {
482 if (m_scrollableArea) 456 if (m_scrollableArea)
483 return m_scrollableArea->convertFromScrollbarToContainingView(this, loca lRect); 457 return m_scrollableArea->convertFromScrollbarToContainingView(this, loca lRect);
484 458
485 return Widget::convertToContainingView(localRect); 459 return Widget::convertToContainingView(localRect);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 invalidateRect(result); 519 invalidateRect(result);
546 } 520 }
547 521
548 void Scrollbar::paintScrollCorner(GraphicsContext* context, const IntRect& corne rRect) 522 void Scrollbar::paintScrollCorner(GraphicsContext* context, const IntRect& corne rRect)
549 { 523 {
550 if (cornerRect.isEmpty()) 524 if (cornerRect.isEmpty())
551 return; 525 return;
552 blink::Platform::current()->themeEngine()->paint(context->canvas(), blink::W ebThemeEngine::PartScrollbarCorner, blink::WebThemeEngine::StateNormal, blink::W ebRect(cornerRect), 0); 526 blink::Platform::current()->themeEngine()->paint(context->canvas(), blink::W ebThemeEngine::PartScrollbarCorner, blink::WebThemeEngine::StateNormal, blink::W ebRect(cornerRect), 0);
553 } 527 }
554 528
555 void Scrollbar::paintOverhangBackground(GraphicsContext* context, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dir tyRect)
556 {
557 context->setFillColor(Color::white);
558 if (!horizontalOverhangRect.isEmpty())
559 context->fillRect(intersection(horizontalOverhangRect, dirtyRect));
560 if (!verticalOverhangRect.isEmpty())
561 context->fillRect(intersection(verticalOverhangRect, dirtyRect));
562 }
563
564 bool Scrollbar::shouldCenterOnThumb(const PlatformMouseEvent& evt) 529 bool Scrollbar::shouldCenterOnThumb(const PlatformMouseEvent& evt)
565 { 530 {
566 return blink::Platform::current()->scrollbarBehavior()->shouldCenterOnThumb( static_cast<blink::WebScrollbarBehavior::Button>(evt.button()), evt.shiftKey(), evt.altKey()); 531 return blink::Platform::current()->scrollbarBehavior()->shouldCenterOnThumb( static_cast<blink::WebScrollbarBehavior::Button>(evt.button()), evt.shiftKey(), evt.altKey());
567 } 532 }
568 533
569 bool Scrollbar::shouldSnapBackToDragOrigin(const PlatformMouseEvent& evt) 534 bool Scrollbar::shouldSnapBackToDragOrigin(const PlatformMouseEvent& evt)
570 { 535 {
571 IntPoint mousePosition = convertFromContainingWindow(evt.position()); 536 IntPoint mousePosition = convertFromContainingWindow(evt.position());
572 mousePosition.move(x(), y()); 537 mousePosition.move(x(), y());
573 return blink::Platform::current()->scrollbarBehavior()->shouldSnapBackToDrag Origin(mousePosition, trackRect(), orientation() == HorizontalScrollbar); 538 return blink::Platform::current()->scrollbarBehavior()->shouldSnapBackToDrag Origin(mousePosition, trackRect(), orientation() == HorizontalScrollbar);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 thumbRect.setWidth(thumbRect.width() - kScrollbarMargin); 630 thumbRect.setWidth(thumbRect.width() - kScrollbarMargin);
666 if (isLeftSideVerticalScrollbar()) 631 if (isLeftSideVerticalScrollbar())
667 thumbRect.setX(thumbRect.x() + kScrollbarMargin); 632 thumbRect.setX(thumbRect.x() + kScrollbarMargin);
668 } 633 }
669 634
670 DEFINE_STATIC_LOCAL(Color, color, (128, 128, 128, 128)); 635 DEFINE_STATIC_LOCAL(Color, color, (128, 128, 128, 128));
671 context->fillRect(thumbRect, color); 636 context->fillRect(thumbRect, color);
672 } 637 }
673 638
674 } // namespace blink 639 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/scroll/Scrollbar.h ('k') | sky/engine/public/platform/WebScrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698