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