Changeset 18975 in webkit


Ignore:
Timestamp:
Jan 18, 2007 10:49:12 PM (17 years ago)
Author:
aroben
Message:

WebCore:

Reviewed by Beth.

Fix: <rdar://problem/4939672> REGRESSION: With text selected that is
not a link, the "Remove Link" contextual menu item remains active

  • platform/ContextMenuItem.h: Added enabled method.
  • platform/qt/ContextMenuItemQt.cpp: (WebCore::ContextMenuItem::enabled): Implemented.
  • platform/mac/ContextMenuItemMac.mm: (WebCore::ContextMenuItem::enabled): Ditto.
  • platform/mac/ContextMenuMac.mm: (-[WebCoreMenuTarget validateMenuItem:]): Implemented to fulfill the NSMenuValidation protocol.

WebKit:

Reviewed by Beth.

Fix <rdar://problem/4939672> REGRESSION: With text selected that is
not a link, the "Remove Link" contextual menu item remains active

  • WebView/WebHTMLView.mm: (-[WebHTMLView menuForEvent:]): Leave autoenabling of menu items on so that clients can implement validateMenuItem:.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r18974 r18975  
     12007-01-18  Adam Roben  <aroben@apple.com>
     2
     3        Reviewed by Beth.
     4
     5        Fix: <rdar://problem/4939672> REGRESSION: With text selected that is
     6        not a link, the "Remove Link" contextual menu item remains active
     7
     8        * platform/ContextMenuItem.h: Added enabled method.
     9        * platform/qt/ContextMenuItemQt.cpp:
     10        (WebCore::ContextMenuItem::enabled): Implemented.
     11        * platform/mac/ContextMenuItemMac.mm:
     12        (WebCore::ContextMenuItem::enabled): Ditto.
     13        * platform/mac/ContextMenuMac.mm:
     14        (-[WebCoreMenuTarget validateMenuItem:]): Implemented to fulfill the
     15        NSMenuValidation protocol.
     16       
    1172007-01-18  Beth Dakin  <bdakin@apple.com>
    218
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r18966 r18975  
    1099010990                        isa = PBXProject;
    1099110991                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
     10992                        compatibilityVersion = "Xcode 2.4";
    1099210993                        hasScannedForEncodings = 1;
    1099310994                        knownRegions = (
     
    1100411005                        projectDirPath = "";
    1100511006                        projectRoot = "";
     11007                        shouldCheckCompatibility = 1;
    1100611008                        targets = (
    1100711009                                93F198A508245E59001E9ABC /* WebCore */,
  • trunk/WebCore/platform/ContextMenuItem.h

    r18262 r18975  
    145145
    146146        void setChecked(bool = true);
     147       
    147148        void setEnabled(bool = true);
     149        bool enabled() const;
    148150
    149151        // FIXME: Do we need a keyboard accelerator here?
  • trunk/WebCore/platform/mac/ContextMenuItemMac.mm

    r18262 r18975  
    146146}
    147147
     148bool ContextMenuItem::enabled() const
     149{
     150    return [m_platformDescription.get() isEnabled];
    148151}
     152
     153}
  • trunk/WebCore/platform/mac/ContextMenuMac.mm

    r18889 r18975  
    3636- (void)setMenuController:(WebCore::ContextMenuController*)menuController;
    3737- (void)forwardContextMenuAction:(id)sender;
     38- (BOOL)validateMenuItem:(NSMenuItem *)item;
    3839@end
    3940
     
    6364    WebCore::ContextMenuItem item(WebCore::ActionType, static_cast<WebCore::ContextMenuAction>([sender tag]), [sender title]);
    6465    _menuController->contextMenuItemSelected(&item);
     66}
     67
     68- (BOOL)validateMenuItem:(NSMenuItem *)item
     69{
     70    WebCore::ContextMenuItem coreItem(item);
     71    ASSERT(_menuController->contextMenu());
     72    _menuController->contextMenu()->checkOrEnableIfNeeded(coreItem);
     73    return coreItem.enabled();
    6574}
    6675
  • trunk/WebCore/platform/qt/ContextMenuItemQt.cpp

    r18273 r18975  
    9494}
    9595
     96bool ContextMenuItem::enabled() const
     97{
     98    return true;
    9699}
     100
     101}
  • trunk/WebKit/ChangeLog

    r18967 r18975  
     12007-01-18  Adam Roben  <aroben@apple.com>
     2
     3        Reviewed by Beth.
     4
     5        Fix <rdar://problem/4939672> REGRESSION: With text selected that is
     6        not a link, the "Remove Link" contextual menu item remains active
     7
     8        * WebView/WebHTMLView.mm:
     9        (-[WebHTMLView menuForEvent:]): Leave autoenabling of menu items on so
     10        that clients can implement validateMenuItem:.
     11
    1122007-01-18  Brady Eidson  <beidson@apple.com>
    213
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r18764 r18975  
    12671267                        isa = PBXProject;
    12681268                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
     1269                        compatibilityVersion = "Xcode 2.4";
    12691270                        hasScannedForEncodings = 1;
    12701271                        knownRegions = (
     
    12811282                        projectDirPath = "";
    12821283                        projectRoot = "";
     1284                        shouldCheckCompatibility = 1;
    12831285                        targets = (
    12841286                                9398100A0824BF01008DF038 /* WebKit */,
  • trunk/WebKit/WebView/WebHTMLView.mm

    r18928 r18975  
    25692569    if (menuItems && [menuItems count] > 0) {
    25702570        menu = [[[NSMenu alloc] init] autorelease];
    2571         [menu setAutoenablesItems:NO];
    25722571        for (unsigned i = 0; i < [menuItems count]; i++)
    25732572            [menu addItem:[menuItems objectAtIndex:i]];
Note: See TracChangeset for help on using the changeset viewer.