OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 // Main thread should deal with the scroll animations it started. | 355 // Main thread should deal with the scroll animations it started. |
356 if (sentToCompositor || runningOnMainThread) | 356 if (sentToCompositor || runningOnMainThread) |
357 addMainThreadScrollingReason(); | 357 addMainThreadScrollingReason(); |
358 else | 358 else |
359 removeMainThreadScrollingReason(); | 359 removeMainThreadScrollingReason(); |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
363 void ScrollAnimator::addMainThreadScrollingReason() { | 363 void ScrollAnimator::addMainThreadScrollingReason() { |
364 // TODO(yigu): Should update the frame tree to make sure | 364 // Usually main thread scrolling reasons should be updated from |
365 // the same reason is set for subframes. crbug.com/675677. | 365 // one frame to all its descendants. khandlingScrollFromMainThread |
| 366 // is a special case because its subframes cannot be scrolled |
| 367 // when the reason is set. When the subframes are ready to scroll |
| 368 // the reason has benn reset. |
366 if (WebLayer* scrollLayer = | 369 if (WebLayer* scrollLayer = |
367 toWebLayer(getScrollableArea()->layerForScrolling())) { | 370 toWebLayer(getScrollableArea()->layerForScrolling())) { |
368 scrollLayer->addMainThreadScrollingReasons( | 371 scrollLayer->addMainThreadScrollingReasons( |
369 MainThreadScrollingReason::kHandlingScrollFromMainThread); | 372 MainThreadScrollingReason::kHandlingScrollFromMainThread); |
370 } | 373 } |
371 } | 374 } |
372 | 375 |
373 void ScrollAnimator::removeMainThreadScrollingReason() { | 376 void ScrollAnimator::removeMainThreadScrollingReason() { |
374 if (WebLayer* scrollLayer = | 377 if (WebLayer* scrollLayer = |
375 toWebLayer(getScrollableArea()->layerForScrolling())) { | 378 toWebLayer(getScrollableArea()->layerForScrolling())) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return false; | 437 return false; |
435 } | 438 } |
436 return true; | 439 return true; |
437 } | 440 } |
438 | 441 |
439 DEFINE_TRACE(ScrollAnimator) { | 442 DEFINE_TRACE(ScrollAnimator) { |
440 ScrollAnimatorBase::trace(visitor); | 443 ScrollAnimatorBase::trace(visitor); |
441 } | 444 } |
442 | 445 |
443 } // namespace blink | 446 } // namespace blink |
OLD | NEW |