Title: [164451] trunk
Revision
164451
Author
[email protected]
Date
2014-02-20 15:11:52 -0800 (Thu, 20 Feb 2014)

Log Message

Add an unresolved WebGLPolicy and an API to resolve it
https://bugs.webkit.org/show_bug.cgi?id=129109

Reviewed by Anders Carlsson.

Source/WebCore:

Add a third WebGLLoadPolicy which is "pending" allowing the page
to go ahead with creating the WebGLRenderingContext and resolve the policy
at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext): WebGLBlock -> WebGLBlockCreation
* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::webGLPolicyForURL): WebGLAllow -> WebGLAllowCreation.
(WebCore::FrameLoaderClient::resolveWebGLPolicyForURL): New method.
* loader/FrameLoaderTypes.h: Add WebGLPendingCreation.

Source/WebKit2:

Add a third WebGLLoadPolicy which is "pending" allowing the page
to go ahead with creating the WebGLRenderingContext and resolve the policy
at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.

* UIProcess/API/APILoaderClient.h:
(API::LoaderClient::webGLLoadPolicy): New return value.
(API::LoaderClient::resolveWebGLLoadPolicy): New method definition.
* UIProcess/API/C/WKAPICast.h:
(WebKit::toWebGLLoadPolicy): Change names of return types.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient): New stubs.
* UIProcess/API/C/WKPageLoaderClient.h: New policy type kWKWebGLLoadPolicyPending.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resolveWebGLPolicyForURL): New method.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: New message.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::webGLPolicyForURL):
(WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::webGLPolicyForURL):
(WebKit::WebPage::resolveWebGLPolicyForURL):
* WebProcess/WebPage/WebPage.h:

Tools:

Add a new entry for resolveWebGLLoadPolicy.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164450 => 164451)


--- trunk/Source/WebCore/ChangeLog	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebCore/ChangeLog	2014-02-20 23:11:52 UTC (rev 164451)
@@ -1,3 +1,21 @@
+2014-02-20  Dean Jackson  <[email protected]>
+
+        Add an unresolved WebGLPolicy and an API to resolve it
+        https://bugs.webkit.org/show_bug.cgi?id=129109
+
+        Reviewed by Anders Carlsson.
+
+        Add a third WebGLLoadPolicy which is "pending" allowing the page
+        to go ahead with creating the WebGLRenderingContext and resolve the policy
+        at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContext): WebGLBlock -> WebGLBlockCreation
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::webGLPolicyForURL): WebGLAllow -> WebGLAllowCreation.
+        (WebCore::FrameLoaderClient::resolveWebGLPolicyForURL): New method.
+        * loader/FrameLoaderTypes.h: Add WebGLPendingCreation.
+
 2014-02-20  Zalan Bujtas  <[email protected]>
 
         Subpixel rendering: Enable compositing RenderLayer painting on device pixel position.

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (164450 => 164451)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2014-02-20 23:11:52 UTC (rev 164451)
@@ -226,7 +226,7 @@
                 if (page && !topDocument.url().isLocalFile()) {
                     WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
 
-                    if (policy == WebGLBlock)
+                    if (policy == WebGLBlockCreation)
                         return nullptr;
                 }
                 m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(attrs));

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (164450 => 164451)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -325,7 +325,8 @@
         // Informs the embedder that a WebGL canvas inside this frame received a lost context
         // notification with the given GL_ARB_robustness guilt/innocence code (see Extensions3D.h).
         virtual void didLoseWebGLContext(int) { }
-        virtual WebGLLoadPolicy webGLPolicyForURL(const String&) const { return WebGLAllow; }
+        virtual WebGLLoadPolicy webGLPolicyForURL(const String&) const { return WebGLAllowCreation; }
+        virtual WebGLLoadPolicy resolveWebGLPolicyForURL(const String&) const { return WebGLAllowCreation; }
 #endif
 
         virtual void forcePageTransitionIfNeeded() { }

Modified: trunk/Source/WebCore/loader/FrameLoaderTypes.h (164450 => 164451)


--- trunk/Source/WebCore/loader/FrameLoaderTypes.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebCore/loader/FrameLoaderTypes.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -107,8 +107,9 @@
     };
     
     enum WebGLLoadPolicy {
-        WebGLBlock = 0,
-        WebGLAllow
+        WebGLBlockCreation,
+        WebGLAllowCreation,
+        WebGLPendingCreation
     };
 
 }

Modified: trunk/Source/WebKit2/ChangeLog (164450 => 164451)


--- trunk/Source/WebKit2/ChangeLog	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-20 23:11:52 UTC (rev 164451)
@@ -1,3 +1,35 @@
+2014-02-20  Dean Jackson  <[email protected]>
+
+        Add an unresolved WebGLPolicy and an API to resolve it
+        https://bugs.webkit.org/show_bug.cgi?id=129109
+
+        Reviewed by Anders Carlsson.
+
+        Add a third WebGLLoadPolicy which is "pending" allowing the page
+        to go ahead with creating the WebGLRenderingContext and resolve the policy
+        at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.
+
+        * UIProcess/API/APILoaderClient.h:
+        (API::LoaderClient::webGLLoadPolicy): New return value.
+        (API::LoaderClient::resolveWebGLLoadPolicy): New method definition.
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toWebGLLoadPolicy): Change names of return types.
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageLoaderClient): New stubs.
+        * UIProcess/API/C/WKPageLoaderClient.h: New policy type kWKWebGLLoadPolicyPending.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::resolveWebGLPolicyForURL): New method.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in: New message.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::webGLPolicyForURL):
+        (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::webGLPolicyForURL):
+        (WebKit::WebPage::resolveWebGLPolicyForURL):
+        * WebProcess/WebPage/WebPage.h:
+
 2014-02-20  Anders Carlsson  <[email protected]>
 
         Make it possible to reply asynchronously to _javascript_ panels and alerts

Modified: trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -97,7 +97,8 @@
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
 #if ENABLE(WEBGL)
-    virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllow; }
+    virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllowCreation; }
+    virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllowCreation; }
 #endif // ENABLE(WEBGL)
 };
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -481,13 +481,15 @@
 {
     switch (webGLLoadPolicy) {
     case kWKWebGLLoadPolicyLoadNormally:
-        return WebCore::WebGLAllow;
+        return WebCore::WebGLAllowCreation;
     case kWKWebGLLoadPolicyBlocked:
-        return WebCore::WebGLBlock;
+        return WebCore::WebGLBlockCreation;
+    case kWKWebGLLoadPolicyPending:
+        return WebCore::WebGLPendingCreation;
     }
     
     ASSERT_NOT_REACHED();
-    return WebCore::WebGLAllow;
+    return WebCore::WebGLAllowCreation;
 }
 
 inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2014-02-20 23:11:52 UTC (rev 164451)
@@ -967,13 +967,24 @@
 #if ENABLE(WEBGL)
         virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebPageProxy* page, const String& url) const override
         {
-            WebCore::WebGLLoadPolicy loadPolicy = WebGLAllow;
+            WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation;
 
             if (m_client.webGLLoadPolicy)
                 loadPolicy = toWebGLLoadPolicy(m_client.webGLLoadPolicy(toAPI(page), toAPI(url.impl()), m_client.base.clientInfo));
 
             return loadPolicy;
         }
+
+        virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebPageProxy* page, const String& url) const override
+        {
+            WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation;
+
+            if (m_client.resolveWebGLLoadPolicy)
+                loadPolicy = toWebGLLoadPolicy(m_client.resolveWebGLLoadPolicy(toAPI(page), toAPI(url.impl()), m_client.base.clientInfo));
+
+            return loadPolicy;
+        }
+
 #endif // ENABLE(WEBGL)
     };
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -45,6 +45,7 @@
 enum {
     kWKWebGLLoadPolicyBlocked = 0,
     kWKWebGLLoadPolicyLoadNormally,
+    kWKWebGLLoadPolicyPending
 };
 typedef uint32_t WKWebGLLoadPolicy;
 
@@ -330,6 +331,7 @@
     
     // Version 4
     WKPageWebGLLoadPolicyCallback                                       webGLLoadPolicy;
+    WKPageWebGLLoadPolicyCallback                                       resolveWebGLLoadPolicy;
 } WKPageLoaderClientV4;
 
 // FIXME: These should be deprecated.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-20 23:11:52 UTC (rev 164451)
@@ -2751,6 +2751,11 @@
 {
     loadPolicy = static_cast<uint32_t>(m_loaderClient->webGLLoadPolicy(this, url));
 }
+
+void WebPageProxy::resolveWebGLPolicyForURL(const String& url, uint32_t& loadPolicy)
+{
+    loadPolicy = static_cast<uint32_t>(m_loaderClient->resolveWebGLLoadPolicy(this, url));
+}
 #endif // ENABLE(WEBGL)
 
 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -967,6 +967,7 @@
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 #if ENABLE(WEBGL)
     void webGLPolicyForURL(const String& url, uint32_t& loadPolicy);
+    void resolveWebGLPolicyForURL(const String& url, uint32_t& loadPolicy);
 #endif // ENABLE(WEBGL)
     void setToolbarsAreVisible(bool toolbarsAreVisible);
     void getToolbarsAreVisible(bool& toolbarsAreVisible);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (164450 => 164451)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-02-20 23:11:52 UTC (rev 164451)
@@ -35,6 +35,7 @@
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 #if ENABLE(WEBGL)
     WebGLPolicyForURL(String url) -> (uint32_t loadPolicy)
+    ResolveWebGLPolicyForURL(String url) -> (uint32_t loadPolicy)
 #endif // ENABLE(WEBGL)
     DidChangeViewportProperties(WebCore::ViewportAttributes attributes)
     DidReceiveEvent(uint32_t type, bool handled)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (164450 => 164451)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2014-02-20 23:11:52 UTC (rev 164451)
@@ -1348,8 +1348,16 @@
     if (WebPage* webPage = m_frame->page())
         return webPage->webGLPolicyForURL(m_frame, url);
 
-    return WebGLAllow;
+    return WebGLAllowCreation;
 }
+
+WebCore::WebGLLoadPolicy WebFrameLoaderClient::resolveWebGLPolicyForURL(const String& url) const
+{
+    if (WebPage* webPage = m_frame->page())
+        return webPage->resolveWebGLPolicyForURL(m_frame, url);
+
+    return WebGLAllowCreation;
+}
 #endif // ENABLE(WEBGL)
 
 PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const URL&, const Vector<String>& paramNames, const Vector<String>& paramValues)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (164450 => 164451)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -187,6 +187,7 @@
     
 #if ENABLE(WEBGL)
     virtual WebCore::WebGLLoadPolicy webGLPolicyForURL(const String&) const override;
+    virtual WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(const String&) const override;
 #endif // ENABLE(WEBGL)
 
     virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::URL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) override;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (164450 => 164451)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-02-20 23:11:52 UTC (rev 164451)
@@ -620,8 +620,18 @@
     if (sendSync(Messages::WebPageProxy::WebGLPolicyForURL(url), Messages::WebPageProxy::WebGLPolicyForURL::Reply(policyResult)))
         return static_cast<WebGLLoadPolicy>(policyResult);
 
-    return WebGLAllow;
+    return WebGLAllowCreation;
 }
+
+WebCore::WebGLLoadPolicy WebPage::resolveWebGLPolicyForURL(WebFrame* frame, const String& url)
+{
+    uint32_t policyResult = 0;
+
+    if (sendSync(Messages::WebPageProxy::ResolveWebGLPolicyForURL(url), Messages::WebPageProxy::ResolveWebGLPolicyForURL::Reply(policyResult)))
+        return static_cast<WebGLLoadPolicy>(policyResult);
+
+    return WebGLAllowCreation;
+}
 #endif // ENABLE(WEBGL)
 
 EditorState WebPage::editorState() const

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (164450 => 164451)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-02-20 23:11:52 UTC (rev 164451)
@@ -306,6 +306,7 @@
 
 #if ENABLE(WEBGL)
     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const String&);
+    WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const String&);
 #endif // ENABLE(WEBGL)
     
     EditorState editorState() const;

Modified: trunk/Tools/ChangeLog (164450 => 164451)


--- trunk/Tools/ChangeLog	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Tools/ChangeLog	2014-02-20 23:11:52 UTC (rev 164451)
@@ -1,3 +1,15 @@
+2014-02-20  Dean Jackson  <[email protected]>
+
+        Add an unresolved WebGLPolicy and an API to resolve it
+        https://bugs.webkit.org/show_bug.cgi?id=129109
+
+        Reviewed by Anders Carlsson.
+
+        Add a new entry for resolveWebGLLoadPolicy.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createWebViewWithOptions):
+
 2014-02-19  Gustavo Noronha Silva  <[email protected]>
 
         [GTK] Add new ARM build slave for GTK+

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (164450 => 164451)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2014-02-20 23:04:31 UTC (rev 164450)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2014-02-20 23:11:52 UTC (rev 164451)
@@ -476,6 +476,7 @@
         0, // pluginDidFail
         pluginLoadPolicy, // pluginLoadPolicy
         0, // webGLLoadPolicy
+        0, // resolveWebGLLoadPolicy
     };
     WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient.base);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to