Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 04aa8f9

Browse files
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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 11d4e38 commit 04aa8f9

File tree

18 files changed

+119
-11
lines changed

18 files changed

+119
-11
lines changed

Source/WebCore/ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2014-02-20 Dean Jackson <[email protected]>
2+
3+
Add an unresolved WebGLPolicy and an API to resolve it
4+
https://bugs.webkit.org/show_bug.cgi?id=129109
5+
6+
Reviewed by Anders Carlsson.
7+
8+
Add a third WebGLLoadPolicy which is "pending" allowing the page
9+
to go ahead with creating the WebGLRenderingContext and resolve the policy
10+
at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.
11+
12+
* html/HTMLCanvasElement.cpp:
13+
(WebCore::HTMLCanvasElement::getContext): WebGLBlock -> WebGLBlockCreation
14+
* loader/FrameLoaderClient.h:
15+
(WebCore::FrameLoaderClient::webGLPolicyForURL): WebGLAllow -> WebGLAllowCreation.
16+
(WebCore::FrameLoaderClient::resolveWebGLPolicyForURL): New method.
17+
* loader/FrameLoaderTypes.h: Add WebGLPendingCreation.
18+
119
2014-02-20 Zalan Bujtas <[email protected]>
220

321
Subpixel rendering: Enable compositing RenderLayer painting on device pixel position.

Source/WebCore/html/HTMLCanvasElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas
226226
if (page && !topDocument.url().isLocalFile()) {
227227
WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
228228

229-
if (policy == WebGLBlock)
229+
if (policy == WebGLBlockCreation)
230230
return nullptr;
231231
}
232232
m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(attrs));

Source/WebCore/loader/FrameLoaderClient.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ namespace WebCore {
325325
// Informs the embedder that a WebGL canvas inside this frame received a lost context
326326
// notification with the given GL_ARB_robustness guilt/innocence code (see Extensions3D.h).
327327
virtual void didLoseWebGLContext(int) { }
328-
virtual WebGLLoadPolicy webGLPolicyForURL(const String&) const { return WebGLAllow; }
328+
virtual WebGLLoadPolicy webGLPolicyForURL(const String&) const { return WebGLAllowCreation; }
329+
virtual WebGLLoadPolicy resolveWebGLPolicyForURL(const String&) const { return WebGLAllowCreation; }
329330
#endif
330331

331332
virtual void forcePageTransitionIfNeeded() { }

Source/WebCore/loader/FrameLoaderTypes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ namespace WebCore {
107107
};
108108

109109
enum WebGLLoadPolicy {
110-
WebGLBlock = 0,
111-
WebGLAllow
110+
WebGLBlockCreation,
111+
WebGLAllowCreation,
112+
WebGLPendingCreation
112113
};
113114

114115
}

Source/WebKit2/ChangeLog

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
2014-02-20 Dean Jackson <[email protected]>
2+
3+
Add an unresolved WebGLPolicy and an API to resolve it
4+
https://bugs.webkit.org/show_bug.cgi?id=129109
5+
6+
Reviewed by Anders Carlsson.
7+
8+
Add a third WebGLLoadPolicy which is "pending" allowing the page
9+
to go ahead with creating the WebGLRenderingContext and resolve the policy
10+
at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.
11+
12+
* UIProcess/API/APILoaderClient.h:
13+
(API::LoaderClient::webGLLoadPolicy): New return value.
14+
(API::LoaderClient::resolveWebGLLoadPolicy): New method definition.
15+
* UIProcess/API/C/WKAPICast.h:
16+
(WebKit::toWebGLLoadPolicy): Change names of return types.
17+
* UIProcess/API/C/WKPage.cpp:
18+
(WKPageSetPageLoaderClient): New stubs.
19+
* UIProcess/API/C/WKPageLoaderClient.h: New policy type kWKWebGLLoadPolicyPending.
20+
* UIProcess/WebPageProxy.cpp:
21+
(WebKit::WebPageProxy::resolveWebGLPolicyForURL): New method.
22+
* UIProcess/WebPageProxy.h:
23+
* UIProcess/WebPageProxy.messages.in: New message.
24+
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
25+
(WebKit::WebFrameLoaderClient::webGLPolicyForURL):
26+
(WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL):
27+
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
28+
* WebProcess/WebPage/WebPage.cpp:
29+
(WebKit::WebPage::webGLPolicyForURL):
30+
(WebKit::WebPage::resolveWebGLPolicyForURL):
31+
* WebProcess/WebPage/WebPage.h:
32+
133
2014-02-20 Anders Carlsson <[email protected]>
234

335
Make it possible to reply asynchronously to JavaScript panels and alerts

Source/WebKit2/UIProcess/API/APILoaderClient.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class LoaderClient {
9797
#endif // ENABLE(NETSCAPE_PLUGIN_API)
9898

9999
#if ENABLE(WEBGL)
100-
virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllow; }
100+
virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllowCreation; }
101+
virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllowCreation; }
101102
#endif // ENABLE(WEBGL)
102103
};
103104

Source/WebKit2/UIProcess/API/C/WKAPICast.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,15 @@ inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPol
481481
{
482482
switch (webGLLoadPolicy) {
483483
case kWKWebGLLoadPolicyLoadNormally:
484-
return WebCore::WebGLAllow;
484+
return WebCore::WebGLAllowCreation;
485485
case kWKWebGLLoadPolicyBlocked:
486-
return WebCore::WebGLBlock;
486+
return WebCore::WebGLBlockCreation;
487+
case kWKWebGLLoadPolicyPending:
488+
return WebCore::WebGLPendingCreation;
487489
}
488490

489491
ASSERT_NOT_REACHED();
490-
return WebCore::WebGLAllow;
492+
return WebCore::WebGLAllowCreation;
491493
}
492494

493495
inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail)

Source/WebKit2/UIProcess/API/C/WKPage.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,13 +967,24 @@ void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClientBase*
967967
#if ENABLE(WEBGL)
968968
virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebPageProxy* page, const String& url) const override
969969
{
970-
WebCore::WebGLLoadPolicy loadPolicy = WebGLAllow;
970+
WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation;
971971

972972
if (m_client.webGLLoadPolicy)
973973
loadPolicy = toWebGLLoadPolicy(m_client.webGLLoadPolicy(toAPI(page), toAPI(url.impl()), m_client.base.clientInfo));
974974

975975
return loadPolicy;
976976
}
977+
978+
virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebPageProxy* page, const String& url) const override
979+
{
980+
WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation;
981+
982+
if (m_client.resolveWebGLLoadPolicy)
983+
loadPolicy = toWebGLLoadPolicy(m_client.resolveWebGLLoadPolicy(toAPI(page), toAPI(url.impl()), m_client.base.clientInfo));
984+
985+
return loadPolicy;
986+
}
987+
977988
#endif // ENABLE(WEBGL)
978989
};
979990

Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ typedef uint32_t WKPluginLoadPolicy;
4545
enum {
4646
kWKWebGLLoadPolicyBlocked = 0,
4747
kWKWebGLLoadPolicyLoadNormally,
48+
kWKWebGLLoadPolicyPending
4849
};
4950
typedef uint32_t WKWebGLLoadPolicy;
5051

@@ -330,6 +331,7 @@ typedef struct WKPageLoaderClientV4 {
330331

331332
// Version 4
332333
WKPageWebGLLoadPolicyCallback webGLLoadPolicy;
334+
WKPageWebGLLoadPolicyCallback resolveWebGLLoadPolicy;
333335
} WKPageLoaderClientV4;
334336

335337
// FIXME: These should be deprecated.

Source/WebKit2/UIProcess/WebPageProxy.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,6 +2751,11 @@ void WebPageProxy::webGLPolicyForURL(const String& url, uint32_t& loadPolicy)
27512751
{
27522752
loadPolicy = static_cast<uint32_t>(m_loaderClient->webGLLoadPolicy(this, url));
27532753
}
2754+
2755+
void WebPageProxy::resolveWebGLPolicyForURL(const String& url, uint32_t& loadPolicy)
2756+
{
2757+
loadPolicy = static_cast<uint32_t>(m_loaderClient->resolveWebGLLoadPolicy(this, url));
2758+
}
27542759
#endif // ENABLE(WEBGL)
27552760

27562761
void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)

0 commit comments

Comments
 (0)