From c96e7ab8a38b1fb102ea55402f60f4e81f4f1acc Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sun, 24 Jul 2011 23:26:40 +0900 Subject: [PATCH] Bug 673315 part.1 selection change reason must be MOUSEUP_REASON when dragging for selection finishes normally r=smaug --- layout/generic/nsFrame.cpp | 12 ++--- layout/generic/test/Makefile.in | 1 + layout/generic/test/test_bug673315-1.html | 64 +++++++++++++++++++++++ layout/xul/base/src/nsSliderFrame.cpp | 15 +++++- 4 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 layout/generic/test/test_bug673315-1.html diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 344dcb2cf66..a1bf4841c78 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2839,12 +2839,12 @@ nsFrame::HandleRelease(nsPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus) { - nsCOMPtr 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 fs = FindDraggingFrameSelection(aPresContext->PresShell(), &targetFrame); diff --git a/layout/generic/test/Makefile.in b/layout/generic/test/Makefile.in index d7b3d9ec3ba..3484206dd2e 100644 --- a/layout/generic/test/Makefile.in +++ b/layout/generic/test/Makefile.in @@ -140,6 +140,7 @@ _CHROME_FILES = \ test_bug670058.html \ test_bug670508.html \ test_bug671319.html \ + test_bug673315-1.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/layout/generic/test/test_bug673315-1.html b/layout/generic/test/test_bug673315-1.html new file mode 100644 index 00000000000..21c878a999f --- /dev/null +++ b/layout/generic/test/test_bug673315-1.html @@ -0,0 +1,64 @@ + + + +test for bug 673315 part.1 + + + + + + +

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

+
+
+
+ + diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index 7bb773ccb6c..006b483045d 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -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); }