Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 static const bool platformSupportsCoordinatedScrollbar = true; | 337 static const bool platformSupportsCoordinatedScrollbar = true; |
| 338 #endif | 338 #endif |
| 339 | 339 |
| 340 bool isMainFrame = isForMainFrame(scrollableArea); | 340 bool isMainFrame = isForMainFrame(scrollableArea); |
| 341 GraphicsLayer* scrollbarGraphicsLayer = orientation == HorizontalScrollbar | 341 GraphicsLayer* scrollbarGraphicsLayer = orientation == HorizontalScrollbar |
| 342 ? scrollableArea->layerForHorizontalScrollbar() | 342 ? scrollableArea->layerForHorizontalScrollbar() |
| 343 : scrollableArea->layerForVerticalScrollbar(); | 343 : scrollableArea->layerForVerticalScrollbar(); |
| 344 | 344 |
| 345 if (!platformSupportsCoordinatedScrollbar) { | 345 if (!platformSupportsCoordinatedScrollbar) { |
| 346 if (scrollbarGraphicsLayer) { | 346 if (scrollbarGraphicsLayer) { |
| 347 WebLayer* scrollbarLayer = toWebLayer(scrollbarGraphicsLayer); | 347 scrollbarGraphicsLayer->setMainThreadScrollingReasons(MainThreadScro llingReason::kScrollbarScrolling); |
|
ajuma
2016/02/04 15:05:48
Is changing this from adding a reason to replacing
| |
| 348 scrollbarLayer->addMainThreadScrollingReasons(MainThreadScrollingRea son::kScrollbarScrolling); | |
| 349 } | 348 } |
| 350 return; | 349 return; |
| 351 } | 350 } |
| 352 | 351 |
| 353 if (scrollbarGraphicsLayer) { | 352 if (scrollbarGraphicsLayer) { |
| 354 Scrollbar& scrollbar = orientation == HorizontalScrollbar ? *scrollableA rea->horizontalScrollbar() : *scrollableArea->verticalScrollbar(); | 353 Scrollbar& scrollbar = orientation == HorizontalScrollbar ? *scrollableA rea->horizontalScrollbar() : *scrollableArea->verticalScrollbar(); |
| 355 if (scrollbar.isCustomScrollbar()) { | 354 if (scrollbar.isCustomScrollbar()) { |
| 356 detachScrollbarLayer(scrollbarGraphicsLayer); | 355 detachScrollbarLayer(scrollbarGraphicsLayer); |
| 357 return; | 356 return; |
| 358 } | 357 } |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 | 676 |
| 678 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) | 677 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) |
| 679 { | 678 { |
| 680 m_layersWithTouchRects.remove(layer); | 679 m_layersWithTouchRects.remove(layer); |
| 681 } | 680 } |
| 682 | 681 |
| 683 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons mainThreadScrollingReasons) | 682 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons mainThreadScrollingReasons) |
| 684 { | 683 { |
| 685 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) | 684 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) |
| 686 return; | 685 return; |
| 687 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { | 686 if (GraphicsLayer* scrollLayer = m_page->deprecatedLocalMainFrame()->view()- >layerForScrolling()) { |
| 688 m_lastMainThreadScrollingReasons = mainThreadScrollingReasons; | 687 m_lastMainThreadScrollingReasons = mainThreadScrollingReasons; |
| 689 if (mainThreadScrollingReasons) | 688 scrollLayer->setMainThreadScrollingReasons(mainThreadScrollingReasons); |
| 690 scrollLayer->addMainThreadScrollingReasons(mainThreadScrollingReason s); | |
| 691 else | |
| 692 scrollLayer->clearMainThreadScrollingReasons(); | |
| 693 } | 689 } |
| 694 } | 690 } |
| 695 | 691 |
| 696 void ScrollingCoordinator::layerTreeViewInitialized(WebLayerTreeView& layerTreeV iew) | 692 void ScrollingCoordinator::layerTreeViewInitialized(WebLayerTreeView& layerTreeV iew) |
| 697 { | 693 { |
| 698 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->isThreadedAnimationEnabled()) { | 694 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->isThreadedAnimationEnabled()) { |
| 699 ASSERT(Platform::current()->compositorSupport()); | 695 ASSERT(Platform::current()->compositorSupport()); |
| 700 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com positorSupport()->createAnimationTimeline()); | 696 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com positorSupport()->createAnimationTimeline()); |
| 701 layerTreeView.attachCompositorAnimationTimeline(m_programmaticScrollAnim atorTimeline.get()); | 697 layerTreeView.attachCompositorAnimationTimeline(m_programmaticScrollAnim atorTimeline.get()); |
| 702 } | 698 } |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1051 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1047 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 1052 if (frameIsScrollable != m_wasFrameScrollable) | 1048 if (frameIsScrollable != m_wasFrameScrollable) |
| 1053 return true; | 1049 return true; |
| 1054 | 1050 |
| 1055 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) | 1051 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) |
| 1056 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1052 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
| 1057 return false; | 1053 return false; |
| 1058 } | 1054 } |
| 1059 | 1055 |
| 1060 } // namespace blink | 1056 } // namespace blink |
| OLD | NEW |