diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebKit/gtk/WebCoreSupport | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebKit/gtk/WebCoreSupport')
7 files changed, 65 insertions, 29 deletions
diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 8e828ac..9f21139 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -79,6 +79,9 @@ ChromeClient::ChromeClient(WebKitWebView* webView) void ChromeClient::chromeDestroyed() { + if (m_closeSoonTimer) + g_source_remove(m_closeSoonTimer); + delete this; } @@ -720,8 +723,11 @@ void ChromeClient::exitFullscreenForNode(Node* node) #endif #if ENABLE(FULLSCREEN_API) -bool ChromeClient::supportsFullScreenForElement(const WebCore::Element* element) +bool ChromeClient::supportsFullScreenForElement(const WebCore::Element* element, bool withKeyboard) { + if (withKeyboard) + return false; + return true; } diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index 462ddc4..2bf81eb 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -145,7 +145,7 @@ namespace WebKit { #endif #if ENABLE(FULLSCREEN_API) - virtual bool supportsFullScreenForElement(const WebCore::Element*); + virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard); virtual void enterFullScreenForElement(WebCore::Element*); virtual void exitFullScreenForElement(WebCore::Element*); #endif diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 6db2c81..1336f11 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -34,6 +34,8 @@ #include "FrameView.h" #include "GCController.h" #include "GraphicsContext.h" +#include "HTMLInputElement.h" +#include "InputElement.h" #include "JSDOMWindow.h" #include "JSDocument.h" #include "JSElement.h" @@ -98,11 +100,6 @@ bool DumpRenderTreeSupportGtk::linksIncludedInFocusChain() return s_linksIncludedInTabChain; } -void DumpRenderTreeSupportGtk::setIconDatabaseEnabled(bool enabled) -{ - WebKit::setIconDatabaseEnabled(enabled); -} - void DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(bool enabled) { s_selectTrailingWhitespaceEnabled = enabled; @@ -629,7 +626,7 @@ void DumpRenderTreeSupportGtk::dumpConfigurationForViewport(WebKitWebView* webVi ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments(); ViewportAttributes attrs = computeViewportAttributes(arguments, /* default layout width for non-mobile pages */ 980, deviceWidth, deviceHeight, deviceDPI, IntSize(availableWidth, availableHeight)); - fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f]\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale); + fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale, attrs.userScalable); } void DumpRenderTreeSupportGtk::clearOpener(WebKitWebFrame* frame) @@ -652,7 +649,7 @@ bool DumpRenderTreeSupportGtk::webkitWebFrameSelectionHasSpellingMarker(WebKitWe { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), FALSE); - return core(frame)->editor()->selectionStartHasSpellingMarkerFor(from, length); + return core(frame)->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length); } bool DumpRenderTreeSupportGtk::findString(WebKitWebView* webView, const gchar* targetString, WebKitFindOptions findOptions) @@ -669,3 +666,32 @@ void DumpRenderTreeSupportGtk::setMinimumTimerInterval(WebKitWebView* webView, d { core(webView)->settings()->setMinDOMTimerInterval(interval); } + +void DumpRenderTreeSupportGtk::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) +{ + JSC::ExecState* exec = toJS(context); + Element* element = toElement(toJS(exec, nodeObject)); + if (!element) + return; + InputElement* inputElement = element->toInputElement(); + if (!inputElement) + return; + + static_cast<HTMLInputElement*>(inputElement)->setAutofilled(autofilled); +} + +void DumpRenderTreeSupportGtk::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) +{ + JSC::ExecState* exec = toJS(context); + Element* element = toElement(toJS(exec, nodeObject)); + if (!element) + return; + InputElement* inputElement = element->toInputElement(); + if (!inputElement) + return; + + size_t bufferSize = JSStringGetMaximumUTF8CStringSize(value); + GOwnPtr<gchar> valueBuffer(static_cast<gchar*>(g_malloc(bufferSize))); + JSStringGetUTF8CString(value, valueBuffer.get(), bufferSize); + inputElement->setValueForUser(String::fromUTF8(valueBuffer.get())); +} diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 595d6da..7ad5af6 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -53,7 +53,6 @@ public: static void setLinksIncludedInFocusChain(bool); static bool linksIncludedInFocusChain(); - static void setIconDatabaseEnabled(bool); static void setSelectTrailingWhitespaceEnabled(bool); static bool selectTrailingWhitespaceEnabled(); @@ -85,6 +84,8 @@ public: static AtkObject* getFocusedAccessibleElement(WebKitWebFrame*); static AtkObject* getRootAccessibleElement(WebKitWebFrame*); static void layoutFrame(WebKitWebFrame*); + static void setAutofilled(JSContextRef, JSValueRef, bool); + static void setValueForUser(JSContextRef, JSValueRef, JSStringRef); // WebKitWebView static void executeCoreCommandByName(WebKitWebView*, const gchar* name, const gchar* value); diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index d8ea90e..ca8bf9a 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -6,6 +6,7 @@ * Copyright (C) 2009, 2010 Gustavo Noronha Silva <gns@gnome.org> * Copyright (C) Research In Motion Limited 2009. All rights reserved. * Copyright (C) 2010 Igalia S.L. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -65,6 +66,7 @@ #include "webkiterror.h" #include "webkitglobals.h" #include "webkitglobalsprivate.h" +#include "webkiticondatabase.h" #include "webkitnetworkrequest.h" #include "webkitnetworkrequestprivate.h" #include "webkitnetworkresponse.h" @@ -710,9 +712,9 @@ PassRefPtr<Widget> FrameLoaderClient::createJavaAppletWidget(const IntSize& plug return FrameLoaderClient::createPlugin(pluginSize, element, baseURL, paramNames, paramValues, "application/x-java-applet", false); } -ObjectContentType FrameLoaderClient::objectContentType(const KURL& url, const String& mimeType) +ObjectContentType FrameLoaderClient::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages) { - return FrameLoader::defaultObjectContentType(url, mimeType); + return FrameLoader::defaultObjectContentType(url, mimeType, shouldPreferPlugInsForImages); } String FrameLoaderClient::overrideMediaType() const @@ -925,6 +927,10 @@ void FrameLoaderClient::dispatchDidReceiveIcon() if (m_loadingErrorPage) return; + const gchar* frameURI = webkit_web_frame_get_uri(m_frame); + WebKitIconDatabase* database = webkit_get_icon_database(); + g_signal_emit_by_name(database, "icon-loaded", m_frame, frameURI); + WebKitWebView* webView = getViewFromFrame(m_frame); // Avoid reporting favicons for non-main frames. diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index 3340837..b7ead7a 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2011 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. * * All rights reserved. @@ -126,7 +126,7 @@ namespace WebKit { virtual void registerForIconNotification(bool); - virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WTF::String& mimeType); + virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages); virtual void setMainFrameDocumentReady(bool); diff --git a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.cpp b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.cpp index 74e8132..460000b 100644 --- a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.cpp @@ -77,16 +77,16 @@ void TextCheckerClientEnchant::checkSpellingOfString(const UChar* text, int leng if (!dicts) return; - gchar* ctext = g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 0, 0, 0); - int utflen = g_utf8_strlen(ctext, -1); + GOwnPtr<gchar> utf8Text(g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 0, 0, 0)); + int utf8Length = g_utf8_strlen(utf8Text.get(), -1); PangoLanguage* language(pango_language_get_default()); - GOwnPtr<PangoLogAttr> attrs(g_new(PangoLogAttr, utflen+1)); + GOwnPtr<PangoLogAttr> attrs(g_new(PangoLogAttr, utf8Length + 1)); // pango_get_log_attrs uses an aditional position at the end of the text. - pango_get_log_attrs(ctext, -1, -1, language, attrs.get(), utflen+1); + pango_get_log_attrs(utf8Text.get(), -1, -1, language, attrs.get(), utf8Length + 1); - for (int i = 0; i < length+1; i++) { + for (int i = 0; i < length + 1; i++) { // We go through each character until we find an is_word_start, // then we get into an inner loop to find the is_word_end corresponding // to it. @@ -103,18 +103,15 @@ void TextCheckerClientEnchant::checkSpellingOfString(const UChar* text, int leng // check characters twice. i = end; - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - gchar* cstart = g_utf8_offset_to_pointer(ctext, start); - gint bytes = static_cast<gint>(g_utf8_offset_to_pointer(ctext, end) - cstart); - gchar* word = g_new0(gchar, bytes+1); - int result; + gchar* cstart = g_utf8_offset_to_pointer(utf8Text.get(), start); + gint bytes = static_cast<gint>(g_utf8_offset_to_pointer(utf8Text.get(), end) - cstart); + GOwnPtr<gchar> word(g_new0(gchar, bytes + 1)); - g_utf8_strncpy(word, cstart, end - start); + g_utf8_strncpy(word.get(), cstart, wordLength); - result = enchant_dict_check(dict, word, -1); - g_free(word); - if (result) { + for (; dicts; dicts = dicts->next) { + EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); + if (enchant_dict_check(dict, word.get(), wordLength)) { *misspellingLocation = start; *misspellingLength = wordLength; } else { |