зеркало из https://github.com/mozilla/pjs.git
Bug 673315 part.1 selection change reason must be MOUSEUP_REASON when dragging for selection finishes normally r=smaug
This commit is contained in:
Родитель
16318b1cd1
Коммит
c96e7ab8a3
|
@ -2839,12 +2839,12 @@ nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
nsCOMPtr<nsIContent> captureContent = nsIPresShell::GetCapturingContent();
|
||||
|
||||
// We can unconditionally stop capturing because
|
||||
// we should never be capturing when the mouse button is up
|
||||
nsIPresShell::SetCapturingContent(nsnull, 0);
|
||||
|
||||
// NOTE: You don't need to release mouse capture here. It'll be done
|
||||
// in PresShell automatically. If you need to do it here, you must
|
||||
// do it after nsFrame::EndSelectionChangeByMouse() because we need
|
||||
// to call nsFrameSelection::SetMouseDownState(PR_FALSE) first.
|
||||
// If we release mouse event capture first, it doesn't cause
|
||||
// MOUSEUP_REASON selection change event.
|
||||
nsFrame* targetFrame;
|
||||
nsRefPtr<nsFrameSelection> fs =
|
||||
FindDraggingFrameSelection(aPresContext->PresShell(), &targetFrame);
|
||||
|
|
|
@ -140,6 +140,7 @@ _CHROME_FILES = \
|
|||
test_bug670058.html \
|
||||
test_bug670508.html \
|
||||
test_bug671319.html \
|
||||
test_bug673315-1.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<title>test for bug 673315 part.1</title>
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="p">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var gSelectionListener = {
|
||||
reason: 0,
|
||||
reset: function () { this.reason = 0; },
|
||||
notifySelectionChanged: function (doc, sel, reason)
|
||||
{
|
||||
this.reason |= reason;
|
||||
}
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
var p = document.getElementById("p");
|
||||
|
||||
const nsISelectionPrivate = Components.interfaces.nsISelectionPrivate;
|
||||
const nsISelectionListener = Components.interfaces.nsISelectionListener;
|
||||
var selPrivate =
|
||||
window.getSelection().QueryInterface(nsISelectionPrivate);
|
||||
selPrivate.addSelectionListener(gSelectionListener);
|
||||
|
||||
gSelectionListener.reset();
|
||||
synthesizeMouse(p, 10, 10, { type: "mousedown", button: 0 });
|
||||
is(gSelectionListener.reason,
|
||||
nsISelectionListener.DRAG_REASON | nsISelectionListener.MOUSEDOWN_REASON,
|
||||
"the reason isn't drag and mosuedown after mousedown event");
|
||||
gSelectionListener.reset();
|
||||
synthesizeMouse(p, 10, 50, { type: "mousemove" });
|
||||
is(gSelectionListener.reason,
|
||||
nsISelectionListener.DRAG_REASON | nsISelectionListener.MOUSEDOWN_REASON,
|
||||
"the reason isn't drag and mosuedown after mousemove event");
|
||||
gSelectionListener.reset();
|
||||
synthesizeMouse(p, 10, 50, { type: "mouseup", button: 0 });
|
||||
is(gSelectionListener.reason,
|
||||
nsISelectionListener.MOUSEUP_REASON,
|
||||
"the reason isn't mosueup after mouseup event");
|
||||
|
||||
selPrivate.addSelectionListener(gSelectionListener);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(doTest, window);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -587,8 +587,19 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
// if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
|
||||
// HandleRelease(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if (aEvent->message == NS_MOUSE_EXIT_SYNTH && mChange)
|
||||
HandleRelease(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_EXIT_SYNTH && mChange) {
|
||||
// XXX This is wrong behavior. We shouldn't stop handling dragging by
|
||||
// mouseexit event.
|
||||
// On Windows, can continue to change the value when mouse cursor is
|
||||
// moved back to the slider button.
|
||||
// On Linux (GTK), even if the mouse cursor existed from slider button,
|
||||
// kept to change the value. (confirmed on Ubuntu 10.10)
|
||||
// On Mac, like Windows, when mouse cursor is moved back to the button,
|
||||
// restart to change the value. However, Mac's slider can use the other
|
||||
// direction button too.
|
||||
HandleRelease(aPresContext, aEvent, aEventStatus);
|
||||
nsIPresShell::SetCapturingContent(nsnull, 0);
|
||||
}
|
||||
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче