Title: [99667] trunk
- Revision
- 99667
- Author
- [email protected]
- Date
- 2011-11-09 00:56:36 -0800 (Wed, 09 Nov 2011)
Log Message
Select multiple options with mouse drag in Select element.
https://bugs.webkit.org/show_bug.cgi?id=71128
Patch by Rakesh KN <[email protected]> on 2011-11-09
Reviewed by Ryosuke Niwa.
Multiple selection of option elements in select element with an mouse drag.
Other browsers(IE, Firefox, Opera) support this feature.
Source/WebCore:
Test: fast/forms/select-multiple-elements-with-mouse-drag.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseDraggedEvent):
Allow auto scroll to be fired if current node(option) under mouse does not have renderer
but its container node(select) can autoscroll and has renderer for specific case of ListBox
LayoutTests:
* fast/forms/select-multiple-elements-with-mouse-drag-expected.txt: Added.
* fast/forms/select-multiple-elements-with-mouse-drag.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (99666 => 99667)
--- trunk/LayoutTests/ChangeLog 2011-11-09 08:52:43 UTC (rev 99666)
+++ trunk/LayoutTests/ChangeLog 2011-11-09 08:56:36 UTC (rev 99667)
@@ -1,3 +1,16 @@
+2011-11-09 Rakesh KN <[email protected]>
+
+ Select multiple options with mouse drag in Select element.
+ https://bugs.webkit.org/show_bug.cgi?id=71128
+
+ Reviewed by Ryosuke Niwa.
+
+ Multiple selection of option elements in select element with an mouse drag.
+ Other browsers(IE, Firefox, Opera) support this feature.
+
+ * fast/forms/select-multiple-elements-with-mouse-drag-expected.txt: Added.
+ * fast/forms/select-multiple-elements-with-mouse-drag.html: Added.
+
2011-11-08 Yuta Kitamura <[email protected]>
[Chromium] Unreviewed, update test expectation of listbox-clip.html.
Added: trunk/LayoutTests/fast/forms/select-multiple-elements-with-mouse-drag-expected.txt (0 => 99667)
--- trunk/LayoutTests/fast/forms/select-multiple-elements-with-mouse-drag-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/select-multiple-elements-with-mouse-drag-expected.txt 2011-11-09 08:56:36 UTC (rev 99667)
@@ -0,0 +1,11 @@
+Select multiple option with mouse drag
+
+
+PASS document.getElementById("selectId").options[0].selected is true
+PASS document.getElementById("selectId").options[1].selected is true
+PASS document.getElementById("selectId").options[2].selected is true
+PASS document.getElementById("selectId").options[3].selected is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/select-multiple-elements-with-mouse-drag.html (0 => 99667)
--- trunk/LayoutTests/fast/forms/select-multiple-elements-with-mouse-drag.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select-multiple-elements-with-mouse-drag.html 2011-11-09 08:56:36 UTC (rev 99667)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script>
+window.jsTestIsAsync = true;
+
+function test() {
+ if (window.eventSender) {
+ var selectObject = document.getElementById("selectId");
+
+ var optionHeight = selectObject.offsetHeight / selectObject.size;
+ var x = selectObject.offsetLeft + selectObject.offsetWidth / 2;
+ var y = selectObject.offsetTop + optionHeight / 2;
+
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(x, y + (optionHeight * 3));
+
+ setTimeout(testSelection, 100);
+ } else {
+ debug("Test manually if options are getting selected by dragging on the select element.");
+ }
+}
+
+function testSelection()
+{
+ eventSender.mouseUp();
+
+ for (var i = 0; i < 4; i++) {
+ shouldBeTrue("document.getElementById(\"selectId\").options[" + i + "].selected");
+ }
+
+ finishJSTest();
+}
+successfullyParsed = true;
+</script>
+<title></title>
+</head>
+<body _onload_="test()">
+<p>Select multiple option with mouse drag</p>
+
+<select multiple="multiple" size="4" id="selectId">
+ <option value="P1">P1</option>
+ <option value="P2">P2</option>
+ <option value="P3">P3</option>
+ <option value="P4">P4</option>
+ <option value="P5">P5</option>
+ <option value="P6">P6</option>
+ <option value="P7">P7</option>
+</select>
+
+<div id="console"></div>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (99666 => 99667)
--- trunk/Source/WebCore/ChangeLog 2011-11-09 08:52:43 UTC (rev 99666)
+++ trunk/Source/WebCore/ChangeLog 2011-11-09 08:56:36 UTC (rev 99667)
@@ -1,3 +1,20 @@
+2011-11-09 Rakesh KN <[email protected]>
+
+ Select multiple options with mouse drag in Select element.
+ https://bugs.webkit.org/show_bug.cgi?id=71128
+
+ Reviewed by Ryosuke Niwa.
+
+ Multiple selection of option elements in select element with an mouse drag.
+ Other browsers(IE, Firefox, Opera) support this feature.
+
+ Test: fast/forms/select-multiple-elements-with-mouse-drag.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMouseDraggedEvent):
+ Allow auto scroll to be fired if current node(option) under mouse does not have renderer
+ but its container node(select) can autoscroll and has renderer for specific case of ListBox
+
2011-11-09 Simon Hausmann <[email protected]>
[Qt] Build system cleanup
Modified: trunk/Source/WebCore/page/EventHandler.cpp (99666 => 99667)
--- trunk/Source/WebCore/page/EventHandler.cpp 2011-11-09 08:52:43 UTC (rev 99666)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2011-11-09 08:56:36 UTC (rev 99667)
@@ -557,9 +557,16 @@
return false;
Node* targetNode = EventHandler::targetNode(event);
- if (event.event().button() != LeftButton || !targetNode || !targetNode->renderer())
+ if (event.event().button() != LeftButton || !targetNode)
return false;
+ RenderObject* renderer = targetNode->renderer();
+ if (!renderer) {
+ renderer = targetNode->parentNode() ? targetNode->parentNode()->renderer() : 0;
+ if (!renderer || !renderer->isListBox())
+ return false;
+ }
+
#if PLATFORM(MAC) // FIXME: Why does this assertion fire on other platforms?
ASSERT(m_mouseDownMayStartSelect || m_mouseDownMayStartAutoscroll);
#endif
@@ -568,7 +575,6 @@
if (m_mouseDownMayStartAutoscroll && !m_panScrollInProgress) {
// Find a renderer that can autoscroll.
- RenderObject* renderer = targetNode->renderer();
while (renderer && !canAutoscroll(renderer)) {
if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
renderer = renderer->document()->ownerElement()->renderer();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes