Changeset 175630 in webkit


Ignore:
Timestamp:
Nov 5, 2014 12:09:26 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Disable interaction with action menu page previews
https://bugs.webkit.org/show_bug.cgi?id=138400

Patch by Conrad Shultz <Conrad Shultz> on 2014-11-05
Reviewed by Tim Horton.

Expand on the existing -[WKView shouldIgnoreMouseEvents] by adding facilities to suppress handling
of all non-wheel events, effectively creating a scroll-only web view. Deploy this in
WKPagePreviewViewController.

  • UIProcess/API/Cocoa/WKViewPrivate.h:

Declare the OS X-only ignoresNonWheelMouseEvents SPI.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _ignoresNonWheelMouseEvents]):
(-[WKWebView _setIgnoresNonWheelMouseEvents:]):
Wrap the underlying WKView methods.

  • UIProcess/API/Cocoa/WKWebViewInternal.h:

Declare the OS X-only ignoresNonWheelMouseEvents property.

  • UIProcess/API/mac/WKView.mm:

Add _ignoresNonWheelMouseEvents to WKViewData.
(-[WKView shouldIgnoreMouseEvents]):
Include a check for _ignoresNonWheelMouseEvents.
(-[WKView _setIgnoresNonWheelMouseEvents:]):
Set the ivar in WKViewData.
(-[WKView _ignoresNonWheelMouseEvents]):
Fetch the ivar in WKViewData.
(-[WKView _shouldIgnoreWheelEvents]):
Implement the old -shouldIgnoreMouseEvents behavior.
(-[WKView scrollWheel:]):
-shouldIgnoreMouseEvents -> -_shouldIgnoreWheelEvents.

  • UIProcess/mac/WKActionMenuController.mm:

(-[WKPagePreviewViewController loadView]):
Configure the WKWebView to ignore non-wheel mouse events; use RetainPtr for the WKWebView.

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r175626 r175630  
     12014-11-05  Conrad Shultz  <conrad_shultz@apple.com>
     2
     3        Disable interaction with action menu page previews
     4        https://bugs.webkit.org/show_bug.cgi?id=138400
     5
     6        Reviewed by Tim Horton.
     7
     8        Expand on the existing -[WKView shouldIgnoreMouseEvents] by adding facilities to suppress handling
     9        of all non-wheel events, effectively creating a scroll-only web view. Deploy this in
     10        WKPagePreviewViewController.
     11
     12        * UIProcess/API/Cocoa/WKViewPrivate.h:
     13        Declare the OS X-only ignoresNonWheelMouseEvents SPI.
     14
     15        * UIProcess/API/Cocoa/WKWebView.mm:
     16        (-[WKWebView _ignoresNonWheelMouseEvents]):
     17        (-[WKWebView _setIgnoresNonWheelMouseEvents:]):
     18        Wrap the underlying WKView methods.
     19
     20        * UIProcess/API/Cocoa/WKWebViewInternal.h:
     21        Declare the OS X-only ignoresNonWheelMouseEvents property.
     22
     23        * UIProcess/API/mac/WKView.mm:
     24        Add _ignoresNonWheelMouseEvents to WKViewData.
     25        (-[WKView shouldIgnoreMouseEvents]):
     26        Include a check for _ignoresNonWheelMouseEvents.
     27        (-[WKView _setIgnoresNonWheelMouseEvents:]):
     28        Set the ivar in WKViewData.
     29        (-[WKView _ignoresNonWheelMouseEvents]):
     30        Fetch the ivar in WKViewData.
     31        (-[WKView _shouldIgnoreWheelEvents]):
     32        Implement the old -shouldIgnoreMouseEvents behavior.
     33        (-[WKView scrollWheel:]):
     34        -shouldIgnoreMouseEvents -> -_shouldIgnoreWheelEvents.
     35
     36        * UIProcess/mac/WKActionMenuController.mm:
     37        (-[WKPagePreviewViewController loadView]):
     38        Configure the WKWebView to ignore non-wheel mouse events; use RetainPtr for the WKWebView.
     39
    1402014-11-03  Dean Jackson  <dino@apple.com>
    241
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h

    r175444 r175630  
    8282@property (readwrite) BOOL allowsMagnification;
    8383@property (readwrite) double magnification;
     84@property (readwrite, setter=_setIgnoresNonWheelMouseEvents:) BOOL _ignoresNonWheelMouseEvents;
    8485@property (readwrite) BOOL allowsBackForwardNavigationGestures;
    8586@property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r175081 r175630  
    24712471}
    24722472
     2473- (BOOL)_ignoresNonWheelMouseEvents
     2474{
     2475    return [_wkView _ignoresNonWheelMouseEvents];
     2476}
     2477
     2478- (void)_setIgnoresNonWheelMouseEvents:(BOOL)ignoresNonWheelMouseEvents
     2479{
     2480    [_wkView _setIgnoresNonWheelMouseEvents:ignoresNonWheelMouseEvents];
     2481}
     2482
    24732483- (CGFloat)_topContentInset
    24742484{
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h

    r174232 r175630  
    100100
    101101@property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
     102#else
     103@property (nonatomic, setter=_setIgnoresNonWheelMouseEvents:) BOOL _ignoresNonWheelMouseEvents;
    102104#endif
     105
    103106@end
    104107
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r175610 r175630  
    243243    std::unique_ptr<ViewGestureController> _gestureController;
    244244    BOOL _allowsMagnification;
     245    BOOL _ignoresNonWheelMouseEvents;
    245246    BOOL _allowsBackForwardNavigationGestures;
    246247
     
    10961097// Events
    10971098
    1098 -(BOOL)shouldIgnoreMouseEvents
     1099- (BOOL)shouldIgnoreMouseEvents
    10991100{
    11001101    // FIXME: This check is surprisingly specific. Are there any other cases where we need to block mouse events?
     
    11041105        return YES;
    11051106#endif
     1107
     1108    // -scrollWheel: uses -_shouldIgnoreWheelEvents, so for all other event types it is correct to use this.
     1109    return _data->_ignoresNonWheelMouseEvents;
     1110}
     1111
     1112- (void)_setIgnoresNonWheelMouseEvents:(BOOL)ignoresNonWheelMouseEvents
     1113{
     1114    _data->_ignoresNonWheelMouseEvents = ignoresNonWheelMouseEvents;
     1115}
     1116
     1117- (BOOL)_ignoresNonWheelMouseEvents
     1118{
     1119    return _data->_ignoresNonWheelMouseEvents;
     1120}
     1121
     1122- (BOOL)_shouldIgnoreWheelEvents
     1123{
     1124#if WK_API_ENABLED
     1125    if (_data->_thumbnailView)
     1126        return YES;
     1127#endif
     1128
    11061129    return NO;
    11071130}
     
    11861209- (void)scrollWheel:(NSEvent *)event
    11871210{
    1188     if ([self shouldIgnoreMouseEvents])
     1211    if ([self _shouldIgnoreWheelEvents])
    11891212        return;
    11901213
  • trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

    r175609 r175630  
    3333#import "WKViewInternal.h"
    3434#import "WKWebView.h"
     35#import "WKWebViewInternal.h"
    3536#import "WebContext.h"
    3637#import "WebKitSystemInterface.h"
     
    99100- (void)loadView
    100101{
    101     WKWebView *webView = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, _preferredSize.width, _preferredSize.height)];
     102    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, _preferredSize.width, _preferredSize.height)]);
     103    [webView _setIgnoresNonWheelMouseEvents:YES];
    102104    if (_url) {
    103105        NSURLRequest *request = [NSURLRequest requestWithURL:_url.get()];
    104106        [webView loadRequest:request];
    105107    }
    106     [self setView:webView];
     108    self.view = webView.get();
    107109}
    108110
Note: See TracChangeset for help on using the changeset viewer.