diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit/gtk/WebCoreSupport | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit/gtk/WebCoreSupport')
5 files changed, 87 insertions, 13 deletions
diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 1336f11..1ce0ada 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -28,6 +28,7 @@ #include "AnimationController.h" #include "DOMWrapperWorld.h" #include "Document.h" +#include "Element.h" #include "FocusController.h" #include "FrameLoaderClientGtk.h" #include "FrameTree.h" @@ -41,6 +42,7 @@ #include "JSElement.h" #include "JSLock.h" #include "JSNodeList.h" +#include "JSRange.h" #include "JSValue.h" #include "NodeList.h" #include "PageGroup.h" @@ -52,6 +54,7 @@ #include "SecurityOrigin.h" #include "Settings.h" #include "TextIterator.h" +#include "WebKitDOMRangePrivate.h" #include "WorkerThread.h" #include "webkitglobalsprivate.h" #include "webkitwebframe.h" @@ -126,6 +129,20 @@ JSValueRef DumpRenderTreeSupportGtk::nodesFromRect(JSContextRef context, JSValue return toRef(exec, toJS(exec, jsDocument->globalObject(), nodes.get())); } +WebKitDOMRange* DumpRenderTreeSupportGtk::jsValueToDOMRange(JSContextRef context, JSValueRef value) +{ + if (!value) + return 0; + + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = toJS(context); + + Range* range = toRange(toJS(exec, value)); + if (!range) + return 0; + return kit(range); +} + /** * getFrameChildren: * @frame: a #WebKitWebFrame @@ -636,6 +653,17 @@ void DumpRenderTreeSupportGtk::clearOpener(WebKitWebFrame* frame) coreFrame->loader()->setOpener(0); } +JSValueRef DumpRenderTreeSupportGtk::shadowRoot(JSContextRef context, JSValueRef value) +{ + JSLock lock(SilenceAssertionsOnly); + JSC::ExecState* exec = toJS(context); + Element* element = toElement(toJS(exec, value)); + if (!element) + return JSValueMakeNull(context); + + return toRef(exec, toJS(exec, element->shadowRoot())); +} + unsigned int DumpRenderTreeSupportGtk::workerThreadCount() { #if ENABLE(WORKERS) @@ -667,6 +695,31 @@ void DumpRenderTreeSupportGtk::setMinimumTimerInterval(WebKitWebView* webView, d core(webView)->settings()->setMinDOMTimerInterval(interval); } +static void modifyAccessibilityValue(AtkObject* axObject, bool increment) +{ + if (!axObject || !WEBKIT_IS_ACCESSIBLE(axObject)) + return; + + AccessibilityObject* coreObject = webkit_accessible_get_accessibility_object(WEBKIT_ACCESSIBLE(axObject)); + if (!coreObject) + return; + + if (increment) + coreObject->increment(); + else + coreObject->decrement(); +} + +void DumpRenderTreeSupportGtk::incrementAccessibilityValue(AtkObject* axObject) +{ + modifyAccessibilityValue(axObject, true); +} + +void DumpRenderTreeSupportGtk::decrementAccessibilityValue(AtkObject* axObject) +{ + modifyAccessibilityValue(axObject, false); +} + void DumpRenderTreeSupportGtk::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) { JSC::ExecState* exec = toJS(context); @@ -695,3 +748,16 @@ void DumpRenderTreeSupportGtk::setValueForUser(JSContextRef context, JSValueRef JSStringGetUTF8CString(value, valueBuffer.get(), bufferSize); inputElement->setValueForUser(String::fromUTF8(valueBuffer.get())); } + +void DumpRenderTreeSupportGtk::rectangleForSelection(WebKitWebFrame* frame, GdkRectangle* rectangle) +{ + Frame* coreFrame = core(frame); + if (!coreFrame) + return; + + IntRect bounds = enclosingIntRect(coreFrame->selection()->bounds()); + rectangle->x = bounds.x(); + rectangle->y = bounds.y(); + rectangle->width = bounds.width(); + rectangle->height = bounds.height(); +} diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 7ad5af6..7731798 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -20,12 +20,10 @@ #define DumpRenderTreeSupportGtk_h #include "JSStringRef.h" -#include <webkit/webkitdefines.h> - #include <atk/atk.h> #include <glib.h> #include <webkit/webkitdefines.h> -#include <webkit/webkitwebframe.h> +#include <webkit/webkitdomdefines.h> #include <wtf/text/CString.h> namespace WebKit { @@ -61,6 +59,9 @@ public: static void clearOpener(WebKitWebFrame*); + static JSValueRef shadowRoot(JSContextRef, JSValueRef); + static WebKitDOMRange* jsValueToDOMRange(JSContextRef, JSValueRef); + // FIXME: Move these to webkitwebframe.h once their API has been discussed. static GSList* getFrameChildren(WebKitWebFrame*); static WTF::CString getInnerText(WebKitWebFrame*); @@ -97,6 +98,11 @@ public: static bool selectedRange(WebKitWebView*, int* start, int* end); static double defaultMinimumTimerInterval(); // Not really tied to WebView static void setMinimumTimerInterval(WebKitWebView*, double); + static void rectangleForSelection(WebKitWebFrame*, GdkRectangle*); + + // Accessibility + static void incrementAccessibilityValue(AtkObject*); + static void decrementAccessibilityValue(AtkObject*); // GC static void gcCollectJavascriptObjects(); diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index ca8bf9a..539675a 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -949,21 +949,22 @@ void FrameLoaderClient::dispatchDidStartProvisionalLoad() notifyStatus(m_frame, WEBKIT_LOAD_PROVISIONAL); } -void FrameLoaderClient::dispatchDidReceiveTitle(const String& title) +void FrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& title) { if (m_loadingErrorPage) return; WebKitWebFramePrivate* priv = m_frame->priv; g_free(priv->title); - priv->title = g_strdup(title.utf8().data()); + // FIXME: use direction of title. + priv->title = g_strdup(title.string().utf8().data()); g_signal_emit_by_name(m_frame, "title-changed", priv->title); g_object_notify(G_OBJECT(m_frame), "title"); WebKitWebView* webView = getViewFromFrame(m_frame); if (m_frame == webkit_web_view_get_main_frame(webView)) { - g_signal_emit_by_name(webView, "title-changed", m_frame, title.utf8().data()); + g_signal_emit_by_name(webView, "title-changed", m_frame, title.string().utf8().data()); g_object_notify(G_OBJECT(webView), "title"); } } @@ -1119,14 +1120,15 @@ void FrameLoaderClient::prepareForDataSourceReplacement() notImplemented(); } -void FrameLoaderClient::setTitle(const String& title, const KURL& url) +void FrameLoaderClient::setTitle(const StringWithDirection& title, const KURL& url) { WebKitWebFramePrivate* frameData = m_frame->priv; g_free(frameData->title); - frameData->title = g_strdup(title.utf8().data()); + // FIXME: use direction of title. + frameData->title = g_strdup(title.string().utf8().data()); } -void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived) +void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) { notImplemented(); } diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index b7ead7a..ed9ac37 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -65,7 +65,7 @@ namespace WebKit { virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); - virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); + virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength); virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); @@ -81,7 +81,7 @@ namespace WebKit { virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); - virtual void dispatchDidReceiveTitle(const WTF::String&); + virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&); virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); @@ -174,7 +174,7 @@ namespace WebKit { virtual void prepareForDataSourceReplacement(); virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); - virtual void setTitle(const WTF::String& title, const WebCore::KURL&); + virtual void setTitle(const WebCore::StringWithDirection& title, const WebCore::KURL&); virtual WTF::String userAgent(const WebCore::KURL&); diff --git a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.h b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.h index c294a3d..5d93c07 100644 --- a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.h +++ b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.h @@ -49,7 +49,7 @@ class TextCheckerClientEnchant : public WebCore::TextCheckerClient { virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); - virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {} + virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) {} void updateSpellCheckingLanguage(const char*); static void freeSpellCheckingLanguage(gpointer, gpointer); |