Commit 08a4e0b1 authored by bolsinga@apple.com's avatar bolsinga@apple.com

Add ENABLE(CONTEXT_MENUS)

https://bugs.webkit.org/show_bug.cgi?id=29225

Reviewed by David Kilzer.

JavaScriptCore:

* wtf/Platform.h:

WebCore:

No new tests. (No change in default behavior.)

* DerivedSources.make: Use new WebCore.ContextMenus.exp file if ENABLE_CONTEXT_MENUS.
* WebCore.base.exp: Move ContextMenu only exports to WebCore.ContextMenus.exp.
* WebCore.xcodeproj/project.pbxproj: Add WebCore.ContextMenus.exp.
* dom/Node.cpp: Use ENABLE(CONTEXT_MENUS) where applicable.
(WebCore::Node::defaultEventHandler):
* loader/EmptyClients.h: Ditto.
* page/ContextMenuController.cpp: Wrap entire file in ENABLE(CONTEXT_MENUS).
* page/EventHandler.cpp: Use ENABLE(CONTEXT_MENUS) where applicable.
* page/EventHandler.h: Ditto.
* page/Page.cpp: Ditto.
(WebCore::Page::Page):
* page/Page.h: Ditto.
* page/mac/EventHandlerMac.mm: Ditto.
* page/mac/WebCoreViewFactory.h: Ditto.
* platform/ContextMenu.cpp: Wrap entire file in ENABLE(CONTEXT_MENUS).
* platform/LocalizedStrings.h: Use ENABLE(CONTEXT_MENUS) where applicable.
* platform/mac/ContextMenuItemMac.mm: Wrap entire file in ENABLE(CONTEXT_MENUS).
* platform/mac/ContextMenuMac.mm: Ditto.
* platform/mac/LocalizedStringsMac.mm: Use ENABLE(CONTEXT_MENUS) where applicable.
* svg/graphics/SVGImage.cpp: Ditto.
(WebCore::SVGImage::dataChanged):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d19ba829
2009-09-16 Greg Bolsinga <bolsinga@apple.com>
Add ENABLE(CONTEXT_MENUS)
https://bugs.webkit.org/show_bug.cgi?id=29225
Reviewed by David Kilzer.
* wtf/Platform.h:
2009-09-16 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
Reviewed by Eric Seidel.
......
......@@ -410,6 +410,7 @@
#if PLATFORM(IPHONE)
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 1
#define ENABLE_CONTEXT_MENUS 0
#define ENABLE_DRAG_SUPPORT 0
#define ENABLE_FTPDIR 1
#define ENABLE_MAC_JAVA_BRIDGE 0
......@@ -553,6 +554,10 @@
#define ENABLE_FTPDIR 1
#endif
#if !defined(ENABLE_CONTEXT_MENUS)
#define ENABLE_CONTEXT_MENUS 1
#endif
#if !defined(ENABLE_DRAG_SUPPORT)
#define ENABLE_DRAG_SUPPORT 1
#endif
......
2009-09-16 Greg Bolsinga <bolsinga@apple.com>
Add ENABLE(CONTEXT_MENUS)
https://bugs.webkit.org/show_bug.cgi?id=29225
Reviewed by David Kilzer.
No new tests. (No change in default behavior.)
* DerivedSources.make: Use new WebCore.ContextMenus.exp file if ENABLE_CONTEXT_MENUS.
* WebCore.base.exp: Move ContextMenu only exports to WebCore.ContextMenus.exp.
* WebCore.xcodeproj/project.pbxproj: Add WebCore.ContextMenus.exp.
* dom/Node.cpp: Use ENABLE(CONTEXT_MENUS) where applicable.
(WebCore::Node::defaultEventHandler):
* loader/EmptyClients.h: Ditto.
* page/ContextMenuController.cpp: Wrap entire file in ENABLE(CONTEXT_MENUS).
* page/EventHandler.cpp: Use ENABLE(CONTEXT_MENUS) where applicable.
* page/EventHandler.h: Ditto.
* page/Page.cpp: Ditto.
(WebCore::Page::Page):
* page/Page.h: Ditto.
* page/mac/EventHandlerMac.mm: Ditto.
* page/mac/WebCoreViewFactory.h: Ditto.
* platform/ContextMenu.cpp: Wrap entire file in ENABLE(CONTEXT_MENUS).
* platform/LocalizedStrings.h: Use ENABLE(CONTEXT_MENUS) where applicable.
* platform/mac/ContextMenuItemMac.mm: Wrap entire file in ENABLE(CONTEXT_MENUS).
* platform/mac/ContextMenuMac.mm: Ditto.
* platform/mac/LocalizedStringsMac.mm: Use ENABLE(CONTEXT_MENUS) where applicable.
* svg/graphics/SVGImage.cpp: Ditto.
(WebCore::SVGImage::dataChanged):
2009-09-16 Dave Hyatt <hyatt@apple.com>
Reviewed by Adam Roben.
......@@ -464,6 +464,12 @@ ENABLE_DASHBOARD_SUPPORT = 0
endif
ifeq ($(shell gcc -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_CONTEXT_MENUS | cut -d' ' -f3), 1)
ENABLE_CONTEXT_MENUS = 1
else
ENABLE_CONTEXT_MENUS = 0
endif
ifeq ($(shell gcc -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_DRAG_SUPPORT | cut -d' ' -f3), 1)
ENABLE_DRAG_SUPPORT = 1
else
......@@ -764,6 +770,10 @@ ifeq ($(shell gcc -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.NPAPI.exp
endif
ifeq ($(ENABLE_CONTEXT_MENUS), 1)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.ContextMenus.exp
endif
ifeq ($(ENABLE_DASHBOARD_SUPPORT), 1)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.DashboardSupport.exp
endif
......
__ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
__ZN7WebCore12EventHandler20sendContextMenuEventEP7NSEvent
__ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
__ZN7WebCore21ContextMenuController16clearContextMenuEv
__ZNK7WebCore11ContextMenu19platformDescriptionEv
......@@ -146,7 +146,6 @@ __ZN7WebCore10handCursorEv
__ZN7WebCore10setCookiesEPNS_8DocumentERKNS_4KURLERKNS_6StringE
__ZN7WebCore11CachedFrame23cachedFramePlatformDataEv
__ZN7WebCore11CachedFrame26setCachedFramePlatformDataEPNS_23CachedFramePlatformDataE
__ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
__ZN7WebCore11EditCommand7reapplyEv
__ZN7WebCore11EditCommand7unapplyEv
__ZN7WebCore11FileChooser10chooseFileERKNS_6StringE
......@@ -225,7 +224,6 @@ __ZN7WebCore12EventHandler14scrollOverflowENS_15ScrollDirectionENS_17ScrollGranu
__ZN7WebCore12EventHandler15sendScrollEventEv
__ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb
__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsE
__ZN7WebCore12EventHandler20sendContextMenuEventEP7NSEvent
__ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv
__ZN7WebCore12EventHandler7mouseUpEP7NSEvent
__ZN7WebCore12EventHandler8keyEventEP7NSEvent
......@@ -331,7 +329,6 @@ __ZN7WebCore15BackForwardList8goToItemEPNS_11HistoryItemE
__ZN7WebCore15BackForwardList9goForwardEv
__ZN7WebCore15BackForwardListC1EPNS_4PageE
__ZN7WebCore15BackForwardListD1Ev
__ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
__ZN7WebCore15DatabaseTracker12deleteOriginEPNS_14SecurityOriginE
__ZN7WebCore15DatabaseTracker14deleteDatabaseEPNS_14SecurityOriginERKNS_6StringE
__ZN7WebCore15DatabaseTracker14quotaForOriginEPNS_14SecurityOriginE
......@@ -425,7 +422,6 @@ __ZN7WebCore19TextResourceDecoderD1Ev
__ZN7WebCore19applicationIsSafariEv
__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
__ZN7WebCore20ResourceResponseBaseC2Ev
__ZN7WebCore21ContextMenuController16clearContextMenuEv
__ZN7WebCore21JavaScriptDebugServer23recompileAllJSFunctionsEPNS_5TimerIS0_EE
__ZN7WebCore21JavaScriptDebugServer6sharedEv
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
......@@ -765,7 +761,6 @@ __ZNK7WebCore10ScrollView12documentViewEv
__ZNK7WebCore10ScrollView14scrollbarModesERNS_13ScrollbarModeES2_
__ZNK7WebCore10ScrollView18visibleContentRectEb
__ZNK7WebCore11CachedImage5imageEv
__ZNK7WebCore11ContextMenu19platformDescriptionEv
__ZNK7WebCore11FrameLoader10isCompleteEv
__ZNK7WebCore11FrameLoader14frameHasLoadedEv
__ZNK7WebCore11FrameLoader15containsPluginsEv
......
......@@ -9845,6 +9845,7 @@
FEA4133F105D67AE0007236F /* WebCore.DragSupport.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.DragSupport.exp; sourceTree = "<group>"; };
FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationService.cpp; sourceTree = "<group>"; };
FEAB90110EA51B9C006348C3 /* GeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationService.h; sourceTree = "<group>"; };
FEFD102C105C41470002855E /* WebCore.ContextMenus.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.ContextMenus.exp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -10441,6 +10442,7 @@
isa = PBXGroup;
children = (
F58EF58E02DFDFB7018635CA /* WebCore.base.exp */,
FEFD102C105C41470002855E /* WebCore.ContextMenus.exp */,
4491959D0FBE17D700D9F824 /* WebCore.DashboardSupport.exp */,
FEA4133F105D67AE0007236F /* WebCore.DragSupport.exp */,
4491959C0FBE17D700D9F824 /* WebCore.JNI.exp */,
......@@ -2970,10 +2970,12 @@ void Node::defaultEventHandler(Event* event)
} else if (eventType == eventNames().clickEvent) {
int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail() : 0;
dispatchUIEvent(eventNames().DOMActivateEvent, detail, event);
#if ENABLE(CONTEXT_MENUS)
} else if (eventType == eventNames().contextmenuEvent) {
if (Frame* frame = document()->frame())
if (Page* page = frame->page())
page->contextMenuController()->handleContextMenuEvent(event);
#endif
} else if (eventType == eventNames().textInputEvent) {
if (event->isTextEvent())
if (Frame* frame = document()->frame())
......
......@@ -415,6 +415,7 @@ public:
};
#if ENABLE(CONTEXT_MENUS)
class EmptyContextMenuClient : public ContextMenuClient {
public:
virtual ~EmptyContextMenuClient() { }
......@@ -435,6 +436,7 @@ public:
virtual void searchWithSpotlight() { }
#endif
};
#endif // ENABLE(CONTEXT_MENUS)
#if ENABLE(DRAG_SUPPORT)
class EmptyDragClient : public DragClient {
......
......@@ -26,6 +26,8 @@
#include "config.h"
#include "ContextMenuController.h"
#if ENABLE(CONTEXT_MENUS)
#include "Chrome.h"
#include "ContextMenu.h"
#include "ContextMenuClient.h"
......@@ -335,3 +337,5 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
}
} // namespace WebCore
#endif // ENABLE(CONTEXT_MENUS)
......@@ -1837,6 +1837,7 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
return e.isAccepted();
}
#if ENABLE(CONTEXT_MENUS)
bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
{
Document* doc = m_frame->document();
......@@ -1867,6 +1868,7 @@ bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
return swallowEvent;
}
#endif // ENABLE(CONTEXT_MENUS)
void EventHandler::scheduleHoverStateUpdate()
{
......
......@@ -137,7 +137,9 @@ public:
bool handleMouseReleaseEvent(const PlatformMouseEvent&);
bool handleWheelEvent(PlatformWheelEvent&);
#if ENABLE(CONTEXT_MENUS)
bool sendContextMenuEvent(const PlatformMouseEvent&);
#endif
void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; }
......@@ -176,7 +178,9 @@ public:
bool keyEvent(NSEvent *);
bool wheelEvent(NSEvent *);
#if ENABLE(CONTEXT_MENUS)
bool sendContextMenuEvent(NSEvent *);
#endif
bool eventMayStartDrag(NSEvent *);
void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
......
......@@ -104,7 +104,9 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
, m_dragController(new DragController(this, dragClient))
#endif
, m_focusController(new FocusController(this))
#if ENABLE(CONTEXT_MENUS)
, m_contextMenuController(new ContextMenuController(this, contextMenuClient))
#endif
, m_inspectorController(new InspectorController(this, inspectorClient))
, m_settings(new Settings(this))
, m_progress(new ProgressTracker)
......@@ -128,6 +130,9 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
, m_customHTMLTokenizerChunkSize(-1)
, m_canStartPlugins(true)
{
#if !ENABLE(CONTEXT_MENUS)
UNUSED_PARAM(contextMenuClient);
#endif
#if !ENABLE(DRAG_SUPPORT)
UNUSED_PARAM(dragClient);
#endif
......
......@@ -129,7 +129,9 @@ namespace WebCore {
DragController* dragController() const { return m_dragController.get(); }
#endif
FocusController* focusController() const { return m_focusController.get(); }
#if ENABLE(CONTEXT_MENUS)
ContextMenuController* contextMenuController() const { return m_contextMenuController.get(); }
#endif
InspectorController* inspectorController() const { return m_inspectorController.get(); }
Settings* settings() const { return m_settings.get(); }
ProgressTracker* progress() const { return m_progress.get(); }
......@@ -223,7 +225,9 @@ namespace WebCore {
OwnPtr<DragController> m_dragController;
#endif
OwnPtr<FocusController> m_focusController;
#if ENABLE(CONTEXT_MENUS)
OwnPtr<ContextMenuController> m_contextMenuController;
#endif
OwnPtr<InspectorController> m_inspectorController;
OwnPtr<Settings> m_settings;
OwnPtr<ProgressTracker> m_progress;
......
......@@ -716,6 +716,7 @@ PlatformMouseEvent EventHandler::currentPlatformMouseEvent() const
return PlatformMouseEvent(currentNSEvent(), windowView);
}
#if ENABLE(CONTEXT_MENUS)
bool EventHandler::sendContextMenuEvent(NSEvent *event)
{
Page* page = m_frame->page();
......@@ -723,6 +724,7 @@ bool EventHandler::sendContextMenuEvent(NSEvent *event)
return false;
return sendContextMenuEvent(PlatformMouseEvent(event, page->chrome()->platformWindow()));
}
#endif // ENABLE(CONTEXT_MENUS)
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::eventMayStartDrag(NSEvent *event)
......
......@@ -39,6 +39,7 @@
- (NSString *)fileButtonNoFileSelectedLabel;
- (NSString *)copyImageUnknownFileLabel;
#if ENABLE(CONTEXT_MENUS)
// Context menu item titles
- (NSString *)contextMenuItemTagOpenLinkInNewWindow;
- (NSString *)contextMenuItemTagDownloadLinkToDisk;
......@@ -97,6 +98,7 @@
- (NSString *)contextMenuItemTagCapitalize;
- (NSString *)contextMenuItemTagChangeBack:(NSString *)replacedString;
- (NSString *)contextMenuItemTagInspectElement;
#endif // ENABLE(CONTEXT_MENUS)
- (NSString *)searchMenuNoRecentSearchesText;
- (NSString *)searchMenuRecentSearchesText;
......
......@@ -27,6 +27,8 @@
#include "config.h"
#include "ContextMenu.h"
#if ENABLE(CONTEXT_MENUS)
#include "ContextMenuController.h"
#include "ContextMenuClient.h"
#include "CSSComputedStyleDeclaration.h"
......@@ -781,4 +783,6 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const
item.setEnabled(shouldEnable);
}
}
} // namespace WebCore
#endif // ENABLE(CONTEXT_MENUS)
......@@ -38,6 +38,7 @@ namespace WebCore {
String fileButtonChooseFileLabel();
String fileButtonNoFileSelectedLabel();
String copyImageUnknownFileLabel();
#if ENABLE(CONTEXT_MENUS)
String contextMenuItemTagOpenLinkInNewWindow();
String contextMenuItemTagDownloadLinkToDisk();
String contextMenuItemTagCopyLinkToClipboard();
......@@ -103,6 +104,7 @@ namespace WebCore {
String contextMenuItemTagChangeBack(const String& replacedString);
#endif
String contextMenuItemTagInspectElement();
#endif // ENABLE(CONTEXT_MENUS)
String searchMenuNoRecentSearchesText();
String searchMenuRecentSearchesText();
......
......@@ -26,6 +26,8 @@
#include "config.h"
#include "ContextMenuItem.h"
#if ENABLE(CONTEXT_MENUS)
#include "ContextMenu.h"
namespace WebCore {
......@@ -152,4 +154,6 @@ bool ContextMenuItem::enabled() const
return [m_platformDescription.get() isEnabled];
}
}
} // namespace WebCore
#endif // ENABLE(CONTEXT_MENUS)
......@@ -26,6 +26,8 @@
#include "config.h"
#include "ContextMenu.h"
#if ENABLE(CONTEXT_MENUS)
#include "ContextMenuController.h"
@interface WebCoreMenuTarget : NSObject {
......@@ -151,4 +153,6 @@ NSMutableArray* ContextMenu::releasePlatformDescription()
return m_platformDescription.releaseRef();
}
}
} // namespace WebCore
#endif // ENABLE(CONTEXT_MENUS)
......@@ -89,6 +89,7 @@ String copyImageUnknownFileLabel()
return String();
}
#if ENABLE(CONTEXT_MENUS)
String contextMenuItemTagOpenLinkInNewWindow()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......@@ -544,6 +545,7 @@ String contextMenuItemTagInspectElement()
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
#endif // ENABLE(CONTEXT_MENUS)
String searchMenuNoRecentSearchesText()
{
......
......@@ -228,7 +228,11 @@ bool SVGImage::dataChanged(bool allDataReceived)
if (allDataReceived) {
static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient;
static EditorClient* dummyEditorClient = new EmptyEditorClient;
#if ENABLE(CONTEXT_MENUS)
static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient;
#else
static ContextMenuClient* dummyContextMenuClient = 0;
#endif
#if ENABLE(DRAG_SUPPORT)
static DragClient* dummyDragClient = new EmptyDragClient;
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment