summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/gtk/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/gtk/WebCoreSupport')
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp36
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp5
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h3
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp6
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/DragClientGtk.h1
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp110
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h21
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp17
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h4
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp172
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h3
11 files changed, 245 insertions, 133 deletions
diff --git a/Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp b/Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp
new file mode 100644
index 0000000..9c596f8
--- /dev/null
+++ b/Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+// Use this file to assert that various WebKit API enum values continue
+// matching WebCore defined enum values.
+
+#include "config.h"
+
+#include "DumpRenderTreeSupportGtk.h"
+#include "FindOptions.h"
+#include <wtf/Assertions.h>
+
+#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
+ COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums)
+
+COMPILE_ASSERT_MATCHING_ENUM(WebFindOptionsCaseInsensitive , CaseInsensitive);
+COMPILE_ASSERT_MATCHING_ENUM(WebFindOptionsAtWordStarts, AtWordStarts);
+COMPILE_ASSERT_MATCHING_ENUM(WebFindOptionsTreatMedialCapitalAsWordStart, TreatMedialCapitalAsWordStart);
+COMPILE_ASSERT_MATCHING_ENUM(WebFindOptionsBackwards, Backwards);
+COMPILE_ASSERT_MATCHING_ENUM(WebFindOptionsWrapAround, WrapAround);
+COMPILE_ASSERT_MATCHING_ENUM(WebFindOptionsStartInSelection, StartInSelection);
diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 04ee8ba..bbfdd72 100644
--- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -674,6 +674,11 @@ bool ChromeClient::selectItemWritingDirectionIsNatural()
return true;
}
+bool ChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
+{
+ return false;
+}
+
PassRefPtr<WebCore::PopupMenu> ChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
{
return adoptRef(new PopupMenuGtk(client));
diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
index d607c54..d7644eb 100644
--- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
+++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
@@ -128,8 +128,6 @@ namespace WebKit {
virtual void formStateDidChange(const WebCore::Node*) { }
- virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
-
virtual void setCursor(const WebCore::Cursor&);
virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const {}
@@ -137,6 +135,7 @@ namespace WebKit {
virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
virtual bool selectItemWritingDirectionIsNatural();
+ virtual bool selectItemAlignmentFollowsMenuWritingDirection();
virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
#if ENABLE(VIDEO)
diff --git a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
index 836ec28..33ab4fa 100644
--- a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
@@ -151,12 +151,6 @@ void DragClient::drawDragIconWindow(GtkWidget* widget, cairo_t* context)
cairo_fill(context);
}
-DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*)
-{
- notImplemented();
- return 0;
-}
-
void DragClient::dragControllerDestroyed()
{
delete this;
diff --git a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.h
index 3a16ae5..4135ea3 100644
--- a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.h
+++ b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.h
@@ -50,7 +50,6 @@ namespace WebKit {
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint);
virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false);
- virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WTF::String& label, WebCore::Frame*);
virtual void dragControllerDestroyed();
diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
index 6f31887..83f7c21 100644
--- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
@@ -2,6 +2,7 @@
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -47,7 +48,9 @@
#include "RenderTreeAsText.h"
#include "RenderView.h"
#include "SecurityOrigin.h"
+#include "TextIterator.h"
#include "WorkerThread.h"
+#include "webkitglobalsprivate.h"
#include "webkitwebframe.h"
#include "webkitwebframeprivate.h"
#include "webkitwebview.h"
@@ -93,6 +96,11 @@ bool DumpRenderTreeSupportGtk::linksIncludedInFocusChain()
return s_linksIncludedInTabChain;
}
+void DumpRenderTreeSupportGtk::setIconDatabaseEnabled(bool enabled)
+{
+ WebKit::setIconDatabaseEnabled(enabled);
+}
+
JSValueRef DumpRenderTreeSupportGtk::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
{
JSLock lock(SilenceAssertionsOnly);
@@ -466,6 +474,102 @@ bool DumpRenderTreeSupportGtk::isCommandEnabled(WebKitWebView* webView, const gc
return core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
}
+void DumpRenderTreeSupportGtk::setComposition(WebKitWebView* webView, const char* text, int start, int end)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+ g_return_if_fail(text);
+
+ Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+ if (!frame)
+ return;
+
+ Editor* editor = frame->editor();
+ if (!editor)
+ return;
+ if (!editor->canEdit() && !editor->hasComposition())
+ return;
+
+ String compositionString = String::fromUTF8(text);
+ Vector<CompositionUnderline> underlines;
+ underlines.append(CompositionUnderline(0, compositionString.length(), Color(0, 0, 0), false));
+ editor->setComposition(compositionString, underlines, start, end);
+}
+
+void DumpRenderTreeSupportGtk::confirmComposition(WebKitWebView* webView, const char* text)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+
+ Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+ if (!frame)
+ return;
+
+ Editor* editor = frame->editor();
+ if (!editor || (!editor->hasComposition() && !text))
+ return;
+
+ if (editor->hasComposition()) {
+ if (text)
+ editor->confirmComposition(String::fromUTF8(text));
+ else
+ editor->confirmComposition();
+ } else
+ editor->insertText(String::fromUTF8(text), 0);
+}
+
+bool DumpRenderTreeSupportGtk::firstRectForCharacterRange(WebKitWebView* webView, int location, int length, GdkRectangle* rect)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false);
+ g_return_val_if_fail(rect, false);
+
+ if ((location + length < location) && (location + length))
+ length = 0;
+
+ Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+ if (!frame)
+ return false;
+
+ Editor* editor = frame->editor();
+ if (!editor)
+ return false;
+
+ Element* selectionRoot = frame->selection()->rootEditableElement();
+ Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
+ RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(scope, location, length);
+ if (!range)
+ return false;
+
+ *rect = editor->firstRectForRange(range.get());
+
+ return true;
+}
+
+bool DumpRenderTreeSupportGtk::selectedRange(WebKitWebView* webView, int* start, int* end)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false);
+ g_return_val_if_fail(start, false);
+ g_return_val_if_fail(end, false);
+
+ Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+ if (!frame)
+ return false;
+
+ RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
+
+ Element* selectionRoot = frame->selection()->rootEditableElement();
+ Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
+
+ RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
+ ASSERT(testRange->startContainer() == scope);
+ *start = TextIterator::rangeLength(testRange.get());
+
+ ExceptionCode ec;
+ testRange->setEnd(range->endContainer(), range->endOffset(), ec);
+ ASSERT(testRange->startContainer() == scope);
+ *end = TextIterator::rangeLength(testRange.get());
+
+ return true;
+}
+
void DumpRenderTreeSupportGtk::whiteListAccessFromOrigin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains)
{
SecurityOrigin::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
@@ -532,3 +636,9 @@ bool DumpRenderTreeSupportGtk::webkitWebFrameSelectionHasSpellingMarker(WebKitWe
return core(frame)->editor()->selectionStartHasSpellingMarkerFor(from, length);
}
+
+bool DumpRenderTreeSupportGtk::findString(WebKitWebView* webView, const gchar* targetString, WebKitFindOptions findOptions)
+{
+ return core(webView)->findString(String::fromUTF8(targetString), findOptions);
+}
+
diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
index 663f13a..553d7bb 100644
--- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
+++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
@@ -19,7 +19,6 @@
#ifndef DumpRenderTreeSupportGtk_h
#define DumpRenderTreeSupportGtk_h
-
#include "JSStringRef.h"
#include <webkit/webkitdefines.h>
@@ -29,6 +28,20 @@
#include <webkit/webkitwebframe.h>
#include <wtf/text/CString.h>
+namespace WebKit {
+
+enum {
+ WebFindOptionsCaseInsensitive = 1 << 0,
+ WebFindOptionsAtWordStarts = 1 << 1,
+ WebFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
+ WebFindOptionsBackwards = 1 << 3,
+ WebFindOptionsWrapAround = 1 << 4,
+ WebFindOptionsStartInSelection = 1 << 5
+};
+
+}
+typedef unsigned WebKitFindOptions;
+
class DumpRenderTreeSupportGtk {
public:
@@ -40,6 +53,7 @@ public:
static void setLinksIncludedInFocusChain(bool);
static bool linksIncludedInFocusChain();
+ static void setIconDatabaseEnabled(bool);
static JSValueRef nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping);
static void dumpConfigurationForViewport(WebKitWebView* webView, gint availableWidth, gint availableHeight);
@@ -70,6 +84,11 @@ public:
// WebKitWebView
static void executeCoreCommandByName(WebKitWebView*, const gchar* name, const gchar* value);
static bool isCommandEnabled(WebKitWebView*, const gchar* name);
+ static bool findString(WebKitWebView*, const gchar*, WebKitFindOptions);
+ static void setComposition(WebKitWebView*, const char* text, int start, int end);
+ static void confirmComposition(WebKitWebView*, const char* text);
+ static bool firstRectForCharacterRange(WebKitWebView*, int location, int length, GdkRectangle*);
+ static bool selectedRange(WebKitWebView*, int* start, int* end);
// GC
static void gcCollectJavascriptObjects();
diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 8f1a819..875455a 100644
--- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -98,6 +98,7 @@ FrameLoaderClient::FrameLoaderClient(WebKitWebFrame* frame)
, m_loadingErrorPage(false)
, m_pluginView(0)
, m_hasSentResponseToPlugin(false)
+ , m_hasRepresentation(false)
{
ASSERT(m_frame);
}
@@ -606,7 +607,7 @@ PassRefPtr<Frame> FrameLoaderClient::createFrame(const KURL& url, const String&
g_signal_emit_by_name(webView, "frame-created", kitFrame);
- childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
+ parentFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
// The frame's onload handler may have removed it from the document.
if (!childFrame->tree()->parent())
@@ -773,14 +774,14 @@ void FrameLoaderClient::didDisplayInsecureContent()
notImplemented();
}
-void FrameLoaderClient::didRunInsecureContent(SecurityOrigin*)
+void FrameLoaderClient::didRunInsecureContent(SecurityOrigin*, const KURL&)
{
notImplemented();
}
void FrameLoaderClient::makeRepresentation(WebCore::DocumentLoader*)
{
- notImplemented();
+ m_hasRepresentation = true;
}
void FrameLoaderClient::forceLayout()
@@ -834,7 +835,7 @@ void FrameLoaderClient::dispatchDidChangeLocationWithinPage()
{
WebKitWebFramePrivate* priv = m_frame->priv;
g_free(priv->uri);
- priv->uri = g_strdup(core(m_frame)->loader()->url().prettyURL().utf8().data());
+ priv->uri = g_strdup(core(m_frame)->document()->url().prettyURL().utf8().data());
g_object_notify(G_OBJECT(m_frame), "uri");
WebKitWebView* webView = getViewFromFrame(m_frame);
if (m_frame == webkit_web_view_get_main_frame(webView))
@@ -980,7 +981,7 @@ void FrameLoaderClient::dispatchDidLoadMainResource(WebCore::DocumentLoader*)
void FrameLoaderClient::revertToProvisionalState(WebCore::DocumentLoader*)
{
- notImplemented();
+ m_hasRepresentation = true;
}
void FrameLoaderClient::willChangeTitle(WebCore::DocumentLoader*)
@@ -1028,8 +1029,10 @@ String FrameLoaderClient::generatedMIMETypeForURLScheme(const String&) const
void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader)
{
if (!m_pluginView) {
- FrameLoader* loader = documentLoader->frameLoader();
- loader->writer()->setEncoding(m_response.textEncodingName(), false);
+ // This is necessary to create an empty document,
+ // but it has to be skipped in the provisional phase.
+ if (m_hasRepresentation)
+ documentLoader->writer()->setEncoding("", false);
} else {
m_pluginView->didFinishLoading();
m_pluginView = 0;
diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
index d8d3684..2e8a2dd 100644
--- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
+++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
@@ -146,7 +146,7 @@ namespace WebKit {
virtual void dispatchDidChangeBackForwardIndex() const;
virtual void didDisplayInsecureContent();
- virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&);
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
@@ -201,6 +201,8 @@ namespace WebKit {
// Plugin view to redirect data to
WebCore::PluginView* m_pluginView;
bool m_hasSentResponseToPlugin;
+
+ bool m_hasRepresentation;
};
}
diff --git a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index 31af243..66f375a 100644
--- a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -23,6 +23,7 @@
#include "Frame.h"
#include "InspectorController.h"
#include "NotImplemented.h"
+#include "Page.h"
#include "PlatformString.h"
#include "webkitversion.h"
#include "webkitwebinspector.h"
@@ -40,6 +41,64 @@ static void notifyWebViewDestroyed(WebKitWebView* webView, InspectorFrontendClie
inspectorFrontendClient->destroyInspectorWindow(true);
}
+namespace {
+
+class InspectorFrontendSettingsGtk : public InspectorFrontendClientLocal::Settings {
+private:
+ virtual ~InspectorFrontendSettingsGtk() { }
+#ifdef HAVE_GSETTINGS
+ static bool shouldIgnoreSetting(const String& key)
+ {
+ // GSettings considers trying to fetch or set a setting that is
+ // not backed by a schema as programmer error, and aborts the
+ // program's execution. We check here to avoid having an unhandled
+ // setting as a fatal error.
+ LOG_VERBOSE(NotYetImplemented, "Unknown key ignored: %s", key.ascii().data());
+ return true;
+ }
+
+ virtual String getProperty(const String& name)
+ {
+ if (shouldIgnoreSetting(name))
+ return String();
+
+ GSettings* settings = inspectorGSettings();
+ if (!settings)
+ return String();
+
+ GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, name.utf8().data()));
+ return String(g_variant_get_string(variant.get(), 0));
+ }
+
+ virtual void setProperty(const String& name, const String& value)
+ {
+ // Avoid setting unknown keys to avoid aborting the execution.
+ if (shouldIgnoreSetting(name))
+ return;
+
+ GSettings* settings = inspectorGSettings();
+ if (!settings)
+ return;
+
+ GRefPtr<GVariant> variant = adoptGRef(g_variant_new_string(value.utf8().data()));
+ g_settings_set_value(settings, name.utf8().data(), variant.get());
+ }
+#else
+ virtual String getProperty(const String&)
+ {
+ notImplemented();
+ return String();
+ }
+
+ virtual void setProperty(const String&, const String&)
+ {
+ notImplemented();
+ }
+#endif // HAVE_GSETTINGS
+};
+
+} // namespace
+
InspectorClient::InspectorClient(WebKitWebView* webView)
: m_inspectedWebView(webView)
, m_frontendPage(0)
@@ -113,117 +172,6 @@ void InspectorClient::hideHighlight()
gtk_widget_queue_draw(GTK_WIDGET(m_inspectedWebView));
}
-#ifdef HAVE_GSETTINGS
-static String toGSettingName(String inspectorSettingName)
-{
- if (inspectorSettingName == "resourceTrackingEnabled")
- return String("resource-tracking-enabled");
-
- if (inspectorSettingName == "xhrMonitor")
- return String("xhr-monitor-enabled");
-
- if (inspectorSettingName == "frontendSettings")
- return String("frontend-settings");
-
- if (inspectorSettingName == "debuggerEnabled")
- return String("debugger-enabled");
-
- if (inspectorSettingName == "profilerEnabled")
- return String("profiler-enabled");
-
- return inspectorSettingName;
-}
-
-static String truthStringFromVariant(GVariant* variant)
-{
- if (g_variant_get_boolean(variant))
- return String("true");
-
- return String("false");
-}
-
-static GVariant* variantFromTruthString(const String& truth)
-{
- if (truth == "true")
- return g_variant_new_boolean(TRUE);
-
- return g_variant_new_boolean(FALSE);
-}
-
-static bool shouldIgnoreSetting(const String& key)
-{
- // Ignore this setting for now, it doesn't seem to be used for
- // anything right now.
- if (key == "lastActivePanel")
- return true;
-
- // GSettings considers trying to fetch or set a setting that is
- // not backed by a schema as programmer error, and aborts the
- // program's execution. We check here to avoid having an unhandled
- // setting as a fatal error.
- if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
- || key == "frontendSettings" || key == "debuggerEnabled"
- || key == "profilerEnabled")
- return false;
-
- LOG_VERBOSE(NotYetImplemented, "Unknown key ignored: %s", key.ascii().data());
- return true;
-}
-
-void InspectorClient::populateSetting(const String& key, String* value)
-{
- if (shouldIgnoreSetting(key))
- return;
-
- GSettings* settings = inspectorGSettings();
- if (!settings)
- return;
-
- GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, toGSettingName(key).utf8().data()));
-
- if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
- || key == "debuggerEnabled" || key == "profilerEnabled")
- *value = truthStringFromVariant(variant.get());
- else if (key == "frontendSettings")
- *value = String(g_variant_get_string(variant.get(), 0));
-}
-
-void InspectorClient::storeSetting(const String& key, const String& value)
-{
- if (shouldIgnoreSetting(key))
- return;
-
- GSettings* settings = inspectorGSettings();
- if (!settings)
- return;
-
- GRefPtr<GVariant> variant(0);
-
- // Set the key with the appropriate type, and also avoid setting
- // unknown keys to avoid aborting the execution.
- if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
- || key == "debuggerEnabled" || key == "profilerEnabled")
- variant = adoptGRef(variantFromTruthString(value));
- else if (key == "frontendSettings")
- variant = adoptGRef(g_variant_new_string(value.utf8().data()));
-
- if (!variant)
- return;
-
- g_settings_set_value(settings, toGSettingName(key).utf8().data(), variant.get());
-}
-#else
-void InspectorClient::populateSetting(const String&, String*)
-{
- notImplemented();
-}
-
-void InspectorClient::storeSetting(const String&, const String&)
-{
- notImplemented();
-}
-#endif // HAVE_GSETTINGS
-
bool InspectorClient::sendMessageToFrontend(const String& message)
{
return doDispatchMessageOnFrontendPage(m_frontendPage, message);
@@ -244,7 +192,7 @@ const char* InspectorClient::inspectorFilesPath()
}
InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient)
- : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage)
+ : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage, new InspectorFrontendSettingsGtk())
, m_inspectorWebView(inspectorWebView)
, m_inspectedWebView(inspectedWebView)
, m_webInspector(webInspector)
diff --git a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
index 08038f6..d5918ba 100644
--- a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
+++ b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
@@ -59,9 +59,6 @@ namespace WebKit {
virtual void highlight(WebCore::Node*);
virtual void hideHighlight();
- virtual void populateSetting(const WTF::String& key, WTF::String* value);
- virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-
virtual bool sendMessageToFrontend(const WTF::String&);
void releaseFrontendPage();