[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 16:29:18 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 613f7e813a6aad401035058ee269170cd0bfaf41
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Nov 24 17:20:26 2010 +0000
2010-11-24 Avi Drissman <avi at google.com>
Reviewed by Antonio Gomes.
Add preference to not select when right-clicked
https://bugs.webkit.org/show_bug.cgi?id=23351
* editing/selection/context-menu-text-selection-expected.txt: Added.
* editing/selection/context-menu-text-selection.html: Added.
2010-11-24 Avi Drissman <avi at google.com>
Reviewed by Antonio Gomes.
Add preference to not select when right-clicked
https://bugs.webkit.org/show_bug.cgi?id=23351
Test: editing/selection/context-menu-text-selection.html
* editing/EditingBehavior.h:
(WebCore::EditingBehavior::shouldSelectOnContextualMenuClick):
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEvent):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72678 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 876eb8d..b0819bf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-24 Avi Drissman <avi at google.com>
+
+ Reviewed by Antonio Gomes.
+
+ Add preference to not select when right-clicked
+ https://bugs.webkit.org/show_bug.cgi?id=23351
+
+ * editing/selection/context-menu-text-selection-expected.txt: Added.
+ * editing/selection/context-menu-text-selection.html: Added.
+
2010-11-24 Martin Robinson <mrobinson at igalia.com>
Reviewed by Xan Lopez.
diff --git a/LayoutTests/editing/selection/context-menu-text-selection-expected.txt b/LayoutTests/editing/selection/context-menu-text-selection-expected.txt
new file mode 100644
index 0000000..3caf907
--- /dev/null
+++ b/LayoutTests/editing/selection/context-menu-text-selection-expected.txt
@@ -0,0 +1,6 @@
+This test checks that triggering the context menu selects/doesn't select as platform-appropriate.
+
+Lorem ipsum
+SUCCESS
+SUCCESS
+SUCCESS
diff --git a/LayoutTests/editing/selection/context-menu-text-selection.html b/LayoutTests/editing/selection/context-menu-text-selection.html
new file mode 100644
index 0000000..5ad8544
--- /dev/null
+++ b/LayoutTests/editing/selection/context-menu-text-selection.html
@@ -0,0 +1,52 @@
+<body onload="load()">
+<p>This test checks that triggering the context menu selects/doesn't select as platform-appropriate.</p>
+<div id="text">Lorem ipsum</div>
+<div id="resultmac">RUNNING</div>
+<div id="resultwin">RUNNING</div>
+<div id="resultunix">RUNNING</div>
+</body>
+<script>
+function test(platform, selectionExpected, result)
+{
+ // clear selection
+ window.getSelection().removeAllRanges();
+
+ layoutTestController.setEditingBehavior(platform);
+
+ var text = document.getElementById("text");
+
+ var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
+ var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2;
+
+ eventSender.mouseMoveTo(x, y);
+ eventSender.contextClick();
+ // esc key to kill the context menu
+ eventSender.keyDown(String.fromCharCode(0x001B), null);
+
+ var resultElement = document.getElementById(result);
+ var selectionType = window.getSelection().type;
+ if (selectionExpected) {
+ if (selectionType == "Range")
+ resultElement.innerHTML = "SUCCESS";
+ else
+ resultElement.innerHTML = "FAILURE: There should be a selection.";
+ } else {
+ if (selectionType == "Range")
+ resultElement.innerHTML = "FAILURE: There shouldn't be a selection.";
+ else
+ resultElement.innerHTML = "SUCCESS";
+ }
+}
+
+function load()
+{
+ if (!window.eventSender || !window.layoutTestController)
+ return;
+
+ layoutTestController.dumpAsText();
+
+ test('mac', true, 'resultmac');
+ test('win', false, 'resultwin');
+ test('unix', false, 'resultunix');
+}
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3fec6de..5bc9d4e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-24 Avi Drissman <avi at google.com>
+
+ Reviewed by Antonio Gomes.
+
+ Add preference to not select when right-clicked
+ https://bugs.webkit.org/show_bug.cgi?id=23351
+
+ Test: editing/selection/context-menu-text-selection.html
+
+ * editing/EditingBehavior.h:
+ (WebCore::EditingBehavior::shouldSelectOnContextualMenuClick):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::sendContextMenuEvent):
+
2010-11-24 Andras Becsi <abecsi at inf.u-szeged.hu>
Reviewed by Csaba Osztrogonác.
diff --git a/WebCore/editing/EditingBehavior.h b/WebCore/editing/EditingBehavior.h
index 842d3f2..a367c52 100644
--- a/WebCore/editing/EditingBehavior.h
+++ b/WebCore/editing/EditingBehavior.h
@@ -57,6 +57,9 @@ public:
// in place and moving the extent. Matches NSTextView.
bool shouldAlwaysGrowSelectionWhenExtendingToBoundary() const { return m_type == EditingMacBehavior; }
+ // On Mac, when processing a contextual click, the object being clicked upon should be selected.
+ bool shouldSelectOnContextualMenuClick() const { return m_type == EditingMacBehavior; }
+
private:
EditingBehaviorType m_type;
};
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index f6a2353..e095136 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2007,11 +2007,8 @@ bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
HitTestRequest request(HitTestRequest::Active);
MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
- // Context menu events shouldn't select text in GTK+ applications or in Chromium.
- // FIXME: This should probably be configurable by embedders. Consider making it a WebPreferences setting.
- // See: https://bugs.webkit.org/show_bug.cgi?id=15279
-#if !PLATFORM(GTK) && !PLATFORM(CHROMIUM)
- if (!m_frame->selection()->contains(viewportPos)
+ if (m_frame->editor()->behavior().shouldSelectOnContextualMenuClick()
+ && !m_frame->selection()->contains(viewportPos)
// FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
// If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
// available for text selections. But only if we're above text.
@@ -2019,7 +2016,6 @@ bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
m_mouseDownMayStartSelect = true; // context menu events are always allowed to perform a selection
selectClosestWordOrLinkFromMouseEvent(mev);
}
-#endif
swallowEvent = dispatchMouseEvent(eventNames().contextmenuEvent, mev.targetNode(), true, 0, event, false);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list