Title: [105538] trunk
Revision
105538
Author
[email protected]
Date
2012-01-20 13:05:14 -0800 (Fri, 20 Jan 2012)

Log Message

Add proper offset to position right click to simulate a context menu invocation.
https://bugs.webkit.org/show_bug.cgi?id=76421

Patch by Marc-Andre Decoste <[email protected]> on 2012-01-20
Reviewed by Ojan Vafai.

.:

* ManualTests/win/contextmenu-key3.html: Added.

Source/WebCore:

Manual tests only because DRT doesn't support context menu key.

* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEventForKey):

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (105537 => 105538)


--- trunk/ChangeLog	2012-01-20 21:01:48 UTC (rev 105537)
+++ trunk/ChangeLog	2012-01-20 21:05:14 UTC (rev 105538)
@@ -1,3 +1,12 @@
+2012-01-20  Marc-Andre Decoste  <[email protected]>
+
+        Add proper offset to position right click to simulate a context menu invocation.
+        https://bugs.webkit.org/show_bug.cgi?id=76421
+
+        Reviewed by Ojan Vafai.
+
+        * ManualTests/win/contextmenu-key3.html: Added.
+
 2012-01-20  Kinuko Yasuda  <[email protected]>
 
         Unreviewed; Windows buildbot update failure fix.

Added: trunk/ManualTests/win/contextmenu-key3.html (0 => 105538)


--- trunk/ManualTests/win/contextmenu-key3.html	                        (rev 0)
+++ trunk/ManualTests/win/contextmenu-key3.html	2012-01-20 21:05:14 UTC (rev 105538)
@@ -0,0 +1,8 @@
+<p>Manual test for <a href="" 76421</a></p>
+<p>Left click on one of the lines in the text area and then hit the keyboard's context menu key to make sure the context menu pops up for the appropriate line.</p>
+
+<textarea style="min-height:75px;">
+  aaaaaaaaa
+  bbbbbbbbb
+  ccccccccc
+</textarea>

Modified: trunk/Source/WebCore/ChangeLog (105537 => 105538)


--- trunk/Source/WebCore/ChangeLog	2012-01-20 21:01:48 UTC (rev 105537)
+++ trunk/Source/WebCore/ChangeLog	2012-01-20 21:05:14 UTC (rev 105538)
@@ -1,3 +1,15 @@
+2012-01-20  Marc-Andre Decoste  <[email protected]>
+
+        Add proper offset to position right click to simulate a context menu invocation.
+        https://bugs.webkit.org/show_bug.cgi?id=76421
+
+        Reviewed by Ojan Vafai.
+
+        Manual tests only because DRT doesn't support context menu key.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::sendContextMenuEventForKey):
+
 2012-01-20  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r105426.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (105537 => 105538)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-01-20 21:01:48 UTC (rev 105537)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-01-20 21:05:14 UTC (rev 105538)
@@ -2338,7 +2338,9 @@
         IntRect firstRect = m_frame->editor()->firstRectForRange(selectionRange.get());
 
         int x = rightAligned ? firstRect.maxX() : firstRect.x();
-        location = IntPoint(x, firstRect.maxY());
+        // In a multiline edit, firstRect.maxY() would endup on the next line, so -1.
+        int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
+        location = IntPoint(x, y);
     } else if (focusedNode) {
         RenderBoxModelObject* box = focusedNode->renderBoxModelObject();
         if (!box)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to