Changeset 19469 in webkit
- Timestamp:
- Feb 7, 2007, 11:48:13 AM (18 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r19458 r19469 1 2007-02-07 John Sullivan <sullivan@apple.com> 2 3 Reviewed by Darin 4 5 - added some clarity to some menu-handling shenanigans 6 7 * WebCoreSupport/WebContextMenuClient.mm: 8 (fixMenusToSendToOldClients): 9 renamed from fixMenusForOldClients; added comments, FIXME, and assertion 10 (fixMenusReceivedFromOldClients): 11 renamed from fixMenusFromOldClients; added comments, FIXME, and assertion 12 (WebContextMenuClient::getCustomMenuFromDefaultItems): 13 updated for name changes 14 1 15 2007-02-06 Kevin Decker <kdecker@apple.com> 2 16 -
trunk/WebKit/WebCoreSupport/WebContextMenuClient.mm
r19409 r19469 59 59 } 60 60 61 static NSMutableArray *fixMenus ForOldClients(NSMutableArray *defaultMenuItems)62 { 63 // Here we change all SPI tags listed in WebUIDelegatePrivate.h to WebMenuItemTagOther61 static NSMutableArray *fixMenusToSendToOldClients(NSMutableArray *defaultMenuItems) 62 { 63 // Here we change all editing-related SPI tags listed in WebUIDelegatePrivate.h to WebMenuItemTagOther 64 64 // to match our old WebKit context menu behavior. 65 66 // FIXME 4950029: This is a temporary solution to make Mail's context menus continue working until 67 // they've updated their code to expect the new tags. We'll have to coordinate a WebKit update with 68 // that Mail update to start sending the new tags again. At that point, this code should be changed 69 // to run only for clients that were linked against old versions of WebKit. 65 70 66 71 unsigned defaultItemsCount = [defaultMenuItems count]; … … 69 74 if ([item tag] >= WEBMENUITEMTAG_SPI_START) 70 75 [item setTag:WebMenuItemTagOther]; 76 else { 77 // All items should have useful tags coming into this method. 78 ASSERT([item tag] != WebMenuItemTagOther); 79 } 71 80 } 72 81 … … 74 83 } 75 84 76 static NSMutableArray *fixMenus FromOldClients(NSMutableArray *newMenuItems, NSMutableArray *defaultMenuItems)85 static NSMutableArray *fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutableArray *defaultMenuItems) 77 86 { 78 87 // The WebMenuItemTag enum has changed since Tiger, so clients built against Tiger WebKit might reference incorrect values for tags. … … 108 117 } 109 118 119 // Restore the new-style tags to the editing-related menu items. This is the 2nd part of the 120 // workaround whose first part is in fixMenusToSendToOldClients. 121 122 // FIXME 4950029: This is a temporary solution to make Mail's context menus continue working until 123 // they've updated their code to expect the new tags. We'll have to coordinate a WebKit update with 124 // that Mail update to start sending the new tags again. At that point, this code should be changed 125 // to run only for clients that were linked against old versions of WebKit. 110 126 unsigned defaultItemsCount = [defaultMenuItems count]; 111 127 for (unsigned i = 0; i < defaultItemsCount; ++i) { 112 128 NSMenuItem *item = [defaultMenuItems objectAtIndex:i]; 129 // Items with a useful tag can be left alone. Items with WebMenuItemTagOther should be only the 130 // ones whose tags we changed in fixMenusToSendToOldClients. 113 131 if ([item tag] != WebMenuItemTagOther) 114 132 continue; … … 160 178 else if (title == [[WebViewFactory sharedFactory] contextMenuItemTagRightToLeft]) 161 179 [item setTag:WebMenuItemTagRightToLeft]; 180 else { 181 // We don't expect WebMenuItemTagOther for any items other than the ones we explicitly handle 182 ASSERT_NOT_REACHED(); 183 } 162 184 } 163 185 … … 172 194 173 195 NSDictionary *element = [[[WebElementDictionary alloc] initWithHitTestResult:defaultMenu->hitTestResult()] autorelease]; 174 NSMutableArray *defaultMenuItems = fixMenus ForOldClients(defaultMenu->platformDescription());196 NSMutableArray *defaultMenuItems = fixMenusToSendToOldClients(defaultMenu->platformDescription()); 175 197 NSMutableArray *newMenuItems = [[delegate webView:m_webView contextMenuItemsForElement:element defaultMenuItems:defaultMenuItems] mutableCopy]; 176 198 177 return fixMenus FromOldClients(newMenuItems, defaultMenuItems);199 return fixMenusReceivedFromOldClients(newMenuItems, defaultMenuItems); 178 200 } 179 201
Note:
See TracChangeset
for help on using the changeset viewer.