Diff
Modified: trunk/Source/WebKit2/ChangeLog (110424 => 110425)
--- trunk/Source/WebKit2/ChangeLog 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/ChangeLog 2012-03-12 14:36:17 UTC (rev 110425)
@@ -1,3 +1,45 @@
+2012-03-11 Timothy Hatcher <[email protected]>
+
+ Update how the Web Inspector resources are loaded.
+
+ https://bugs.webkit.org/show_bug.cgi?id=80814
+ rdar://problem/10359959
+
+ Reviewed by John Sullivan.
+
+ * Shared/WebPreferencesStore.h:
+ (WebKit): Added InspectorUsesWebKitUserInterface.
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode): Removed webInspectorLocalizedStringsPath.
+ (WebKit::WebProcessCreationParameters::decode): Ditto.
+ * Shared/WebProcessCreationParameters.h: Ditto.
+ (WebProcessCreationParameters): Ditto.
+ * UIProcess/API/C/WKContext.cpp:
+ * UIProcess/API/C/WKContextPrivate.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetInspectorUsesWebKitUserInterface): Added.
+ (WKPreferencesGetInspectorUsesWebKitUserInterface): Added.
+ * UIProcess/API/C/WKPreferencesPrivate.h:
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::ensureWebProcess): Removed webInspectorLocalizedStringsPath.
+ * UIProcess/WebContext.h:
+ (WebContext): Ditto.
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::inspectorReallyUsesWebKitUserInterface): Added.
+ (WebKit::WebInspectorProxy::createInspectorWindow): Use inspectorReallyUsesWebKitUserInterface
+ to determine if texture should be used.
+ (WebKit::WebInspectorProxy::inspectorPageURL): Choose the right path.
+ (WebKit::WebInspectorProxy::inspectorBaseURL): Ditto.
+ * WebProcess/WebPage/WebInspector.h:
+ * WebProcess/WebPage/mac/WebInspectorMac.mm:
+ (WebKit::inspectorReallyUsesWebKitUserInterface):
+ (WebKit::WebInspector::setInspectorUsesWebKitUserInterface): Added.
+ (WebKit::WebInspector::localizedStringsURL):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::platformPreferencesDidChange): Call WebInspector::setInspectorUsesWebKitUserInterface.
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess): Removed call to WebInspector::setLocalizedStringsPath.
+
2012-03-11 Andy Estes <[email protected]>
Remove unnecessary call to NSSizeToCGSize().
Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (110424 => 110425)
--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h 2012-03-12 14:36:17 UTC (rev 110425)
@@ -95,6 +95,7 @@
macro(MediaPlaybackRequiresUserGesture, mediaPlaybackRequiresUserGesture, Bool, bool, false) \
macro(MediaPlaybackAllowsInline, mediaPlaybackAllowsInline, Bool, bool, true) \
macro(InspectorStartsAttached, inspectorStartsAttached, Bool, bool, true) \
+ macro(InspectorUsesWebKitUserInterface, inspectorUsesWebKitUserInterface, Bool, bool, false) \
macro(ShowsToolTipOverTruncatedText, showsToolTipOverTruncatedText, Bool, bool, false) \
macro(MockScrollbarsEnabled, mockScrollbarsEnabled, Bool, bool, false) \
macro(WebAudioEnabled, webAudioEnabled, Bool, bool, false) \
Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (110424 => 110425)
--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp 2012-03-12 14:36:17 UTC (rev 110425)
@@ -54,7 +54,6 @@
encoder->encode(applicationCacheDirectory);
encoder->encode(databaseDirectory);
encoder->encode(localStorageDirectory);
- encoder->encode(webInspectorLocalizedStringsPath);
encoder->encode(urlSchemesRegistererdAsEmptyDocument);
encoder->encode(urlSchemesRegisteredAsSecure);
encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden);
@@ -117,8 +116,6 @@
return false;
if (!decoder->decode(parameters.localStorageDirectory))
return false;
- if (!decoder->decode(parameters.webInspectorLocalizedStringsPath))
- return false;
if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument))
return false;
if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure))
Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (110424 => 110425)
--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h 2012-03-12 14:36:17 UTC (rev 110425)
@@ -57,7 +57,6 @@
String applicationCacheDirectory;
String databaseDirectory;
String localStorageDirectory;
- String webInspectorLocalizedStringsPath;
Vector<String> urlSchemesRegistererdAsEmptyDocument;
Vector<String> urlSchemesRegisteredAsSecure;
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp 2012-03-12 14:36:17 UTC (rev 110425)
@@ -235,21 +235,6 @@
toImpl(contextRef)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string());
}
-void WKContextSetOverrideWebInspectorBaseDirectory(WKContextRef contextRef, WKStringRef webInspectorBaseDirectory)
-{
- toImpl(contextRef)->setOverrideWebInspectorBaseDirectory(toImpl(webInspectorBaseDirectory)->string());
-}
-
-void WKContextSetOverrideWebInspectorPagePath(WKContextRef contextRef, WKStringRef webInspectorPagePath)
-{
- toImpl(contextRef)->setOverrideWebInspectorPagePath(toImpl(webInspectorPagePath)->string());
-}
-
-void WKContextSetOverrideWebInspectorLocalizedStringsPath(WKContextRef contextRef, WKStringRef webInspectorLocalizedStringsPath)
-{
- toImpl(contextRef)->setOverrideWebInspectorLocalizedStringsPath(toImpl(webInspectorLocalizedStringsPath)->string());
-}
-
void WKContextDisableProcessTermination(WKContextRef contextRef)
{
toImpl(contextRef)->disableProcessTermination();
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h 2012-03-12 14:36:17 UTC (rev 110425)
@@ -62,9 +62,6 @@
// we should really change these settings to be on WebPreferences and changeable at runtime.
WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory);
WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory);
-WK_EXPORT void WKContextSetOverrideWebInspectorBaseDirectory(WKContextRef context, WKStringRef webInspectorBaseDirectory);
-WK_EXPORT void WKContextSetOverrideWebInspectorPagePath(WKContextRef context, WKStringRef webInspectorPagePath);
-WK_EXPORT void WKContextSetOverrideWebInspectorLocalizedStringsPath(WKContextRef context, WKStringRef webInspectorLocalizedStringsPath);
// FIXME: This is a workaround for testing purposes only and should be removed once a better
// solution has been found for testing.
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2012-03-12 14:36:17 UTC (rev 110425)
@@ -678,6 +678,16 @@
return toImpl(preferencesRef)->applicationChromeMode();
}
+void WKPreferencesSetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setInspectorUsesWebKitUserInterface(enabled);
+}
+
+bool WKPreferencesGetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->inspectorUsesWebKitUserInterface();
+}
+
void WKPreferencesSetSuppressesIncrementalRendering(WKPreferencesRef preferencesRef, bool enabled)
{
toImpl(preferencesRef)->setSuppressesIncrementalRendering(enabled);
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h 2012-03-12 14:36:17 UTC (rev 110425)
@@ -167,6 +167,10 @@
WK_EXPORT void WKPreferencesSetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef, bool enabled);
WK_EXPORT bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef);
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef);
+
WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
#ifdef __cplusplus
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-03-12 14:36:17 UTC (rev 110425)
@@ -259,10 +259,8 @@
parameters.applicationCacheDirectory = applicationCacheDirectory();
parameters.databaseDirectory = databaseDirectory();
parameters.localStorageDirectory = localStorageDirectory();
- parameters.webInspectorLocalizedStringsPath = m_overrideWebInspectorLocalizedStringsPath;
#if PLATFORM(MAC)
- parameters.webInspectorBaseDirectory = m_overrideWebInspectorBaseDirectory;
parameters.presenterApplicationPid = getpid();
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2012-03-12 14:36:17 UTC (rev 110425)
@@ -174,14 +174,6 @@
String iconDatabasePath() const;
void setLocalStorageDirectory(const String& dir) { m_overrideLocalStorageDirectory = dir; }
- String overrideWebInspectorBaseDirectory() const { return m_overrideWebInspectorBaseDirectory; }
- void setOverrideWebInspectorBaseDirectory(const String& path) { m_overrideWebInspectorBaseDirectory = path; }
-
- String overrideWebInspectorPagePath() const { return m_overrideWebInspectorPagePath; }
- void setOverrideWebInspectorPagePath(const String& path) { m_overrideWebInspectorPagePath = path; }
-
- void setOverrideWebInspectorLocalizedStringsPath(const String& path) { m_overrideWebInspectorLocalizedStringsPath = path; }
-
void ensureWebProcess();
void warmInitialProcess();
@@ -315,9 +307,6 @@
String m_overrideDatabaseDirectory;
String m_overrideIconDatabasePath;
String m_overrideLocalStorageDirectory;
- String m_overrideWebInspectorBaseDirectory;
- String m_overrideWebInspectorPagePath;
- String m_overrideWebInspectorLocalizedStringsPath;
bool m_processTerminationEnabled;
Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (110424 => 110425)
--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm 2012-03-12 14:36:17 UTC (rev 110425)
@@ -39,9 +39,11 @@
#import <WebKitSystemInterface.h>
#import <WebCore/InspectorFrontendClientLocal.h>
#import <WebCore/LocalizedStrings.h>
-#import <WebCore/NotImplemented.h>
+#import <WebCore/SoftLinking.h>
#import <wtf/text/WTFString.h>
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(WebInspector)
+
using namespace WebCore;
using namespace WebKit;
@@ -102,11 +104,24 @@
namespace WebKit {
+static bool inspectorReallyUsesWebKitUserInterface(WebPreferences* preferences)
+{
+ // This matches a similar check in WebInspectorMac.mm. Keep them in sync.
+
+ // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
+ WebInspectorLibrary();
+
+ if (![[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"])
+ return true;
+
+ return preferences->inspectorUsesWebKitUserInterface();
+}
+
void WebInspectorProxy::createInspectorWindow()
{
ASSERT(!m_inspectorWindow);
- bool useTexturedWindow = page()->process()->context()->overrideWebInspectorPagePath().isEmpty();
+ bool useTexturedWindow = inspectorReallyUsesWebKitUserInterface(page()->pageGroup()->preferences());
NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask);
if (useTexturedWindow)
@@ -302,9 +317,11 @@
String WebInspectorProxy::inspectorPageURL() const
{
- NSString *path = page()->process()->context()->overrideWebInspectorPagePath();
- if (![path length])
+ NSString *path;
+ if (inspectorReallyUsesWebKitUserInterface(page()->pageGroup()->preferences()))
path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
+ else
+ path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"];
ASSERT([path length]);
@@ -313,11 +330,11 @@
String WebInspectorProxy::inspectorBaseURL() const
{
- NSString *path = page()->process()->context()->overrideWebInspectorBaseDirectory();
- if (![path length]) {
- // WebCore's Web Inspector uses localized strings, which are not contained within inspector directory.
+ NSString *path;
+ if (inspectorReallyUsesWebKitUserInterface(page()->pageGroup()->preferences()))
path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] resourcePath];
- }
+ else
+ path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] resourcePath];
ASSERT([path length]);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (110424 => 110425)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2012-03-12 14:36:17 UTC (rev 110425)
@@ -30,8 +30,8 @@
#include "APIObject.h"
#include "Connection.h"
-#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
+#include <wtf/text/WTFString.h>
namespace WebKit {
@@ -62,7 +62,7 @@
void stopPageProfiling();
#if PLATFORM(MAC)
- static void setLocalizedStringsPath(const String&);
+ void setInspectorUsesWebKitUserInterface(bool);
#endif
private:
@@ -108,6 +108,9 @@
WebPage* m_page;
WebPage* m_inspectorPage;
WebInspectorFrontendClient* m_frontendClient;
+#if PLATFORM(MAC)
+ String m_localizedStringsURL;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm (110424 => 110425)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm 2012-03-12 14:36:17 UTC (rev 110425)
@@ -26,27 +26,38 @@
#import "config.h"
#import "WebInspector.h"
-#import <wtf/text/WTFString.h>
+#import <WebCore/SoftLinking.h>
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(WebInspector)
+
namespace WebKit {
-static String& globalInspectorLocalizedStringsURL()
+static bool inspectorReallyUsesWebKitUserInterface(bool preference)
{
- DEFINE_STATIC_LOCAL(String, inspectorLocalizedStringsURL, ());
- return inspectorLocalizedStringsURL;
+ // This matches a similar check in WebInspectorProxyMac.mm. Keep them in sync.
+
+ // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
+ WebInspectorLibrary();
+
+ if (![[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"])
+ return true;
+
+ return preference;
}
-void WebInspector::setLocalizedStringsPath(const String& path)
+void WebInspector::setInspectorUsesWebKitUserInterface(bool flag)
{
- if (!path.isEmpty())
- globalInspectorLocalizedStringsURL() = [[NSURL fileURLWithPath:path] absoluteString];
+ NSString *bundleIdentifier = inspectorReallyUsesWebKitUserInterface(flag) ? @"com.apple.WebCore" : @"com.apple.WebInspector";
+ NSString *path = [[NSBundle bundleWithIdentifier:bundleIdentifier] pathForResource:@"localizedStrings" ofType:@"js"];
+ if ([path length])
+ m_localizedStringsURL = [[NSURL fileURLWithPath:path] absoluteString];
else
- globalInspectorLocalizedStringsURL() = String();
+ m_localizedStringsURL = String();
}
String WebInspector::localizedStringsURL() const
{
- return globalInspectorLocalizedStringsURL();
+ return m_localizedStringsURL;
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (110424 => 110425)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2012-03-12 14:36:17 UTC (rev 110425)
@@ -35,7 +35,9 @@
#import "WebEvent.h"
#import "WebEventConversion.h"
#import "WebFrame.h"
+#import "WebInspector.h"
#import "WebPageProxyMessages.h"
+#import "WebPreferencesStore.h"
#import "WebProcess.h"
#import <WebCore/AXObjectCache.h>
#import <WebCore/FocusController.h>
@@ -83,8 +85,10 @@
m_mockAccessibilityElement = mockAccessibilityElement;
}
-void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
+void WebPage::platformPreferencesDidChange(const WebPreferencesStore& store)
{
+ if (WebInspector* inspector = this->inspector())
+ inspector->setInspectorUsesWebKitUserInterface(store.getBoolValueForKey(WebPreferencesKey::inspectorUsesWebKitUserInterfaceKey()));
}
typedef HashMap<String, String> SelectorNameMap;
Modified: trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (110424 => 110425)
--- trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm 2012-03-12 14:33:32 UTC (rev 110424)
+++ trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm 2012-03-12 14:36:17 UTC (rev 110425)
@@ -249,10 +249,8 @@
[NSURLCache setSharedURLCache:parentProcessURLCache.get()];
}
- WebInspector::setLocalizedStringsPath(parameters.webInspectorLocalizedStringsPath);
-
m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
-
+
#if ENABLE(NOTIFICATIONS)
m_notificationManager.initialize(parameters.notificationPermissions);
#endif