| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "platform/exported/WebScrollbarThemeGeometryNative.h" | 49 #include "platform/exported/WebScrollbarThemeGeometryNative.h" |
| 50 #include "platform/geometry/Region.h" | 50 #include "platform/geometry/Region.h" |
| 51 #include "platform/geometry/TransformState.h" | 51 #include "platform/geometry/TransformState.h" |
| 52 #include "platform/graphics/GraphicsLayer.h" | 52 #include "platform/graphics/GraphicsLayer.h" |
| 53 #if OS(MACOSX) | 53 #if OS(MACOSX) |
| 54 #include "platform/mac/ScrollAnimatorMac.h" | 54 #include "platform/mac/ScrollAnimatorMac.h" |
| 55 #endif | 55 #endif |
| 56 #include "platform/scroll/ScrollAnimator.h" | 56 #include "platform/scroll/ScrollAnimator.h" |
| 57 #include "platform/scroll/ScrollbarTheme.h" | 57 #include "platform/scroll/ScrollbarTheme.h" |
| 58 #include "public/platform/Platform.h" | 58 #include "public/platform/Platform.h" |
| 59 #include "public/platform/WebCompositorAnimationTimeline.h" | |
| 60 #include "public/platform/WebCompositorSupport.h" | 59 #include "public/platform/WebCompositorSupport.h" |
| 61 #include "public/platform/WebLayerPositionConstraint.h" | 60 #include "public/platform/WebLayerPositionConstraint.h" |
| 62 #include "public/platform/WebScrollbarLayer.h" | 61 #include "public/platform/WebScrollbarLayer.h" |
| 63 #include "public/platform/WebScrollbarThemeGeometry.h" | 62 #include "public/platform/WebScrollbarThemeGeometry.h" |
| 64 #include "public/platform/WebScrollbarThemePainter.h" | 63 #include "public/platform/WebScrollbarThemePainter.h" |
| 65 #include "wtf/text/StringBuilder.h" | 64 #include "wtf/text/StringBuilder.h" |
| 66 | 65 |
| 67 using blink::WebLayer; | 66 using blink::WebLayer; |
| 68 using blink::WebLayerPositionConstraint; | 67 using blink::WebLayerPositionConstraint; |
| 69 using blink::WebRect; | 68 using blink::WebRect; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 } | 86 } |
| 88 | 87 |
| 89 ScrollingCoordinator::ScrollingCoordinator(Page* page) | 88 ScrollingCoordinator::ScrollingCoordinator(Page* page) |
| 90 : m_page(page) | 89 : m_page(page) |
| 91 , m_scrollGestureRegionIsDirty(false) | 90 , m_scrollGestureRegionIsDirty(false) |
| 92 , m_touchEventTargetRectsAreDirty(false) | 91 , m_touchEventTargetRectsAreDirty(false) |
| 93 , m_shouldScrollOnMainThreadDirty(false) | 92 , m_shouldScrollOnMainThreadDirty(false) |
| 94 , m_wasFrameScrollable(false) | 93 , m_wasFrameScrollable(false) |
| 95 , m_lastMainThreadScrollingReasons(0) | 94 , m_lastMainThreadScrollingReasons(0) |
| 96 { | 95 { |
| 97 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { | |
| 98 ASSERT(m_page); | |
| 99 ASSERT(m_page->mainFrame()->isLocalFrame()); | |
| 100 ASSERT(Platform::current()->compositorSupport()); | |
| 101 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com
positorSupport()->createAnimationTimeline()); | |
| 102 m_page->chromeClient().attachCompositorAnimationTimeline(m_programmaticS
crollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame())); | |
| 103 } | |
| 104 } | 96 } |
| 105 | 97 |
| 106 ScrollingCoordinator::~ScrollingCoordinator() | 98 ScrollingCoordinator::~ScrollingCoordinator() |
| 107 { | 99 { |
| 108 ASSERT(!m_page); | 100 ASSERT(!m_page); |
| 109 } | 101 } |
| 110 | 102 |
| 111 DEFINE_TRACE(ScrollingCoordinator) | 103 DEFINE_TRACE(ScrollingCoordinator) |
| 112 { | 104 { |
| 113 visitor->trace(m_page); | 105 visitor->trace(m_page); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
VerticalScrollbar)) { | 428 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
VerticalScrollbar)) { |
| 437 GraphicsLayer* verticalScrollbarLayer = scrollableArea->layerForVertical
Scrollbar(); | 429 GraphicsLayer* verticalScrollbarLayer = scrollableArea->layerForVertical
Scrollbar(); |
| 438 if (verticalScrollbarLayer) | 430 if (verticalScrollbarLayer) |
| 439 setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer
, containerLayer); | 431 setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer
, containerLayer); |
| 440 } | 432 } |
| 441 | 433 |
| 442 // Update the viewport layer registration if the outer viewport may have cha
nged. | 434 // Update the viewport layer registration if the outer viewport may have cha
nged. |
| 443 if (m_page->settings().rootLayerScrolls() && isForRootLayer(scrollableArea)) | 435 if (m_page->settings().rootLayerScrolls() && isForRootLayer(scrollableArea)) |
| 444 m_page->chromeClient().registerViewportLayers(); | 436 m_page->chromeClient().registerViewportLayers(); |
| 445 | 437 |
| 446 scrollableArea->layerForScrollingDidChange(m_programmaticScrollAnimatorTimel
ine.get()); | 438 scrollableArea->layerForScrollingDidChange(); |
| 447 | 439 |
| 448 return !!webLayer; | 440 return !!webLayer; |
| 449 } | 441 } |
| 450 | 442 |
| 451 using GraphicsLayerHitTestRects = WTF::HashMap<const GraphicsLayer*, Vector<Layo
utRect>>; | 443 using GraphicsLayerHitTestRects = WTF::HashMap<const GraphicsLayer*, Vector<Layo
utRect>>; |
| 452 | 444 |
| 453 // In order to do a DFS cross-frame walk of the Layer tree, we need to know whic
h | 445 // In order to do a DFS cross-frame walk of the Layer tree, we need to know whic
h |
| 454 // Layers have child frames inside of them. This computes a mapping for the | 446 // Layers have child frames inside of them. This computes a mapping for the |
| 455 // current frame which we can consult while walking the layers of that frame. | 447 // current frame which we can consult while walking the layers of that frame. |
| 456 // Whenever we descend into a new frame, a new map will be created. | 448 // Whenever we descend into a new frame, a new map will be created. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 return; | 716 return; |
| 725 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { | 717 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
| 726 m_lastMainThreadScrollingReasons = reasons; | 718 m_lastMainThreadScrollingReasons = reasons; |
| 727 scrollLayer->setShouldScrollOnMainThread(reasons); | 719 scrollLayer->setShouldScrollOnMainThread(reasons); |
| 728 } | 720 } |
| 729 } | 721 } |
| 730 | 722 |
| 731 void ScrollingCoordinator::willBeDestroyed() | 723 void ScrollingCoordinator::willBeDestroyed() |
| 732 { | 724 { |
| 733 ASSERT(m_page); | 725 ASSERT(m_page); |
| 734 | |
| 735 if (m_programmaticScrollAnimatorTimeline) { | |
| 736 ASSERT(m_page->mainFrame()->isLocalFrame()); | |
| 737 m_page->chromeClient().detachCompositorAnimationTimeline(m_programmaticS
crollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame())); | |
| 738 m_programmaticScrollAnimatorTimeline.clear(); | |
| 739 } | |
| 740 | |
| 741 m_page = nullptr; | 726 m_page = nullptr; |
| 742 for (const auto& scrollbar : m_horizontalScrollbars) | 727 for (const auto& scrollbar : m_horizontalScrollbars) |
| 743 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 728 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
| 744 for (const auto& scrollbar : m_verticalScrollbars) | 729 for (const auto& scrollbar : m_verticalScrollbars) |
| 745 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 730 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
| 746 } | 731 } |
| 747 | 732 |
| 748 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
) const | 733 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
) const |
| 749 { | 734 { |
| 750 ASSERT(isMainThread()); | 735 ASSERT(isMainThread()); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1061 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 1077 if (frameIsScrollable != m_wasFrameScrollable) | 1062 if (frameIsScrollable != m_wasFrameScrollable) |
| 1078 return true; | 1063 return true; |
| 1079 | 1064 |
| 1080 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1065 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
| 1081 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1066 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
| 1082 return false; | 1067 return false; |
| 1083 } | 1068 } |
| 1084 | 1069 |
| 1085 } // namespace blink | 1070 } // namespace blink |
| OLD | NEW |