Changeset 19810 in webkit


Ignore:
Timestamp:
Feb 22, 2007 3:49:13 PM (17 years ago)
Author:
bdakin
Message:

WebCore:

Reviewed by Adam. Manual test added.

Fix for http://bugs.webkit.org/show_bug.cgi?id=12399 REGRESSION:
Unable to prevent default context menu from appearing. <rdar://
problem/5017416>

This problem appeared because of two facets of the current context
menu design. First, all context menu events are now considered to
be "swallowed" since we take care of building up the regular
context menu through the defaultEventHandler(). Second, the context
menu controller holds onto it's context menu until a new one is
created. There would be logistical problems changing this since
AppKit relies on the menu being around for as long as it is
visible on the screen and we don't get any notification once the
menu is popped-down.

This patch fixes the problem by giving WebKit a way to clear the
controller's context menu. WebKit now clears the menu before it
propagates a new context menu event through the DOM.

  • WebCore.exp:
  • manual-tests/DOMContextMenuEvent.html: Added.
  • page/ContextMenuController.cpp: (WebCore::ContextMenuController::clearContextMenu):
  • page/ContextMenuController.h:

WebKit:

Reviewed by Adam.

Fix for http://bugs.webkit.org/show_bug.cgi?id=12399 REGRESSION:
Unable to prevent default context menu from appearing. <rdar://
problem/5017416>

  • WebView/WebHTMLView.mm: (-[WebHTMLView menuForEvent:]): Clear the controller's context menu before propagating a new context menu event through the DOM.
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r19809 r19810  
     12007-02-22  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Adam. Manual test added.
     4
     5        Fix for http://bugs.webkit.org/show_bug.cgi?id=12399 REGRESSION:
     6        Unable to prevent default context menu from appearing. <rdar://
     7        problem/5017416>
     8
     9        This problem appeared because of two facets of the current context
     10        menu design. First, all context menu events are now considered to
     11        be "swallowed" since we take care of building up the regular
     12        context menu through the defaultEventHandler(). Second, the context
     13        menu controller holds onto it's context menu until a new one is
     14        created. There would be logistical problems changing this since
     15        AppKit relies on the menu being around for as long as it is
     16        visible on the screen and we don't get any notification once the
     17        menu is popped-down.
     18
     19        This patch fixes the problem by giving WebKit a way to clear the
     20        controller's context menu. WebKit now clears the menu before it
     21        propagates a new context menu event through the DOM.
     22
     23        * WebCore.exp:
     24        * manual-tests/DOMContextMenuEvent.html: Added.
     25        * page/ContextMenuController.cpp:
     26        (WebCore::ContextMenuController::clearContextMenu):
     27        * page/ContextMenuController.h:
     28
    1292007-02-22  John Sullivan  <sullivan@apple.com>
    230
  • trunk/WebCore/WebCore.exp

    r19764 r19810  
    306306__ZN7WebCore19TextResourceDecoderC1ERKNS_6StringERKNS_12TextEncodingE
    307307__ZN7WebCore19TextResourceDecoderD1Ev
     308__ZN7WebCore21ContextMenuController16clearContextMenuEv
    308309__ZN7WebCore21PlatformKeyboardEventC1EP7NSEventb
    309310__ZN7WebCore21findEventWithKeyStateEPNS_5EventE
  • trunk/WebCore/page/ContextMenuController.cpp

    r19764 r19810  
    7070}
    7171
     72void ContextMenuController::clearContextMenu()
     73{
     74    m_contextMenu.set(0);
     75}
     76
    7277void ContextMenuController::handleContextMenuEvent(Event* event)
    7378{
  • trunk/WebCore/page/ContextMenuController.h

    r17910 r19810  
    4949
    5050        ContextMenu* contextMenu() const { return m_contextMenu.get(); }
     51        void clearContextMenu();
    5152
    5253        void handleContextMenuEvent(Event*);
  • trunk/WebKit/ChangeLog

    r19794 r19810  
     12007-02-22  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Adam.
     4
     5        Fix for http://bugs.webkit.org/show_bug.cgi?id=12399 REGRESSION:
     6        Unable to prevent default context menu from appearing. <rdar://
     7        problem/5017416>
     8
     9        * WebView/WebHTMLView.mm:
     10        (-[WebHTMLView menuForEvent:]): Clear the controller's context menu
     11        before propagating a new context menu event through the DOM.
     12
    1132007-02-22  John Sullivan  <sullivan@apple.com>
    214
  • trunk/WebKit/WebView/WebHTMLView.mm

    r19790 r19810  
    26282628    }
    26292629
     2630    Page* page = coreFrame->page();
     2631    if (!page)
     2632        return nil;
     2633
     2634    page->contextMenuController()->clearContextMenu();
    26302635    handledEvent = coreFrame->eventHandler()->sendContextMenuEvent(PlatformMouseEvent(event));
    26312636    _private->handlingMouseDownEvent = NO;
    26322637
    26332638    if (!handledEvent)
    2634         return nil;
    2635 
    2636     Page* page = coreFrame->page();
    2637     if (!page)
    26382639        return nil;
    26392640
Note: See TracChangeset for help on using the changeset viewer.