Title: [175403] branches/safari-600.3-branch

Diff

Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-10-31 01:03:51 UTC (rev 175403)
@@ -1,3 +1,31 @@
+2014-10-29  Tim Horton  <[email protected]>
+
+        Merge r175160. <rdar://problem/18742297>
+
+    2014-10-24  Marcos Chavarría Teijeiro  <[email protected]>
+
+            [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.
+
 2014-10-29  Matthew Hanson  <[email protected]>
 
         Merge r175353. rdar://problem/18817803

Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp	2014-10-31 01:03:51 UTC (rev 175403)
@@ -52,6 +52,7 @@
     , isContentEditable(hitTestResult.isContentEditable())
     , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
     , isScrollbar(hitTestResult.scrollbar())
+    , isSelected(hitTestResult.isSelected())
     , isTextNode(hitTestResult.innerNode() && hitTestResult.innerNode()->isTextNode())
 {
 }
@@ -71,6 +72,7 @@
     encoder << isContentEditable;
     encoder << elementBoundingBox;
     encoder << isScrollbar;
+    encoder << isSelected;
     encoder << isTextNode;
 }
 
@@ -85,6 +87,7 @@
         || !decoder.decode(hitTestResultData.isContentEditable)
         || !decoder.decode(hitTestResultData.elementBoundingBox)
         || !decoder.decode(hitTestResultData.isScrollbar)
+        || !decoder.decode(hitTestResultData.isSelected)
         || !decoder.decode(hitTestResultData.isTextNode))
         return false;
 

Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h	2014-10-31 01:03:51 UTC (rev 175403)
@@ -52,6 +52,7 @@
         bool isContentEditable;
         WebCore::IntRect elementBoundingBox;
         bool isScrollbar;
+        bool isSelected;
         bool isTextNode;
 
         Data();
@@ -80,6 +81,8 @@
 
     bool isScrollbar() const { return m_data.isScrollbar; }
 
+    bool isSelected() const { return m_data.isSelected; }
+
     bool isTextNode() const { return m_data.isTextNode; }
 
 private:

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp	2014-10-31 01:03:51 UTC (rev 175403)
@@ -240,6 +240,9 @@
     if (hitTestResult.isScrollbar)
         context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR;
 
+    if (hitTestResult.isSelected)
+        context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
+
     return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
         "context", context,
         "link-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK ? hitTestResult.absoluteLinkURL.utf8().data() : nullptr,
@@ -260,6 +263,7 @@
     WebKitHitTestResultPrivate* priv = hitTestResult->priv;
     return webHitTestResult.isContentEditable == webkit_hit_test_result_context_is_editable(hitTestResult)
         && webHitTestResult.isScrollbar == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
+        && webHitTestResult.isSelected == webkit_hit_test_result_context_is_selection(hitTestResult)
         && stringIsEqualToCString(webHitTestResult.absoluteLinkURL, priv->linkURI)
         && stringIsEqualToCString(webHitTestResult.linkTitle, priv->linkTitle)
         && stringIsEqualToCString(webHitTestResult.linkLabel, priv->linkLabel)
@@ -351,6 +355,25 @@
 }
 
 /**
+ * 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;
+}
+
+/**
  * webkit_hit_test_result_get_link_uri:
  * @hit_test_result: a #WebKitHitTestResult
  *

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h	2014-10-31 01:03:51 UTC (rev 175403)
@@ -48,6 +48,7 @@
  * @WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA: a video or audio element.
  * @WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE: an editable element
  * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR: a scrollbar element.
+ * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION: a selected element. Since 2.8
  *
  * Enum values with flags representing the context of a #WebKitHitTestResult.
  */
@@ -58,7 +59,8 @@
     WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE     = 1 << 3,
     WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA     = 1 << 4,
     WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE  = 1 << 5,
-    WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6
+    WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6,
+    WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 7
 } WebKitHitTestResultContext;
 
 struct _WebKitHitTestResult {
@@ -94,6 +96,9 @@
 WEBKIT_API gboolean
 webkit_hit_test_result_context_is_editable  (WebKitHitTestResult *hit_test_result);
 
+WEBKIT_API gboolean
+webkit_hit_test_result_context_is_selection (WebKitHitTestResult *hit_test_result);
+
 WEBKIT_API const gchar *
 webkit_hit_test_result_get_link_uri         (WebKitHitTestResult *hit_test_result);
 

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2014-10-31 01:03:51 UTC (rev 175403)
@@ -1871,6 +1871,7 @@
     data.isContentEditable = webHitTestResult->isContentEditable();
     data.elementBoundingBox = webHitTestResult->elementBoundingBox();
     data.isScrollbar = webHitTestResult->isScrollbar();
+    data.isSelected = webHitTestResult->isSelected();
 
     GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(data));
     GUniquePtr<GdkEvent> contextMenuEvent(webkitWebViewBaseTakeContextMenuEvent(webViewBase));

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (175402 => 175403)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt	2014-10-31 01:03:51 UTC (rev 175403)
@@ -654,6 +654,7 @@
 webkit_hit_test_result_context_is_image
 webkit_hit_test_result_context_is_media
 webkit_hit_test_result_context_is_editable
+webkit_hit_test_result_context_is_selection
 webkit_hit_test_result_get_link_uri
 webkit_hit_test_result_get_link_title
 webkit_hit_test_result_get_link_label

Modified: branches/safari-600.3-branch/Tools/ChangeLog (175402 => 175403)


--- branches/safari-600.3-branch/Tools/ChangeLog	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Tools/ChangeLog	2014-10-31 01:03:51 UTC (rev 175403)
@@ -1,3 +1,21 @@
+2014-10-29  Tim Horton  <[email protected]>
+
+        Merge r175160. <rdar://problem/18742297>
+
+    2014-10-24  Marcos Chavarría Teijeiro  <[email protected]>
+
+            [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):
+
 2014-10-29  Lucas Forschler  <[email protected]>
 
         Merge r172542

Modified: branches/safari-600.3-branch/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp (175402 => 175403)


--- branches/safari-600.3-branch/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestContextMenu.cpp	2014-10-31 01:03:51 UTC (rev 175403)
@@ -239,7 +239,8 @@
         LinkImage,
         Video,
         Audio,
-        Editable
+        Editable,
+        Selection
     };
 
     ContextMenuDefaultTest()
@@ -257,6 +258,7 @@
             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_GO_BACK, Visible);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD, Visible);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_STOP, Visible);
@@ -267,6 +269,7 @@
             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_OPEN_LINK, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_LINK_TO_DISK, Visible | Enabled);
@@ -277,6 +280,7 @@
             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_OPEN_IMAGE_IN_NEW_WINDOW, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_IMAGE_TO_DISK, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_COPY_IMAGE_TO_CLIPBOARD, Visible | Enabled);
@@ -287,6 +291,7 @@
             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_OPEN_LINK, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_LINK_TO_DISK, Visible | Enabled);
@@ -302,6 +307,7 @@
             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_MEDIA_PLAY, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE, Visible);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS, Visible | Enabled | Checked);
@@ -317,6 +323,7 @@
             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_MEDIA_PLAY, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE, Visible);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS, Visible | Enabled | Checked);
@@ -332,6 +339,7 @@
             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_CUT, Visible);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_COPY, Visible);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_PASTE, Visible | Enabled);
@@ -343,6 +351,14 @@
                 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_UNICODE, Visible | Enabled);
             break;
+        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;
         default:
             g_assert_not_reached();
         }
@@ -366,17 +382,32 @@
     test->showInWindowAndWaitUntilMapped();
 
     const char* linksHTML =
-        "<html><body>"
+        "<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>"
         " <a style='position:absolute; left:1; top:1' href='' title='WebKitGTK+ Title'>WebKitGTK+ Website</a>"
         " <img style='position:absolute; left:1; top:10' src='' width=5 height=5></img>"
         " <a style='position:absolute; left:1; top:20' href='' title='WebKitGTK+ Logo'><img src='' width=5 height=5></img></a>"
         " <input style='position:absolute; left:1; top:30' size='10'></input>"
         " <video style='position:absolute; left:1; top:50' width='300' height='300' controls='controls' preload='none'><source src='' type='video/ogg' /></video>"
         " <audio style='position:absolute; left:1; top:60' width='50' height='20' controls='controls' preload='none'><source src='' type='audio/mp3' /></audio>"
+        " <p style='position:absolute; left:1; top:90' id='text_to_select'>Lorem ipsum.</p>"
         "</body></html>";
     test->loadHtml(linksHTML, "file:///");
     test->waitUntilLoadFinished();
 
+    // 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);
+
     // Context menu for document.
     test->m_expectedMenuType = ContextMenuDefaultTest::Navigation;
     test->showContextMenuAtPositionAndWaitUntilFinished(0, 0);

Modified: branches/safari-600.3-branch/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp (175402 => 175403)


--- branches/safari-600.3-branch/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp	2014-10-31 00:40:57 UTC (rev 175402)
+++ branches/safari-600.3-branch/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp	2014-10-31 01:03:51 UTC (rev 175403)
@@ -509,13 +509,23 @@
     test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
 
     const char* linksHoveredHTML =
-        "<html><body>"
+        "<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>"
         " <a style='position:absolute; left:1; top:1' href='' title='WebKitGTK+ Title'>WebKitGTK+ Website</a>"
         " <img style='position:absolute; left:1; top:10' src='' width=5 height=5></img>"
         " <a style='position:absolute; left:1; top:20' href='' title='WebKitGTK+ Logo'><img src='' width=5 height=5></img></a>"
         " <input style='position:absolute; left:1; top:30' size='10'></input>"
         " <div style='position:absolute; left:1; top:50; width:30; height:30; overflow:scroll'>&nbsp;</div>"
         " <video style='position:absolute; left:1; top:100' width='300' height='300' controls='controls' preload='none'><source src='' type='video/ogg' /></video>"
+        " <p style='position:absolute; left:1; top:120' id='text_to_select'>Lorem ipsum.</p>"
         "</body></html>";
 
     test->loadHtml(linksHoveredHTML, "file:///");
@@ -527,6 +537,7 @@
     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));
     g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, "http://www.webkitgtk.org/");
     g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, "WebKitGTK+ Title");
     g_assert_cmpstr(webkit_hit_test_result_get_link_label(hitTestResult), ==, "WebKitGTK+ Website");
@@ -538,6 +549,7 @@
     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));
     g_assert(!test->m_mouseTargetModifiers);
 
     // Move over image with GDK_CONTROL_MASK.
@@ -546,6 +558,7 @@
     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));
     g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
     g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, "file:///0xdeadbeef");
     g_assert(test->m_mouseTargetModifiers & GDK_CONTROL_MASK);
@@ -557,6 +570,7 @@
     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_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, "http://www.webkitgtk.org/logo");
     g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, "file:///0xdeadbeef");
     g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, "WebKitGTK+ Logo");
@@ -570,6 +584,7 @@
     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_cmpstr(webkit_hit_test_result_get_media_uri(hitTestResult), ==, "file:///movie.ogg");
     g_assert(!test->m_mouseTargetModifiers);
 
@@ -580,6 +595,7 @@
     g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
     g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
     g_assert(webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_selection(hitTestResult));
     g_assert(!test->m_mouseTargetModifiers);
 
     // Move over scrollbar.
@@ -589,7 +605,19 @@
     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);
+
+    // 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);
+
 }
 
 static void testWebViewPermissionRequests(UIClientTest* test, gconstpointer)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to