summaryrefslogtreecommitdiffstats
path: root/WebKit/wx/WebKitSupport
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebKit/wx/WebKitSupport
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebKit/wx/WebKitSupport')
-rw-r--r--WebKit/wx/WebKitSupport/ChromeClientWx.cpp65
-rw-r--r--WebKit/wx/WebKitSupport/ChromeClientWx.h15
-rw-r--r--WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp6
-rw-r--r--WebKit/wx/WebKitSupport/ContextMenuClientWx.h1
-rw-r--r--WebKit/wx/WebKitSupport/EditorClientWx.cpp208
-rw-r--r--WebKit/wx/WebKitSupport/EditorClientWx.h4
-rw-r--r--WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp93
-rw-r--r--WebKit/wx/WebKitSupport/FrameLoaderClientWx.h7
-rw-r--r--WebKit/wx/WebKitSupport/InspectorClientWx.cpp5
-rw-r--r--WebKit/wx/WebKitSupport/InspectorClientWx.h2
10 files changed, 300 insertions, 106 deletions
diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
index 411f795..b25fce9 100644
--- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "ChromeClientWx.h"
+#include "Console.h"
#include "FileChooser.h"
#include "FloatRect.h"
#include "FrameLoadRequest.h"
@@ -199,7 +200,10 @@ void ChromeClientWx::setResizable(bool)
notImplemented();
}
-void ChromeClientWx::addMessageToConsole(const String& message,
+void ChromeClientWx::addMessageToConsole(MessageSource source,
+ MessageType type,
+ MessageLevel level,
+ const String& message,
unsigned int lineNumber,
const String& sourceID)
{
@@ -239,25 +243,50 @@ void ChromeClientWx::closeWindowSoon()
void ChromeClientWx::runJavaScriptAlert(Frame* frame, const String& string)
{
- wxMessageBox(string, wxT("JavaScript Alert"), wxOK);
+ if (m_webView) {
+ wxWebViewAlertEvent wkEvent(m_webView);
+ wkEvent.SetMessage(string);
+ if (!m_webView->GetEventHandler()->ProcessEvent(wkEvent))
+ wxMessageBox(string, wxT("JavaScript Alert"), wxOK);
+ }
}
bool ChromeClientWx::runJavaScriptConfirm(Frame* frame, const String& string)
{
- wxMessageDialog dialog(NULL, string, wxT("JavaScript Confirm"), wxYES_NO);
- dialog.Centre();
- return (dialog.ShowModal() == wxID_YES);
+ bool result = false;
+ if (m_webView) {
+ wxWebViewConfirmEvent wkEvent(m_webView);
+ wkEvent.SetMessage(string);
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent))
+ result = wkEvent.GetReturnCode() == wxID_YES;
+ else {
+ wxMessageDialog dialog(NULL, string, wxT("JavaScript Confirm"), wxYES_NO);
+ dialog.Centre();
+ result = (dialog.ShowModal() == wxID_YES);
+ }
+ }
+ return result;
}
bool ChromeClientWx::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
{
- wxTextEntryDialog dialog(NULL, message, wxT("JavaScript Prompt"), wxEmptyString, wxOK | wxCANCEL);
- dialog.Centre();
- if (dialog.ShowModal() == wxID_OK) {
- result = dialog.GetValue();
- return true;
+ if (m_webView) {
+ wxWebViewPromptEvent wkEvent(m_webView);
+ wkEvent.SetMessage(message);
+ wkEvent.SetResponse(defaultValue);
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) {
+ result = wkEvent.GetResponse();
+ return true;
+ }
+ else {
+ wxTextEntryDialog dialog(NULL, message, wxT("JavaScript Prompt"), wxEmptyString, wxOK | wxCANCEL);
+ dialog.Centre();
+ if (dialog.ShowModal() == wxID_OK) {
+ result = dialog.GetValue();
+ return true;
+ }
+ }
}
-
return false;
}
@@ -336,7 +365,7 @@ void ChromeClientWx::mouseDidMoveOverElement(const HitTestResult&, unsigned modi
notImplemented();
}
-void ChromeClientWx::setToolTip(const String& tip)
+void ChromeClientWx::setToolTip(const String& tip, TextDirection)
{
wxToolTip* tooltip = m_webView->GetToolTip();
if (!tooltip || tooltip->GetTip() != wxString(tip))
@@ -372,4 +401,16 @@ void ChromeClientWx::runOpenPanel(Frame*, PassRefPtr<FileChooser>)
notImplemented();
}
+bool ChromeClientWx::setCursor(PlatformCursorHandle)
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
+{
+ // See the comment in WebCore/page/ChromeClient.h
+ notImplemented();
+}
+
}
diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h
index d7f4152..85335c8 100644
--- a/WebKit/wx/WebKitSupport/ChromeClientWx.h
+++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h
@@ -75,7 +75,10 @@ public:
virtual void setResizable(bool);
- virtual void addMessageToConsole(const String& message,
+ virtual void addMessageToConsole(MessageSource source,
+ MessageType type,
+ MessageLevel level,
+ const String& message,
unsigned int lineNumber,
const String& sourceID);
@@ -106,7 +109,7 @@ public:
virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
- virtual void setToolTip(const String&);
+ virtual void setToolTip(const String&, TextDirection);
virtual void print(Frame*);
@@ -122,6 +125,14 @@ public:
virtual void formStateDidChange(const Node*) { }
+ virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
+
+ virtual bool setCursor(PlatformCursorHandle);
+
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {}
+
+ virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+
private:
wxWebView* m_webView;
};
diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp
index e3d8e5a..4b73b61 100644
--- a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp
@@ -83,4 +83,10 @@ void ContextMenuClientWx::stopSpeaking()
notImplemented();
}
+bool ContextMenuClientWx::isSpeaking()
+{
+ notImplemented();
+ return false;
+}
+
}
diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.h b/WebKit/wx/WebKitSupport/ContextMenuClientWx.h
index 2655974..0030c1d 100644
--- a/WebKit/wx/WebKitSupport/ContextMenuClientWx.h
+++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.h
@@ -48,6 +48,7 @@ public:
virtual void lookUpInDictionary(Frame*);
virtual void speak(const String&);
virtual void stopSpeaking();
+ virtual bool isSpeaking();
};
}
diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp
index 6c443ed..3808bfe 100644
--- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp
@@ -49,6 +49,81 @@
namespace WebCore {
+static const unsigned CtrlKey = 1 << 0;
+static const unsigned AltKey = 1 << 1;
+static const unsigned ShiftKey = 1 << 2;
+
+struct KeyDownEntry {
+ unsigned virtualKey;
+ unsigned modifiers;
+ const char* name;
+};
+
+struct KeyPressEntry {
+ unsigned charCode;
+ unsigned modifiers;
+ const char* name;
+};
+
+static const KeyDownEntry keyDownEntries[] = {
+ { VK_LEFT, 0, "MoveLeft" },
+ { VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" },
+ { VK_LEFT, CtrlKey, "MoveWordLeft" },
+ { VK_LEFT, CtrlKey | ShiftKey, "MoveWordLeftAndModifySelection" },
+ { VK_RIGHT, 0, "MoveRight" },
+ { VK_RIGHT, ShiftKey, "MoveRightAndModifySelection" },
+ { VK_RIGHT, CtrlKey, "MoveWordRight" },
+ { VK_RIGHT, CtrlKey | ShiftKey, "MoveWordRightAndModifySelection" },
+ { VK_UP, 0, "MoveUp" },
+ { VK_UP, ShiftKey, "MoveUpAndModifySelection" },
+ { VK_PRIOR, ShiftKey, "MovePageUpAndModifySelection" },
+ { VK_DOWN, 0, "MoveDown" },
+ { VK_DOWN, ShiftKey, "MoveDownAndModifySelection" },
+ { VK_NEXT, ShiftKey, "MovePageDownAndModifySelection" },
+ { VK_PRIOR, 0, "MovePageUp" },
+ { VK_NEXT, 0, "MovePageDown" },
+ { VK_HOME, 0, "MoveToBeginningOfLine" },
+ { VK_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" },
+ { VK_HOME, CtrlKey, "MoveToBeginningOfDocument" },
+ { VK_HOME, CtrlKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" },
+
+ { VK_END, 0, "MoveToEndOfLine" },
+ { VK_END, ShiftKey, "MoveToEndOfLineAndModifySelection" },
+ { VK_END, CtrlKey, "MoveToEndOfDocument" },
+ { VK_END, CtrlKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" },
+
+ { VK_BACK, 0, "DeleteBackward" },
+ { VK_BACK, ShiftKey, "DeleteBackward" },
+ { VK_DELETE, 0, "DeleteForward" },
+ { VK_BACK, CtrlKey, "DeleteWordBackward" },
+ { VK_DELETE, CtrlKey, "DeleteWordForward" },
+
+ { 'B', CtrlKey, "ToggleBold" },
+ { 'I', CtrlKey, "ToggleItalic" },
+
+ { VK_ESCAPE, 0, "Cancel" },
+ //FIXME: this'll never happen. We can trash it or make it a normal period
+ { VK_OEM_PERIOD, CtrlKey, "Cancel" },
+ { VK_TAB, 0, "InsertTab" },
+ { VK_TAB, ShiftKey, "InsertBacktab" },
+ { VK_RETURN, 0, "InsertNewline" },
+ { VK_RETURN, CtrlKey, "InsertNewline" },
+ { VK_RETURN, AltKey, "InsertNewline" },
+ { VK_RETURN, AltKey | ShiftKey, "InsertNewline" },
+ { 'A', CtrlKey, "SelectAll" },
+ { 'Z', CtrlKey, "Undo" },
+ { 'Z', CtrlKey | ShiftKey, "Redo" },
+};
+
+static const KeyPressEntry keyPressEntries[] = {
+ { '\t', 0, "InsertTab" },
+ { '\t', ShiftKey, "InsertBacktab" },
+ { '\r', 0, "InsertNewline" },
+ { '\r', CtrlKey, "InsertNewline" },
+ { '\r', AltKey, "InsertNewline" },
+ { '\r', AltKey | ShiftKey, "InsertNewline" },
+};
+
EditorClientWx::~EditorClientWx()
{
m_page = NULL;
@@ -61,7 +136,7 @@ void EditorClientWx::setPage(Page* page)
void EditorClientWx::pageDestroyed()
{
- notImplemented();
+ delete this;
}
bool EditorClientWx::shouldDeleteRange(Range*)
@@ -286,6 +361,74 @@ void EditorClientWx::redo()
}
}
+bool EditorClientWx::handleEditingKeyboardEvent(KeyboardEvent* event)
+{
+ Node* node = event->target()->toNode();
+ ASSERT(node);
+ Frame* frame = node->document()->frame();
+ ASSERT(frame);
+
+ const PlatformKeyboardEvent* keyEvent = event->keyEvent();
+
+ //NB: this is what windows does, but they also have a keypress event for Alt+Enter which clearly won't get hit with this
+ if (!keyEvent || keyEvent->altKey()) // do not treat this as text input if Alt is down
+ return false;
+
+ Editor::Command command = frame->editor()->command(interpretKeyEvent(event));
+
+ if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
+ // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or if not to let a CHAR event be generated
+ // (e.g. Tab that inserts a Tab character, or Enter).
+ return !command.isTextInsertion() && command.execute(event);
+ }
+
+ if (command.execute(event))
+ return true;
+
+ // Don't insert null or control characters as they can result in unexpected behaviour
+ if (event->charCode() < ' ')
+ return false;
+
+ return frame->editor()->insertText(event->keyEvent()->text(), event);
+}
+
+const char* EditorClientWx::interpretKeyEvent(const KeyboardEvent* evt)
+{
+ ASSERT(evt->keyEvent()->type() == PlatformKeyboardEvent::RawKeyDown || evt->keyEvent()->type() == PlatformKeyboardEvent::Char);
+
+ static HashMap<int, const char*>* keyDownCommandsMap = 0;
+ static HashMap<int, const char*>* keyPressCommandsMap = 0;
+
+ if (!keyDownCommandsMap) {
+ keyDownCommandsMap = new HashMap<int, const char*>;
+ keyPressCommandsMap = new HashMap<int, const char*>;
+
+ for (unsigned i = 0; i < WXSIZEOF(keyDownEntries); i++)
+ keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);
+
+ for (unsigned i = 0; i < WXSIZEOF(keyPressEntries); i++)
+ keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
+ }
+
+ unsigned modifiers = 0;
+ if (evt->shiftKey())
+ modifiers |= ShiftKey;
+ if (evt->altKey())
+ modifiers |= AltKey;
+ if (evt->ctrlKey())
+ modifiers |= CtrlKey;
+
+ if (evt->keyEvent()->type() == PlatformKeyboardEvent::RawKeyDown) {
+ int mapKey = modifiers << 16 | evt->keyCode();
+ return mapKey ? keyDownCommandsMap->get(mapKey) : 0;
+ }
+
+ int mapKey = modifiers << 16 | evt->charCode();
+ return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
+}
+
+
void EditorClientWx::handleInputMethodKeydown(KeyboardEvent* event)
{
// NOTE: we don't currently need to handle this. When key events occur,
@@ -295,63 +438,8 @@ void EditorClientWx::handleInputMethodKeydown(KeyboardEvent* event)
void EditorClientWx::handleKeyboardEvent(KeyboardEvent* event)
{
- Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame)
- return;
-
- const PlatformKeyboardEvent* kevent = event->keyEvent();
- if (kevent->type() != PlatformKeyboardEvent::KeyUp) {
- Node* start = frame->selection()->start().node();
- if (!start || !start->isContentEditable())
- return;
-
- if (kevent->type() == PlatformKeyboardEvent::Char && !kevent->ctrlKey() && !kevent->altKey()) {
- switch (kevent->windowsVirtualKeyCode()) {
- // we handled these on key down, ignore them for char events
- case VK_BACK:
- case VK_DELETE:
- case VK_LEFT:
- case VK_RIGHT:
- case VK_UP:
- case VK_DOWN:
- case VK_RETURN:
- break;
- default:
- frame->editor()->insertText(kevent->text(), event);
- }
- event->setDefaultHandled();
- return;
- }
-
- switch (kevent->windowsVirtualKeyCode()) {
- case VK_BACK:
- frame->editor()->deleteWithDirection(SelectionController::BACKWARD,
- CharacterGranularity, false, true);
- break;
- case VK_DELETE:
- frame->editor()->deleteWithDirection(SelectionController::FORWARD,
- CharacterGranularity, false, true);
- break;
- case VK_LEFT:
- frame->editor()->command("MoveLeft").execute();
- break;
- case VK_RIGHT:
- frame->editor()->command("MoveRight").execute();
- break;
- case VK_UP:
- frame->editor()->command("MoveUp").execute();
- break;
- case VK_DOWN:
- frame->editor()->command("MoveDown").execute();
- break;
- case VK_RETURN:
- frame->editor()->command("InsertLineBreak").execute();
- default:
- break;
- }
-
+ if (handleEditingKeyboardEvent(event))
event->setDefaultHandled();
- }
}
void EditorClientWx::textFieldDidBeginEditing(Element*)
@@ -436,6 +524,12 @@ void EditorClientWx::getGuessesForWord(const String&, Vector<String>& guesses)
notImplemented();
}
+String EditorClientWx::getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&)
+{
+ notImplemented();
+ return String();
+}
+
void EditorClientWx::setInputMethodState(bool enabled)
{
notImplemented();
diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.h b/WebKit/wx/WebKitSupport/EditorClientWx.h
index 0f98167..93cf961 100644
--- a/WebKit/wx/WebKitSupport/EditorClientWx.h
+++ b/WebKit/wx/WebKitSupport/EditorClientWx.h
@@ -87,6 +87,8 @@ public:
virtual void undo();
virtual void redo();
+ virtual const char* interpretKeyEvent(const KeyboardEvent*);
+ virtual bool handleEditingKeyboardEvent(KeyboardEvent*);
virtual void handleKeyboardEvent(KeyboardEvent*);
virtual void handleInputMethodKeydown(KeyboardEvent*);
@@ -106,6 +108,8 @@ public:
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const String&, Vector<String>& guesses);
+ virtual String getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&);
+
virtual void setInputMethodState(bool enabled);
private:
diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
index 3cfd86e..9603bd5 100644
--- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
@@ -28,7 +28,11 @@
#include "config.h"
#include "FrameLoaderClientWx.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/APICast.h>
+
#include "DocumentLoader.h"
+#include "FormState.h"
#include "Frame.h"
#include "FrameLoaderTypes.h"
#include "FrameView.h"
@@ -42,9 +46,12 @@
#include "RenderPart.h"
#include "ResourceError.h"
#include "ResourceResponse.h"
+#include "ScriptController.h"
+#include "ScriptString.h"
#include <stdio.h>
+#include "WebFrame.h"
#include "WebView.h"
#include "WebViewPrivate.h"
@@ -96,8 +103,7 @@ void FrameLoaderClientWx::detachFrameLoader()
bool FrameLoaderClientWx::hasWebView() const
{
- notImplemented();
- return true;
+ return m_webView != NULL;
}
bool FrameLoaderClientWx::hasBackForwardList() const
@@ -476,8 +482,7 @@ void FrameLoaderClientWx::didFinishLoad()
void FrameLoaderClientWx::prepareForDataSourceReplacement()
{
- if (m_frame && m_frame->loader())
- m_frame->loader()->detachChildren();
+ notImplemented();
}
@@ -555,40 +560,39 @@ void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const c
fl->addData(data, length);
}
-WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest&)
+WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest& request)
{
notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
}
-WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest&)
+WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest& request)
{
notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
}
-WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest&)
+WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest& request)
{
- notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
}
-WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest&)
+WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
{
notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
}
-WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse&)
+WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
{
notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
}
-WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse&)
+WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse& response)
{
notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
}
bool FrameLoaderClientWx::shouldFallBack(const WebCore::ResourceError& error)
@@ -652,7 +656,12 @@ void FrameLoaderClientWx::dispatchDidFinishLoading(DocumentLoader*, unsigned lon
void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&)
{
- notImplemented();
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_FAILED);
+ wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
}
bool FrameLoaderClientWx::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int)
@@ -661,6 +670,11 @@ bool FrameLoaderClientWx::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*
return false;
}
+void FrameLoaderClientWx::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&)
+{
+ notImplemented();
+}
+
void FrameLoaderClientWx::dispatchDidFailProvisionalLoad(const ResourceError&)
{
notImplemented();
@@ -686,12 +700,23 @@ void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu
(m_frame->loader()->*function)(PolicyUse);
}
-void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&)
+void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName)
{
if (!m_frame)
return;
- notImplemented();
+ if (m_webView) {
+ wxWebViewNewWindowEvent wkEvent(m_webView);
+ wkEvent.SetURL(request.url().string());
+ wkEvent.SetTargetName(targetName);
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) {
+ // if the app handles and doesn't skip the event,
+ // from WebKit's perspective treat it as blocked / ignored
+ (m_frame->loader()->*function)(PolicyIgnore);
+ return;
+ }
+ }
+
(m_frame->loader()->*function)(PolicyUse);
}
@@ -785,7 +810,7 @@ ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const
return ObjectContentType();
}
-Widget* FrameLoaderClientWx::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually)
+PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually)
{
notImplemented();
return 0;
@@ -797,13 +822,13 @@ void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget)
return;
}
-ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse&)
+ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse& response)
{
notImplemented();
- return ResourceError();
+ return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
}
-Widget* FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
+PassRefPtr<Widget> FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
const Vector<String>& paramNames, const Vector<String>& paramValues)
{
notImplemented();
@@ -818,7 +843,15 @@ String FrameLoaderClientWx::overrideMediaType() const
void FrameLoaderClientWx::windowObjectCleared()
{
- notImplemented();
+ if (m_webView) {
+ wxWebViewWindowObjectClearedEvent wkEvent(m_webView);
+ Frame* coreFrame = m_webView->GetMainFrame()->GetFrame();
+ JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject()->globalExec());
+ JSObjectRef windowObject = toRef(coreFrame->script()->globalObject());
+ wkEvent.SetJSContext(context);
+ wkEvent.SetWindowObject(windowObject);
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
}
void FrameLoaderClientWx::documentElementAvailable()
@@ -857,21 +890,17 @@ void FrameLoaderClientWx::transitionToCommittedForNewPage()
m_frame->setView(0);
- FrameView* frameView;
+ RefPtr<FrameView> frameView;
if (isMainFrame)
- frameView = new FrameView(m_frame, IntRect(m_webView->GetRect()).size());
+ frameView = FrameView::create(m_frame, IntRect(m_webView->GetRect()).size());
else
- frameView = new FrameView(m_frame);
+ frameView = FrameView::create(m_frame);
ASSERT(frameView);
m_frame->setView(frameView);
- frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame.
frameView->setPlatformWidget(m_webView);
- if (m_frame->ownerRenderer())
- m_frame->ownerRenderer()->setWidget(frameView);
-
if (HTMLFrameOwnerElement* owner = m_frame->ownerElement())
m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode());
}
diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
index 43b3a8f..7b44149 100644
--- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
+++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
@@ -172,8 +172,9 @@ namespace WebCore {
virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int);
virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long);
virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&);
-
virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int);
+ virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&);
+
virtual void dispatchDidFailProvisionalLoad(const ResourceError&);
virtual void dispatchDidFailLoad(const ResourceError&);
virtual Frame* dispatchCreatePage();
@@ -189,11 +190,11 @@ namespace WebCore {
virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
- virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) ;
+ virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) ;
virtual void redirectDataToPlugin(Widget* pluginWidget);
virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&);
- virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
+ virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
virtual String overrideMediaType() const;
diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp
index 75e4595..d55ad04 100644
--- a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp
@@ -120,4 +120,9 @@ void InspectorClientWx::removeSetting(const String& key)
notImplemented();
}
+void InspectorClientWx::inspectorWindowObjectCleared()
+{
+ notImplemented();
+}
+
};
diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.h b/WebKit/wx/WebKitSupport/InspectorClientWx.h
index ad3ad5b..182df1b 100644
--- a/WebKit/wx/WebKitSupport/InspectorClientWx.h
+++ b/WebKit/wx/WebKitSupport/InspectorClientWx.h
@@ -63,6 +63,8 @@ public:
virtual void populateSetting(const String& key, InspectorController::Setting&);
virtual void storeSetting(const String& key, const InspectorController::Setting&);
virtual void removeSetting(const String& key);
+
+ virtual void inspectorWindowObjectCleared();
};
} // namespace WebCore