Changeset 77075 in webkit
- Timestamp:
- Jan 29, 2011 4:22:49 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r77073 r77075 1 2011-01-29 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Fix fat build for both 32-bit and 64-bit under llvm-gcc 4.2 6 https://bugs.webkit.org/show_bug.cgi?id=53386 7 8 * platform/mac/ScrollAnimatorMac.mm: 9 (WebCore::elasticDeltaForReboundDelta): 10 (WebCore::scrollWheelMultiplier): 11 (WebCore::ScrollAnimatorMac::smoothScrollWithEvent): 12 (WebCore::ScrollAnimatorMac::beginScrollGesture): 13 (WebCore::roundTowardZero): 14 (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired): 15 1 16 2011-01-29 Daniel Bates <dbates@rim.com> 2 17 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r77071 r77075 214 214 215 215 static const float scrollVelocityZeroingTimeout = 0.10f; 216 static const float rubberbandStiffness = 20 .0f;217 static const float rubberbandDirectionLockStretchRatio = 1 .0f;218 static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10 .0f;216 static const float rubberbandStiffness = 20; 217 static const float rubberbandDirectionLockStretchRatio = 1; 218 static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10; 219 219 static const float rubberbandAmplitude = 0.31f; 220 220 static const float rubberbandPeriod = 1.6f; … … 231 231 static float elasticDeltaForReboundDelta(float delta) 232 232 { 233 float stiffness = std::max(rubberbandStiffness, 1.0 );233 float stiffness = std::max(rubberbandStiffness, 1.0f); 234 234 return delta / stiffness; 235 235 } … … 242 242 static float scrollWheelMultiplier() 243 243 { 244 static float multiplier = -1 .0;244 static float multiplier = -1; 245 245 if (multiplier < 0) { 246 246 multiplier = [[NSUserDefaults standardUserDefaults] floatForKey:@"NSScrollWheelMultiplier"]; … … 340 340 // Slightly prefer scrolling vertically by applying the = case to deltaY 341 341 if (fabsf(deltaY) >= fabsf(deltaX)) 342 deltaX = 0 .0;342 deltaX = 0; 343 343 else 344 deltaY = 0 .0;344 deltaY = 0; 345 345 346 346 bool isVerticallyStretched = false; … … 350 350 IntSize stretchAmount = m_scrollableArea->overhangAmount(); 351 351 352 isHorizontallyStretched = (stretchAmount.width() == 0.0) ? false : true;353 isVerticallyStretched = (stretchAmount.height() == 0.0) ? false : true;352 isHorizontallyStretched = stretchAmount.width(); 353 isVerticallyStretched = stretchAmount.height(); 354 354 355 355 PlatformWheelEventPhase phase = wheelEvent.phase(); … … 361 361 CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMomemtumScrollTimestamp; 362 362 if (m_inScrollGesture || m_momentumScrollInProgress) { 363 if (m_lastMomemtumScrollTimestamp && timeDelta > 0 .0&& timeDelta < scrollVelocityZeroingTimeout) {364 m_momentumVelocity.setWidth(eventCoallescedDeltaX / timeDelta);365 m_momentumVelocity.setHeight(eventCoallescedDeltaY / timeDelta);363 if (m_lastMomemtumScrollTimestamp && timeDelta > 0 && timeDelta < scrollVelocityZeroingTimeout) { 364 m_momentumVelocity.setWidth(eventCoallescedDeltaX / (float)timeDelta); 365 m_momentumVelocity.setHeight(eventCoallescedDeltaY / (float)timeDelta); 366 366 m_lastMomemtumScrollTimestamp = wheelEvent.timestamp(); 367 367 } else { … … 373 373 if (!isHorizontallyStretched && pinnedInDirection(deltaX, 0)) { 374 374 // Stretching only in the vertical. 375 if (deltaY != 0 .0&& (fabsf(deltaX / deltaY) < rubberbandDirectionLockStretchRatio))376 deltaX = 0 .0;375 if (deltaY != 0 && (fabsf(deltaX / deltaY) < rubberbandDirectionLockStretchRatio)) 376 deltaX = 0; 377 377 else if (fabsf(deltaX) < rubberbandMinimumRequiredDeltaBeforeStretch) { 378 378 m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX); 379 deltaX = 0 .0;379 deltaX = 0; 380 380 } else 381 381 m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX); … … 384 384 // Stretching only in the horizontal. 385 385 if (pinnedInDirection(0, deltaY)) { 386 if (deltaX != 0 .0&& (fabsf(deltaY / deltaX) < rubberbandDirectionLockStretchRatio))387 deltaY = 0 .0;386 if (deltaX != 0 && (fabsf(deltaY / deltaX) < rubberbandDirectionLockStretchRatio)) 387 deltaY = 0; 388 388 else if (fabsf(deltaY) < rubberbandMinimumRequiredDeltaBeforeStretch) { 389 389 m_overflowScrollDelta.setHeight(m_overflowScrollDelta.height() + deltaY); 390 deltaY = 0 .0;390 deltaY = 0; 391 391 } else 392 392 m_overflowScrollDelta.setHeight(m_overflowScrollDelta.height() + deltaY); … … 398 398 if (fabsf(deltaX) < rubberbandMinimumRequiredDeltaBeforeStretch) { 399 399 m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX); 400 deltaX = 0 .0;400 deltaX = 0; 401 401 } else 402 402 m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX); … … 407 407 } 408 408 409 if (deltaX != 0 .0 || deltaY != 0.0) {409 if (deltaX != 0 || deltaY != 0) { 410 410 if (!(shouldStretch || isVerticallyStretched || isHorizontallyStretched)) { 411 411 if (deltaY != 0) { … … 419 419 } else { 420 420 if (!allowsHorizontalStretching()) { 421 deltaX = 0 .0;422 eventCoallescedDeltaX = 0 .0;421 deltaX = 0; 422 eventCoallescedDeltaX = 0; 423 423 } else if ((deltaX != 0) && !isHorizontallyStretched && !pinnedInDirection(deltaX, 0)) { 424 424 deltaX *= scrollWheelMultiplier(); … … 428 428 m_scrollableArea->setConstrainsScrollingToContentEdge(true); 429 429 430 deltaX = 0 .0;430 deltaX = 0; 431 431 } 432 432 433 433 if (!allowsVerticalStretching()) { 434 deltaY = 0 .0;435 eventCoallescedDeltaY = 0 .0;434 deltaY = 0; 435 eventCoallescedDeltaY = 0; 436 436 } else if ((deltaY != 0) && !isVerticallyStretched && !pinnedInDirection(0, deltaY)) { 437 437 deltaY *= scrollWheelMultiplier(); … … 441 441 m_scrollableArea->setConstrainsScrollingToContentEdge(true); 442 442 443 deltaY = 0 .0;443 deltaY = 0; 444 444 } 445 445 … … 472 472 m_momentumScrollInProgress = false; 473 473 m_ignoreMomentumScrolls = false; 474 m_lastMomemtumScrollTimestamp = 0 .0;474 m_lastMomemtumScrollTimestamp = 0; 475 475 } 476 476 } … … 481 481 m_momentumScrollInProgress = false; 482 482 m_ignoreMomentumScrolls = false; 483 m_lastMomemtumScrollTimestamp = 0 .0;483 m_lastMomemtumScrollTimestamp = 0; 484 484 m_momentumVelocity = FloatSize(); 485 485 … … 520 520 static inline float roundTowardZero(float num) 521 521 { 522 return num > 0 .0 ? ceilf(num - 0.5) : floorf(num + 0.5);522 return num > 0 ? ceilf(num - 0.5f) : floorf(num + 0.5f); 523 523 } 524 524 … … 568 568 } 569 569 570 FloatPoint delta(roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.width(), -m_origVelocity.width(), timeDelta)),571 roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.height(), -m_origVelocity.height(), timeDelta)));572 573 if (fabs(delta.x()) >= 1 .0 || fabs(delta.y()) >= 1.0) {570 FloatPoint delta(roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.width(), -m_origVelocity.width(), (float)timeDelta)), 571 roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.height(), -m_origVelocity.height(), (float)timeDelta))); 572 573 if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) { 574 574 FloatPoint newOrigin = m_origOrigin + delta; 575 575
Note: See TracChangeset
for help on using the changeset viewer.