<!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>[175160] 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/175160">175160</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-24 00:09:57 -0700 (Fri, 24 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Implement is_selected method on WebKitHitTestResult
https://bugs.webkit.org/show_bug.cgi?id=137110
Patch by Marcos Chavarría Teijeiro <chavarria1991@gmail.com> on 2014-10-24
Reviewed by Tim Horton.
Source/WebKit2:
Expose CONTEXT_SELECTION for WebKitHitTestResult.
* Shared/WebHitTestResult.cpp: Add is_selected field and getter for this field.
(WebKit::WebHitTestResult::Data::Data):
(WebKit::WebHitTestResult::Data::encode):
(WebKit::WebHitTestResult::Data::decode):
* Shared/WebHitTestResult.h:
(WebKit::WebHitTestResult::isSelected):
* UIProcess/API/gtk/WebKitHitTestResult.cpp: Add WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION context and method to check it.
(webkitHitTestResultCreate):
(webkitHitTestResultCompare):
(webkit_hit_test_result_context_is_selection):
* UIProcess/API/gtk/WebKitHitTestResult.h:
* UIProcess/API/gtk/WebKitWebView.cpp: Modify context-menu callback to set the new context option.
(webkitWebViewPopulateContextMenu):
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add documentation about new function.
Tools:
Add tests for new context SELECTION on WebKitHitTestResult.
* TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp:
(testContextMenuDefaultMenu):
* TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
(testWebViewMouseTarget):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebHitTestResultcpp">trunk/Source/WebKit2/Shared/WebHitTestResult.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebHitTestResulth">trunk/Source/WebKit2/Shared/WebHitTestResult.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResultcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResulth">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestContextMenucpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestUIClientcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/ChangeLog        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-10-24 Marcos Chavarría Teijeiro <chavarria1991@gmail.com>
+
+ [GTK] Implement is_selected method on WebKitHitTestResult
+ https://bugs.webkit.org/show_bug.cgi?id=137110
+
+ Reviewed by Tim Horton.
+
+ Expose CONTEXT_SELECTION for WebKitHitTestResult.
+
+ * Shared/WebHitTestResult.cpp: Add is_selected field and getter for this field.
+ (WebKit::WebHitTestResult::Data::Data):
+ (WebKit::WebHitTestResult::Data::encode):
+ (WebKit::WebHitTestResult::Data::decode):
+ * Shared/WebHitTestResult.h:
+ (WebKit::WebHitTestResult::isSelected):
+ * UIProcess/API/gtk/WebKitHitTestResult.cpp: Add WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION context and method to check it.
+ (webkitHitTestResultCreate):
+ (webkitHitTestResultCompare):
+ (webkit_hit_test_result_context_is_selection):
+ * UIProcess/API/gtk/WebKitHitTestResult.h:
+ * UIProcess/API/gtk/WebKitWebView.cpp: Modify context-menu callback to set the new context option.
+ (webkitWebViewPopulateContextMenu):
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add documentation about new function.
+
</ins><span class="cx"> 2014-10-23 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK][Cairo] Remove GTK dependency of WidgetBackingStoreGtkX11
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebHitTestResult.cpp (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebHitTestResult.cpp        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/Shared/WebHitTestResult.cpp        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> , isContentEditable(hitTestResult.isContentEditable())
</span><span class="cx"> , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
</span><span class="cx"> , isScrollbar(hitTestResult.scrollbar())
</span><ins>+ , isSelected(hitTestResult.isSelected())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -70,6 +71,7 @@
</span><span class="cx"> encoder << isContentEditable;
</span><span class="cx"> encoder << elementBoundingBox;
</span><span class="cx"> encoder << isScrollbar;
</span><ins>+ encoder << isSelected;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebHitTestResult::Data::decode(IPC::ArgumentDecoder& decoder, WebHitTestResult::Data& hitTestResultData)
</span><span class="lines">@@ -82,7 +84,8 @@
</span><span class="cx"> || !decoder.decode(hitTestResultData.linkTitle)
</span><span class="cx"> || !decoder.decode(hitTestResultData.isContentEditable)
</span><span class="cx"> || !decoder.decode(hitTestResultData.elementBoundingBox)
</span><del>- || !decoder.decode(hitTestResultData.isScrollbar))
</del><ins>+ || !decoder.decode(hitTestResultData.isScrollbar)
+ || !decoder.decode(hitTestResultData.isSelected))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebHitTestResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebHitTestResult.h (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebHitTestResult.h        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/Shared/WebHitTestResult.h        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> bool isContentEditable;
</span><span class="cx"> WebCore::IntRect elementBoundingBox;
</span><span class="cx"> bool isScrollbar;
</span><ins>+ bool isSelected;
</ins><span class="cx">
</span><span class="cx"> Data();
</span><span class="cx"> explicit Data(const WebCore::HitTestResult&);
</span><span class="lines">@@ -79,6 +80,8 @@
</span><span class="cx">
</span><span class="cx"> bool isScrollbar() const { return m_data.isScrollbar; }
</span><span class="cx">
</span><ins>+ bool isSelected() const { return m_data.isSelected; }
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit WebHitTestResult(const WebHitTestResult::Data& hitTestResultData)
</span><span class="cx"> : m_data(hitTestResultData)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -240,6 +240,9 @@
</span><span class="cx"> if (hitTestResult.isScrollbar)
</span><span class="cx"> context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR;
</span><span class="cx">
</span><ins>+ if (hitTestResult.isSelected)
+ context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
+
</ins><span class="cx"> return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
</span><span class="cx"> "context", context,
</span><span class="cx"> "link-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK ? hitTestResult.absoluteLinkURL.utf8().data() : nullptr,
</span><span class="lines">@@ -260,6 +263,7 @@
</span><span class="cx"> WebKitHitTestResultPrivate* priv = hitTestResult->priv;
</span><span class="cx"> return webHitTestResult.isContentEditable == webkit_hit_test_result_context_is_editable(hitTestResult)
</span><span class="cx"> && webHitTestResult.isScrollbar == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
</span><ins>+ && webHitTestResult.isSelected == webkit_hit_test_result_context_is_selection(hitTestResult)
</ins><span class="cx"> && stringIsEqualToCString(webHitTestResult.absoluteLinkURL, priv->linkURI)
</span><span class="cx"> && stringIsEqualToCString(webHitTestResult.linkTitle, priv->linkTitle)
</span><span class="cx"> && stringIsEqualToCString(webHitTestResult.linkLabel, priv->linkLabel)
</span><span class="lines">@@ -351,6 +355,25 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_hit_test_result_context_is_selection:
+ * @hit_test_result: a #WebKitHitTestResult
+ *
+ * Gets whether %WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION flag is present in
+ * #WebKitHitTestResult:context.
+ *
+ * Returns: %TRUE if there's a selected element at the coordinates of the @hit_test_result,
+ * or %FALSE otherwise
+ *
+ * Since: 2.8
+ */
+gboolean webkit_hit_test_result_context_is_selection(WebKitHitTestResult* hitTestResult)
+{
+ g_return_val_if_fail(WEBKIT_IS_HIT_TEST_RESULT(hitTestResult), FALSE);
+
+ return hitTestResult->priv->context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
+}
+
+/**
</ins><span class="cx"> * webkit_hit_test_result_get_link_uri:
</span><span class="cx"> * @hit_test_result: a #WebKitHitTestResult
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitHitTestResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> * @WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA: a video or audio element.
</span><span class="cx"> * @WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE: an editable element
</span><span class="cx"> * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR: a scrollbar element.
</span><ins>+ * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION: a selected element. Since 2.8
</ins><span class="cx"> *
</span><span class="cx"> * Enum values with flags representing the context of a #WebKitHitTestResult.
</span><span class="cx"> */
</span><span class="lines">@@ -58,7 +59,8 @@
</span><span class="cx"> WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE = 1 << 3,
</span><span class="cx"> WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA = 1 << 4,
</span><span class="cx"> WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE = 1 << 5,
</span><del>- WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6
</del><ins>+ WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6,
+ WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 7
</ins><span class="cx"> } WebKitHitTestResultContext;
</span><span class="cx">
</span><span class="cx"> struct _WebKitHitTestResult {
</span><span class="lines">@@ -94,6 +96,9 @@
</span><span class="cx"> WEBKIT_API gboolean
</span><span class="cx"> webkit_hit_test_result_context_is_editable (WebKitHitTestResult *hit_test_result);
</span><span class="cx">
</span><ins>+WEBKIT_API gboolean
+webkit_hit_test_result_context_is_selection (WebKitHitTestResult *hit_test_result);
+
</ins><span class="cx"> WEBKIT_API const gchar *
</span><span class="cx"> webkit_hit_test_result_get_link_uri (WebKitHitTestResult *hit_test_result);
</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 (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -1911,6 +1911,7 @@
</span><span class="cx"> data.isContentEditable = webHitTestResult->isContentEditable();
</span><span class="cx"> data.elementBoundingBox = webHitTestResult->elementBoundingBox();
</span><span class="cx"> data.isScrollbar = webHitTestResult->isScrollbar();
</span><ins>+ data.isSelected = webHitTestResult->isSelected();
</ins><span class="cx">
</span><span class="cx"> GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(data));
</span><span class="cx"> GUniquePtr<GdkEvent> contextMenuEvent(webkitWebViewBaseTakeContextMenuEvent(webViewBase));
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -668,6 +668,7 @@
</span><span class="cx"> webkit_hit_test_result_context_is_image
</span><span class="cx"> webkit_hit_test_result_context_is_media
</span><span class="cx"> webkit_hit_test_result_context_is_editable
</span><ins>+webkit_hit_test_result_context_is_selection
</ins><span class="cx"> webkit_hit_test_result_get_link_uri
</span><span class="cx"> webkit_hit_test_result_get_link_title
</span><span class="cx"> webkit_hit_test_result_get_link_label
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Tools/ChangeLog        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-10-24 Marcos Chavarría Teijeiro <chavarria1991@gmail.com>
+
+ [GTK] Implement is_selected method on WebKitHitTestResult
+ https://bugs.webkit.org/show_bug.cgi?id=137110
+
+ Reviewed by Tim Horton.
+
+ Add tests for new context SELECTION on WebKitHitTestResult.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp:
+ (testContextMenuDefaultMenu):
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
+ (testWebViewMouseTarget):
+
</ins><span class="cx"> 2014-10-23 Roger Fong <roger_fong@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win] Skip failing JSC tests following r175078
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestContextMenucpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -239,7 +239,8 @@
</span><span class="cx"> LinkImage,
</span><span class="cx"> Video,
</span><span class="cx"> Audio,
</span><del>- Editable
</del><ins>+ Editable,
+ Selection
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> ContextMenuDefaultTest()
</span><span class="lines">@@ -257,6 +258,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_GO_BACK, Visible);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD, Visible);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_STOP, Visible);
</span><span class="lines">@@ -267,6 +269,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_LINK_TO_DISK, Visible | Enabled);
</span><span class="lines">@@ -277,6 +280,7 @@
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_IMAGE_IN_NEW_WINDOW, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_IMAGE_TO_DISK, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_COPY_IMAGE_TO_CLIPBOARD, Visible | Enabled);
</span><span class="lines">@@ -287,6 +291,7 @@
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_LINK_TO_DISK, Visible | Enabled);
</span><span class="lines">@@ -302,6 +307,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE, Visible);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS, Visible | Enabled | Checked);
</span><span class="lines">@@ -317,6 +323,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE, Visible);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS, Visible | Enabled | Checked);
</span><span class="lines">@@ -332,6 +339,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_CUT, Visible);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_COPY, Visible);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_PASTE, Visible | Enabled);
</span><span class="lines">@@ -343,6 +351,14 @@
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS, Visible | Enabled);
</span><span class="cx"> iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_UNICODE, Visible | Enabled);
</span><span class="cx"> break;
</span><ins>+ case Selection:
+ g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+ g_assert(webkit_hit_test_result_context_is_selection(hitTestResult));
+ iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_COPY, Visible | Enabled);
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> g_assert_not_reached();
</span><span class="cx"> }
</span><span class="lines">@@ -366,17 +382,32 @@
</span><span class="cx"> test->showInWindowAndWaitUntilMapped();
</span><span class="cx">
</span><span class="cx"> const char* linksHTML =
</span><del>- "<html><body>"
</del><ins>+ "<html><head>"
+ " <script>"
+ " window.onload = function () {"
+ " window.getSelection().removeAllRanges();"
+ " var select_range = document.createRange();"
+ " select_range.selectNodeContents(document.getElementById('text_to_select'));"
+ " window.getSelection().addRange(select_range);"
+ " }"
+ " </script>"
+ "</head><body>"
</ins><span class="cx"> " <a style='position:absolute; left:1; top:1' href='http://www.webkitgtk.org' title='WebKitGTK+ Title'>WebKitGTK+ Website</a>"
</span><span class="cx"> " <img style='position:absolute; left:1; top:10' src='0xdeadbeef' width=5 height=5></img>"
</span><span class="cx"> " <a style='position:absolute; left:1; top:20' href='http://www.webkitgtk.org/logo' title='WebKitGTK+ Logo'><img src='0xdeadbeef' width=5 height=5></img></a>"
</span><span class="cx"> " <input style='position:absolute; left:1; top:30' size='10'></input>"
</span><span class="cx"> " <video style='position:absolute; left:1; top:50' width='300' height='300' controls='controls' preload='none'><source src='movie.ogg' type='video/ogg' /></video>"
</span><span class="cx"> " <audio style='position:absolute; left:1; top:60' width='50' height='20' controls='controls' preload='none'><source src='track.mp3' type='audio/mp3' /></audio>"
</span><ins>+ " <p style='position:absolute; left:1; top:90' id='text_to_select'>Lorem ipsum.</p>"
</ins><span class="cx"> "</body></html>";
</span><span class="cx"> test->loadHtml(linksHTML, "file:///");
</span><span class="cx"> test->waitUntilLoadFinished();
</span><span class="cx">
</span><ins>+ // Context menu for selection.
+ // This test should always be the first because any other click removes the selection.
+ test->m_expectedMenuType = ContextMenuDefaultTest::Selection;
+ test->showContextMenuAtPositionAndWaitUntilFinished(2, 115);
+
</ins><span class="cx"> // Context menu for document.
</span><span class="cx"> test->m_expectedMenuType = ContextMenuDefaultTest::Navigation;
</span><span class="cx"> test->showContextMenuAtPositionAndWaitUntilFinished(0, 0);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp (175159 => 175160)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp        2014-10-24 06:58:13 UTC (rev 175159)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp        2014-10-24 07:09:57 UTC (rev 175160)
</span><span class="lines">@@ -509,13 +509,23 @@
</span><span class="cx"> test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
</span><span class="cx">
</span><span class="cx"> const char* linksHoveredHTML =
</span><del>- "<html><body>"
</del><ins>+ "<html><head>"
+ " <script>"
+ " window.onload = function () {"
+ " window.getSelection().removeAllRanges();"
+ " var select_range = document.createRange();"
+ " select_range.selectNodeContents(document.getElementById('text_to_select'));"
+ " window.getSelection().addRange(select_range);"
+ " }"
+ " </script>"
+ "</head><body>"
</ins><span class="cx"> " <a style='position:absolute; left:1; top:1' href='http://www.webkitgtk.org' title='WebKitGTK+ Title'>WebKitGTK+ Website</a>"
</span><span class="cx"> " <img style='position:absolute; left:1; top:10' src='0xdeadbeef' width=5 height=5></img>"
</span><span class="cx"> " <a style='position:absolute; left:1; top:20' href='http://www.webkitgtk.org/logo' title='WebKitGTK+ Logo'><img src='0xdeadbeef' width=5 height=5></img></a>"
</span><span class="cx"> " <input style='position:absolute; left:1; top:30' size='10'></input>"
</span><span class="cx"> " <div style='position:absolute; left:1; top:50; width:30; height:30; overflow:scroll'>&nbsp;</div>"
</span><span class="cx"> " <video style='position:absolute; left:1; top:100' width='300' height='300' controls='controls' preload='none'><source src='movie.ogg' type='video/ogg' /></video>"
</span><ins>+ " <p style='position:absolute; left:1; top:120' id='text_to_select'>Lorem ipsum.</p>"
</ins><span class="cx"> "</body></html>";
</span><span class="cx">
</span><span class="cx"> test->loadHtml(linksHoveredHTML, "file:///");
</span><span class="lines">@@ -527,6 +537,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, "http://www.webkitgtk.org/");
</span><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, "WebKitGTK+ Title");
</span><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_link_label(hitTestResult), ==, "WebKitGTK+ Website");
</span><span class="lines">@@ -538,6 +549,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert(!test->m_mouseTargetModifiers);
</span><span class="cx">
</span><span class="cx"> // Move over image with GDK_CONTROL_MASK.
</span><span class="lines">@@ -546,6 +558,7 @@
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
</span><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, "file:///0xdeadbeef");
</span><span class="cx"> g_assert(test->m_mouseTargetModifiers & GDK_CONTROL_MASK);
</span><span class="lines">@@ -557,6 +570,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, "http://www.webkitgtk.org/logo");
</span><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, "file:///0xdeadbeef");
</span><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, "WebKitGTK+ Logo");
</span><span class="lines">@@ -570,6 +584,7 @@
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert_cmpstr(webkit_hit_test_result_get_media_uri(hitTestResult), ==, "file:///movie.ogg");
</span><span class="cx"> g_assert(!test->m_mouseTargetModifiers);
</span><span class="cx">
</span><span class="lines">@@ -580,6 +595,7 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_editable(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert(!test->m_mouseTargetModifiers);
</span><span class="cx">
</span><span class="cx"> // Move over scrollbar.
</span><span class="lines">@@ -589,7 +605,19 @@
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
</span><span class="cx"> g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
</span><span class="cx"> g_assert(webkit_hit_test_result_context_is_scrollbar(hitTestResult));
</span><ins>+ g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
</ins><span class="cx"> g_assert(!test->m_mouseTargetModifiers);
</span><ins>+
+ // Move over selection.
+ hitTestResult = test->moveMouseAndWaitUntilMouseTargetChanged(2, 145);
+ g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+ g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
+ g_assert(webkit_hit_test_result_context_is_selection(hitTestResult));
+ g_assert(!test->m_mouseTargetModifiers);
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void testWebViewPermissionRequests(UIClientTest* test, gconstpointer)
</span></span></pre>
</div>
</div>
</body>
</html>