Changeset 176753 in webkit
- Timestamp:
- Dec 3, 2014, 1:53:36 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/ChromeClient.h (modified) (1 diff)
-
WebCore/page/EventHandler.cpp (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (modified) (1 diff)
-
WebKit2/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (modified) (1 diff)
-
WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm (modified) (2 diffs)
-
WebKit2/UIProcess/API/mac/WKView.mm (modified) (19 diffs)
-
WebKit2/UIProcess/API/mac/WKViewInternal.h (modified) (1 diff)
-
WebKit2/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
WebKit2/UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit2/UIProcess/mac/WKActionMenuController.mm (modified) (2 diffs)
-
WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/WebPage.h (modified) (3 diffs)
-
WebKit2/WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176751 r176753 1 2014-12-03 Tim Horton <timothy_horton@apple.com> 2 3 Keyboard input should be disabled in the preview popover 4 https://bugs.webkit.org/show_bug.cgi?id=139219 5 <rdar://problem/19052381> 6 7 Reviewed by Anders Carlsson. 8 9 * page/ChromeClient.h: 10 (WebCore::ChromeClient::shouldDispatchFakeMouseMoveEvents): 11 * page/EventHandler.cpp: 12 (WebCore::EventHandler::dispatchFakeMouseMoveEventSoon): 13 Allow ChromeClient to disable the dispatch of "fake" mouseMove events 14 that happens during scrolling. 15 1 16 2014-12-03 Antti Koivisto <antti@apple.com> 2 17 -
trunk/Source/WebCore/page/ChromeClient.h
r176670 r176753 447 447 #endif 448 448 449 virtual bool shouldDispatchFakeMouseMoveEvents() const { return true; } 450 449 451 protected: 450 452 virtual ~ChromeClient() { } -
trunk/Source/WebCore/page/EventHandler.cpp
r176459 r176753 2905 2905 return; 2906 2906 2907 if (Page* page = m_frame.page()) { 2908 if (!page->chrome().client().shouldDispatchFakeMouseMoveEvents()) 2909 return; 2910 } 2911 2907 2912 // If the content has ever taken longer than fakeMouseMoveShortInterval we 2908 2913 // reschedule the timer and use a longer time. This will cause the content -
trunk/Source/WebKit2/ChangeLog
r176739 r176753 1 2014-12-03 Tim Horton <timothy_horton@apple.com> 2 3 Keyboard input should be disabled in the preview popover 4 https://bugs.webkit.org/show_bug.cgi?id=139219 5 <rdar://problem/19052381> 6 7 Reviewed by Anders Carlsson. 8 9 Make sure that keyboard input, Quick Look, etc. are blocked in preview popovers 10 and WKThumbnailViews. Also block the fake mouseMove events that originate in 11 the Web process upon scrolling, because we were missing those despite blocking 12 ordinary mouseMove events. 13 14 * UIProcess/API/Cocoa/WKViewPrivate.h: 15 * UIProcess/API/mac/WKView.mm: 16 Rename _ignoresNonWheelMouseEvents to _ignoresNonWheelEvents, because it will 17 apply not only to mouse events but also key events, Quick Look events, menu 18 preparation events, swipe events, etc. 19 20 Add _ignoresAllEvents, which means the same thing as _ignoresNonWheelEvents 21 with the addition of ignoring scrollWheel events. 22 23 (-[WKView scrollWheel:]): 24 (-[WKView swipeWithEvent:]): 25 (-[WKView mouseMoved:]): 26 (-[WKView mouseDown:]): 27 (-[WKView mouseUp:]): 28 (-[WKView mouseDragged:]): 29 Adjust to the new name. 30 31 (-[WKView performKeyEquivalent:]): 32 (-[WKView keyUp:]): 33 (-[WKView keyDown:]): 34 (-[WKView flagsChanged:]): 35 (-[WKView quickLookWithEvent:]): 36 (-[WKView prepareForMenu:withEvent:]): 37 (-[WKView willOpenMenu:withEvent:]): 38 (-[WKView didCloseMenu:withEvent:]): 39 Block all of these events as well as those we were previously blocking. 40 41 (-[WKView _setIgnoresAllEvents:]): 42 (-[WKView _setIgnoresNonWheelMouseEvents:]): 43 (-[WKView _setIgnoresNonWheelEvents:]): 44 (-[WKView _ignoresNonWheelEvents]): 45 (-[WKView _ignoresAllEvents]): 46 * UIProcess/API/mac/WKViewInternal.h: 47 Adjust to the new names and the addition of ignoresAllEvents. 48 49 * UIProcess/mac/WKActionMenuController.mm: 50 (-[WKPagePreviewViewController loadView]): 51 Adjust to the new name. 52 53 (-[WKActionMenuController prepareForMenu:withEvent:]): 54 Move bailing from prepareForMenu: up to WKView. 55 56 * UIProcess/API/Cocoa/WKWebView.mm: 57 (-[WKWebView _ignoresNonWheelEvents]): 58 (-[WKWebView _setIgnoresNonWheelEvents:]): 59 (-[WKWebView _ignoresNonWheelMouseEvents]): Deleted. 60 (-[WKWebView _setIgnoresNonWheelMouseEvents:]): Deleted. 61 * UIProcess/API/Cocoa/WKWebViewInternal.h: 62 Adjust to the new name (without "mouse" in it). 63 64 * UIProcess/API/Cocoa/_WKThumbnailView.mm: 65 (-[_WKThumbnailView _viewWasUnparented]): 66 (-[_WKThumbnailView _viewWasParented]): 67 Explicitly tell WKView to disable event handling while thumbnailed, 68 instead of having WKView special-case thumbnail views internally. 69 70 * UIProcess/WebPageProxy.cpp: 71 (WebKit::WebPageProxy::setShouldDispatchFakeMouseMoveEvents): 72 * UIProcess/WebPageProxy.h: 73 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 74 (WebKit::WebChromeClient::shouldDispatchFakeMouseMoveEvents): 75 * WebProcess/WebCoreSupport/WebChromeClient.h: 76 * WebProcess/WebPage/WebPage.cpp: 77 (WebKit::WebPage::WebPage): 78 * WebProcess/WebPage/WebPage.h: 79 (WebKit::WebPage::shouldDispatchFakeMouseMoveEvents): 80 (WebKit::WebPage::setShouldDispatchFakeMouseMoveEvents): 81 * WebProcess/WebPage/WebPage.messages.in: 82 Plumb shouldDispatchFakeMouseMoveEvents from the UI process to the Web process 83 and through to WebKit2's ChromeClient implementation. 84 1 85 2014-12-03 Anders Carlsson <andersca@apple.com> 2 86 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
r176684 r176753 82 82 @property (readwrite) BOOL allowsMagnification; 83 83 @property (readwrite) double magnification; 84 @property (readwrite, setter=_setIgnoresNonWheelMouseEvents:) BOOL _ignoresNonWheelMouseEvents; 84 @property (readwrite, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents; 85 @property (readwrite, setter=_setIgnoresAllEvents:) BOOL _ignoresAllEvents; 85 86 @property (readwrite) BOOL allowsBackForwardNavigationGestures; 86 87 @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r176448 r176753 1584 1584 } 1585 1585 1586 - (BOOL)_ignoresNonWheel MouseEvents1587 { 1588 return [_wkView _ignoresNonWheel MouseEvents];1589 } 1590 1591 - (void)_setIgnoresNonWheel MouseEvents:(BOOL)ignoresNonWheelMouseEvents1592 { 1593 [_wkView _setIgnoresNonWheel MouseEvents:ignoresNonWheelMouseEvents];1586 - (BOOL)_ignoresNonWheelEvents 1587 { 1588 return [_wkView _ignoresNonWheelEvents]; 1589 } 1590 1591 - (void)_setIgnoresNonWheelEvents:(BOOL)ignoresNonWheelEvents 1592 { 1593 [_wkView _setIgnoresNonWheelEvents:ignoresNonWheelEvents]; 1594 1594 } 1595 1595 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
r176308 r176753 100 100 @property (nonatomic, readonly) UIEdgeInsets _computedContentInset; 101 101 #else 102 @property (nonatomic, setter=_setIgnoresNonWheel MouseEvents:) BOOL _ignoresNonWheelMouseEvents;102 @property (nonatomic, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents; 103 103 #endif 104 104 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm
r172104 r176753 81 81 { 82 82 [_wkView _setThumbnailView:nil]; 83 [_wkView _setIgnoresAllEvents:NO]; 83 84 84 85 self.layer.contents = nil; … … 98 99 [self _requestSnapshotIfNeeded]; 99 100 [_wkView _setThumbnailView:self]; 101 [_wkView _setIgnoresAllEvents:YES]; 100 102 } 101 103 -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r176684 r176753 248 248 std::unique_ptr<ViewGestureController> _gestureController; 249 249 BOOL _allowsMagnification; 250 BOOL _ignoresNonWheelMouseEvents; 250 BOOL _ignoresNonWheelEvents; 251 BOOL _ignoresAllEvents; 251 252 BOOL _allowsBackForwardNavigationGestures; 252 253 … … 1105 1106 // Events 1106 1107 1107 - (BOOL)_shouldIgnoreMouseEvents1108 {1109 // FIXME: This check is surprisingly specific. Are there any other cases where we need to block mouse events?1110 // Do we actually need to in thumbnail view? And if we do, what about non-mouse events?1111 #if WK_API_ENABLED1112 if (_data->_thumbnailView)1113 return YES;1114 #endif1115 1116 // -scrollWheel: uses -_shouldIgnoreWheelEvents, so for all other event types it is correct to use this.1117 return _data->_ignoresNonWheelMouseEvents;1118 }1119 1120 - (BOOL)_shouldIgnoreWheelEvents1121 {1122 #if WK_API_ENABLED1123 if (_data->_thumbnailView)1124 return YES;1125 #endif1126 1127 return NO;1128 }1129 1130 1108 // Override this so that AppKit will send us arrow keys as key down events so we can 1131 1109 // support them via the key bindings mechanism. … … 1150 1128 - (void)Selector:(NSEvent *)theEvent \ 1151 1129 { \ 1152 if ( self._shouldIgnoreMouseEvents) \1130 if (_data->_ignoresNonWheelEvents) \ 1153 1131 return; \ 1154 1132 if (NSTextInputContext *context = [self inputContext]) { \ … … 1170 1148 - (void)Selector:(NSEvent *)theEvent \ 1171 1149 { \ 1172 if ( self._shouldIgnoreMouseEvents) \1150 if (_data->_ignoresNonWheelEvents) \ 1173 1151 return; \ 1174 1152 if ([[self inputContext] handleEvent:theEvent]) { \ … … 1207 1185 - (void)scrollWheel:(NSEvent *)event 1208 1186 { 1209 if ( [self _shouldIgnoreWheelEvents])1187 if (_data->_ignoresAllEvents) 1210 1188 return; 1211 1189 … … 1225 1203 - (void)swipeWithEvent:(NSEvent *)event 1226 1204 { 1227 if ( self._shouldIgnoreMouseEvents)1205 if (_data->_ignoresNonWheelEvents) 1228 1206 return; 1229 1207 … … 1243 1221 - (void)mouseMoved:(NSEvent *)event 1244 1222 { 1245 if ( self._shouldIgnoreMouseEvents)1223 if (_data->_ignoresNonWheelEvents) 1246 1224 return; 1247 1225 … … 1255 1233 - (void)mouseDown:(NSEvent *)event 1256 1234 { 1257 if ( self._shouldIgnoreMouseEvents)1235 if (_data->_ignoresNonWheelEvents) 1258 1236 return; 1259 1237 … … 1271 1249 - (void)mouseUp:(NSEvent *)event 1272 1250 { 1273 if ( self._shouldIgnoreMouseEvents)1251 if (_data->_ignoresNonWheelEvents) 1274 1252 return; 1275 1253 … … 1280 1258 - (void)mouseDragged:(NSEvent *)event 1281 1259 { 1282 if ( self._shouldIgnoreMouseEvents)1260 if (_data->_ignoresNonWheelEvents) 1283 1261 return; 1284 1262 … … 2183 2161 - (BOOL)performKeyEquivalent:(NSEvent *)event 2184 2162 { 2163 if (_data->_ignoresNonWheelEvents) 2164 return NO; 2165 2185 2166 // There's a chance that responding to this event will run a nested event loop, and 2186 2167 // fetching a new event might release the old one. Retaining and then autoreleasing … … 2220 2201 - (void)keyUp:(NSEvent *)theEvent 2221 2202 { 2203 if (_data->_ignoresNonWheelEvents) 2204 return; 2205 2222 2206 LOG(TextInput, "keyUp:%p %@", theEvent, theEvent); 2223 2207 // We don't interpret the keyUp event, as this breaks key bindings (see <https://bugs.webkit.org/show_bug.cgi?id=130100>). … … 2227 2211 - (void)keyDown:(NSEvent *)theEvent 2228 2212 { 2213 if (_data->_ignoresNonWheelEvents) 2214 return; 2215 2229 2216 LOG(TextInput, "keyDown:%p %@%s", theEvent, theEvent, (theEvent == _data->_keyDownEventBeingResent) ? " (re-sent)" : ""); 2230 2217 … … 2262 2249 - (void)flagsChanged:(NSEvent *)theEvent 2263 2250 { 2251 if (_data->_ignoresNonWheelEvents) 2252 return; 2253 2264 2254 LOG(TextInput, "flagsChanged:%p %@", theEvent, theEvent); 2265 2255 … … 2834 2824 - (void)quickLookWithEvent:(NSEvent *)event 2835 2825 { 2826 if (_data->_ignoresNonWheelEvents) 2827 return; 2828 2836 2829 NSPoint locationInViewCoordinates = [self convertPoint:[event locationInWindow] fromView:nil]; 2837 2830 _data->_page->performDictionaryLookupAtLocation(FloatPoint(locationInViewCoordinates.x, locationInViewCoordinates.y)); … … 3699 3692 - (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event 3700 3693 { 3694 if (_data->_ignoresNonWheelEvents) { 3695 [menu cancelTracking]; 3696 return; 3697 } 3698 3701 3699 [_data->_actionMenuController prepareForMenu:menu withEvent:event]; 3702 3700 } … … 3704 3702 - (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event 3705 3703 { 3704 if (_data->_ignoresNonWheelEvents) { 3705 [menu cancelTracking]; 3706 return; 3707 } 3708 3706 3709 [_data->_actionMenuController willOpenMenu:menu withEvent:event]; 3707 3710 } … … 3709 3712 - (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event 3710 3713 { 3714 if (_data->_ignoresNonWheelEvents) { 3715 [menu cancelTracking]; 3716 return; 3717 } 3718 3711 3719 [_data->_actionMenuController didCloseMenu:menu withEvent:event]; 3712 3720 } … … 4011 4019 } 4012 4020 4021 - (void)_setIgnoresAllEvents:(BOOL)ignoresAllEvents 4022 { 4023 _data->_ignoresAllEvents = ignoresAllEvents; 4024 [self _setIgnoresNonWheelEvents:ignoresAllEvents]; 4025 } 4026 4027 // Forward _setIgnoresNonWheelMouseEvents to _setIgnoresNonWheelEvents to avoid breaking existing clients. 4013 4028 - (void)_setIgnoresNonWheelMouseEvents:(BOOL)ignoresNonWheelMouseEvents 4014 4029 { 4015 _data->_ignoresNonWheelMouseEvents = ignoresNonWheelMouseEvents; 4016 } 4017 4018 - (BOOL)_ignoresNonWheelMouseEvents 4019 { 4020 return _data->_ignoresNonWheelMouseEvents; 4030 [self _setIgnoresNonWheelEvents:ignoresNonWheelMouseEvents]; 4031 } 4032 4033 - (void)_setIgnoresNonWheelEvents:(BOOL)ignoresNonWheelEvents 4034 { 4035 if (_data->_ignoresNonWheelEvents == ignoresNonWheelEvents) 4036 return; 4037 4038 _data->_ignoresNonWheelEvents = ignoresNonWheelEvents; 4039 _data->_page->setShouldDispatchFakeMouseMoveEvents(!ignoresNonWheelEvents); 4040 } 4041 4042 - (BOOL)_ignoresNonWheelEvents 4043 { 4044 return _data->_ignoresNonWheelEvents; 4045 } 4046 4047 - (BOOL)_ignoresAllEvents 4048 { 4049 return _data->_ignoresAllEvents; 4021 4050 } 4022 4051 -
trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
r176462 r176753 111 111 - (BOOL)_suppressVisibilityUpdates; 112 112 113 - (BOOL)_shouldIgnoreMouseEvents;114 115 113 - (void)_didFirstVisuallyNonEmptyLayoutForMainFrame; 116 114 - (void)_didFinishLoadForMainFrame; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r176530 r176753 5343 5343 #endif 5344 5344 5345 void WebPageProxy::setShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents) 5346 { 5347 m_process->send(Messages::WebPage::SetShouldDispatchFakeMouseMoveEvents(shouldDispatchFakeMouseMoveEvents), m_pageID); 5348 } 5349 5345 5350 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r176530 r176753 948 948 void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); 949 949 950 void setShouldDispatchFakeMouseMoveEvents(bool); 951 950 952 private: 951 953 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&); -
trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm
r176707 r176753 148 148 if (!_previewView) { 149 149 RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:defaultFrame]); 150 [webView _setIgnoresNonWheel MouseEvents:YES];150 [webView _setIgnoresNonWheelEvents:YES]; 151 151 if (_url) { 152 152 NSURLRequest *request = [NSURLRequest requestWithURL:_url.get()]; … … 253 253 if (menu != _wkView.actionMenu) 254 254 return; 255 256 if (_wkView._shouldIgnoreMouseEvents) {257 [menu cancelTracking];258 return;259 }260 255 261 256 [self dismissActionMenuPopovers]; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r176670 r176753 1081 1081 return (isTextOnly && WebProcess::shared().hasSelectionServices()) || WebProcess::shared().hasRichContentServices(); 1082 1082 } 1083 1084 #endif 1083 #endif 1084 1085 bool WebChromeClient::shouldDispatchFakeMouseMoveEvents() const 1086 { 1087 return m_page->shouldDispatchFakeMouseMoveEvents(); 1088 } 1085 1089 1086 1090 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r176670 r176753 310 310 #endif 311 311 312 virtual bool shouldDispatchFakeMouseMoveEvents() const override; 313 312 314 String m_cachedToolTip; 313 315 mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r176728 r176753 335 335 #endif 336 336 , m_mainFrameProgressCompleted(false) 337 , m_shouldDispatchFakeMouseMoveEvents(true) 337 338 { 338 339 ASSERT(m_pageID); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r176687 r176753 862 862 863 863 void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; } 864 bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; } 865 864 866 private: 865 867 WebPage(uint64_t pageID, const WebPageCreationParameters&); … … 1082 1084 void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID); 1083 1085 #endif 1086 1087 void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; } 1084 1088 1085 1089 uint64_t m_pageID; … … 1327 1331 1328 1332 bool m_mainFrameProgressCompleted; 1333 bool m_shouldDispatchFakeMouseMoveEvents; 1329 1334 }; 1330 1335 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r176687 r176753 411 411 DataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID pageOverlay) 412 412 #endif 413 414 SetShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents) 413 415 }
Note:
See TracChangeset
for help on using the changeset viewer.