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