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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 #include "public/platform/WebScrollbarThemeGeometry.h" | 63 #include "public/platform/WebScrollbarThemeGeometry.h" |
64 #include "public/platform/WebScrollbarThemePainter.h" | 64 #include "public/platform/WebScrollbarThemePainter.h" |
65 #include "wtf/text/StringBuilder.h" | 65 #include "wtf/text/StringBuilder.h" |
66 | 66 |
67 using blink::WebLayer; | 67 using blink::WebLayer; |
68 using blink::WebLayerPositionConstraint; | 68 using blink::WebLayerPositionConstraint; |
69 using blink::WebRect; | 69 using blink::WebRect; |
70 using blink::WebScrollbarLayer; | 70 using blink::WebScrollbarLayer; |
71 using blink::WebVector; | 71 using blink::WebVector; |
72 | 72 |
73 namespace blink { | |
74 | |
73 namespace { | 75 namespace { |
74 | 76 |
75 WebLayer* toWebLayer(blink::GraphicsLayer* layer) | 77 WebLayer* toWebLayer(blink::GraphicsLayer* layer) |
76 { | 78 { |
77 return layer ? layer->platformLayer() : nullptr; | 79 return layer ? layer->platformLayer() : nullptr; |
78 } | 80 } |
79 | 81 |
82 WebEventListenerProperties webEventListenerProperties(EventHandlerRegistry::Even tHandlerClass blockingClass, EventHandlerRegistry::EventHandlerClass passiveClas s, Page* page) | |
83 { | |
84 WebEventListenerProperties result = WebEventListenerProperties::Nothing; | |
85 if (page->frameHost().eventHandlerRegistry().hasEventHandlers(blockingClass) ) | |
86 result |= WebEventListenerProperties::Blocking; | |
87 if (page->frameHost().eventHandlerRegistry().hasEventHandlers(passiveClass)) | |
88 result |= WebEventListenerProperties::Passive; | |
89 return result; | |
90 } | |
91 | |
80 } // namespace | 92 } // namespace |
81 | 93 |
82 namespace blink { | |
83 | |
84 PassOwnPtrWillBeRawPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) | 94 PassOwnPtrWillBeRawPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) |
85 { | 95 { |
86 return adoptPtrWillBeNoop(new ScrollingCoordinator(page)); | 96 return adoptPtrWillBeNoop(new ScrollingCoordinator(page)); |
87 } | 97 } |
88 | 98 |
89 ScrollingCoordinator::ScrollingCoordinator(Page* page) | 99 ScrollingCoordinator::ScrollingCoordinator(Page* page) |
90 : m_page(page) | 100 : m_page(page) |
91 , m_scrollGestureRegionIsDirty(false) | 101 , m_scrollGestureRegionIsDirty(false) |
92 , m_touchEventTargetRectsAreDirty(false) | 102 , m_touchEventTargetRectsAreDirty(false) |
93 , m_shouldScrollOnMainThreadDirty(false) | 103 , m_shouldScrollOnMainThreadDirty(false) |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent ForSublayers()); | 683 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent ForSublayers()); |
674 | 684 |
675 child->setClipParent(clipParentWebLayer); | 685 child->setClipParent(clipParentWebLayer); |
676 } | 686 } |
677 | 687 |
678 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) | 688 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) |
679 { | 689 { |
680 m_layersWithTouchRects.remove(layer); | 690 m_layersWithTouchRects.remove(layer); |
681 } | 691 } |
682 | 692 |
683 void ScrollingCoordinator::updateHaveWheelEventHandlers() | 693 void ScrollingCoordinator::updateTouchEventListenerProperties() |
684 { | 694 { |
685 ASSERT(isMainThread()); | 695 ASSERT(isMainThread()); |
686 ASSERT(m_page); | 696 ASSERT(m_page); |
697 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) | |
698 return; | |
699 | |
700 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { | |
aelias_OOO_until_Jul13
2016/01/26 19:16:33
Hmm, on the Blink side we only ever set it on the
dtapuska
2016/01/29 21:46:41
Done.
| |
701 scrollLayer->setTouchEventListenerProperties(webEventListenerProperties( EventHandlerRegistry::TouchEvent, EventHandlerRegistry::TouchEventPassive, m_pag e)); | |
702 } | |
703 } | |
704 | |
705 void ScrollingCoordinator::updateWheelEventListenerProperties() | |
706 { | |
707 ASSERT(isMainThread()); | |
708 ASSERT(m_page); | |
687 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) | 709 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) |
688 return; | 710 return; |
689 | 711 |
690 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { | 712 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { |
691 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH andlers(EventHandlerRegistry::WheelEvent); | 713 scrollLayer->setWheelEventListenerProperties(webEventListenerProperties( EventHandlerRegistry::WheelEvent, EventHandlerRegistry::WheelEventPassive, m_pag e)); |
692 scrollLayer->setHaveWheelEventHandlers(haveHandlers); | |
693 } | 714 } |
694 } | 715 } |
695 | 716 |
696 void ScrollingCoordinator::updateHaveScrollEventHandlers() | 717 void ScrollingCoordinator::updateHaveScrollEventHandlers() |
697 { | 718 { |
698 ASSERT(isMainThread()); | 719 ASSERT(isMainThread()); |
699 ASSERT(m_page); | 720 ASSERT(m_page); |
700 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) | 721 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) |
701 return; | 722 return; |
702 | 723 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 | 974 |
954 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) | 975 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
955 { | 976 { |
956 ASSERT(isMainThread()); | 977 ASSERT(isMainThread()); |
957 ASSERT(m_page); | 978 ASSERT(m_page); |
958 | 979 |
959 if (!coordinatesScrollingForFrameView(frameView)) | 980 if (!coordinatesScrollingForFrameView(frameView)) |
960 return; | 981 return; |
961 | 982 |
962 notifyGeometryChanged(); | 983 notifyGeometryChanged(); |
963 updateHaveWheelEventHandlers(); | 984 updateTouchEventListenerProperties(); |
985 updateWheelEventListenerProperties(); | |
964 updateHaveScrollEventHandlers(); | 986 updateHaveScrollEventHandlers(); |
965 } | 987 } |
966 | 988 |
967 #if OS(MACOSX) | 989 #if OS(MACOSX) |
968 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) | 990 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) |
969 { | 991 { |
970 ASSERT(isMainThread()); | 992 ASSERT(isMainThread()); |
971 | 993 |
972 if (!m_page) | 994 if (!m_page) |
973 return; | 995 return; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1082 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1104 bool frameIsScrollable = frameView && frameView->isScrollable(); |
1083 if (frameIsScrollable != m_wasFrameScrollable) | 1105 if (frameIsScrollable != m_wasFrameScrollable) |
1084 return true; | 1106 return true; |
1085 | 1107 |
1086 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) | 1108 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) |
1087 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1109 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
1088 return false; | 1110 return false; |
1089 } | 1111 } |
1090 | 1112 |
1091 } // namespace blink | 1113 } // namespace blink |
OLD | NEW |