Commit bc00ddcf authored by treat@webkit.org's avatar treat@webkit.org

WebCore:

2009-07-22  Viet-Trung Luu  <viettrungluu@gmail.com>

        Reviewed by David Hyatt.

        https://bugs.webkit.org/show_bug.cgi?id=27289
        When a mouse click occurs on a scrollbar without a preceding mouse move
        onto it, the release isn't handled correctly (since
        EventHandler::m_lastScrollbarUnderMouse isn't set on mouse down, but
        only on mouse move). (Side comment: That scrollbar-handling code
        in EventHandler is ugly. It should be fixed properly.)

        Tests: scrollbars/scrollbar-miss-mousemove.html
               scrollbars/scrollbar-miss-mousemove-disabled.html

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMousePressEvent):
        (WebCore::EventHandler::handleMouseMoveEvent):
        (WebCore::EventHandler::updateLastScrollbarUnderMouse):
        * page/EventHandler.h:

LayoutTests:
2009-07-22  Viet-Trung Luu  <viettrungluu@gmail.com>

        Reviewed by David Hyatt.

        https://bugs.webkit.org/show_bug.cgi?id=27289
        Tests that mouse clicks/releases are handled properly on scrollbars
        even when there is no mouse move onto the scrollbar (two cases: enabled
        and disabled controls).

        * scrollbars/scrollbar-miss-mousemove-disabled-expected.txt: Added.
        * scrollbars/scrollbar-miss-mousemove-disabled.html: Added.
        * scrollbars/scrollbar-miss-mousemove-expected.txt: Added.
        * scrollbars/scrollbar-miss-mousemove.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 86403917
2009-07-22 Viet-Trung Luu <viettrungluu@gmail.com>
Reviewed by David Hyatt.
https://bugs.webkit.org/show_bug.cgi?id=27289
Tests that mouse clicks/releases are handled properly on scrollbars
even when there is no mouse move onto the scrollbar (two cases: enabled
and disabled controls).
* scrollbars/scrollbar-miss-mousemove-disabled-expected.txt: Added.
* scrollbars/scrollbar-miss-mousemove-disabled.html: Added.
* scrollbars/scrollbar-miss-mousemove-expected.txt: Added.
* scrollbars/scrollbar-miss-mousemove.html: Added.
2009-07-23 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Tor Arne Vestbø.
......
Test for bug 27289: This tests that mouse clicks/releases on scrollbars are handled properly even is there was no mouse move onto the scrollbar; this is the disabled control case. On success, the text should begin with "zx".
Text is "zx y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y "
<html>
<body style="margin:0">
<script>
if (layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
</script>
<form name="form1">
<textarea name="text1" style="border:2px solid black;overflow:auto;height:400px;width:400px; position:absolute;">
x
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
</textarea>
</form>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=27289">bug
27289</a>: This tests that mouse clicks/releases on scrollbars are handled
properly even is there was no mouse move onto the scrollbar; this is the
disabled control case. On success, the text should begin with "zx".<p/>
<div id="console"></div>
<script>
if (eventSender) {
document.form1.text1.disabled = true;
document.form1.style.display = "none";
eventSender.mouseMoveTo(390, 10);
document.form1.style.display = "";
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseMoveTo(390, 350);
eventSender.mouseMoveTo(4,350);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseMoveTo(4,4);
document.form1.text1.disabled = false;
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.keyDown('z');
setTimeout(finished, 500);
}
function finished()
{
document.getElementById('console').innerHTML
= "Text is \"" + document.form1.text1.value + "\"";
window.layoutTestController.notifyDone();
}
</script>
</body>
</html>
Test for bug 27289: This tests that mouse clicks/releases on scrollbars are handled properly even is there was no mouse move onto the scrollbar; this is the enabled control case. On success, the offset should be 0.
Scroll offset is 0
<html>
<body style="margin:0">
<script>
if (layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
</script>
<div id="overflow" style="border:2px solid black;overflow:auto;height:400px;width:400px; position:absolute;">
<div style="background-color:green;height:1000px"></div>
<div style="background-color:red;height:1000px"></div>
</div>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=27289">bug
27289</a>: This tests that mouse clicks/releases on scrollbars are handled
properly even is there was no mouse move onto the scrollbar; this is the
enabled control case. On success, the offset should be 0.<p/>
<div id="console"></div>
<script>
if (eventSender) {
document.getElementById('overflow').style.display = "none";
eventSender.mouseMoveTo(390, 10);
document.getElementById('overflow').style.display = "";
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseMoveTo(390, 350);
setTimeout(finished, 500);
}
function finished()
{
document.getElementById('console').innerHTML
= "Scroll offset is " + document.getElementById('overflow').scrollTop;
window.layoutTestController.notifyDone();
}
</script>
</body>
</html>
2009-07-22 Viet-Trung Luu <viettrungluu@gmail.com>
Reviewed by David Hyatt.
https://bugs.webkit.org/show_bug.cgi?id=27289
When a mouse click occurs on a scrollbar without a preceding mouse move
onto it, the release isn't handled correctly (since
EventHandler::m_lastScrollbarUnderMouse isn't set on mouse down, but
only on mouse move). (Side comment: That scrollbar-handling code
in EventHandler is ugly. It should be fixed properly.)
Tests: scrollbars/scrollbar-miss-mousemove.html
scrollbars/scrollbar-miss-mousemove-disabled.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::updateLastScrollbarUnderMouse):
* page/EventHandler.h:
2009-07-23 Mike Fenton <mike.fenton@torchmobile.com>
Reviewed by David Levin.
......
......@@ -1195,8 +1195,12 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
if (swallowEvent) {
// scrollbars should get events anyway, even disabled controls might be scrollable
if (mev.scrollbar())
passMousePressEventToScrollbar(mev, mev.scrollbar());
Scrollbar* scrollbar = mev.scrollbar();
updateLastScrollbarUnderMouse(scrollbar, true);
if (scrollbar)
passMousePressEventToScrollbar(mev, scrollbar);
} else {
// Refetch the event target node if it currently is the shadow node inside an <input> element.
// If a mouse event handler changes the input element type to one that has a widget associated,
......@@ -1211,6 +1215,9 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.pos()) : 0;
if (!scrollbar)
scrollbar = mev.scrollbar();
updateLastScrollbarUnderMouse(scrollbar, true);
if (scrollbar && passMousePressEventToScrollbar(mev, scrollbar))
swallowEvent = true;
else
......@@ -1327,12 +1334,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
if (!scrollbar)
scrollbar = mev.scrollbar();
if (m_lastScrollbarUnderMouse != scrollbar) {
// Send mouse exited to the old scrollbar.
if (m_lastScrollbarUnderMouse)
m_lastScrollbarUnderMouse->mouseExited();
m_lastScrollbarUnderMouse = m_mousePressed ? 0 : scrollbar;
}
updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed);
}
bool swallowEvent = false;
......@@ -2422,4 +2424,16 @@ bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&
return scrollbar->mouseDown(mev.event());
}
// If scrollbar (under mouse) is different from last, send a mouse exited. Set
// last to scrollbar if setLast is true; else set last to 0.
void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setLast)
{
if (m_lastScrollbarUnderMouse != scrollbar) {
// Send mouse exited to the old scrollbar.
if (m_lastScrollbarUnderMouse)
m_lastScrollbarUnderMouse->mouseExited();
m_lastScrollbarUnderMouse = setLast ? scrollbar : 0;
}
}
}
......@@ -271,6 +271,8 @@ private:
void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint);
void updateLastScrollbarUnderMouse(Scrollbar*, bool);
bool capturesDragging() const { return m_capturesDragging; }
#if PLATFORM(MAC) && defined(__OBJC__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment