Title: [124477] trunk
Revision
124477
Author
[email protected]
Date
2012-08-02 10:36:59 -0700 (Thu, 02 Aug 2012)

Log Message

WebKitTestRunner needs layoutTestController.setUserStyleSheetEnabled
https://bugs.webkit.org/show_bug.cgi?id=42679

Patch by Dinu Jacob <[email protected]> on 2012-08-02
Reviewed by Eric Seidel.

Source/WebKit2:

Added WKBundleSetUserStyleSheetLocation API.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetUserStyleSheetLocation): Added.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Added WKBundleSetUserStyleSheetLocation.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setUserStyleSheetLocation): Added. Sets the user style sheet location
for all pages in the page group.
(WebKit):
* WebProcess/InjectedBundle/InjectedBundle.h:
(InjectedBundle):

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added
setUserStyleSheetEnabled and setUserStyleSheetLocation.
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::LayoutTestController): Initialize new members added.
(WTR::LayoutTestController::setUserStyleSheetEnabled): Added.
(WTR::LayoutTestController::setUserStyleSheetLocation): Added.
* WebKitTestRunner/InjectedBundle/LayoutTestController.h: Added members
userStyleSheetEnabled, and m_userStyleSheetLocation and methods
setUserStyleSheetEnabled, and setUserStyleSheetLocation.

LayoutTests:

Removed tests that are now passing.

* platform/wk2/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (124476 => 124477)


--- trunk/LayoutTests/ChangeLog	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/LayoutTests/ChangeLog	2012-08-02 17:36:59 UTC (rev 124477)
@@ -1,3 +1,14 @@
+2012-08-02  Dinu Jacob  <[email protected]>
+
+        WebKitTestRunner needs layoutTestController.setUserStyleSheetEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=42679
+
+        Reviewed by Eric Seidel.
+
+        Removed tests that are now passing.
+
+        * platform/wk2/Skipped:
+
 2012-08-02  Dominik Röttsches  <[email protected]>
 
         [EFL][GTK] Implement font-feature settings

Modified: trunk/LayoutTests/platform/wk2/Skipped (124476 => 124477)


--- trunk/LayoutTests/platform/wk2/Skipped	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/LayoutTests/platform/wk2/Skipped	2012-08-02 17:36:59 UTC (rev 124477)
@@ -611,14 +611,6 @@
 # <https://bugs.webkit.org/show_bug.cgi?id=42675>
 http/tests/cache/subresource-failover-to-network.html
 
-# WebKitTestRunner needs layoutTestController.setUserStyleSheetLocation
-# <https://bugs.webkit.org/show_bug.cgi?id=42678>
-http/tests/security/local-user-CSS-from-remote.html
-
-# WebKitTestRunner needs layoutTestController.setUserStyleSheetEnabled
-# <https://bugs.webkit.org/show_bug.cgi?id=42679> 
-fast/loader/user-stylesheet-fast-path.html
-
 # WebKitTestRunner needs layoutTestController.setCacheModel
 # <https://bugs.webkit.org/show_bug.cgi?id=42684>
 fast/dom/HTMLScriptElement/nested-execution.html

Modified: trunk/Source/WebKit2/ChangeLog (124476 => 124477)


--- trunk/Source/WebKit2/ChangeLog	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-02 17:36:59 UTC (rev 124477)
@@ -1,3 +1,22 @@
+2012-08-02  Dinu Jacob  <[email protected]>
+
+        WebKitTestRunner needs layoutTestController.setUserStyleSheetEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=42679
+
+        Reviewed by Eric Seidel.
+
+        Added WKBundleSetUserStyleSheetLocation API.
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleSetUserStyleSheetLocation): Added.
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Added WKBundleSetUserStyleSheetLocation.
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setUserStyleSheetLocation): Added. Sets the user style sheet location
+        for all pages in the page group.
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        (InjectedBundle):
+
 2012-08-02  Lauro Neto  <[email protected]>
 
         [Qt] Fix axis locking when panning on N9

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (124476 => 124477)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-08-02 17:36:59 UTC (rev 124477)
@@ -255,3 +255,8 @@
 {
     toImpl(bundleRef)->setPageVisibilityState(toImpl(pageRef), state, isInitialState);
 }
+
+void WKBundleSetUserStyleSheetLocation(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef location)
+{
+    toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toImpl(location)->string());
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (124476 => 124477)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-08-02 17:36:59 UTC (rev 124477)
@@ -74,6 +74,7 @@
 WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
+WK_EXPORT void WKBundleSetUserStyleSheetLocation(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef location);
 WK_EXPORT void WKBundleSetAuthorAndUserStylesEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleClearAllDatabases(WKBundleRef bundle);
 WK_EXPORT void WKBundleSetDatabaseQuota(WKBundleRef bundle, uint64_t);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (124476 => 124477)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-08-02 17:36:59 UTC (rev 124477)
@@ -479,4 +479,11 @@
 #endif
 }
 
+void InjectedBundle::setUserStyleSheetLocation(WebPageGroupProxy* pageGroup, const String& location)
+{
+    const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
+    for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
+        (*iter)->settings()->setUserStyleSheetLocation(KURL(KURL(), location));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (124476 => 124477)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-08-02 17:36:59 UTC (rev 124477)
@@ -123,6 +123,7 @@
     int pageNumberForElementById(WebFrame*, const String&, double, double);
     String pageSizeAndMarginsInPixels(WebFrame*, int, int, int, int, int, int, int);
     bool isPageBoxVisible(WebFrame*, int);
+    void setUserStyleSheetLocation(WebPageGroupProxy*, const String&);
 
     // UserContent API
     void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);

Modified: trunk/Tools/ChangeLog (124476 => 124477)


--- trunk/Tools/ChangeLog	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Tools/ChangeLog	2012-08-02 17:36:59 UTC (rev 124477)
@@ -1,3 +1,20 @@
+2012-08-02  Dinu Jacob  <[email protected]>
+
+        WebKitTestRunner needs layoutTestController.setUserStyleSheetEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=42679
+
+        Reviewed by Eric Seidel.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added 
+        setUserStyleSheetEnabled and setUserStyleSheetLocation.
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::LayoutTestController): Initialize new members added.
+        (WTR::LayoutTestController::setUserStyleSheetEnabled): Added.
+        (WTR::LayoutTestController::setUserStyleSheetLocation): Added.
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Added members
+        userStyleSheetEnabled, and m_userStyleSheetLocation and methods
+        setUserStyleSheetEnabled, and setUserStyleSheetLocation.
+
 2012-08-02  Hans Wennborg  <[email protected]>
 
         Speech _javascript_ API: Fire speech start event at the same time as sound start event

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl (124476 => 124477)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2012-08-02 17:36:59 UTC (rev 124477)
@@ -62,6 +62,8 @@
         void setAuthorAndUserStylesEnabled(in boolean value);
         void addOriginAccessWhitelistEntry(in DOMString sourceOrigin, in DOMString destinationProtocol, in DOMString destinationHost, in boolean allowDestinationSubdomains);
         void removeOriginAccessWhitelistEntry(in DOMString sourceOrigin, in DOMString destinationProtocol, in DOMString destinationHost, in boolean allowDestinationSubdomains);
+        void setUserStyleSheetEnabled(in boolean value);
+        void setUserStyleSheetLocation(in DOMString location);
 
         // Special DOM functions.
         void clearBackForwardList();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (124476 => 124477)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-08-02 17:36:59 UTC (rev 124477)
@@ -85,6 +85,8 @@
     , m_policyDelegatePermissive(false)
     , m_globalFlag(false)
     , m_customFullScreenBehavior(false)
+    , m_userStyleSheetEnabled(false)
+    , m_userStyleSheetLocation(adoptWK(WKStringCreateWithUTF8CString("")))
 {
     platformInitialize();
 }
@@ -664,4 +666,21 @@
     return currentTime();
 }
 
+void LayoutTestController::setUserStyleSheetEnabled(bool enabled)
+{
+    m_userStyleSheetEnabled = enabled;
+
+    WKRetainPtr<WKStringRef> emptyUrl = adoptWK(WKStringCreateWithUTF8CString(""));
+    WKStringRef location = enabled ? m_userStyleSheetLocation.get() : emptyUrl.get();
+    WKBundleSetUserStyleSheetLocation(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), location);
+}
+
+void LayoutTestController::setUserStyleSheetLocation(JSStringRef location)
+{
+    m_userStyleSheetLocation = adoptWK(WKStringCreateWithJSString(location));
+
+    if (m_userStyleSheetEnabled)
+        setUserStyleSheetEnabled(true);
+}
+
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h (124476 => 124477)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2012-08-02 17:32:35 UTC (rev 124476)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2012-08-02 17:36:59 UTC (rev 124477)
@@ -29,6 +29,7 @@
 #include "JSWrappable.h"
 #include <_javascript_Core/JSRetainPtr.h>
 #include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKRetainPtr.h>
 #include <string>
 #include <wtf/PassRefPtr.h>
 
@@ -100,6 +101,8 @@
     void setCustomPolicyDelegate(bool enabled, bool permissive = false);
     void addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
     void removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
+    void setUserStyleSheetEnabled(bool);
+    void setUserStyleSheetLocation(JSStringRef);
 
     // Special DOM functions.
     JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element);
@@ -255,6 +258,9 @@
     bool m_globalFlag;
     bool m_customFullScreenBehavior;
 
+    bool m_userStyleSheetEnabled;
+    WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
+
     PlatformTimerRef m_waitToDumpWatchdogTimer;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to