summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/gtk/WebCoreSupport')
-rw-r--r--WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp57
-rw-r--r--WebKit/gtk/WebCoreSupport/ChromeClientGtk.h3
-rw-r--r--WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp115
-rw-r--r--WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h74
-rw-r--r--WebKit/gtk/WebCoreSupport/DragClientGtk.cpp68
-rw-r--r--WebKit/gtk/WebCoreSupport/DragClientGtk.h9
-rw-r--r--WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp181
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp178
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h3
-rw-r--r--WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp9
-rw-r--r--WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp5
-rw-r--r--WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h1
12 files changed, 552 insertions, 151 deletions
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 1292e99..8d31af3 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -215,6 +215,10 @@ void ChromeClient::setResizable(bool)
void ChromeClient::closeWindowSoon()
{
+ // We may not have a WebView as create-web-view can return NULL.
+ if (!m_webView)
+ return;
+
webkit_web_view_stop_loading(m_webView);
gboolean isHandled = false;
@@ -226,7 +230,6 @@ void ChromeClient::closeWindowSoon()
// FIXME: should we clear the frame group name here explicitly? Mac does it.
// But this gets cleared in Page's destructor anyway.
// webkit_web_view_set_group_name(m_webView, "");
- g_object_unref(m_webView);
}
bool ChromeClient::canTakeFocus(FocusDirection)
@@ -383,7 +386,7 @@ IntPoint ChromeClient::screenToWindow(const IntPoint& point) const
return result;
}
-PlatformWidget ChromeClient::platformWindow() const
+PlatformPageClient ChromeClient::platformPageClient() const
{
return GTK_WIDGET(m_webView);
}
@@ -399,6 +402,40 @@ void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
gtk_widget_queue_resize_no_redraw(widget);
}
+void ChromeClient::scrollbarsModeDidChange() const
+{
+ WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView);
+
+ g_object_notify(G_OBJECT(webFrame), "horizontal-scrollbar-policy");
+ g_object_notify(G_OBJECT(webFrame), "vertical-scrollbar-policy");
+
+ gboolean isHandled;
+ g_signal_emit_by_name(webFrame, "scrollbars-policy-changed", &isHandled);
+
+ if (isHandled)
+ return;
+
+ GtkWidget* parent = gtk_widget_get_parent(GTK_WIDGET(m_webView));
+ if (!parent || !GTK_IS_SCROLLED_WINDOW(parent))
+ return;
+
+ GtkPolicyType horizontalPolicy = webkit_web_frame_get_horizontal_scrollbar_policy(webFrame);
+ GtkPolicyType verticalPolicy = webkit_web_frame_get_vertical_scrollbar_policy(webFrame);
+
+ // ScrolledWindow doesn't like to display only part of a widget if
+ // the scrollbars are completely disabled; We have a disparity
+ // here on what the policy requested by the web app is and what we
+ // can represent; the idea is not to show scrollbars, only.
+ if (horizontalPolicy == GTK_POLICY_NEVER)
+ horizontalPolicy = GTK_POLICY_AUTOMATIC;
+
+ if (verticalPolicy == GTK_POLICY_NEVER)
+ verticalPolicy = GTK_POLICY_AUTOMATIC;
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(parent),
+ horizontalPolicy, verticalPolicy);
+}
+
void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags)
{
// If a tooltip must be displayed it will be, afterwards, when
@@ -459,13 +496,17 @@ void ChromeClient::print(Frame* frame)
}
#if ENABLE(DATABASE)
-void ChromeClient::exceededDatabaseQuota(Frame* frame, const String&)
+void ChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
{
- // Set to 5M for testing
- // FIXME: Make this configurable
- notImplemented();
- const unsigned long long defaultQuota = 5 * 1024 * 1024;
+ guint64 defaultQuota = webkit_get_default_web_database_quota();
DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), defaultQuota);
+
+ WebKitWebFrame* webFrame = kit(frame);
+ WebKitWebView* webView = getViewFromFrame(webFrame);
+
+ WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(webFrame);
+ WebKitWebDatabase* webDatabase = webkit_security_origin_get_web_database(origin, databaseName.utf8().data());
+ g_signal_emit_by_name(webView, "database-quota-exceeded", webFrame, webDatabase);
}
#endif
@@ -482,7 +523,7 @@ void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser)
RefPtr<FileChooser> chooser = prpFileChooser;
GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"),
- GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformWindow()))),
+ GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformPageClient()))),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
index 0f35e52..e321c35 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
@@ -89,9 +89,10 @@ namespace WebKit {
virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
- virtual PlatformWidget platformWindow() const;
+ virtual PlatformPageClient platformPageClient() const;
virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
+ virtual void scrollbarsModeDidChange() const;
virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
virtual void setToolTip(const WebCore::String&, WebCore::TextDirection);
diff --git a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp
new file mode 100644
index 0000000..0efc9fa
--- /dev/null
+++ b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Jan Michael Alonzo
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DocumentLoaderGtk.h"
+
+#include "webkitwebdatasource.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+DocumentLoader::DocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
+ : WebCore::DocumentLoader(request, substituteData)
+ , m_isDataSourceReffed(false)
+ , m_dataSource(0)
+{
+}
+
+void DocumentLoader::setDataSource(WebKitWebDataSource* dataSource)
+{
+ ASSERT(!m_dataSource);
+
+ m_dataSource = dataSource;
+ refDataSource();
+}
+
+void DocumentLoader::detachDataSource()
+{
+ unrefDataSource();
+}
+
+void DocumentLoader::attachToFrame()
+{
+ WebCore::DocumentLoader::attachToFrame();
+
+ refDataSource();
+}
+
+void DocumentLoader::detachFromFrame()
+{
+ WebCore::DocumentLoader::detachFromFrame();
+
+ if (m_loadingResources.isEmpty())
+ unrefDataSource();
+}
+
+void DocumentLoader::increaseLoadCount(unsigned long identifier)
+{
+ ASSERT(m_dataSource);
+
+ if (m_loadingResources.contains(identifier))
+ return;
+ m_loadingResources.add(identifier);
+ refDataSource();
+}
+
+void DocumentLoader::decreaseLoadCount(unsigned long identifier)
+{
+ HashSet<unsigned long>::iterator it = m_loadingResources.find(identifier);
+
+ // It is valid for a load to be cancelled before it's started.
+ if (it == m_loadingResources.end())
+ return;
+
+ m_loadingResources.remove(it);
+
+ if (m_loadingResources.isEmpty() && !frame())
+ unrefDataSource();
+}
+
+// helper methos to avoid ref count churn
+void DocumentLoader::refDataSource()
+{
+ if (!m_dataSource || m_isDataSourceReffed)
+ return;
+ m_isDataSourceReffed = true;
+ g_object_ref(m_dataSource);
+}
+void DocumentLoader::unrefDataSource()
+{
+ if (!m_isDataSourceReffed)
+ return;
+ ASSERT(m_dataSource);
+ m_isDataSourceReffed = false;
+ g_object_unref(m_dataSource);
+}
+
+} // end namespace WebKit
diff --git a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h
new file mode 100644
index 0000000..c601bc5
--- /dev/null
+++ b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Jan Michael Alonzo
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DocumentLoaderGtk_h
+#define DocumentLoaderGtk_h
+
+#include "DocumentLoader.h"
+#include "webkitdefines.h"
+#include "wtf/HashSet.h"
+
+namespace WebCore {
+ class ResourceRequest;
+ class SubstituteData;
+}
+
+namespace WebKit {
+
+class DocumentLoader : public WebCore::DocumentLoader {
+public:
+ static PassRefPtr<WebKit::DocumentLoader> create(const WebCore::ResourceRequest& request, const WebCore::SubstituteData& data)
+ {
+ return adoptRef(new DocumentLoader(request, data));
+ }
+
+ void setDataSource(WebKitWebDataSource*);
+ void detachDataSource();
+ WebKitWebDataSource* dataSource() const { return m_dataSource; }
+
+ void increaseLoadCount(unsigned long identifier);
+ void decreaseLoadCount(unsigned long identifier);
+
+private:
+ DocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+
+ virtual void attachToFrame();
+ virtual void detachFromFrame();
+
+ void refDataSource();
+ void unrefDataSource();
+
+ bool m_isDataSourceReffed;
+ WebKitWebDataSource* m_dataSource;
+ HashSet<unsigned long> m_loadingResources;
+};
+
+} // end namespace WebKit
+
+#endif
diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
index f55b6ea..f4b0df1 100644
--- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
@@ -17,20 +17,36 @@
#include "config.h"
#include "DragClientGtk.h"
+#include "Document.h"
+#include "Element.h"
+#include "Frame.h"
#include "NotImplemented.h"
+#include "RenderObject.h"
+#include "webkitwebview.h"
+
+#include <gtk/gtk.h>
+#if !GTK_CHECK_VERSION(2, 14, 0)
+#define gtk_widget_get_window(widget) (widget)->window
+#endif
using namespace WebCore;
namespace WebKit {
+DragClient::DragClient(WebKitWebView* webView)
+ : m_webView(webView)
+ , m_startPos(0, 0)
+{
+}
+
void DragClient::willPerformDragDestinationAction(DragDestinationAction, DragData*)
{
notImplemented();
}
-void DragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
+void DragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint& startPos, Clipboard*)
{
- notImplemented();
+ m_startPos = startPos;
}
DragDestinationAction DragClient::actionMaskForDrag(DragData*)
@@ -45,12 +61,53 @@ DragSourceAction DragClient::dragSourceActionMaskForPoint(const IntPoint&)
return DragSourceActionAny;
}
-void DragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool)
+void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame* frame, bool linkDrag)
{
- notImplemented();
+ Element* targetElement = frame->document()->elementFromPoint(m_startPos.x(), m_startPos.y());
+ bool imageDrag = false;
+
+ if (targetElement)
+ imageDrag = targetElement->renderer()->isImage();
+
+ GdkAtom textHtml = gdk_atom_intern_static_string("text/html");
+ GdkAtom netscapeUrl = gdk_atom_intern_static_string("_NETSCAPE_URL");
+
+ GtkTargetList* targetList = gtk_target_list_new(NULL, 0);
+ gtk_target_list_add(targetList, textHtml, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML);
+ gtk_target_list_add_text_targets(targetList, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT);
+
+ if (linkDrag || imageDrag) {
+ gtk_target_list_add(targetList, netscapeUrl, 0, WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL);
+ gtk_target_list_add_uri_targets(targetList, WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST);
+ }
+
+ if (imageDrag)
+ gtk_target_list_add_image_targets(targetList, WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE, false);
+
+ GdkDragAction dragAction = GDK_ACTION_COPY;
+ if (linkDrag) {
+ dragAction = GDK_ACTION_LINK;
+ if (imageDrag)
+ dragAction = (GdkDragAction)(dragAction | GDK_ACTION_COPY);
+ }
+
+ GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
+ reinterpret_cast<GdkEventButton*>(event)->window = gtk_widget_get_window(GTK_WIDGET(m_webView));
+ reinterpret_cast<GdkEventButton*>(event)->time = GDK_CURRENT_TIME;
+
+ GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView),
+ targetList, dragAction, 1, event);
+ g_object_ref(context);
+
+ if (image)
+ gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y());
+ else
+ gtk_drag_set_icon_default(context);
+
+ gtk_target_list_unref(targetList);
}
-DragImageRef DragClient::createDragImageForLink(KURL&, const String& label, Frame*)
+DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*)
{
notImplemented();
return 0;
@@ -61,4 +118,3 @@ void DragClient::dragControllerDestroyed()
delete this;
}
}
-
diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.h b/WebKit/gtk/WebCoreSupport/DragClientGtk.h
index 4367c68..97ea72a 100644
--- a/WebKit/gtk/WebCoreSupport/DragClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.h
@@ -32,9 +32,14 @@
#include "DragClient.h"
+typedef struct _WebKitWebView WebKitWebView;
+
namespace WebKit {
+
class DragClient : public WebCore::DragClient {
public:
+ DragClient(WebKitWebView*);
+
virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*);
virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
@@ -45,6 +50,10 @@ namespace WebKit {
virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WebCore::String& label, WebCore::Frame*);
virtual void dragControllerDestroyed();
+
+ private:
+ WebKitWebView* m_webView;
+ WebCore::IntPoint m_startPos;
};
}
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index b5148d8..7121163 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -49,39 +49,40 @@ using namespace WebCore;
namespace WebKit {
-static void imContextCommitted(GtkIMContext* context, const gchar* str, EditorClient* client)
-{
- Frame* targetFrame = core(client->m_webView)->focusController()->focusedOrMainFrame();
+static gchar* pendingComposition = 0;
+static gchar* pendingPreedit = 0;
- if (!targetFrame || !targetFrame->editor()->canEdit())
- return;
+static void setPendingComposition(gchar* newComposition)
+{
+ g_free(pendingComposition);
+ pendingComposition = newComposition;
+}
- Editor* editor = targetFrame->editor();
+static void setPendingPreedit(gchar* newPreedit)
+{
+ g_free(pendingPreedit);
+ pendingPreedit = newPreedit;
+}
- String commitString = String::fromUTF8(str);
- editor->confirmComposition(commitString);
+static void clearPendingIMData()
+{
+ setPendingComposition(0);
+ setPendingPreedit(0);
+}
+static void imContextCommitted(GtkIMContext* context, const gchar* str, EditorClient* client)
+{
+ // This signal will fire during a keydown event. We want the contents of the
+ // field to change right before the keyup event, so we wait until then to actually
+ // commit this composition.
+ setPendingComposition(g_strdup(str));
}
static void imContextPreeditChanged(GtkIMContext* context, EditorClient* client)
{
- Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame();
- Editor* editor = frame->editor();
-
- gchar* preedit = NULL;
- gint cursorPos = 0;
// We ignore the provided PangoAttrList for now.
- gtk_im_context_get_preedit_string(context, &preedit, NULL, &cursorPos);
- String preeditString = String::fromUTF8(preedit);
- g_free(preedit);
-
- // setComposition() will replace the user selection if passed an empty
- // preedit. We don't want this to happen.
- if (preeditString.isEmpty() && !editor->hasComposition())
- return;
-
- Vector<CompositionUnderline> underlines;
- underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
- editor->setComposition(preeditString, underlines, cursorPos, 0);
+ gchar* newPreedit = 0;
+ gtk_im_context_get_preedit_string(context, &newPreedit, NULL, NULL);
+ setPendingPreedit(newPreedit);
}
void EditorClient::setInputMethodState(bool active)
@@ -136,12 +137,16 @@ int EditorClient::spellCheckerDocumentTag()
bool EditorClient::shouldBeginEditing(WebCore::Range*)
{
+ clearPendingIMData();
+
notImplemented();
return true;
}
bool EditorClient::shouldEndEditing(WebCore::Range*)
{
+ clearPendingIMData();
+
notImplemented();
return true;
}
@@ -410,11 +415,6 @@ static const KeyDownEntry keyDownEntries[] = {
{ VK_RETURN, CtrlKey, "InsertNewline" },
{ VK_RETURN, AltKey, "InsertNewline" },
{ VK_RETURN, AltKey | ShiftKey, "InsertNewline" },
-
- // It's not quite clear whether Undo/Redo should be handled
- // in the application or in WebKit. We chose WebKit.
- { 'Z', CtrlKey, "Undo" },
- { 'Z', CtrlKey | ShiftKey, "Redo" },
};
static const KeyPressEntry keyPressEntries[] = {
@@ -426,7 +426,7 @@ static const KeyPressEntry keyPressEntries[] = {
{ '\r', AltKey | ShiftKey, "InsertNewline" },
};
-static const char* interpretKeyEvent(const KeyboardEvent* evt)
+static const char* interpretEditorCommandKeyEvent(const KeyboardEvent* evt)
{
ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent);
@@ -461,74 +461,79 @@ static const char* interpretKeyEvent(const KeyboardEvent* evt)
return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
}
-static bool handleEditingKeyboardEvent(KeyboardEvent* evt)
+void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
- Node* node = evt->target()->toNode();
+ Node* node = event->target()->toNode();
ASSERT(node);
Frame* frame = node->document()->frame();
ASSERT(frame);
- const PlatformKeyboardEvent* keyEvent = evt->keyEvent();
- if (!keyEvent)
- return false;
-
- bool caretBrowsing = frame->settings()->caretBrowsingEnabled();
- if (caretBrowsing) {
- switch (keyEvent->windowsVirtualKeyCode()) {
- case VK_LEFT:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::LEFT,
- keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,
- true);
- return true;
- case VK_RIGHT:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::RIGHT,
- keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,
- true);
- return true;
- case VK_UP:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::BACKWARD,
- keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,
- true);
- return true;
- case VK_DOWN:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::FORWARD,
- keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,
- true);
- return true;
+ const PlatformKeyboardEvent* platformEvent = event->keyEvent();
+ if (!platformEvent)
+ return;
+
+ // Don't allow editor commands or text insertion for nodes that
+ // cannot edit, unless we are in caret mode.
+ if (!frame->editor()->canEdit() && !(frame->settings() && frame->settings()->caretBrowsingEnabled()))
+ return;
+
+ const gchar* editorCommandString = interpretEditorCommandKeyEvent(event);
+ if (editorCommandString) {
+ Editor::Command command = frame->editor()->command(editorCommandString);
+
+ // On editor commands from key down events, we only want to let the event bubble up to
+ // the DOM if it inserts text. If it doesn't insert text (e.g. Tab that changes focus)
+ // we just want WebKit to handle it immediately without a DOM event.
+ if (platformEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ if (!command.isTextInsertion() && command.execute(event))
+ event->setDefaultHandled();
+
+ return;
+ } else if (command.execute(event)) {
+ event->setDefaultHandled();
+ return;
}
}
- Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
+ // This is just a normal text insertion, so wait to execute the insertion
+ // until a keypress event happens. This will ensure that the insertion will not
+ // be reflected in the contents of the field until the keyup DOM event.
+ if (event->type() == eventNames().keypressEvent) {
- 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 let a keypress event be generated
- // (e.g. Tab that inserts a Tab character, or Enter).
- return !command.isTextInsertion() && command.execute(evt);
- }
+ if (pendingComposition) {
+ String compositionString = String::fromUTF8(pendingComposition);
+ frame->editor()->confirmComposition(compositionString);
- if (command.execute(evt))
- return true;
+ clearPendingIMData();
+ event->setDefaultHandled();
- // Don't insert null or control characters as they can result in unexpected behaviour
- if (evt->charCode() < ' ')
- return false;
+ } else if (pendingPreedit) {
+ String preeditString = String::fromUTF8(pendingPreedit);
- // Don't insert anything if a modifier is pressed
- if (keyEvent->ctrlKey() || keyEvent->altKey())
- return false;
+ // Don't use an empty preedit as it will destroy the current
+ // selection, even if the composition is cancelled or fails later on.
+ if (!preeditString.isEmpty()) {
+ Vector<CompositionUnderline> underlines;
+ underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
+ frame->editor()->setComposition(preeditString, underlines, 0, 0);
+ }
- return frame->editor()->insertText(evt->keyEvent()->text(), evt);
-}
+ clearPendingIMData();
+ event->setDefaultHandled();
-void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
-{
- if (handleEditingKeyboardEvent(event))
- event->setDefaultHandled();
+ } else {
+ // Don't insert null or control characters as they can result in unexpected behaviour
+ if (event->charCode() < ' ')
+ return;
+
+ // Don't insert anything if a modifier is pressed
+ if (platformEvent->ctrlKey() || platformEvent->altKey())
+ return;
+
+ if (frame->editor()->insertText(platformEvent->text(), event))
+ event->setDefaultHandled();
+ }
+ }
}
void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
@@ -537,10 +542,10 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
if (!targetFrame || !targetFrame->editor()->canEdit())
return;
+ // TODO: We need to decide which filtered keystrokes should be treated as IM
+ // events and which should not.
WebKitWebViewPrivate* priv = m_webView->priv;
- // TODO: Dispatch IE-compatible text input events for IM events.
- if (gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()))
- event->setDefaultHandled();
+ gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey());
}
EditorClient::EditorClient(WebKitWebView* webView)
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 68c0435..1cf9aee 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -2,7 +2,7 @@
* Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
* Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther
* Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
- * Copyright (C) 2008 Collabora Ltd. All rights reserved.
+ * Copyright (C) 2008, 2009 Collabora Ltd. All rights reserved.
* Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -23,8 +23,10 @@
#include "config.h"
#include "FrameLoaderClientGtk.h"
+#include "ArchiveResource.h"
#include "Color.h"
#include "DocumentLoader.h"
+#include "DocumentLoaderGtk.h"
#include "FormState.h"
#include "FrameLoader.h"
#include "FrameView.h"
@@ -53,6 +55,7 @@
#include "ScriptController.h"
#include "webkiterror.h"
#include "webkitnetworkrequest.h"
+#include "webkitnetworkresponse.h"
#include "webkitprivate.h"
#include "webkitwebframe.h"
#include "webkitwebnavigationaction.h"
@@ -111,7 +114,13 @@ static void loadDone(WebKitWebFrame* frame, bool didSucceed)
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
{
- return DocumentLoader::create(request, substituteData);
+ RefPtr<WebKit::DocumentLoader> loader = WebKit::DocumentLoader::create(request, substituteData);
+
+ WebKitWebDataSource* webDataSource = webkit_web_data_source_new_with_loader(loader.get());
+ loader->setDataSource(webDataSource);
+ g_object_unref(webDataSource);
+
+ return loader.release();
}
void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunction, PassRefPtr<FormState>)
@@ -120,11 +129,11 @@ void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunctio
ASSERT(policyFunction);
if (!policyFunction)
return;
- (core(m_frame)->loader()->*policyFunction)(PolicyUse);
+ (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyUse);
}
-void FrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
+void FrameLoaderClient::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
{
if (!m_pluginView) {
ASSERT(loader->frame());
@@ -158,30 +167,68 @@ void FrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data,
}
bool
-FrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier)
+FrameLoaderClient::shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier)
{
notImplemented();
return false;
}
-void FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
+void FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
{
notImplemented();
}
-void FrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
+void FrameLoaderClient::dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
{
notImplemented();
}
-void FrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&)
+// We convert this to string because it's easier to use strings as
+// keys in a GHashTable.
+static char* toString(unsigned long identifier)
{
- notImplemented();
+ return g_strdup_printf("%ld", identifier);
}
-void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&)
+void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
- notImplemented();
+ GOwnPtr<WebKitNetworkResponse> networkResponse(0);
+
+ // We are adding one more resource to the load, or maybe we are
+ // just redirecting a load.
+ if (redirectResponse.isNull())
+ static_cast<WebKit::DocumentLoader*>(loader)->increaseLoadCount(identifier);
+ else
+ networkResponse.set(webkit_network_response_new_with_core_response(redirectResponse));
+
+ WebKitWebView* webView = getViewFromFrame(m_frame);
+ GOwnPtr<gchar> identifierString(toString(identifier));
+ WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get());
+ GOwnPtr<WebKitNetworkRequest> networkRequest(webkit_network_request_new_with_core_request(request));
+
+ if (!redirectResponse.isNull()) {
+ // This is a redirect, so we need to update the WebResource's knowledge
+ // of the URI.
+ g_free(webResource->priv->uri);
+ webResource->priv->uri = g_strdup(request.url().string().utf8().data());
+ }
+
+ g_signal_emit_by_name(webView, "resource-request-starting", m_frame, webResource, networkRequest.get(), networkResponse.get());
+
+ // Feed any changes back into the ResourceRequest object.
+ SoupMessage* message = webkit_network_request_get_message(networkRequest.get());
+ if (!message) {
+ request.setURL(KURL(KURL(), String::fromUTF8(webkit_network_request_get_uri(networkRequest.get()))));
+ return;
+ }
+
+ request.updateFromSoupMessage(message);
+}
+
+void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const ResourceRequest& request)
+{
+ webkit_web_view_add_resource(getViewFromFrame(m_frame), toString(identifier),
+ WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0)));
}
void FrameLoaderClient::postProgressStartedNotification()
@@ -221,7 +268,7 @@ void FrameLoaderClient::frameLoaderDestroyed()
delete this;
}
-void FrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse& response)
+void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long, const ResourceResponse& response)
{
m_response = response;
}
@@ -233,7 +280,7 @@ void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction poli
return;
if (resourceRequest.isNull()) {
- (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
+ (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore);
return;
}
@@ -300,7 +347,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti
return;
if (resourceRequest.isNull()) {
- (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
+ (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore);
return;
}
@@ -323,7 +370,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti
// FIXME: I think Qt version marshals this to another thread so when we
// have multi-threaded download, we might need to do the same
if (!isHandled)
- (core(m_frame)->loader()->*policyFunction)(PolicyUse);
+ (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyUse);
}
void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr<FormState>)
@@ -333,7 +380,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct
return;
if (resourceRequest.isNull()) {
- (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
+ (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore);
return;
}
@@ -350,7 +397,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct
g_signal_emit_by_name(webView, "navigation-requested", m_frame, request, &response);
if (response == WEBKIT_NAVIGATION_RESPONSE_IGNORE) {
- (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
+ (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore);
g_object_unref(request);
return;
}
@@ -403,11 +450,11 @@ PassRefPtr<Widget> FrameLoaderClient::createPlugin(const IntSize& pluginSize, HT
PassRefPtr<Frame> FrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
{
- Frame* coreFrame = core(webFrame());
+ Frame* coreFrame = core(m_frame);
- ASSERT(core(getViewFromFrame(webFrame())) == coreFrame->page());
+ ASSERT(core(getViewFromFrame(m_frame)) == coreFrame->page());
- RefPtr<Frame> childFrame = webkit_web_frame_init_with_web_view(getViewFromFrame(webFrame()), ownerElement);
+ RefPtr<Frame> childFrame = webkit_web_frame_init_with_web_view(getViewFromFrame(m_frame), ownerElement);
coreFrame->tree()->appendChild(childFrame);
@@ -474,7 +521,7 @@ void FrameLoaderClient::windowObjectCleared()
// Is this obsolete now?
g_signal_emit_by_name(m_frame, "cleared");
- Frame* coreFrame = core(webFrame());
+ Frame* coreFrame = core(m_frame);
ASSERT(coreFrame);
Settings* settings = coreFrame->settings();
@@ -546,7 +593,17 @@ bool FrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
return item != 0;
}
-void FrameLoaderClient::makeRepresentation(DocumentLoader*)
+void FrameLoaderClient::didDisplayInsecureContent()
+{
+ notImplemented();
+}
+
+void FrameLoaderClient::didRunInsecureContent(SecurityOrigin*)
+{
+ notImplemented();
+}
+
+void FrameLoaderClient::makeRepresentation(WebCore::DocumentLoader*)
{
notImplemented();
}
@@ -700,22 +757,22 @@ void FrameLoaderClient::cancelPolicyCheck()
webkit_web_policy_decision_cancel(m_policyDecision);
}
-void FrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*)
+void FrameLoaderClient::dispatchDidLoadMainResource(WebCore::DocumentLoader*)
{
notImplemented();
}
-void FrameLoaderClient::revertToProvisionalState(DocumentLoader*)
+void FrameLoaderClient::revertToProvisionalState(WebCore::DocumentLoader*)
{
notImplemented();
}
-void FrameLoaderClient::willChangeTitle(DocumentLoader*)
+void FrameLoaderClient::willChangeTitle(WebCore::DocumentLoader*)
{
notImplemented();
}
-void FrameLoaderClient::didChangeTitle(DocumentLoader *l)
+void FrameLoaderClient::didChangeTitle(WebCore::DocumentLoader *l)
{
setTitle(l->title(), l->url());
}
@@ -744,7 +801,7 @@ String FrameLoaderClient::generatedMIMETypeForURLScheme(const String&) const
return String();
}
-void FrameLoaderClient::finishedLoading(DocumentLoader* documentLoader)
+void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader)
{
if (!m_pluginView)
committedLoad(documentLoader, 0, 0);
@@ -758,7 +815,10 @@ void FrameLoaderClient::finishedLoading(DocumentLoader* documentLoader)
void FrameLoaderClient::provisionalLoadStarted()
{
- notImplemented();
+ WebKitWebView* webView = getViewFromFrame(m_frame);
+
+ if (m_frame == webkit_web_view_get_main_frame(webView))
+ webkit_web_view_clear_resources(webView);
}
void FrameLoaderClient::didFinishLoad() {
@@ -774,19 +834,45 @@ void FrameLoaderClient::setTitle(const String& title, const KURL& url)
frameData->title = g_strdup(title.utf8().data());
}
-void FrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived)
+void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived)
{
notImplemented();
}
-void FrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier)
+void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader, unsigned long identifier)
{
+ static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier);
+
+ WebKitWebView* webView = getViewFromFrame(m_frame);
+ GOwnPtr<gchar> identifierString(toString(identifier));
+ WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get());
+
+ const char* uri = webkit_web_resource_get_uri(webResource);
+ RefPtr<ArchiveResource> coreResource(loader->subresource(KURL(KURL(), uri)));
+
+ // If coreResource is NULL here, the resource failed to load,
+ // unless it's the main resource.
+ if (!coreResource && webResource != webkit_web_view_get_main_resource(webView))
+ return;
+
+ if (!coreResource)
+ coreResource = loader->mainResource().releaseRef();
+
+ webkit_web_resource_init_with_core_resource(webResource, coreResource.get());
+
+ // FIXME: This function should notify the application that the resource
+ // finished loading, maybe using a load-status property in the
+ // WebKitWebResource object, similar to what we do for WebKitWebFrame'
+ // signal.
notImplemented();
}
-void FrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& error)
+void FrameLoaderClient::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
{
- // FIXME: when does this occur and what should happen?
+ static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier);
+
+ // FIXME: This function should notify the application that the resource failed
+ // loading, maybe a 'load-error' signal in the WebKitWebResource object.
notImplemented();
}
@@ -795,7 +881,7 @@ void FrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, c
notImplemented();
}
-bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length)
+bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length)
{
notImplemented();
return false;
@@ -804,12 +890,12 @@ bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*,
void FrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
{
dispatchDidFailLoad(error);
-
- loadDone(m_frame, false);
}
void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
{
+ notifyStatus(m_frame, WEBKIT_LOAD_FAILED);
+
WebKitWebView* webView = getViewFromFrame(m_frame);
GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()),
error.errorCode(),
@@ -824,7 +910,6 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
if (!shouldFallBack(error)) {
g_error_free(webError);
- loadDone(m_frame, false);
return;
}
@@ -852,21 +937,14 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
g_object_unref(errorFile);
g_error_free(webError);
-
- loadDone(m_frame, false);
}
void FrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response)
{
- // FIXME: We could reuse the same handle here, but when I tried
- // implementing that the main load would fail and stop, so I have
- // simplified this case for now.
- handle->cancel();
-
- WebKitNetworkRequest* networkRequest = webkit_network_request_new(request.url().string().utf8().data());
+ WebKitNetworkRequest* networkRequest = webkit_network_request_new_with_core_request(request);
WebKitWebView* view = getViewFromFrame(m_frame);
- webkit_web_view_request_download(view, networkRequest, response);
+ webkit_web_view_request_download(view, networkRequest, response, handle);
g_object_unref(networkRequest);
}
@@ -943,7 +1021,7 @@ void FrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
notImplemented();
}
-void FrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error)
+void FrameLoaderClient::setMainDocumentError(WebCore::DocumentLoader*, const ResourceError& error)
{
if (m_pluginView) {
m_pluginView->didFail(error);
@@ -997,6 +1075,14 @@ void FrameLoaderClient::transitionToCommittedForNewPage()
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
frame->view()->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment);
+
+ if (priv->currentMenu) {
+ GtkMenu* menu = priv->currentMenu;
+ priv->currentMenu = NULL;
+
+ gtk_menu_popdown(menu);
+ g_object_unref(menu);
+ }
}
}
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
index bc64c2f..c820135 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
@@ -136,6 +136,9 @@ namespace WebKit {
virtual void updateGlobalHistoryRedirectLinks();
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+ virtual void didDisplayInsecureContent();
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&);
diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index 908bffa..fef07c1 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -68,8 +68,13 @@ void InspectorClient::webViewDestroyed()
Page* InspectorClient::createPage()
{
- if (m_webView)
- return core(m_webView);
+ if (m_webView) {
+ gboolean handled = FALSE;
+ g_signal_emit_by_name(m_webInspector, "destroy", &handled);
+
+ /* we can now dispose our own reference */
+ g_object_unref(m_webInspector);
+ }
// This g_object_get will ref the inspector. We're not doing an
// unref if this method succeeds because the inspector object must
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
index 5a7157e..f2ea316 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
@@ -67,4 +67,9 @@ GtkTargetList* PasteboardHelperGtk::getPasteTargetList(Frame* frame) const
return webkit_web_view_get_paste_target_list(webView);
}
+gint PasteboardHelperGtk::getWebViewTargetInfoHtml() const
+{
+ return WEBKIT_WEB_VIEW_TARGET_INFO_HTML;
+}
+
}
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
index 4e66357..849b417 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
@@ -45,6 +45,7 @@ public:
virtual GtkClipboard* getPrimary(Frame*) const;
virtual GtkTargetList* getCopyTargetList(Frame*) const;
virtual GtkTargetList* getPasteTargetList(Frame*) const;
+ virtual gint getWebViewTargetInfoHtml() const;
};
}