| 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 | |
| 365 // the same reason is set for subframes. crbug.com/675677. | |
| 366 if (WebLayer* scrollLayer = | 364 if (WebLayer* scrollLayer = |
| 367 toWebLayer(getScrollableArea()->layerForScrolling())) { | 365 toWebLayer(getScrollableArea()->layerForScrolling())) { |
| 368 scrollLayer->addMainThreadScrollingReasons( | 366 scrollLayer->addMainThreadScrollingReasons( |
| 369 MainThreadScrollingReason::kHandlingScrollFromMainThread); | 367 MainThreadScrollingReason::kHandlingScrollFromMainThread); |
| 370 } | 368 } |
| 371 } | 369 } |
| 372 | 370 |
| 373 void ScrollAnimator::removeMainThreadScrollingReason() { | 371 void ScrollAnimator::removeMainThreadScrollingReason() { |
| 374 if (WebLayer* scrollLayer = | 372 if (WebLayer* scrollLayer = |
| 375 toWebLayer(getScrollableArea()->layerForScrolling())) { | 373 toWebLayer(getScrollableArea()->layerForScrolling())) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 return false; | 432 return false; |
| 435 } | 433 } |
| 436 return true; | 434 return true; |
| 437 } | 435 } |
| 438 | 436 |
| 439 DEFINE_TRACE(ScrollAnimator) { | 437 DEFINE_TRACE(ScrollAnimator) { |
| 440 ScrollAnimatorBase::trace(visitor); | 438 ScrollAnimatorBase::trace(visitor); |
| 441 } | 439 } |
| 442 | 440 |
| 443 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |