summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/gtk/WebCoreSupport')
-rw-r--r--WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp9
-rw-r--r--WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp108
-rw-r--r--WebKit/gtk/WebCoreSupport/EditorClientGtk.h2
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp6
4 files changed, 95 insertions, 30 deletions
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index d63317c..190ae9b 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -26,10 +26,12 @@
#include "Console.h"
#include "DumpRenderTreeSupportGtk.h"
+#include "Element.h"
#include "FileSystem.h"
#include "FileChooser.h"
#include "FloatRect.h"
#include "FrameLoadRequest.h"
+#include "FrameView.h"
#include "GtkVersioning.h"
#include "HTMLNames.h"
#include "IntRect.h"
@@ -520,6 +522,13 @@ void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned mo
g_signal_emit_by_name(m_webView, "hovering-over-link", 0, 0);
m_hoveredLinkURL = KURL();
}
+
+ if (Node* node = hit.innerNonSharedNode()) {
+ Frame* frame = node->document()->frame();
+ FrameView* view = frame ? frame->view() : 0;
+ m_webView->priv->tooltipArea = view ? view->contentsToWindow(node->getRect()) : IntRect();
+ } else
+ m_webView->priv->tooltipArea = IntRect();
}
void ChromeClient::setToolTip(const String& toolTip, TextDirection)
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index e04b5f9..da07e56 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -38,6 +38,11 @@
#include "Page.h"
#include "PasteboardHelperGtk.h"
#include "PlatformKeyboardEvent.h"
+#include "WebKitDOMBinding.h"
+#include "WebKitDOMCSSStyleDeclarationPrivate.h"
+#include "WebKitDOMHTMLElementPrivate.h"
+#include "WebKitDOMNodePrivate.h"
+#include "WebKitDOMRangePrivate.h"
#include "WindowsKeyboardCodes.h"
#include "webkitmarshal.h"
#include "webkitprivate.h"
@@ -267,15 +272,20 @@ void EditorClient::setInputMethodState(bool active)
#endif
}
-bool EditorClient::shouldDeleteRange(Range*)
+bool EditorClient::shouldDeleteRange(Range* range)
{
- notImplemented();
- return true;
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range)));
+ g_signal_emit_by_name(m_webView, "should-delete-range", kitRange.get(), &accept);
+ return accept;
}
-bool EditorClient::shouldShowDeleteInterface(HTMLElement*)
+bool EditorClient::shouldShowDeleteInterface(HTMLElement* element)
{
- return false;
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMHTMLElement> kitElement(adoptPlatformRef(kit(element)));
+ g_signal_emit_by_name(m_webView, "should-show-delete-interface-for-element", kitElement.get(), &accept);
+ return accept;
}
bool EditorClient::isContinuousSpellCheckingEnabled()
@@ -300,38 +310,77 @@ int EditorClient::spellCheckerDocumentTag()
return 0;
}
-bool EditorClient::shouldBeginEditing(WebCore::Range*)
+bool EditorClient::shouldBeginEditing(WebCore::Range* range)
{
clearPendingComposition();
- notImplemented();
- return true;
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range)));
+ g_signal_emit_by_name(m_webView, "should-begin-editing", kitRange.get(), &accept);
+ return accept;
}
-bool EditorClient::shouldEndEditing(WebCore::Range*)
+bool EditorClient::shouldEndEditing(WebCore::Range* range)
{
clearPendingComposition();
- notImplemented();
- return true;
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range)));
+ g_signal_emit_by_name(m_webView, "should-end-editing", kitRange.get(), &accept);
+ return accept;
}
-bool EditorClient::shouldInsertText(const String&, Range*, EditorInsertAction)
+static WebKitInsertAction kit(EditorInsertAction action)
{
- notImplemented();
- return true;
+ switch (action) {
+ case EditorInsertActionTyped:
+ return WEBKIT_INSERT_ACTION_TYPED;
+ case EditorInsertActionPasted:
+ return WEBKIT_INSERT_ACTION_PASTED;
+ case EditorInsertActionDropped:
+ return WEBKIT_INSERT_ACTION_DROPPED;
+ }
+ ASSERT_NOT_REACHED();
+ return WEBKIT_INSERT_ACTION_TYPED;
}
-bool EditorClient::shouldChangeSelectedRange(Range*, Range*, EAffinity, bool)
+bool EditorClient::shouldInsertText(const String& string, Range* range, EditorInsertAction action)
{
- notImplemented();
- return true;
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range)));
+ g_signal_emit_by_name(m_webView, "should-insert-text", string.utf8().data(), kitRange.get(), kit(action), &accept);
+ return accept;
}
-bool EditorClient::shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*)
+static WebKitSelectionAffinity kit(EAffinity affinity)
{
- notImplemented();
- return true;
+ switch (affinity) {
+ case UPSTREAM:
+ return WEBKIT_SELECTION_AFFINITY_UPSTREAM;
+ case DOWNSTREAM:
+ return WEBKIT_SELECTION_AFFINITY_DOWNSTREAM;
+ }
+ ASSERT_NOT_REACHED();
+ return WEBKIT_SELECTION_AFFINITY_UPSTREAM;
+}
+
+bool EditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
+{
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMRange> kitFromRange(fromRange ? adoptPlatformRef(kit(fromRange)) : 0);
+ PlatformRefPtr<WebKitDOMRange> kitToRange(toRange ? adoptPlatformRef(kit(toRange)) : 0);
+ g_signal_emit_by_name(m_webView, "should-change-selected-range", kitFromRange.get(), kitToRange.get(),
+ kit(affinity), stillSelecting, &accept);
+ return accept;
+}
+
+bool EditorClient::shouldApplyStyle(WebCore::CSSStyleDeclaration* declaration, WebCore::Range* range)
+{
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMCSSStyleDeclaration> kitDeclaration(kit(declaration));
+ PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range)));
+ g_signal_emit_by_name(m_webView, "should-apply-style", kitDeclaration.get(), kitRange.get(), &accept);
+ return accept;
}
bool EditorClient::shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*)
@@ -342,12 +391,12 @@ bool EditorClient::shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*)
void EditorClient::didBeginEditing()
{
- notImplemented();
+ g_signal_emit_by_name(m_webView, "editing-began");
}
void EditorClient::respondToChangedContents()
{
- notImplemented();
+ g_signal_emit_by_name(m_webView, "user-changed-contents");
}
static WebKitWebView* viewSettingClipboard = 0;
@@ -394,6 +443,8 @@ static void setSelectionPrimaryClipboardIfNeeded(WebKitWebView* webView)
void EditorClient::respondToChangedSelection()
{
+ g_signal_emit_by_name(m_webView, "selection-changed");
+
WebKitWebViewPrivate* priv = m_webView->priv;
WebCore::Page* corePage = core(m_webView);
Frame* targetFrame = corePage->focusController()->focusedOrMainFrame();
@@ -422,7 +473,7 @@ void EditorClient::respondToChangedSelection()
void EditorClient::didEndEditing()
{
- notImplemented();
+ g_signal_emit_by_name(m_webView, "editing-ended");
}
void EditorClient::didWriteSelectionToPasteboard()
@@ -494,10 +545,13 @@ void EditorClient::redo()
}
}
-bool EditorClient::shouldInsertNode(Node*, Range*, EditorInsertAction)
+bool EditorClient::shouldInsertNode(Node* node, Range* range, EditorInsertAction action)
{
- notImplemented();
- return true;
+ gboolean accept = TRUE;
+ PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range)));
+ PlatformRefPtr<WebKitDOMNode> kitNode(adoptPlatformRef(kit(node)));
+ g_signal_emit_by_name(m_webView, "should-insert-node", kitNode.get(), kitRange.get(), kit(action), &accept);
+ return accept;
}
void EditorClient::pageDestroyed()
@@ -954,7 +1008,7 @@ bool EditorClient::spellingUIIsShowing()
return false;
}
-void EditorClient::getGuessesForWord(const String& word, WTF::Vector<String>& guesses)
+void EditorClient::getGuessesForWord(const String& word, const String& context, WTF::Vector<String>& guesses)
{
GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView);
guesses.clear();
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
index f9ff82e..22543c6 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
@@ -129,7 +129,7 @@ namespace WebKit {
virtual void updateSpellingUIWithMisspelledWord(const WTF::String&);
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
- virtual void getGuessesForWord(const WTF::String&, WTF::Vector<WTF::String>& guesses);
+ virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses);
virtual void willSetInputMethodState();
virtual void setInputMethodState(bool enabled);
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index b23bd70..fdef9dc 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -28,6 +28,7 @@
#include "ArchiveResource.h"
#include "CachedFrame.h"
#include "Color.h"
+#include "DOMObjectCache.h"
#include "DocumentLoader.h"
#include "DocumentLoaderGtk.h"
#include "FormState.h"
@@ -696,9 +697,10 @@ void FrameLoaderClient::registerForIconNotification(bool shouldRegister)
notImplemented();
}
-void FrameLoaderClient::setMainFrameDocumentReady(bool)
+void FrameLoaderClient::setMainFrameDocumentReady(bool ready)
{
- // this is only interesting once we provide an external API for the DOM
+ if (!ready)
+ DOMObjectCache::clearByFrame(core(m_frame));
}
bool FrameLoaderClient::hasWebView() const