⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181668 in webkit


Ignore:
Timestamp:
Mar 17, 2015, 3:48:07 PM (11 years ago)
Author:
timothy_horton@apple.com
Message:

Cannot invoke action menus anymore
https://bugs.webkit.org/show_bug.cgi?id=142797
<rdar://problem/20032670>

Reviewed by Beth Dakin.

  • UIProcess/API/mac/WKView.mm:

Don't process mouse events that would make an action menu; call super
and let AppKit take care of it. We have to duplicate the macro so that
we can avoid calling super for the internal-only methods.
Also, otherMouseMoved is simply not a thing, so remove it.

  • WebView/WebHTMLView.mm:

(-[WebHTMLView otherMouseDown:]):
Don't override otherMouseDown: if the event would make an action menu.

  • platform/spi/mac/NSMenuSPI.h:

Add additional NSMenu SPI.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181667 r181668  
     12015-03-17  Tim Horton  <timothy_horton@apple.com>
     2
     3        Cannot invoke action menus anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=142797
     5        <rdar://problem/20032670>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * platform/spi/mac/NSMenuSPI.h:
     10        Add additional NSMenu SPI.
     11
    1122015-03-17  Zalan Bujtas  <zalan@apple.com>
    213
  • trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h

    r176692 r181668  
    2828// FIXME: We should just include the appropriate internal headers.
    2929
     30typedef NS_ENUM(NSInteger, NSMenuType) {
     31    NSMenuTypeNone = 0,
     32    NSMenuTypeContextMenu,
     33    NSMenuTypeActionMenu,
     34};
     35
     36@interface NSMenu (Private)
     37+ (NSMenuType)menuTypeForEvent:(NSEvent *)event;
     38@end
     39
    3040@interface NSMenuItem (Private)
    3141+ (QLPreviewMenuItem *)standardQuickLookMenuItem;
  • trunk/Source/WebKit/mac/ChangeLog

    r181618 r181668  
     12015-03-17  Tim Horton  <timothy_horton@apple.com>
     2
     3        Cannot invoke action menus anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=142797
     5        <rdar://problem/20032670>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * WebView/WebHTMLView.mm:
     10        (-[WebHTMLView otherMouseDown:]):
     11        Don't override otherMouseDown: if the event would make an action menu.
     12
    1132015-03-16  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r180281 r181668  
    107107#import <WebCore/MIMETypeRegistry.h>
    108108#import <WebCore/MainFrame.h>
     109#import <WebCore/NSMenuSPI.h>
    109110#import <WebCore/NSURLFileTypeMappingsSPI.h>
    110111#import <WebCore/Page.h>
     
    53885389- (void)otherMouseDown:(NSEvent *)event
    53895390{
    5390     if ([event buttonNumber] == 2)
    5391         [self mouseDown:event];
    5392     else
     5391    if ([event buttonNumber] != 2 || [NSMenu menuTypeForEvent:event] == NSMenuTypeActionMenu) {
    53935392        [super otherMouseDown:event];
     5393        return;
     5394    }
     5395
     5396    [self mouseDown:event];
    53945397}
    53955398
  • trunk/Source/WebKit2/ChangeLog

    r181660 r181668  
     12015-03-17  Tim Horton  <timothy_horton@apple.com>
     2
     3        Cannot invoke action menus anymore
     4        https://bugs.webkit.org/show_bug.cgi?id=142797
     5        <rdar://problem/20032670>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * UIProcess/API/mac/WKView.mm:
     10        Don't process mouse events that would make an action menu; call super
     11        and let AppKit take care of it. We have to duplicate the macro so that
     12        we can avoid calling super for the internal-only methods.
     13        Also, otherMouseMoved is simply not a thing, so remove it.
     14
    1152015-03-17  Beth Dakin  <bdakin@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r181660 r181668  
    9292#import <WebCore/LookupSPI.h>
    9393#import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
     94#import <WebCore/NSMenuSPI.h>
    9495#import <WebCore/NSViewSPI.h>
    9596#import <WebCore/PlatformEventFactoryMac.h>
     
    11771178            return; \
    11781179        } \
     1180        if ([NSMenu menuTypeForEvent:theEvent] == NSMenuTypeActionMenu) { \
     1181            [super Selector:theEvent]; \
     1182            return; \
     1183        } \
     1184        NativeWebMouseEvent webEvent(theEvent, self); \
     1185        _data->_page->handleMouseEvent(webEvent); \
     1186    }
     1187#define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(Selector) \
     1188    - (void)Selector:(NSEvent *)theEvent \
     1189    { \
     1190        if (_data->_ignoresNonWheelEvents) \
     1191            return; \
     1192        if (NSTextInputContext *context = [self inputContext]) { \
     1193            [context handleEvent:theEvent completionHandler:^(BOOL handled) { \
     1194                if (handled) \
     1195                    LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
     1196                else { \
     1197                    NativeWebMouseEvent webEvent(theEvent, self); \
     1198                    _data->_page->handleMouseEvent(webEvent); \
     1199                } \
     1200            }]; \
     1201            return; \
     1202        } \
    11791203        NativeWebMouseEvent webEvent(theEvent, self); \
    11801204        _data->_page->handleMouseEvent(webEvent); \
     
    11901214            return; \
    11911215        } \
     1216        if ([NSMenu menuTypeForEvent:theEvent] == NSMenuTypeActionMenu) { \
     1217            [super Selector:theEvent]; \
     1218            return; \
     1219        } \
    11921220        NativeWebMouseEvent webEvent(theEvent, self); \
    11931221        _data->_page->handleMouseEvent(webEvent); \
    11941222    }
     1223#define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(Selector) \
     1224    - (void)Selector:(NSEvent *)theEvent \
     1225    { \
     1226        if (_data->_ignoresNonWheelEvents) \
     1227            return; \
     1228        if ([[self inputContext] handleEvent:theEvent]) { \
     1229            LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
     1230            return; \
     1231        } \
     1232        NativeWebMouseEvent webEvent(theEvent, self); \
     1233        _data->_page->handleMouseEvent(webEvent); \
     1234    }
    11951235#endif
    11961236
    11971237NATIVE_MOUSE_EVENT_HANDLER(mouseEntered)
    11981238NATIVE_MOUSE_EVENT_HANDLER(mouseExited)
    1199 NATIVE_MOUSE_EVENT_HANDLER(mouseMovedInternal)
    1200 NATIVE_MOUSE_EVENT_HANDLER(mouseDownInternal)
    1201 NATIVE_MOUSE_EVENT_HANDLER(mouseUpInternal)
    1202 NATIVE_MOUSE_EVENT_HANDLER(mouseDraggedInternal)
    12031239NATIVE_MOUSE_EVENT_HANDLER(otherMouseDown)
    12041240NATIVE_MOUSE_EVENT_HANDLER(otherMouseDragged)
    1205 NATIVE_MOUSE_EVENT_HANDLER(otherMouseMoved)
    12061241NATIVE_MOUSE_EVENT_HANDLER(otherMouseUp)
    12071242NATIVE_MOUSE_EVENT_HANDLER(rightMouseDown)
    12081243NATIVE_MOUSE_EVENT_HANDLER(rightMouseDragged)
    12091244NATIVE_MOUSE_EVENT_HANDLER(rightMouseUp)
     1245
     1246NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(mouseMovedInternal)
     1247NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(mouseDownInternal)
     1248NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(mouseUpInternal)
     1249NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(mouseDraggedInternal)
    12101250
    12111251#undef NATIVE_MOUSE_EVENT_HANDLER
Note: See TracChangeset for help on using the changeset viewer.