<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170702] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170702">170702</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-02 00:19:46 -0700 (Wed, 02 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] WebKitWebView::create should receive information about the navigation action
https://bugs.webkit.org/show_bug.cgi?id=133680
Reviewed by Martin Robinson.
Source/WebKit2:
Add WebKitNavigationAction boxed type representing a navigation
action to be passed as parameter of WebKitWebView::create
signal. In the future it could be also for the
WebKitNavigationPolicyDecision class. The class contains
information about a navigation action like the navigation type,
the request, the mouse button and key modifiers and whether it was
started by a user gesture. This information is needed to be able
to implement a proper popup blocker. Since all that information is
not provided by the C API, we have switched the UI client to use a
custom client derived from API::UIClient. This also avoids a lot
of toAPI -> toImpl unneeded conversions.
* PlatformGTK.cmake: Add new files to compilation.
* UIProcess/API/gtk/WebKitHitTestResult.cpp:
(webkitHitTestResultCreate): Use a WebHitTestResult::Data const
reference instead of a pointer to a WebHitTestResult.
(webkitHitTestResultCompare): Ditto.
* UIProcess/API/gtk/WebKitHitTestResultPrivate.h:
* UIProcess/API/gtk/WebKitNavigationAction.cpp: Added.
(webkitNavigationActionCreate): Create a WebKitNavigationAction
for the given ResourceRequest and NavigationActionData.
(webkit_navigation_action_copy):
(webkit_navigation_action_free):
(webkit_navigation_action_get_navigation_type):
(webkit_navigation_action_get_mouse_button):
(webkit_navigation_action_get_modifiers):
(webkit_navigation_action_get_request):
(webkit_navigation_action_is_user_gesture):
* UIProcess/API/gtk/WebKitNavigationAction.h: Added.
* UIProcess/API/gtk/WebKitNavigationActionPrivate.h: Added.
* UIProcess/API/gtk/WebKitNavigationPolicyDecision.h:
* UIProcess/API/gtk/WebKitPrivate.cpp:
(toGdkModifiers):
(toWebKitNavigationType):
(toWebKitMouseButton):
* UIProcess/API/gtk/WebKitPrivate.h:
* UIProcess/API/gtk/WebKitUIClient.cpp:
(UIClient::UIClient): Implement the UIClient using a custom class.
(attachUIClientToView): Set the UIClient directly to the WebPageProxy.
(createNewPage): Deleted.
(showPage): Deleted.
(closePage): Deleted.
(runJavaScriptAlert): Deleted.
(runJavaScriptConfirm): Deleted.
(runJavaScriptPrompt): Deleted.
(toolbarsAreVisible): Deleted.
(setToolbarsAreVisible): Deleted.
(menuBarIsVisible): Deleted.
(setMenuBarIsVisible): Deleted.
(statusBarIsVisible): Deleted.
(setStatusBarIsVisible): Deleted.
(isResizable): Deleted.
(setIsResizable): Deleted.
(getWindowFrame): Deleted.
(setWindowFrame): Deleted.
(mouseDidMoveOverElement): Deleted.
(printFrame): Deleted.
(runOpenPanel): Deleted.
(decidePolicyForGeolocationPermissionRequest): Deleted.
(runModal): Deleted.
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewCreate): Add WebKitNavigationAction parameter.
(webkit_web_view_class_init): Add WebKitNavigationAction paramter
to CREATE signal.
(webkitWebViewCreateNewPage): Add WebKitNavigationAction parameter
and pass it to the signal callbacks.
(webkitWebViewMouseTargetChanged): Use a WebHitTestResult::Data
const reference.
(webkitWebViewPopulateContextMenu): Ditto.
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWindowProperties.cpp:
(webkitWindowPropertiesUpdateFromWebWindowFeatures): Use a
WebCore::WindowFeatures const reference.
* UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
* UIProcess/API/gtk/webkit2.h: Include WebKitNavigationAction.h.
Tools:
Add unit test to check the WebKitNavigationAction passed to
WebKitWebView::create callback.
* MiniBrowser/gtk/BrowserWindow.c:
(webViewCreate): Add WebKitNavigationAction parameter.
* TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
* TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp:
* TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
(testWebViewCreateNavigationData):
(beforeAll):
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitPolicyClient.cpp:
(createCallback):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResultcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResultPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationPolicyDecisionh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitPrivatecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUIClientcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWindowPropertiescpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWindowPropertiesPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkwebkit2h">trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsergtkBrowserWindowc">trunk/Tools/MiniBrowser/gtk/BrowserWindow.c</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestMultiprocesscpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestPrintingcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestUIClientcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitPolicyClientcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitPolicyClient.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationActioncpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationActionh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationActionPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2014-07-02 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] WebKitWebView::create should receive information about the navigation action
+ https://bugs.webkit.org/show_bug.cgi?id=133680
+
+ Reviewed by Martin Robinson.
+
+ Add WebKitNavigationAction boxed type representing a navigation
+ action to be passed as parameter of WebKitWebView::create
+ signal. In the future it could be also for the
+ WebKitNavigationPolicyDecision class. The class contains
+ information about a navigation action like the navigation type,
+ the request, the mouse button and key modifiers and whether it was
+ started by a user gesture. This information is needed to be able
+ to implement a proper popup blocker. Since all that information is
+ not provided by the C API, we have switched the UI client to use a
+ custom client derived from API::UIClient. This also avoids a lot
+ of toAPI -> toImpl unneeded conversions.
+
+ * PlatformGTK.cmake: Add new files to compilation.
+ * UIProcess/API/gtk/WebKitHitTestResult.cpp:
+ (webkitHitTestResultCreate): Use a WebHitTestResult::Data const
+ reference instead of a pointer to a WebHitTestResult.
+ (webkitHitTestResultCompare): Ditto.
+ * UIProcess/API/gtk/WebKitHitTestResultPrivate.h:
+ * UIProcess/API/gtk/WebKitNavigationAction.cpp: Added.
+ (webkitNavigationActionCreate): Create a WebKitNavigationAction
+ for the given ResourceRequest and NavigationActionData.
+ (webkit_navigation_action_copy):
+ (webkit_navigation_action_free):
+ (webkit_navigation_action_get_navigation_type):
+ (webkit_navigation_action_get_mouse_button):
+ (webkit_navigation_action_get_modifiers):
+ (webkit_navigation_action_get_request):
+ (webkit_navigation_action_is_user_gesture):
+ * UIProcess/API/gtk/WebKitNavigationAction.h: Added.
+ * UIProcess/API/gtk/WebKitNavigationActionPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitNavigationPolicyDecision.h:
+ * UIProcess/API/gtk/WebKitPrivate.cpp:
+ (toGdkModifiers):
+ (toWebKitNavigationType):
+ (toWebKitMouseButton):
+ * UIProcess/API/gtk/WebKitPrivate.h:
+ * UIProcess/API/gtk/WebKitUIClient.cpp:
+ (UIClient::UIClient): Implement the UIClient using a custom class.
+ (attachUIClientToView): Set the UIClient directly to the WebPageProxy.
+ (createNewPage): Deleted.
+ (showPage): Deleted.
+ (closePage): Deleted.
+ (runJavaScriptAlert): Deleted.
+ (runJavaScriptConfirm): Deleted.
+ (runJavaScriptPrompt): Deleted.
+ (toolbarsAreVisible): Deleted.
+ (setToolbarsAreVisible): Deleted.
+ (menuBarIsVisible): Deleted.
+ (setMenuBarIsVisible): Deleted.
+ (statusBarIsVisible): Deleted.
+ (setStatusBarIsVisible): Deleted.
+ (isResizable): Deleted.
+ (setIsResizable): Deleted.
+ (getWindowFrame): Deleted.
+ (setWindowFrame): Deleted.
+ (mouseDidMoveOverElement): Deleted.
+ (printFrame): Deleted.
+ (runOpenPanel): Deleted.
+ (decidePolicyForGeolocationPermissionRequest): Deleted.
+ (runModal): Deleted.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewCreate): Add WebKitNavigationAction parameter.
+ (webkit_web_view_class_init): Add WebKitNavigationAction paramter
+ to CREATE signal.
+ (webkitWebViewCreateNewPage): Add WebKitNavigationAction parameter
+ and pass it to the signal callbacks.
+ (webkitWebViewMouseTargetChanged): Use a WebHitTestResult::Data
+ const reference.
+ (webkitWebViewPopulateContextMenu): Ditto.
+ * UIProcess/API/gtk/WebKitWebView.h:
+ * UIProcess/API/gtk/WebKitWebViewPrivate.h:
+ * UIProcess/API/gtk/WebKitWindowProperties.cpp:
+ (webkitWindowPropertiesUpdateFromWebWindowFeatures): Use a
+ WebCore::WindowFeatures const reference.
+ * UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section.
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
+ * UIProcess/API/gtk/webkit2.h: Include WebKitNavigationAction.h.
+
</ins><span class="cx"> 2014-07-01 KwangHyuk Kim <hyuki.kim@samsung.com>
</span><span class="cx">
</span><span class="cx"> [EFL] Fix occurrence of two cursors on WK2 EFL.
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -162,6 +162,9 @@
</span><span class="cx"> UIProcess/API/gtk/WebKitMimeInfo.cpp
</span><span class="cx"> UIProcess/API/gtk/WebKitMimeInfo.h
</span><span class="cx"> UIProcess/API/gtk/WebKitMimeInfoPrivate.h
</span><ins>+ UIProcess/API/gtk/WebKitNavigationAction.cpp
+ UIProcess/API/gtk/WebKitNavigationAction.h
+ UIProcess/API/gtk/WebKitNavigationActionPrivate.h
</ins><span class="cx"> UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
</span><span class="cx"> UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
</span><span class="cx"> UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
</span><span class="lines">@@ -337,6 +340,7 @@
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitHitTestResult.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitJavascriptResult.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitMimeInfo.h
</span><ins>+ ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitNavigationAction.h
</ins><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitPermissionRequest.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitPlugin.h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -221,39 +221,33 @@
</span><span class="cx"> paramFlags));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-WebKitHitTestResult* webkitHitTestResultCreate(WebHitTestResult* hitTestResult)
</del><ins>+WebKitHitTestResult* webkitHitTestResultCreate(const WebHitTestResult::Data& hitTestResult)
</ins><span class="cx"> {
</span><span class="cx"> unsigned context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT;
</span><span class="cx">
</span><del>- const String& linkURL = hitTestResult->absoluteLinkURL();
- if (!linkURL.isEmpty())
</del><ins>+ if (!hitTestResult.absoluteLinkURL.isEmpty())
</ins><span class="cx"> context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK;
</span><span class="cx">
</span><del>- const String& imageURL = hitTestResult->absoluteImageURL();
- if (!imageURL.isEmpty())
</del><ins>+ if (!hitTestResult.absoluteImageURL.isEmpty())
</ins><span class="cx"> context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE;
</span><span class="cx">
</span><del>- const String& mediaURL = hitTestResult->absoluteMediaURL();
- if (!mediaURL.isEmpty())
</del><ins>+ if (!hitTestResult.absoluteMediaURL.isEmpty())
</ins><span class="cx"> context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA;
</span><span class="cx">
</span><del>- if (hitTestResult->isContentEditable())
</del><ins>+ if (hitTestResult.isContentEditable)
</ins><span class="cx"> context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE;
</span><span class="cx">
</span><del>- if (hitTestResult->isScrollbar())
</del><ins>+ if (hitTestResult.isScrollbar)
</ins><span class="cx"> context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR;
</span><span class="cx">
</span><del>- const String& linkTitle = hitTestResult->linkTitle();
- const String& linkLabel = hitTestResult->linkLabel();
-
</del><span class="cx"> return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
</span><del>- "context", context,
- "link-uri", !linkURL.isEmpty() ? linkURL.utf8().data() : 0,
- "image-uri", !imageURL.isEmpty() ? imageURL.utf8().data() : 0,
- "media-uri", !mediaURL.isEmpty() ? mediaURL.utf8().data() : 0,
- "link-title", !linkTitle.isEmpty() ? linkTitle.utf8().data() : 0,
- "link-label", !linkLabel.isEmpty() ? linkLabel.utf8().data() : 0,
- NULL));
</del><ins>+ "context", context,
+ "link-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK ? hitTestResult.absoluteLinkURL.utf8().data() : nullptr,
+ "image-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE ? hitTestResult.absoluteImageURL.utf8().data() : nullptr,
+ "media-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA ? hitTestResult.absoluteMediaURL.utf8().data() : nullptr,
+ "link-title", !hitTestResult.linkTitle.isEmpty() ? hitTestResult.linkTitle.utf8().data() : nullptr,
+ "link-label", !hitTestResult.linkLabel.isEmpty() ? hitTestResult.linkLabel.utf8().data() : nullptr,
+ nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static bool stringIsEqualToCString(const String& string, const CString& cString)
</span><span class="lines">@@ -261,16 +255,16 @@
</span><span class="cx"> return ((string.isEmpty() && cString.isNull()) || (string.utf8() == cString));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, WebHitTestResult* webHitTestResult)
</del><ins>+bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, const WebHitTestResult::Data& webHitTestResult)
</ins><span class="cx"> {
</span><span class="cx"> WebKitHitTestResultPrivate* priv = hitTestResult->priv;
</span><del>- return webHitTestResult->isContentEditable() == webkit_hit_test_result_context_is_editable(hitTestResult)
- && webHitTestResult->isScrollbar() == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
- && stringIsEqualToCString(webHitTestResult->absoluteLinkURL(), priv->linkURI)
- && stringIsEqualToCString(webHitTestResult->linkTitle(), priv->linkTitle)
- && stringIsEqualToCString(webHitTestResult->linkLabel(), priv->linkLabel)
- && stringIsEqualToCString(webHitTestResult->absoluteImageURL(), priv->imageURI)
- && stringIsEqualToCString(webHitTestResult->absoluteMediaURL(), priv->mediaURI);
</del><ins>+ return webHitTestResult.isContentEditable == webkit_hit_test_result_context_is_editable(hitTestResult)
+ && webHitTestResult.isScrollbar == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
+ && stringIsEqualToCString(webHitTestResult.absoluteLinkURL, priv->linkURI)
+ && stringIsEqualToCString(webHitTestResult.linkTitle, priv->linkTitle)
+ && stringIsEqualToCString(webHitTestResult.linkLabel, priv->linkLabel)
+ && stringIsEqualToCString(webHitTestResult.absoluteImageURL, priv->imageURI)
+ && stringIsEqualToCString(webHitTestResult.absoluteMediaURL, priv->mediaURI);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResultPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> #include "WebKitHitTestResult.h"
</span><span class="cx"> #include "WebKitPrivate.h"
</span><span class="cx">
</span><del>-WebKitHitTestResult* webkitHitTestResultCreate(WebKit::WebHitTestResult*);
-bool webkitHitTestResultCompare(WebKitHitTestResult*, WebKit::WebHitTestResult*);
</del><ins>+WebKitHitTestResult* webkitHitTestResultCreate(const WebKit::WebHitTestResult::Data&);
+bool webkitHitTestResultCompare(WebKitHitTestResult*, const WebKit::WebHitTestResult::Data&);
</ins><span class="cx">
</span><span class="cx"> #endif // WebKitHitTestResultPrivate_h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationActioncpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp (0 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -0,0 +1,153 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitNavigationAction.h"
+
+#include "WebKitNavigationActionPrivate.h"
+#include <gdk/gdk.h>
+#include <wtf/gobject/GRefPtr.h>
+
+using namespace WebKit;
+
+G_DEFINE_BOXED_TYPE(WebKitNavigationAction, webkit_navigation_action, webkit_navigation_action_copy, webkit_navigation_action_free)
+
+WebKitNavigationAction* webkitNavigationActionCreate(WebKitURIRequest* request, const NavigationActionData& navigationActionData)
+{
+ WebKitNavigationAction* navigation = g_slice_new0(WebKitNavigationAction);
+ new (navigation) WebKitNavigationAction(request, navigationActionData);
+ return navigation;
+}
+
+/**
+ * webkit_navigation_action_copy:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Make a copy of @navigation.
+ *
+ * Returns: (transfer full): A copy of passed in #WebKitNavigationAction
+ *
+ * Since: 2.6
+ */
+WebKitNavigationAction* webkit_navigation_action_copy(WebKitNavigationAction* navigation)
+{
+ g_return_val_if_fail(navigation, nullptr);
+
+ WebKitNavigationAction* copy = g_slice_new0(WebKitNavigationAction);
+ new (copy) WebKitNavigationAction(navigation);
+ return copy;
+}
+
+/**
+ * webkit_navigation_action_free:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Free the #WebKitNavigationAction
+ *
+ * Since: 2.6
+ */
+void webkit_navigation_action_free(WebKitNavigationAction* navigation)
+{
+ g_return_if_fail(navigation);
+
+ navigation->~WebKitNavigationAction();
+ g_slice_free(WebKitNavigationAction, navigation);
+}
+
+/**
+ * webkit_navigation_action_get_navigation_type:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Rtuen the type of action that triggered the navigation.
+ *
+ * Returns: a #WebKitNavigationType
+ *
+ * Since: 2.6
+ */
+WebKitNavigationType webkit_navigation_action_get_navigation_type(WebKitNavigationAction* navigation)
+{
+ g_return_val_if_fail(navigation, WEBKIT_NAVIGATION_TYPE_OTHER);
+ return navigation->type;
+}
+
+/**
+ * webkit_navigation_action_get_mouse_button:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Return the number of the mouse button that triggered the navigation, or 0 if
+ * the navigation was not started by a mouse event.
+ *
+ * Returns: the mouse button number or 0
+ *
+ * Since: 2.6
+ */
+unsigned webkit_navigation_action_get_mouse_button(WebKitNavigationAction* navigation)
+{
+ g_return_val_if_fail(navigation, 0);
+ return navigation->mouseButton;
+}
+
+/**
+ * webkit_navigation_action_get_modifiers:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Return a bitmask of #GdkModifierType values describing the modifier keys that were in effect
+ * when the navigation was requested
+ *
+ * Returns: the modifier keys
+ *
+ * Since: 2.6
+ */
+unsigned webkit_navigation_action_get_modifiers(WebKitNavigationAction* navigation)
+{
+ g_return_val_if_fail(navigation, 0);
+ return navigation->modifiers;
+}
+
+/**
+ * webkit_navigation_action_get_request:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Return the navigation #WebKitURIRequest
+ *
+ * Returns: (transfer none): a #WebKitURIRequest
+ *
+ * Since: 2.6
+ */
+WebKitURIRequest* webkit_navigation_action_get_request(WebKitNavigationAction* navigation)
+{
+ g_return_val_if_fail(navigation, nullptr);
+ return navigation->request.get();
+}
+
+/**
+ * webkit_navigation_action_is_user_gesture:
+ * @navigation: a #WebKitNavigationAction
+ *
+ * Return whether the navigation was triggered by a user gesture like a mouse click.
+ *
+ * Returns: whether navigation action is a user gesture
+ *
+ * Since: 2.6
+ */
+gboolean webkit_navigation_action_is_user_gesture(WebKitNavigationAction* navigation)
+{
+ g_return_val_if_fail(navigation, FALSE);
+ return navigation->isUserGesture;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationActionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h (0 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitNavigationAction_h
+#define WebKitNavigationAction_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitURIRequest.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_NAVIGATION_ACTION (webkit_navigation_action_get_type())
+
+/**
+ * WebKitNavigationType:
+ * @WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: The navigation was triggered by clicking a link.
+ * @WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: The navigation was triggered by submitting a form.
+ * @WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: The navigation was triggered by navigating forward or backward.
+ * @WEBKIT_NAVIGATION_TYPE_RELOAD: The navigation was triggered by reloading.
+ * @WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED: The navigation was triggered by resubmitting a form.
+ * @WEBKIT_NAVIGATION_TYPE_OTHER: The navigation was triggered by some other action.
+ *
+ * Enum values used to denote the various navigation types.
+ */
+typedef enum {
+ WEBKIT_NAVIGATION_TYPE_LINK_CLICKED,
+ WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED,
+ WEBKIT_NAVIGATION_TYPE_BACK_FORWARD,
+ WEBKIT_NAVIGATION_TYPE_RELOAD,
+ WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED,
+ WEBKIT_NAVIGATION_TYPE_OTHER
+} WebKitNavigationType;
+
+typedef struct _WebKitNavigationAction WebKitNavigationAction;
+
+
+WEBKIT_API GType
+webkit_navigation_action_get_type (void);
+
+WEBKIT_API WebKitNavigationAction *
+webkit_navigation_action_copy (WebKitNavigationAction *navigation);
+
+WEBKIT_API void
+webkit_navigation_action_free (WebKitNavigationAction *navigation);
+
+WEBKIT_API WebKitNavigationType
+webkit_navigation_action_get_navigation_type (WebKitNavigationAction *navigation);
+
+WEBKIT_API guint
+webkit_navigation_action_get_mouse_button (WebKitNavigationAction *navigation);
+
+WEBKIT_API guint
+webkit_navigation_action_get_modifiers (WebKitNavigationAction *navigation);
+
+WEBKIT_API WebKitURIRequest *
+webkit_navigation_action_get_request (WebKitNavigationAction *navigation);
+
+WEBKIT_API gboolean
+webkit_navigation_action_is_user_gesture (WebKitNavigationAction *navigation);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationActionPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h (0 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitNavigationActionPrivate_h
+#define WebKitNavigationActionPrivate_h
+
+#include "NavigationActionData.h"
+#include "WebKitNavigationAction.h"
+#include "WebKitPrivate.h"
+
+struct _WebKitNavigationAction {
+ _WebKitNavigationAction(WebKitURIRequest* uriRequest, const WebKit::NavigationActionData& navigationActionData)
+ : type(toWebKitNavigationType(navigationActionData.navigationType))
+ , mouseButton(toWebKitMouseButton(navigationActionData.mouseButton))
+ , modifiers(toGdkModifiers(navigationActionData.modifiers))
+ , isUserGesture(navigationActionData.isProcessingUserGesture)
+ , request(uriRequest)
+ {
+ }
+
+ _WebKitNavigationAction(WebKitNavigationAction* navigation)
+ : type(navigation->type)
+ , mouseButton(navigation->mouseButton)
+ , modifiers(navigation->modifiers)
+ , isUserGesture(navigation->isUserGesture)
+ , request(navigation->request)
+ {
+ }
+
+ WebKitNavigationType type;
+ unsigned mouseButton;
+ unsigned modifiers;
+ bool isUserGesture : 1;
+ GRefPtr<WebKitURIRequest> request;
+};
+
+WebKitNavigationAction* webkitNavigationActionCreate(WebKitURIRequest*, const WebKit::NavigationActionData&);
+
+#endif // WebKitNavigationActionPrivate_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNavigationPolicyDecisionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -26,31 +26,12 @@
</span><span class="cx">
</span><span class="cx"> #include <glib-object.h>
</span><span class="cx"> #include <webkit2/WebKitDefines.h>
</span><ins>+#include <webkit2/WebKitNavigationAction.h>
</ins><span class="cx"> #include <webkit2/WebKitPolicyDecision.h>
</span><span class="cx"> #include <webkit2/WebKitURIRequest.h>
</span><span class="cx">
</span><span class="cx"> G_BEGIN_DECLS
</span><span class="cx">
</span><del>-/**
- * WebKitNavigationType:
- * @WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: The navigation was triggered by clicking a link.
- * @WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: The navigation was triggered by submitting a form.
- * @WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: The navigation was triggered by navigating forward or backward.
- * @WEBKIT_NAVIGATION_TYPE_RELOAD: The navigation was triggered by reloading.
- * @WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED: The navigation was triggered by resubmitting a form.
- * @WEBKIT_NAVIGATION_TYPE_OTHER: The navigation was triggered by some other action.
- *
- * Enum values used to denote the various navigation types.
- */
-typedef enum {
- WEBKIT_NAVIGATION_TYPE_LINK_CLICKED,
- WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED,
- WEBKIT_NAVIGATION_TYPE_BACK_FORWARD,
- WEBKIT_NAVIGATION_TYPE_RELOAD,
- WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED,
- WEBKIT_NAVIGATION_TYPE_OTHER,
-} WebKitNavigationType;
-
</del><span class="cx"> #define WEBKIT_TYPE_NAVIGATION_POLICY_DECISION (webkit_navigation_policy_decision_get_type())
</span><span class="cx"> #define WEBKIT_NAVIGATION_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecision))
</span><span class="cx"> #define WEBKIT_NAVIGATION_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecisionClass))
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> #include "WebKitPrivate.h"
</span><span class="cx">
</span><span class="cx"> #include "ErrorsGtk.h"
</span><ins>+#include "WebEvent.h"
</ins><span class="cx"> #include "WebKitError.h"
</span><span class="cx"> #include <gdk/gdk.h>
</span><span class="cx">
</span><span class="lines">@@ -38,6 +39,57 @@
</span><span class="cx"> return modifiers;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned toGdkModifiers(WebKit::WebEvent::Modifiers wkModifiers)
+{
+ unsigned modifiers = 0;
+ if (wkModifiers & WebKit::WebEvent::Modifiers::ShiftKey)
+ modifiers |= GDK_SHIFT_MASK;
+ if (wkModifiers & WebKit::WebEvent::Modifiers::ControlKey)
+ modifiers |= GDK_CONTROL_MASK;
+ if (wkModifiers & WebKit::WebEvent::Modifiers::AltKey)
+ modifiers |= GDK_MOD1_MASK;
+ if (wkModifiers & WebKit::WebEvent::Modifiers::MetaKey)
+ modifiers |= GDK_META_MASK;
+ return modifiers;
+}
+
+WebKitNavigationType toWebKitNavigationType(WebCore::NavigationType type)
+{
+ switch (type) {
+ case WebCore::NavigationType::NavigationTypeLinkClicked:
+ return WEBKIT_NAVIGATION_TYPE_LINK_CLICKED;
+ case WebCore::NavigationType::NavigationTypeFormSubmitted:
+ return WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED;
+ case WebCore::NavigationType::NavigationTypeBackForward:
+ return WEBKIT_NAVIGATION_TYPE_BACK_FORWARD;
+ case WebCore::NavigationType::NavigationTypeReload:
+ return WEBKIT_NAVIGATION_TYPE_RELOAD;
+ case WebCore::NavigationType::NavigationTypeFormResubmitted:
+ return WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED;
+ case WebCore::NavigationType::NavigationTypeOther:
+ return WEBKIT_NAVIGATION_TYPE_OTHER;
+ default:
+ ASSERT_NOT_REACHED();
+ return WEBKIT_NAVIGATION_TYPE_OTHER;
+ }
+}
+
+unsigned toWebKitMouseButton(WebKit::WebMouseEvent::Button button)
+{
+ switch (button) {
+ case WebKit::WebMouseEvent::Button::NoButton:
+ return 0;
+ case WebKit::WebMouseEvent::Button::LeftButton:
+ return 1;
+ case WebKit::WebMouseEvent::Button::MiddleButton:
+ return 2;
+ case WebKit::WebMouseEvent::Button::RightButton:
+ return 3;
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
</ins><span class="cx"> unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton wkButton)
</span><span class="cx"> {
</span><span class="cx"> switch (wkButton) {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef WebKitPrivate_h
</span><span class="cx"> #define WebKitPrivate_h
</span><span class="cx">
</span><ins>+#include "WebKitNavigationAction.h"
</ins><span class="cx"> #include <WebKit/WKAPICast.h>
</span><span class="cx"> #include <WebKit/WKDownload.h>
</span><span class="cx"> #include <WebKit/WKFindOptions.h>
</span><span class="lines">@@ -115,6 +116,9 @@
</span><span class="cx">
</span><span class="cx"> unsigned wkEventModifiersToGdkModifiers(WKEventModifiers);
</span><span class="cx"> unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton);
</span><ins>+unsigned toGdkModifiers(WebKit::WebEvent::Modifiers);
+WebKitNavigationType toWebKitNavigationType(WebCore::NavigationType);
+unsigned toWebKitMouseButton(WebKit::WebMouseEvent::Button);
</ins><span class="cx"> unsigned toWebKitError(unsigned webCoreError);
</span><span class="cx"> unsigned toWebCoreError(unsigned webKitError);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -20,9 +20,12 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "WebKitUIClient.h"
</span><span class="cx">
</span><ins>+#include "APIUIClient.h"
</ins><span class="cx"> #include "WebKitFileChooserRequestPrivate.h"
</span><span class="cx"> #include "WebKitGeolocationPermissionRequestPrivate.h"
</span><ins>+#include "WebKitNavigationActionPrivate.h"
</ins><span class="cx"> #include "WebKitPrivate.h"
</span><ins>+#include "WebKitURIRequestPrivate.h"
</ins><span class="cx"> #include "WebKitWebViewBasePrivate.h"
</span><span class="cx"> #include "WebKitWebViewPrivate.h"
</span><span class="cx"> #include "WebKitWindowPropertiesPrivate.h"
</span><span class="lines">@@ -32,187 +35,147 @@
</span><span class="cx">
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><del>-static WKPageRef createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef wkWindowFeatures, WKEventModifiers, WKEventMouseButton, const void* clientInfo)
-{
- return static_cast<WKPageRef>(toAPI(webkitWebViewCreateNewPage(WEBKIT_WEB_VIEW(clientInfo), toImpl(wkWindowFeatures))));
-}
</del><ins>+class UIClient : public API::UIClient {
+public:
+ explicit UIClient(WebKitWebView* webView)
+ : m_webView(webView)
+ {
+ }
</ins><span class="cx">
</span><del>-static void showPage(WKPageRef, const void* clientInfo)
-{
- webkitWebViewReadyToShowPage(WEBKIT_WEB_VIEW(clientInfo));
-}
</del><ins>+private:
+ virtual PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceRequest& resourceRequest, const WebCore::WindowFeatures& windowFeatures, const NavigationActionData& navigationActionData) override
+ {
+ GRefPtr<WebKitURIRequest> request = adoptGRef(webkitURIRequestCreateForResourceRequest(resourceRequest));
+ WebKitNavigationAction navigationAction(request.get(), navigationActionData);
+ return webkitWebViewCreateNewPage(m_webView, windowFeatures, &navigationAction);
+ }
</ins><span class="cx">
</span><del>-static void closePage(WKPageRef, const void* clientInfo)
-{
- webkitWebViewClosePage(WEBKIT_WEB_VIEW(clientInfo));
-}
</del><ins>+ virtual void showPage(WebPageProxy*) override
+ {
+ webkitWebViewReadyToShowPage(m_webView);
+ }
</ins><span class="cx">
</span><del>-static void runJavaScriptAlert(WKPageRef, WKStringRef message, WKFrameRef, const void* clientInfo)
-{
- webkitWebViewRunJavaScriptAlert(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8());
-}
</del><ins>+ virtual void close(WebPageProxy*) override
+ {
+ webkitWebViewClosePage(m_webView);
+ }
</ins><span class="cx">
</span><del>-static bool runJavaScriptConfirm(WKPageRef, WKStringRef message, WKFrameRef, const void* clientInfo)
-{
- return webkitWebViewRunJavaScriptConfirm(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8());
-}
</del><ins>+ virtual void runJavaScriptAlert(WebPageProxy*, const String& message, WebFrameProxy*, std::function<void ()> completionHandler) override
+ {
+ webkitWebViewRunJavaScriptAlert(m_webView, message.utf8());
+ completionHandler();
+ }
</ins><span class="cx">
</span><del>-static WKStringRef runJavaScriptPrompt(WKPageRef, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void* clientInfo)
-{
- CString result = webkitWebViewRunJavaScriptPrompt(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8(),
- toImpl(defaultValue)->string().utf8());
- return WKStringCreateWithUTF8CString(result.data());
-}
</del><ins>+ virtual void runJavaScriptConfirm(WebPageProxy*, const String& message, WebFrameProxy*, std::function<void (bool)> completionHandler) override
+ {
+ completionHandler(webkitWebViewRunJavaScriptConfirm(m_webView, message.utf8()));
+ }
</ins><span class="cx">
</span><del>-static bool toolbarsAreVisible(WKPageRef, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- return webkit_window_properties_get_toolbar_visible(windowProperties);
-}
</del><ins>+ virtual void runJavaScriptPrompt(WebPageProxy*, const String& message, const String& defaultValue, WebFrameProxy*, std::function<void (const String&)> completionHandler) override
+ {
+ CString result = webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8());
+ if (result.isNull()) {
+ completionHandler(String());
+ return;
+ }
</ins><span class="cx">
</span><del>-static void setToolbarsAreVisible(WKPageRef, bool toolbarsVisible, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- webkitWindowPropertiesSetToolbarVisible(windowProperties, toolbarsVisible);
-}
</del><ins>+ completionHandler(String::fromUTF8(result.data()));
+ }
</ins><span class="cx">
</span><del>-static bool menuBarIsVisible(WKPageRef, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- return webkit_window_properties_get_menubar_visible(windowProperties);
-}
</del><ins>+ virtual void mouseDidMoveOverElement(WebPageProxy*, const WebHitTestResult::Data& data, WebEvent::Modifiers modifiers, API::Object*) override
+ {
+ webkitWebViewMouseTargetChanged(m_webView, data, toGdkModifiers(modifiers));
+ }
</ins><span class="cx">
</span><del>-static void setMenuBarIsVisible(WKPageRef, bool menuBarVisible, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- webkitWindowPropertiesSetMenubarVisible(windowProperties, menuBarVisible);
-}
</del><ins>+ virtual bool toolbarsAreVisible(WebPageProxy*) override
+ {
+ return webkit_window_properties_get_toolbar_visible(webkit_web_view_get_window_properties(m_webView));
+ }
</ins><span class="cx">
</span><del>-static bool statusBarIsVisible(WKPageRef, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- return webkit_window_properties_get_statusbar_visible(windowProperties);
-}
</del><ins>+ virtual void setToolbarsAreVisible(WebPageProxy*, bool visible) override
+ {
+ webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
+ }
</ins><span class="cx">
</span><del>-static void setStatusBarIsVisible(WKPageRef, bool statusBarVisible, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- webkitWindowPropertiesSetStatusbarVisible(windowProperties, statusBarVisible);
-}
</del><ins>+ virtual bool menuBarIsVisible(WebPageProxy*) override
+ {
+ return webkit_window_properties_get_menubar_visible(webkit_web_view_get_window_properties(m_webView));
+ }
</ins><span class="cx">
</span><del>-static bool isResizable(WKPageRef, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- return webkit_window_properties_get_resizable(windowProperties);
-}
</del><ins>+ virtual void setMenuBarIsVisible(WebPageProxy*, bool visible) override
+ {
+ webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
+ }
</ins><span class="cx">
</span><del>-static void setIsResizable(WKPageRef, bool resizable, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- webkitWindowPropertiesSetResizable(windowProperties, resizable);
-}
</del><ins>+ virtual bool statusBarIsVisible(WebPageProxy*) override
+ {
+ return webkit_window_properties_get_statusbar_visible(webkit_web_view_get_window_properties(m_webView));
+ }
</ins><span class="cx">
</span><del>-static WKRect getWindowFrame(WKPageRef, const void* clientInfo)
-{
- GdkRectangle geometry = { 0, 0, 0, 0 };
- GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(clientInfo));
- if (WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) {
- gtk_window_get_position(GTK_WINDOW(window), &geometry.x, &geometry.y);
- gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height);
</del><ins>+ virtual void setStatusBarIsVisible(WebPageProxy*, bool visible) override
+ {
+ webkitWindowPropertiesSetStatusbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
</ins><span class="cx"> }
</span><del>- return WKRectMake(geometry.x, geometry.y, geometry.width, geometry.height);
-}
</del><span class="cx">
</span><del>-static void setWindowFrame(WKPageRef, WKRect frame, const void* clientInfo)
-{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
- GdkRectangle geometry = { static_cast<int>(frame.origin.x), static_cast<int>(frame.origin.y),
- static_cast<int>(frame.size.width), static_cast<int>(frame.size.height) };
- webkitWindowPropertiesSetGeometry(windowProperties, &geometry);
-}
</del><ins>+ virtual bool isResizable(WebPageProxy*) override
+ {
+ return webkit_window_properties_get_resizable(webkit_web_view_get_window_properties(m_webView));
+ }
</ins><span class="cx">
</span><del>-static void mouseDidMoveOverElement(WKPageRef, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef /* userData */, const void* clientInfo)
-{
- webkitWebViewMouseTargetChanged(WEBKIT_WEB_VIEW(clientInfo), toImpl(hitTestResult), wkEventModifiersToGdkModifiers(modifiers));
-}
</del><ins>+ virtual void setIsResizable(WebPageProxy*, bool resizable) override
+ {
+ webkitWindowPropertiesSetResizable(webkit_web_view_get_window_properties(m_webView), resizable);
+ }
</ins><span class="cx">
</span><del>-static void printFrame(WKPageRef page, WKFrameRef frame, const void*)
-{
- webkitWebViewPrintFrame(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(frame));
-}
</del><ins>+ virtual void setWindowFrame(WebPageProxy*, const WebCore::FloatRect& frame) override
+ {
+ GdkRectangle geometry = WebCore::IntRect(frame);
+ webkitWindowPropertiesSetGeometry(webkit_web_view_get_window_properties(m_webView), &geometry);
+ }
</ins><span class="cx">
</span><del>-static void runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo)
-{
- GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(toImpl(parameters), toImpl(listener)));
- webkitWebViewRunFileChooserRequest(WEBKIT_WEB_VIEW(clientInfo), request.get());
-}
</del><ins>+ virtual WebCore::FloatRect windowFrame(WebPageProxy*) override
+ {
+ GdkRectangle geometry = { 0, 0, 0, 0 };
+ GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
+ if (WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) {
+ gtk_window_get_position(GTK_WINDOW(window), &geometry.x, &geometry.y);
+ gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height);
+ }
+ return WebCore::FloatRect(geometry);
+ }
</ins><span class="cx">
</span><del>-static void decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKGeolocationPermissionRequestRef request, const void* clientInfo)
-{
- GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(toImpl(request)));
- webkitWebViewMakePermissionRequest(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
-}
</del><ins>+ virtual bool runOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override
+ {
+ GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(parameters, listener));
+ webkitWebViewRunFileChooserRequest(m_webView, request.get());
+ return true;
+ }
</ins><span class="cx">
</span><del>-static void runModal(WKPageRef, const void* clientInfo)
-{
- webkitWebViewRunAsModal(WEBKIT_WEB_VIEW(clientInfo));
-}
</del><ins>+ virtual bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy* permissionRequest) override
+ {
+ GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(permissionRequest));
+ webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
+ return true;
+ }
</ins><span class="cx">
</span><ins>+ virtual void printFrame(WebPageProxy*, WebFrameProxy* frame) override
+ {
+ webkitWebViewPrintFrame(m_webView, frame);
+ }
+
+ virtual bool canRunModal() const override { return true; }
+
+ virtual void runModal(WebPageProxy*) override
+ {
+ webkitWebViewRunAsModal(m_webView);
+ }
+
+ WebKitWebView* m_webView;
+};
+
</ins><span class="cx"> void attachUIClientToView(WebKitWebView* webView)
</span><span class="cx"> {
</span><del>- WKPageUIClientV2 wkUIClient = {
- {
- 2, // version
- webView, // clientInfo
- },
- 0, // createNewPage_deprecatedForUseWithV0
- showPage,
- closePage,
- 0, // takeFocus
- 0, // focus
- 0, // unfocus
- runJavaScriptAlert,
- runJavaScriptConfirm,
- runJavaScriptPrompt,
- 0, // setStatusText
- 0, // mouseDidMoveOverElement_deprecatedForUseWithV0
- 0, // missingPluginButtonClicked
- 0, // didNotHandleKeyEvent
- 0, // didNotHandleWheelEvent
- toolbarsAreVisible,
- setToolbarsAreVisible,
- menuBarIsVisible,
- setMenuBarIsVisible,
- statusBarIsVisible,
- setStatusBarIsVisible,
- isResizable,
- setIsResizable,
- getWindowFrame,
- setWindowFrame,
- 0, // runBeforeUnloadConfirmPanel
- 0, // didDraw
- 0, // pageDidScroll
- 0, // exceededDatabaseQuota
- runOpenPanel,
- decidePolicyForGeolocationPermissionRequest,
- 0, // headerHeight
- 0, // footerHeight
- 0, // drawHeader
- 0, // drawFooter
- printFrame,
- runModal,
- 0, // didCompleteRubberBandForMainFrame
- 0, // saveDataToFileInDownloadsFolder
- 0, // shouldInterruptJavaScript
- createNewPage,
- mouseDidMoveOverElement,
- 0, // decidePolicyForNotificationPermissionRequest
- 0, // unavailablePluginButtonClicked
- 0, // showColorPicker
- 0, // hideColorPicker
- 0, // pluginLoadPolicy
- };
- WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
- WKPageSetPageUIClient(wkPage, &wkUIClient.base);
</del><ins>+ WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
+ page->setUIClient(std::make_unique<UIClient>(webView));
</ins><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -217,9 +217,9 @@
</span><span class="cx"> return TRUE;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static GtkWidget* webkitWebViewCreate(WebKitWebView*)
</del><ins>+static GtkWidget* webkitWebViewCreate(WebKitWebView*, WebKitNavigationAction*)
</ins><span class="cx"> {
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static GtkWidget* webkitWebViewCreateJavaScriptDialog(WebKitWebView* webView, GtkMessageType type, GtkButtonsType buttons, int defaultResponse, const char* message)
</span><span class="lines">@@ -889,14 +889,18 @@
</span><span class="cx"> /**
</span><span class="cx"> * WebKitWebView::create:
</span><span class="cx"> * @web_view: the #WebKitWebView on which the signal is emitted
</span><ins>+ * @navigation_action: a #WebKitNavigationAction
</ins><span class="cx"> *
</span><span class="cx"> * Emitted when the creation of a new #WebKitWebView is requested.
</span><span class="cx"> * If this signal is handled the signal handler should return the
</span><span class="cx"> * newly created #WebKitWebView.
</span><span class="cx"> *
</span><ins>+ * The #WebKitNavigationAction parameter contains information about the
+ * navigation action that triggered this signal.
+ *
</ins><span class="cx"> * When using %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES
</span><span class="cx"> * process model, the new #WebKitWebView should be related to
</span><del>- * @web_view to share the same web process, see webkit_web_view_new_with_related_view
</del><ins>+ * @web_view to share the same web process, see webkit_web_view_new_with_related_view()
</ins><span class="cx"> * for more details.
</span><span class="cx"> *
</span><span class="cx"> * The new #WebKitWebView should not be displayed to the user
</span><span class="lines">@@ -905,14 +909,15 @@
</span><span class="cx"> * Returns: (transfer full): a newly allocated #WebKitWebView widget
</span><span class="cx"> * or %NULL to propagate the event further.
</span><span class="cx"> */
</span><del>- signals[CREATE] =
- g_signal_new("create",
- G_TYPE_FROM_CLASS(webViewClass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebViewClass, create),
- webkitWebViewAccumulatorObjectHandled, 0,
- webkit_marshal_OBJECT__VOID,
- GTK_TYPE_WIDGET, 0);
</del><ins>+ signals[CREATE] = g_signal_new(
+ "create",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitWebViewClass, create),
+ webkitWebViewAccumulatorObjectHandled, 0,
+ g_cclosure_marshal_generic,
+ GTK_TYPE_WIDGET, 1,
+ WEBKIT_TYPE_NAVIGATION_ACTION | G_SIGNAL_TYPE_STATIC_SCOPE);
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * WebKitWebView::ready-to-show:
</span><span class="lines">@@ -1601,10 +1606,10 @@
</span><span class="cx"> g_object_notify(G_OBJECT(webView), "uri");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, ImmutableDictionary* windowFeatures)
</del><ins>+WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, const WindowFeatures& windowFeatures, WebKitNavigationAction* navigationAction)
</ins><span class="cx"> {
</span><span class="cx"> WebKitWebView* newWebView;
</span><del>- g_signal_emit(webView, signals[CREATE], 0, &newWebView);
</del><ins>+ g_signal_emit(webView, signals[CREATE], 0, navigationAction, &newWebView);
</ins><span class="cx"> if (!newWebView)
</span><span class="cx"> return 0;
</span><span class="cx">
</span><span class="lines">@@ -1674,9 +1679,9 @@
</span><span class="cx"> g_signal_emit(webView, signals[PERMISSION_REQUEST], 0, request, &returnValue);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void webkitWebViewMouseTargetChanged(WebKitWebView* webView, WebHitTestResult* hitTestResult, unsigned modifiers)
</del><ins>+void webkitWebViewMouseTargetChanged(WebKitWebView* webView, const WebHitTestResult::Data& hitTestResult, unsigned modifiers)
</ins><span class="cx"> {
</span><del>- webkitWebViewBaseSetTooltipArea(WEBKIT_WEB_VIEW_BASE(webView), hitTestResult->elementBoundingBox());
</del><ins>+ webkitWebViewBaseSetTooltipArea(WEBKIT_WEB_VIEW_BASE(webView), hitTestResult.elementBoundingBox);
</ins><span class="cx">
</span><span class="cx"> WebKitWebViewPrivate* priv = webView->priv;
</span><span class="cx"> if (priv->mouseTargetHitTestResult
</span><span class="lines">@@ -1828,7 +1833,19 @@
</span><span class="cx"> if (webHitTestResult->isContentEditable())
</span><span class="cx"> webkitWebViewCreateAndAppendInputMethodsMenuItem(webView, contextMenu.get());
</span><span class="cx">
</span><del>- GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(webHitTestResult));
</del><ins>+ // FIXME: we should use a custom ContextMenuClient at some point, that will receive a
+ // const WebHitTestResult::Data& that we can use directly here.
+ WebHitTestResult::Data data;
+ data.absoluteImageURL = webHitTestResult->absoluteImageURL();
+ data.absoluteLinkURL = webHitTestResult->absoluteLinkURL();
+ data.absoluteMediaURL = webHitTestResult->absoluteMediaURL();
+ data.linkLabel = webHitTestResult->linkLabel();
+ data.linkTitle = webHitTestResult->linkTitle();
+ data.isContentEditable = webHitTestResult->isContentEditable();
+ data.elementBoundingBox = webHitTestResult->elementBoundingBox();
+ data.isScrollbar = webHitTestResult->isScrollbar();
+
+ GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(data));
</ins><span class="cx"> GUniquePtr<GdkEvent> contextMenuEvent(webkitWebViewBaseTakeContextMenuEvent(webViewBase));
</span><span class="cx">
</span><span class="cx"> gboolean returnValue;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include <webkit2/WebKitForwardDeclarations.h>
</span><span class="cx"> #include <webkit2/WebKitHitTestResult.h>
</span><span class="cx"> #include <webkit2/WebKitJavascriptResult.h>
</span><ins>+#include <webkit2/WebKitNavigationAction.h>
</ins><span class="cx"> #include <webkit2/WebKitPermissionRequest.h>
</span><span class="cx"> #include <webkit2/WebKitPolicyDecision.h>
</span><span class="cx"> #include <webkit2/WebKitScriptDialog.h>
</span><span class="lines">@@ -194,7 +195,8 @@
</span><span class="cx"> const gchar *failing_uri,
</span><span class="cx"> GError *error);
</span><span class="cx">
</span><del>- GtkWidget *(* create) (WebKitWebView *web_view);
</del><ins>+ GtkWidget *(* create) (WebKitWebView *web_view,
+ WebKitNavigationAction *navigation_action);
</ins><span class="cx"> void (* ready_to_show) (WebKitWebView *web_view);
</span><span class="cx"> void (* run_as_modal) (WebKitWebView *web_view);
</span><span class="cx"> void (* close) (WebKitWebView *web_view);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #ifndef WebKitWebViewPrivate_h
</span><span class="cx"> #define WebKitWebViewPrivate_h
</span><span class="cx">
</span><ins>+#include "WebHitTestResult.h"
</ins><span class="cx"> #include "WebImage.h"
</span><span class="cx"> #include "WebKitWebView.h"
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="lines">@@ -37,7 +38,7 @@
</span><span class="cx"> void webkitWebViewSetEstimatedLoadProgress(WebKitWebView*, double estimatedLoadProgress);
</span><span class="cx"> void webkitWebViewSetTitle(WebKitWebView*, const CString&);
</span><span class="cx"> void webkitWebViewUpdateURI(WebKitWebView*);
</span><del>-WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, WebKit::ImmutableDictionary* windowFeatures);
</del><ins>+WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, const WebCore::WindowFeatures&, WebKitNavigationAction*);
</ins><span class="cx"> void webkitWebViewReadyToShowPage(WebKitWebView*);
</span><span class="cx"> void webkitWebViewRunAsModal(WebKitWebView*);
</span><span class="cx"> void webkitWebViewClosePage(WebKitWebView*);
</span><span class="lines">@@ -46,7 +47,7 @@
</span><span class="cx"> CString webkitWebViewRunJavaScriptPrompt(WebKitWebView*, const CString& message, const CString& defaultText);
</span><span class="cx"> void webkitWebViewMakePermissionRequest(WebKitWebView*, WebKitPermissionRequest*);
</span><span class="cx"> void webkitWebViewMakePolicyDecision(WebKitWebView*, WebKitPolicyDecisionType, WebKitPolicyDecision*);
</span><del>-void webkitWebViewMouseTargetChanged(WebKitWebView*, WebKit::WebHitTestResult*, unsigned modifiers);
</del><ins>+void webkitWebViewMouseTargetChanged(WebKitWebView*, const WebKit::WebHitTestResult::Data&, unsigned modifiers);
</ins><span class="cx"> void webkitWebViewPrintFrame(WebKitWebView*, WebKit::WebFrameProxy*);
</span><span class="cx"> void webkitWebViewResourceLoadStarted(WebKitWebView*, WebKit::WebFrameProxy*, uint64_t resourceIdentifier, WebKitURIRequest*);
</span><span class="cx"> void webkitWebViewRunFileChooserRequest(WebKitWebView*, WebKitFileChooserRequest*);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWindowPropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "WebKitPrivate.h"
</span><span class="cx"> #include "WebKitWindowPropertiesPrivate.h"
</span><span class="cx"> #include <WebCore/IntRect.h>
</span><ins>+#include <WebCore/WindowFeatures.h>
</ins><span class="cx"> #include <glib/gi18n-lib.h>
</span><span class="cx">
</span><span class="cx"> using namespace WebKit;
</span><span class="lines">@@ -374,54 +375,26 @@
</span><span class="cx"> g_object_notify(G_OBJECT(windowProperties), "fullscreen");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties* windowProperties, ImmutableDictionary* features)
</del><ins>+void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties* windowProperties, const WindowFeatures& windowFeatures)
</ins><span class="cx"> {
</span><span class="cx"> GdkRectangle geometry = windowProperties->priv->geometry;
</span><del>-
- API::Double* doubleValue = static_cast<API::Double*>(features->get("x"));
- if (doubleValue)
- geometry.x = doubleValue->value();
-
- doubleValue = static_cast<API::Double*>(features->get("y"));
- if (doubleValue)
- geometry.y = doubleValue->value();
-
- doubleValue = static_cast<API::Double*>(features->get("width"));
- if (doubleValue)
- geometry.width = doubleValue->value();
-
- doubleValue = static_cast<API::Double*>(features->get("height"));
- if (doubleValue)
- geometry.height = doubleValue->value();
</del><ins>+ if (windowFeatures.xSet)
+ geometry.x = windowFeatures.x;
+ if (windowFeatures.ySet)
+ geometry.y = windowFeatures.y;
+ if (windowFeatures.widthSet)
+ geometry.width = windowFeatures.width;
+ if (windowFeatures.heightSet)
+ geometry.height = windowFeatures.height;
</ins><span class="cx"> webkitWindowPropertiesSetGeometry(windowProperties, &geometry);
</span><span class="cx">
</span><del>- API::Boolean* booleanValue = static_cast<API::Boolean*>(features->get("menuBarVisible"));
- if (booleanValue)
- webkitWindowPropertiesSetMenubarVisible(windowProperties, booleanValue->value());
-
- booleanValue = static_cast<API::Boolean*>(features->get("statusBarVisible"));
- if (booleanValue)
- webkitWindowPropertiesSetStatusbarVisible(windowProperties, booleanValue->value());
-
- booleanValue = static_cast<API::Boolean*>(features->get("toolBarVisible"));
- if (booleanValue)
- webkitWindowPropertiesSetToolbarVisible(windowProperties, booleanValue->value());
-
- booleanValue = static_cast<API::Boolean*>(features->get("locationBarVisible"));
- if (booleanValue)
- webkitWindowPropertiesSetLocationbarVisible(windowProperties, booleanValue->value());
-
- booleanValue = static_cast<API::Boolean*>(features->get("scrollbarsVisible"));
- if (booleanValue)
- webkitWindowPropertiesSetScrollbarsVisible(windowProperties, booleanValue->value());
-
- booleanValue = static_cast<API::Boolean*>(features->get("resizable"));
- if (booleanValue)
- webkitWindowPropertiesSetResizable(windowProperties, booleanValue->value());
-
- booleanValue = static_cast<API::Boolean*>(features->get("fullscreen"));
- if (booleanValue)
- webkitWindowPropertiesSetFullscreen(windowProperties, booleanValue->value());
</del><ins>+ webkitWindowPropertiesSetMenubarVisible(windowProperties, windowFeatures.menuBarVisible);
+ webkitWindowPropertiesSetStatusbarVisible(windowProperties, windowFeatures.statusBarVisible);
+ webkitWindowPropertiesSetToolbarVisible(windowProperties, windowFeatures.toolBarVisible);
+ webkitWindowPropertiesSetLocationbarVisible(windowProperties, windowFeatures.locationBarVisible);
+ webkitWindowPropertiesSetScrollbarsVisible(windowProperties, windowFeatures.scrollbarsVisible);
+ webkitWindowPropertiesSetResizable(windowProperties, windowFeatures.resizable);
+ webkitWindowPropertiesSetFullscreen(windowProperties, windowFeatures.fullscreen);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWindowPropertiesPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #include "WebKitWindowProperties.h"
</span><span class="cx">
</span><span class="cx"> WebKitWindowProperties* webkitWindowPropertiesCreate();
</span><del>-void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties*, WebKit::ImmutableDictionary* features);
</del><ins>+void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties*, const WebCore::WindowFeatures&);
</ins><span class="cx"> void webkitWindowPropertiesSetGeometry(WebKitWindowProperties*, GdkRectangle*);
</span><span class="cx"> void webkitWindowPropertiesSetToolbarVisible(WebKitWindowProperties*, bool toolbarsVisible);
</span><span class="cx"> void webkitWindowPropertiesSetMenubarVisible(WebKitWindowProperties*, bool menuBarVisible);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> <xi:include href="xml/WebKitDownload.xml"/>
</span><span class="cx"> <xi:include href="xml/WebKitPermissionRequest.xml"/>
</span><span class="cx"> <xi:include href="xml/WebKitGeolocationPermissionRequest.xml"/>
</span><ins>+ <xi:include href="xml/WebKitNavigationAction.xml"/>
</ins><span class="cx"> <xi:include href="xml/WebKitPolicyDecision.xml"/>
</span><span class="cx"> <xi:include href="xml/WebKitNavigationPolicyDecision.xml"/>
</span><span class="cx"> <xi:include href="xml/WebKitResponsePolicyDecision.xml"/>
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -521,6 +521,24 @@
</span><span class="cx"> </SECTION>
</span><span class="cx">
</span><span class="cx"> <SECTION>
</span><ins>+<FILE>WebKitNavigationAction</FILE>
+WebKitNavigationAction
+webkit_navigation_action_copy
+webkit_navigation_action_free
+webkit_navigation_action_get_navigation_type
+webkit_navigation_action_get_mouse_button
+webkit_navigation_action_get_modifiers
+webkit_navigation_action_get_request
+webkit_navigation_action_is_user_gesture
+
+<SUBSECTION Standard>
+WEBKIT_TYPE_NAVIGATION_ACTION
+
+<SUBSECTION Private>
+webkit_navigation_action_get_type
+</SECTION>
+
+<SECTION>
</ins><span class="cx"> <FILE>WebKitPolicyDecision</FILE>
</span><span class="cx"> WebKitPolicyDecision
</span><span class="cx"> webkit_policy_decision_download
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkwebkit2h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include <webkit2/WebKitHitTestResult.h>
</span><span class="cx"> #include <webkit2/WebKitJavascriptResult.h>
</span><span class="cx"> #include <webkit2/WebKitMimeInfo.h>
</span><ins>+#include <webkit2/WebKitNavigationAction.h>
</ins><span class="cx"> #include <webkit2/WebKitNavigationPolicyDecision.h>
</span><span class="cx"> #include <webkit2/WebKitPermissionRequest.h>
</span><span class="cx"> #include <webkit2/WebKitPlugin.h>
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Tools/ChangeLog        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2014-07-02 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [GTK] WebKitWebView::create should receive information about the navigation action
+ https://bugs.webkit.org/show_bug.cgi?id=133680
+
+ Reviewed by Martin Robinson.
+
+ Add unit test to check the WebKitNavigationAction passed to
+ WebKitWebView::create callback.
+
+ * MiniBrowser/gtk/BrowserWindow.c:
+ (webViewCreate): Add WebKitNavigationAction parameter.
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp:
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
+ (testWebViewCreateNavigationData):
+ (beforeAll):
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitPolicyClient.cpp:
+ (createCallback):
+
+2014-07-02 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GTK] Do not add forward declaration of class struct for interfaces
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=134297
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsMiniBrowsergtkBrowserWindowc"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -348,7 +348,7 @@
</span><span class="cx"> return FALSE;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static GtkWidget *webViewCreate(WebKitWebView *webView, BrowserWindow *window)
</del><ins>+static GtkWidget *webViewCreate(WebKitWebView *webView, WebKitNavigationAction *navigation, BrowserWindow *window)
</ins><span class="cx"> {
</span><span class="cx"> WebKitWebView *newWebView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_related_view(webView));
</span><span class="cx"> webkit_web_view_set_settings(newWebView, webkit_web_view_get_settings(webView));
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestMultiprocesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx"> Close
</span><span class="cx"> };
</span><span class="cx">
</span><del>- static GtkWidget* viewCreateCallback(WebKitWebView* webView, UIClientMultiprocessTest* test)
</del><ins>+ static GtkWidget* viewCreateCallback(WebKitWebView* webView, WebKitNavigationAction*, UIClientMultiprocessTest* test)
</ins><span class="cx"> {
</span><span class="cx"> return test->viewCreate(webView);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestPrintingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx"> public:
</span><span class="cx"> MAKE_GLIB_TEST_FIXTURE(CloseAfterPrintTest);
</span><span class="cx">
</span><del>- static GtkWidget* webViewCreate(WebKitWebView* webView, CloseAfterPrintTest* test)
</del><ins>+ static GtkWidget* webViewCreate(WebKitWebView* webView, WebKitNavigationAction*, CloseAfterPrintTest* test)
</ins><span class="cx"> {
</span><span class="cx"> return test->createWebView();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -117,9 +117,9 @@
</span><span class="cx"> test->m_windowPropertiesChanged.add(g_param_spec_get_name(paramSpec));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static GtkWidget* viewCreateCallback(WebKitWebView* webView, UIClientTest* test)
</del><ins>+ static GtkWidget* viewCreateCallback(WebKitWebView* webView, WebKitNavigationAction* navigation, UIClientTest* test)
</ins><span class="cx"> {
</span><del>- return test->viewCreate(webView);
</del><ins>+ return test->viewCreate(webView, navigation);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void viewReadyToShowCallback(WebKitWebView* webView, UIClientTest* test)
</span><span class="lines">@@ -240,9 +240,10 @@
</span><span class="cx"> return m_mouseTargetHitTestResult.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- virtual GtkWidget* viewCreate(WebKitWebView* webView)
</del><ins>+ virtual GtkWidget* viewCreate(WebKitWebView* webView, WebKitNavigationAction* navigation)
</ins><span class="cx"> {
</span><span class="cx"> g_assert(webView == m_webView);
</span><ins>+ g_assert(navigation);
</ins><span class="cx">
</span><span class="cx"> GtkWidget* newWebView = webkit_web_view_new_with_context(webkit_web_view_get_context(webView));
</span><span class="cx"> g_object_ref_sink(newWebView);
</span><span class="lines">@@ -305,6 +306,91 @@
</span><span class="cx"> g_assert_cmpint(events[2], ==, UIClientTest::Close);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+class CreateNavigationDataTest: public UIClientTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(CreateNavigationDataTest);
+
+ CreateNavigationDataTest()
+ : m_navigation(nullptr)
+ {
+ }
+
+ ~CreateNavigationDataTest()
+ {
+ clearNavigation();
+ }
+
+ void clearNavigation()
+ {
+ if (m_navigation)
+ webkit_navigation_action_free(m_navigation);
+ m_navigation = nullptr;
+ }
+
+ GtkWidget* viewCreate(WebKitWebView* webView, WebKitNavigationAction* navigation)
+ {
+ g_assert(navigation);
+ g_assert(!m_navigation);
+ m_navigation = webkit_navigation_action_copy(navigation);
+ g_main_loop_quit(m_mainLoop);
+ return nullptr;
+ }
+
+ void loadHTML(const char* html)
+ {
+ clearNavigation();
+ WebViewTest::loadHtml(html, nullptr);
+ }
+
+ void clickAndWaitUntilMainLoopFinishes(int x, int y)
+ {
+ clearNavigation();
+ clickMouseButton(x, y, 1);
+ g_main_loop_run(m_mainLoop);
+ }
+
+ WebKitNavigationAction* m_navigation;
+};
+
+static void testWebViewCreateNavigationData(CreateNavigationDataTest* test, gconstpointer)
+{
+ test->showInWindowAndWaitUntilMapped();
+
+ test->loadHTML(
+ "<html><body>"
+ "<input style=\"position:absolute; left:0; top:0; margin:0; padding:0\" type=\"button\" value=\"click to show a popup\" onclick=\"window.open('data:foo');\"/>"
+ "<a style=\"position:absolute; left:20; top:20;\" href=\"data:bar\" target=\"_blank\">popup link</a>"
+ "</body></html>");
+ test->waitUntilLoadFinished();
+
+ // Click on a button.
+ test->clickAndWaitUntilMainLoopFinishes(5, 5);
+ g_assert_cmpstr(webkit_uri_request_get_uri(webkit_navigation_action_get_request(test->m_navigation)), ==, "data:foo");
+ g_assert_cmpuint(webkit_navigation_action_get_navigation_type(test->m_navigation), ==, WEBKIT_NAVIGATION_TYPE_OTHER);
+ // FIXME: This should be button 1.
+ g_assert_cmpuint(webkit_navigation_action_get_mouse_button(test->m_navigation), ==, 0);
+ g_assert_cmpuint(webkit_navigation_action_get_modifiers(test->m_navigation), ==, 0);
+ g_assert(webkit_navigation_action_is_user_gesture(test->m_navigation));
+
+ // Click on a link.
+ test->clickAndWaitUntilMainLoopFinishes(21, 21);
+ g_assert_cmpstr(webkit_uri_request_get_uri(webkit_navigation_action_get_request(test->m_navigation)), ==, "data:bar");
+ g_assert_cmpuint(webkit_navigation_action_get_navigation_type(test->m_navigation), ==, WEBKIT_NAVIGATION_TYPE_LINK_CLICKED);
+ g_assert_cmpuint(webkit_navigation_action_get_mouse_button(test->m_navigation), ==, 1);
+ g_assert_cmpuint(webkit_navigation_action_get_modifiers(test->m_navigation), ==, 0);
+ g_assert(webkit_navigation_action_is_user_gesture(test->m_navigation));
+
+ // No user interaction.
+ test->loadHTML("<html><body onLoad=\"window.open();\"></html>");
+ test->waitUntilMainLoopFinishes();
+
+ g_assert_cmpstr(webkit_uri_request_get_uri(webkit_navigation_action_get_request(test->m_navigation)), ==, "");
+ g_assert_cmpuint(webkit_navigation_action_get_navigation_type(test->m_navigation), ==, WEBKIT_NAVIGATION_TYPE_OTHER);
+ g_assert_cmpuint(webkit_navigation_action_get_mouse_button(test->m_navigation), ==, 0);
+ g_assert_cmpuint(webkit_navigation_action_get_modifiers(test->m_navigation), ==, 0);
+ g_assert(!webkit_navigation_action_is_user_gesture(test->m_navigation));
+}
+
</ins><span class="cx"> static gboolean checkMimeTypeForFilter(GtkFileFilter* filter, const gchar* mimeType)
</span><span class="cx"> {
</span><span class="cx"> GtkFileFilterInfo filterInfo;
</span><span class="lines">@@ -323,11 +409,11 @@
</span><span class="cx"> test->m_webViewEvents.append(RunAsModal);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GtkWidget* viewCreate(WebKitWebView* webView)
</del><ins>+ GtkWidget* viewCreate(WebKitWebView* webView, WebKitNavigationAction* navigation)
</ins><span class="cx"> {
</span><span class="cx"> g_assert(webView == m_webView);
</span><span class="cx">
</span><del>- GtkWidget* newWebView = UIClientTest::viewCreate(webView);
</del><ins>+ GtkWidget* newWebView = UIClientTest::viewCreate(webView, navigation);
</ins><span class="cx"> g_signal_connect(newWebView, "run-as-modal", G_CALLBACK(dialogRunAsModalCallback), this);
</span><span class="cx"> return newWebView;
</span><span class="cx"> }
</span><span class="lines">@@ -665,6 +751,7 @@
</span><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><span class="cx"> UIClientTest::add("WebKitWebView", "create-ready-close", testWebViewCreateReadyClose);
</span><ins>+ CreateNavigationDataTest::add("WebKitWebView", "create-navigation-data", testWebViewCreateNavigationData);
</ins><span class="cx"> ModalDialogsTest::add("WebKitWebView", "allow-modal-dialogs", testWebViewAllowModalDialogs);
</span><span class="cx"> ModalDialogsTest::add("WebKitWebView", "disallow-modal-dialogs", testWebViewDisallowModalDialogs);
</span><span class="cx"> UIClientTest::add("WebKitWebView", "javascript-dialogs", testWebViewJavaScriptDialogs);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitPolicyClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitPolicyClient.cpp (170701 => 170702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitPolicyClient.cpp        2014-07-02 07:09:26 UTC (rev 170701)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitPolicyClient.cpp        2014-07-02 07:19:46 UTC (rev 170702)
</span><span class="lines">@@ -191,7 +191,7 @@
</span><span class="cx"> GMainLoop* mainLoop;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-static WebKitWebView* createCallback(WebKitWebView* webView, CreateCallbackData* data)
</del><ins>+static WebKitWebView* createCallback(WebKitWebView* webView, WebKitNavigationAction*, CreateCallbackData* data)
</ins><span class="cx"> {
</span><span class="cx"> data->triedToOpenWindow = true;
</span><span class="cx"> g_main_loop_quit(data->mainLoop);
</span></span></pre>
</div>
</div>
</body>
</html>