|
Lines 26-31
WebCore/platform/Scrollbar.cpp_sec1
|
| 26 |
#include "config.h" |
26 |
#include "config.h" |
| 27 |
#include "Scrollbar.h" |
27 |
#include "Scrollbar.h" |
| 28 |
|
28 |
|
|
|
29 |
#include "CurrentTime.h" |
| 29 |
#include "EventHandler.h" |
30 |
#include "EventHandler.h" |
| 30 |
#include "Frame.h" |
31 |
#include "Frame.h" |
| 31 |
#include "FrameView.h" |
32 |
#include "FrameView.h" |
|
Lines 57-62
Scrollbar::Scrollbar(ScrollbarClient* cl
WebCore/platform/Scrollbar.cpp_sec2
|
| 57 |
, m_visibleSize(0) |
58 |
, m_visibleSize(0) |
| 58 |
, m_totalSize(0) |
59 |
, m_totalSize(0) |
| 59 |
, m_currentPos(0) |
60 |
, m_currentPos(0) |
|
|
61 |
, m_desiredPos(0) |
| 62 |
, m_smoothScrollCurrentVelocity(0) |
| 63 |
, m_smoothScrollDesiredVelocity(0) |
| 60 |
, m_dragOrigin(0) |
64 |
, m_dragOrigin(0) |
| 61 |
, m_lineStep(0) |
65 |
, m_lineStep(0) |
| 62 |
, m_pageStep(0) |
66 |
, m_pageStep(0) |
|
Lines 65-71
Scrollbar::Scrollbar(ScrollbarClient* cl
WebCore/platform/Scrollbar.cpp_sec3
|
| 65 |
, m_pressedPart(NoPart) |
69 |
, m_pressedPart(NoPart) |
| 66 |
, m_pressedPos(0) |
70 |
, m_pressedPos(0) |
| 67 |
, m_enabled(true) |
71 |
, m_enabled(true) |
| 68 |
, m_scrollTimer(this, &Scrollbar::autoscrollTimerFired) |
72 |
, m_autoscrollTimer(this, &Scrollbar::autoscrollTimerFired) |
|
|
73 |
, m_smoothScrollTimer(this, &Scrollbar::smoothScrollTimerFired) |
| 69 |
, m_overlapsResizer(false) |
74 |
, m_overlapsResizer(false) |
| 70 |
, m_suppressInvalidation(false) |
75 |
, m_suppressInvalidation(false) |
| 71 |
{ |
76 |
{ |
|
Lines 83-90
Scrollbar::Scrollbar(ScrollbarClient* cl
WebCore/platform/Scrollbar.cpp_sec4
|
| 83 |
|
88 |
|
| 84 |
Scrollbar::~Scrollbar() |
89 |
Scrollbar::~Scrollbar() |
| 85 |
{ |
90 |
{ |
| 86 |
stopTimerIfNeeded(); |
91 |
stopAutoscrollTimerIfNeeded(); |
| 87 |
|
92 |
stopSmoothScrollTimerIfNeeded(); |
|
|
93 |
|
| 88 |
m_theme->unregisterScrollbar(this); |
94 |
m_theme->unregisterScrollbar(this); |
| 89 |
} |
95 |
} |
| 90 |
|
96 |
|
|
Lines 93-99
bool Scrollbar::setValue(int v)
WebCore/platform/Scrollbar.cpp_sec5
|
| 93 |
v = max(min(v, m_totalSize - m_visibleSize), 0); |
99 |
v = max(min(v, m_totalSize - m_visibleSize), 0); |
| 94 |
if (value() == v) |
100 |
if (value() == v) |
| 95 |
return false; // Our value stayed the same. |
101 |
return false; // Our value stayed the same. |
| 96 |
setCurrentPos(v); |
102 |
setCurrentPos(v, true); |
| 97 |
return true; |
103 |
return true; |
| 98 |
} |
104 |
} |
| 99 |
|
105 |
|
|
Lines 115-140
void Scrollbar::setSteps(int lineStep, i
WebCore/platform/Scrollbar.cpp_sec6
|
| 115 |
m_pixelStep = 1.0f / pixelsPerStep; |
121 |
m_pixelStep = 1.0f / pixelsPerStep; |
| 116 |
} |
122 |
} |
| 117 |
|
123 |
|
| 118 |
bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) |
124 |
bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, bool allowUnlimitedQueueing) |
| 119 |
{ |
125 |
{ |
| 120 |
float step = 0; |
126 |
float step = 0; |
| 121 |
if ((direction == ScrollUp && m_orientation == VerticalScrollbar) || (direction == ScrollLeft && m_orientation == HorizontalScrollbar)) |
127 |
if ((direction == ScrollUp && m_orientation == VerticalScrollbar) || (direction == ScrollLeft && m_orientation == HorizontalScrollbar)) |
| 122 |
step = -1; |
128 |
step = -multiplier; |
| 123 |
else if ((direction == ScrollDown && m_orientation == VerticalScrollbar) || (direction == ScrollRight && m_orientation == HorizontalScrollbar)) |
129 |
else if ((direction == ScrollDown && m_orientation == VerticalScrollbar) || (direction == ScrollRight && m_orientation == HorizontalScrollbar)) |
| 124 |
step = 1; |
130 |
step = multiplier; |
| 125 |
|
131 |
|
| 126 |
if (granularity == ScrollByLine) |
132 |
float smoothScrollStep = 0; |
| 127 |
step *= m_lineStep; |
133 |
if (granularity == ScrollByDocument) |
| 128 |
else if (granularity == ScrollByPage) |
|
|
| 129 |
step *= m_pageStep; |
| 130 |
else if (granularity == ScrollByDocument) |
| 131 |
step *= m_totalSize; |
134 |
step *= m_totalSize; |
| 132 |
else if (granularity == ScrollByPixel) |
135 |
else if (granularity == ScrollByPixel) |
| 133 |
step *= m_pixelStep; |
136 |
step *= m_pixelStep; |
| 134 |
|
137 |
else { |
| 135 |
float newPos = m_currentPos + step * multiplier; |
138 |
if (granularity == ScrollByLine) |
| 136 |
float maxPos = m_totalSize - m_visibleSize; |
139 |
smoothScrollStep = m_lineStep; |
| 137 |
return setCurrentPos(max(min(newPos, maxPos), 0.0f)); |
140 |
else if (granularity == ScrollByPage) |
|
|
141 |
smoothScrollStep = m_pageStep; |
| 142 |
step *= smoothScrollStep; |
| 143 |
} |
| 144 |
|
| 145 |
float newPos = max(min(m_desiredPos + step, static_cast<float>(m_totalSize) - m_visibleSize), 0.0f); |
| 146 |
// Don't smooth scroll jumping to the beginning or end of the document. |
| 147 |
if (!theme()->smoothScroll() || (granularity == ScrollByDocument)) |
| 148 |
return setCurrentPos(newPos, true); |
| 149 |
// For keyboard autorepeat scrolling, don't queue up more than two scroll |
| 150 |
// increments in advance, lest when the user lifts up the key we continue |
| 151 |
// scrolling for a while to "catch up". (Two increments is the minimum |
| 152 |
// cutoff we can have without risking scroll underflow; to be more precise, |
| 153 |
// for a key repeat delay of |x| * theme()->autoscrollTimerDelay(), we will |
| 154 |
// eventually underflow if we don't allow the new position to advance by at |
| 155 |
// least (|step| * |x| * 2)). |
| 156 |
if (!allowUnlimitedQueueing && (abs(newPos - m_currentPos) >= (abs(step) * 2))) |
| 157 |
return false; |
| 158 |
return setDesiredPos(newPos, smoothScrollStep); |
| 138 |
} |
159 |
} |
| 139 |
|
160 |
|
| 140 |
void Scrollbar::updateThumbPosition() |
161 |
void Scrollbar::updateThumbPosition() |
|
Lines 153-159
void Scrollbar::paint(GraphicsContext* c
WebCore/platform/Scrollbar.cpp_sec7
|
| 153 |
invalidate(); |
174 |
invalidate(); |
| 154 |
return; |
175 |
return; |
| 155 |
} |
176 |
} |
| 156 |
|
177 |
|
| 157 |
if (context->paintingDisabled() || !frameRect().intersects(damageRect)) |
178 |
if (context->paintingDisabled() || !frameRect().intersects(damageRect)) |
| 158 |
return; |
179 |
return; |
| 159 |
|
180 |
|
|
Lines 188-197
void Scrollbar::autoscrollPressedPart(do
WebCore/platform/Scrollbar.cpp_sec8
|
| 188 |
|
209 |
|
| 189 |
// Handle the arrows and track. |
210 |
// Handle the arrows and track. |
| 190 |
if (scroll(pressedPartScrollDirection(), pressedPartScrollGranularity())) |
211 |
if (scroll(pressedPartScrollDirection(), pressedPartScrollGranularity())) |
| 191 |
startTimerIfNeeded(delay); |
212 |
startAutoscrollTimerIfNeeded(delay); |
| 192 |
} |
213 |
} |
| 193 |
|
214 |
|
| 194 |
void Scrollbar::startTimerIfNeeded(double delay) |
215 |
void Scrollbar::startAutoscrollTimerIfNeeded(double delay) |
| 195 |
{ |
216 |
{ |
| 196 |
// Don't do anything for the thumb. |
217 |
// Don't do anything for the thumb. |
| 197 |
if (m_pressedPart == ThumbPart) |
218 |
if (m_pressedPart == ThumbPart) |
|
Lines 208-227
void Scrollbar::startTimerIfNeeded(doubl
WebCore/platform/Scrollbar.cpp_sec9
|
| 208 |
// We can't scroll if we've hit the beginning or end. |
229 |
// We can't scroll if we've hit the beginning or end. |
| 209 |
ScrollDirection dir = pressedPartScrollDirection(); |
230 |
ScrollDirection dir = pressedPartScrollDirection(); |
| 210 |
if (dir == ScrollUp || dir == ScrollLeft) { |
231 |
if (dir == ScrollUp || dir == ScrollLeft) { |
| 211 |
if (m_currentPos == 0) |
232 |
if (!m_desiredPos) |
| 212 |
return; |
233 |
return; |
| 213 |
} else { |
234 |
} else { |
| 214 |
if (m_currentPos == maximum()) |
235 |
if (m_desiredPos == maximum()) |
| 215 |
return; |
236 |
return; |
| 216 |
} |
237 |
} |
| 217 |
|
238 |
|
| 218 |
m_scrollTimer.startOneShot(delay); |
239 |
m_autoscrollTimer.startOneShot(delay); |
| 219 |
} |
240 |
} |
| 220 |
|
241 |
|
| 221 |
void Scrollbar::stopTimerIfNeeded() |
242 |
void Scrollbar::stopAutoscrollTimerIfNeeded() |
| 222 |
{ |
243 |
{ |
| 223 |
if (m_scrollTimer.isActive()) |
244 |
if (m_autoscrollTimer.isActive()) |
| 224 |
m_scrollTimer.stop(); |
245 |
m_autoscrollTimer.stop(); |
| 225 |
} |
246 |
} |
| 226 |
|
247 |
|
| 227 |
ScrollDirection Scrollbar::pressedPartScrollDirection() |
248 |
ScrollDirection Scrollbar::pressedPartScrollDirection() |
|
Lines 244-249
ScrollGranularity Scrollbar::pressedPart
WebCore/platform/Scrollbar.cpp_sec10
|
| 244 |
return ScrollByPage; |
265 |
return ScrollByPage; |
| 245 |
} |
266 |
} |
| 246 |
|
267 |
|
|
|
268 |
void Scrollbar::smoothScrollTimerFired(Timer<Scrollbar>*) |
| 269 |
{ |
| 270 |
smoothScroll(); |
| 271 |
} |
| 272 |
|
| 273 |
void Scrollbar::stopSmoothScrollTimerIfNeeded() |
| 274 |
{ |
| 275 |
if (m_smoothScrollTimer.isActive()) |
| 276 |
m_smoothScrollTimer.stop(); |
| 277 |
} |
| 278 |
|
| 279 |
void Scrollbar::smoothScroll() |
| 280 |
{ |
| 281 |
// Note on smooth scrolling perf versus non-smooth scrolling perf: |
| 282 |
// The total time to perform a complete scroll is equal to |
| 283 |
// t0 + 0.5tA - tD + tS |
| 284 |
// Where |
| 285 |
// t0 = The time to perform the scroll without smooth scrolling |
| 286 |
// tA = theme()->smoothScrollAccelerationTime() |
| 287 |
// tD = theme()->smoothScrollTimerDelay() |
| 288 |
// tS = A value less than or equal to the time required to perform a |
| 289 |
// single scroll increment, i.e. the work done due to calling |
| 290 |
// client()->valueChanged() (~0 for simple pages, larger for complex |
| 291 |
// pages). |
| 292 |
// |
| 293 |
// Because tA and tD are fairly small, the total lag (as users perceive it) |
| 294 |
// is ~0 (actually 15 ms by default) for simple pages and roughly tS for |
| 295 |
// complex pages. Without knowing in advance how large tS is it's hard to |
| 296 |
// do better than this. Perhaps we could try to remember previous values |
| 297 |
// and forward-compensate. |
| 298 |
|
| 299 |
|
| 300 |
// We want to update the scroll position based on the time it's been since |
| 301 |
// our last update. This may be longer than our ideal time, especially if |
| 302 |
// the page is complex or the system is slow. |
| 303 |
double desiredScrollInterval = theme()->smoothScrollTimerDelay(); |
| 304 |
// To avoid feeling laggy, if we've just started smooth scrolling we pretend |
| 305 |
// we've already accelerated for one ideal interval, so that we'll scroll at |
| 306 |
// least some distance immediately. |
| 307 |
double lastScrollInterval = m_smoothScrollCurrentVelocity ? (WTF::currentTime() - m_lastSmoothScrollTime) : desiredScrollInterval; |
| 308 |
|
| 309 |
// Figure out how far we've actually traveled and update our current |
| 310 |
// velocity. |
| 311 |
float distanceTraveled; |
| 312 |
if (m_smoothScrollCurrentVelocity < m_smoothScrollDesiredVelocity) { |
| 313 |
// We accelerate at a constant rate until we reach the desired velocity. |
| 314 |
// theme()->smoothScrollAccelerationTime() is the time we'll take to |
| 315 |
// accelerate from 0 to that velocity. Increasing this value will |
| 316 |
// produce a more pronounced acceleration effect. |
| 317 |
float accelerationRate = m_smoothScrollDesiredVelocity / theme()->smoothScrollAccelerationTime(); |
| 318 |
|
| 319 |
// Figure out whether contant acceleration has caused us to reach our |
| 320 |
// target velocity. |
| 321 |
float potentialVelocityChange = accelerationRate * lastScrollInterval; |
| 322 |
float potentialNewVelocity = m_smoothScrollCurrentVelocity + potentialVelocityChange; |
| 323 |
if (potentialNewVelocity > m_smoothScrollDesiredVelocity) { |
| 324 |
// We reached the target velocity at some point between our last |
| 325 |
// update and now. The distance traveled can be calculated in two |
| 326 |
// pieces: the distance traveled while accelerating, and the |
| 327 |
// distance traveled after reaching the target velocity. |
| 328 |
float actualVelocityChange = m_smoothScrollDesiredVelocity - m_smoothScrollCurrentVelocity; |
| 329 |
float accelerationInterval = actualVelocityChange / accelerationRate; |
| 330 |
// The distance traveled under constant acceleration is the area |
| 331 |
// under a line segment with a constant rising slope. Break this |
| 332 |
// into a triangular portion atop a rectangular portion and sum. |
| 333 |
distanceTraveled = ((m_smoothScrollCurrentVelocity + (actualVelocityChange / 2)) * accelerationInterval); |
| 334 |
// The distance traveled at the target velocity is simply |
| 335 |
// (target velocity) * (remaining time after accelerating). |
| 336 |
distanceTraveled += (m_smoothScrollDesiredVelocity * (lastScrollInterval - accelerationInterval)); |
| 337 |
m_smoothScrollCurrentVelocity = m_smoothScrollDesiredVelocity; |
| 338 |
} else { |
| 339 |
// Constant acceleration through the entire time interval. |
| 340 |
distanceTraveled = (m_smoothScrollCurrentVelocity + (potentialVelocityChange / 2)) * lastScrollInterval; |
| 341 |
m_smoothScrollCurrentVelocity = potentialNewVelocity; |
| 342 |
} |
| 343 |
} else { |
| 344 |
// We've already reached the target velocity, so the distance we've |
| 345 |
// traveled is simply (current velocity) * (elapsed time). |
| 346 |
distanceTraveled = m_smoothScrollCurrentVelocity * lastScrollInterval; |
| 347 |
// If our desired velocity has decreased, drop the current velocity too. |
| 348 |
m_smoothScrollCurrentVelocity = m_smoothScrollDesiredVelocity; |
| 349 |
} |
| 350 |
|
| 351 |
// Now update the scroll position based on the distance traveled. |
| 352 |
if (distanceTraveled >= abs(m_desiredPos - m_currentPos)) { |
| 353 |
// We've traveled far enough to reach the desired position. Stop smooth |
| 354 |
// scrolling. |
| 355 |
setCurrentPos(m_desiredPos, false); |
| 356 |
m_smoothScrollCurrentVelocity = 0; |
| 357 |
} else { |
| 358 |
// Not yet at the target position. Travel towards it and set up the |
| 359 |
// next update. |
| 360 |
if (m_currentPos > m_desiredPos) |
| 361 |
distanceTraveled = -distanceTraveled; |
| 362 |
setCurrentPos(m_currentPos + distanceTraveled, false); |
| 363 |
m_smoothScrollTimer.startOneShot(desiredScrollInterval); |
| 364 |
m_lastSmoothScrollTime = WTF::currentTime(); |
| 365 |
} |
| 366 |
} |
| 367 |
|
| 247 |
void Scrollbar::moveThumb(int pos) |
368 |
void Scrollbar::moveThumb(int pos) |
| 248 |
{ |
369 |
{ |
| 249 |
// Drag the thumb. |
370 |
// Drag the thumb. |
|
Lines 257-267
void Scrollbar::moveThumb(int pos)
WebCore/platform/Scrollbar.cpp_sec11
|
| 257 |
else if (delta < 0) |
378 |
else if (delta < 0) |
| 258 |
delta = max(-thumbPos, delta); |
379 |
delta = max(-thumbPos, delta); |
| 259 |
if (delta) |
380 |
if (delta) |
| 260 |
setCurrentPos(static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen)); |
381 |
setCurrentPos(static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen), true); |
| 261 |
} |
382 |
} |
| 262 |
|
383 |
|
| 263 |
bool Scrollbar::setCurrentPos(float pos) |
384 |
bool Scrollbar::setCurrentPos(float pos, bool resetSmoothScroll) |
| 264 |
{ |
385 |
{ |
|
|
386 |
if (resetSmoothScroll) { |
| 387 |
stopSmoothScrollTimerIfNeeded(); |
| 388 |
m_desiredPos = pos; |
| 389 |
m_smoothScrollCurrentVelocity = 0; |
| 390 |
} |
| 391 |
|
| 265 |
if (pos == m_currentPos) |
392 |
if (pos == m_currentPos) |
| 266 |
return false; |
393 |
return false; |
| 267 |
|
394 |
|
|
Lines 277-282
bool Scrollbar::setCurrentPos(float pos)
WebCore/platform/Scrollbar.cpp_sec12
|
| 277 |
return true; |
404 |
return true; |
| 278 |
} |
405 |
} |
| 279 |
|
406 |
|
|
|
407 |
bool Scrollbar::setDesiredPos(float pos, float step) |
| 408 |
{ |
| 409 |
if (pos == m_desiredPos) |
| 410 |
return false; |
| 411 |
|
| 412 |
m_desiredPos = pos; |
| 413 |
if (m_currentPos == m_desiredPos) |
| 414 |
return false; |
| 415 |
|
| 416 |
// For wheel scrolls, we set the target velocity based on how far away from |
| 417 |
// the target position we are. This makes wheel scrolls feel similar to the |
| 418 |
// other types of scrolls, since in both cases we're setting the velocity |
| 419 |
// such that in theme()->autoscrollTimerDelay() seconds we'll reach the new |
| 420 |
// desired position (see below). |
| 421 |
if (!step) |
| 422 |
step = abs(m_desiredPos - m_currentPos); |
| 423 |
|
| 424 |
// When autoscrolling, |m_autoscrollTimer| will end up calling here to |
| 425 |
// increment |m_desiredPos| by |step| every |
| 426 |
// theme()->autoscrollTimerDelay() seconds. If we set the desired velocity |
| 427 |
// to exactly this rate, smooth scrolling will neither race ahead (and then |
| 428 |
// have to slow down) nor lag behind. |
| 429 |
m_smoothScrollDesiredVelocity = step / theme()->autoscrollTimerDelay(); |
| 430 |
if (!m_smoothScrollTimer.isActive()) |
| 431 |
smoothScroll(); |
| 432 |
return true; |
| 433 |
} |
| 434 |
|
| 280 |
void Scrollbar::setHoveredPart(ScrollbarPart part) |
435 |
void Scrollbar::setHoveredPart(ScrollbarPart part) |
| 281 |
{ |
436 |
{ |
| 282 |
if (part == m_hoveredPart) |
437 |
if (part == m_hoveredPart) |
|
Lines 306-312
bool Scrollbar::mouseMoved(const Platfor
WebCore/platform/Scrollbar.cpp_sec13
|
| 306 |
{ |
461 |
{ |
| 307 |
if (m_pressedPart == ThumbPart) { |
462 |
if (m_pressedPart == ThumbPart) { |
| 308 |
if (theme()->shouldSnapBackToDragOrigin(this, evt)) |
463 |
if (theme()->shouldSnapBackToDragOrigin(this, evt)) |
| 309 |
setCurrentPos(m_dragOrigin); |
464 |
setCurrentPos(m_dragOrigin, true); |
| 310 |
else { |
465 |
else { |
| 311 |
moveThumb(m_orientation == HorizontalScrollbar ? |
466 |
moveThumb(m_orientation == HorizontalScrollbar ? |
| 312 |
convertFromContainingWindow(evt.pos()).x() : |
467 |
convertFromContainingWindow(evt.pos()).x() : |
|
Lines 324-339
bool Scrollbar::mouseMoved(const Platfor
WebCore/platform/Scrollbar.cpp_sec14
|
| 324 |
if (part == m_pressedPart) { |
479 |
if (part == m_pressedPart) { |
| 325 |
// The mouse is moving back over the pressed part. We |
480 |
// The mouse is moving back over the pressed part. We |
| 326 |
// need to start up the timer action again. |
481 |
// need to start up the timer action again. |
| 327 |
startTimerIfNeeded(theme()->autoscrollTimerDelay()); |
482 |
startAutoscrollTimerIfNeeded(theme()->autoscrollTimerDelay()); |
| 328 |
theme()->invalidatePart(this, m_pressedPart); |
483 |
theme()->invalidatePart(this, m_pressedPart); |
| 329 |
} else if (m_hoveredPart == m_pressedPart) { |
484 |
} else if (m_hoveredPart == m_pressedPart) { |
| 330 |
// The mouse is leaving the pressed part. Kill our timer |
485 |
// The mouse is leaving the pressed part. Kill our timer |
| 331 |
// if needed. |
486 |
// if needed. |
| 332 |
stopTimerIfNeeded(); |
487 |
stopAutoscrollTimerIfNeeded(); |
| 333 |
theme()->invalidatePart(this, m_pressedPart); |
488 |
theme()->invalidatePart(this, m_pressedPart); |
| 334 |
} |
489 |
} |
| 335 |
} |
490 |
} |
| 336 |
|
491 |
|
| 337 |
setHoveredPart(part); |
492 |
setHoveredPart(part); |
| 338 |
} |
493 |
} |
| 339 |
|
494 |
|
|
Lines 350-356
bool Scrollbar::mouseUp()
WebCore/platform/Scrollbar.cpp_sec15
|
| 350 |
{ |
505 |
{ |
| 351 |
setPressedPart(NoPart); |
506 |
setPressedPart(NoPart); |
| 352 |
m_pressedPos = 0; |
507 |
m_pressedPos = 0; |
| 353 |
stopTimerIfNeeded(); |
508 |
stopAutoscrollTimerIfNeeded(); |
| 354 |
|
509 |
|
| 355 |
if (parent() && parent()->isFrameView()) |
510 |
if (parent() && parent()->isFrameView()) |
| 356 |
static_cast<FrameView*>(parent())->frame()->eventHandler()->setMousePressed(false); |
511 |
static_cast<FrameView*>(parent())->frame()->eventHandler()->setMousePressed(false); |
|
Lines 366-372
bool Scrollbar::mouseDown(const Platform
WebCore/platform/Scrollbar.cpp_sec16
|
| 366 |
|
521 |
|
| 367 |
setPressedPart(theme()->hitTest(this, evt)); |
522 |
setPressedPart(theme()->hitTest(this, evt)); |
| 368 |
int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y()); |
523 |
int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y()); |
| 369 |
|
524 |
|
| 370 |
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) { |
525 |
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) { |
| 371 |
setHoveredPart(ThumbPart); |
526 |
setHoveredPart(ThumbPart); |
| 372 |
setPressedPart(ThumbPart); |
527 |
setPressedPart(ThumbPart); |