mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 670081 Cannot scroll any scrollable elements by drag if non-scrollable element captures mouse events r=roc
This commit is contained in:
parent
94b269683e
commit
945600c8b7
@ -2609,8 +2609,8 @@ nsFrame::ExpandSelectionByMouseMove(nsFrameSelection* aFrameSelection,
|
||||
|
||||
nsIScrollableFrame* scrollableFrame =
|
||||
FindNearestScrollableFrameForSelection(this, selectionRoot);
|
||||
// If a non-scrollable content captures by script, we may not be able to find
|
||||
// any scrollable frame.
|
||||
// If a non-scrollable content captures by script and there is no scrollable
|
||||
// frame between the selection root and this, we don't need to do anymore.
|
||||
if (!scrollableFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2619,8 +2619,8 @@ nsFrame::ExpandSelectionByMouseMove(nsFrameSelection* aFrameSelection,
|
||||
|
||||
if (!handleTableSelection) {
|
||||
nsIScrollableFrame* selectionRootScrollableFrame =
|
||||
FindNearestScrollableFrameForSelection(selectionRoot->GetPrimaryFrame());
|
||||
NS_ENSURE_TRUE(selectionRootScrollableFrame, NS_OK);
|
||||
FindNearestScrollableFrameForSelection(selectionRoot->GetPrimaryFrame(),
|
||||
selectionRoot);
|
||||
while (scrollableFrame) {
|
||||
// We don't need to scroll the selection root frame when the mouse cursor
|
||||
// is on its edge because selection root frame will be scrolled when the
|
||||
|
@ -94,6 +94,7 @@
|
||||
|
||||
var body = document.body;
|
||||
|
||||
var div_container = document.getElementById("container");
|
||||
var div_fixed = document.getElementById("fixed");
|
||||
var div_subframe1 = document.getElementById("static_overflow");
|
||||
var div_subframe2 = document.getElementById("static_overflow_inner");
|
||||
@ -690,6 +691,71 @@ var gTests = [
|
||||
scrollIsExpected: true,
|
||||
},
|
||||
|
||||
// Scroll subframe1 on its edge when container (non-scrollable element) is
|
||||
// capturing mouse events
|
||||
// visible scrollable elements: body, div_subframe1
|
||||
{
|
||||
description: "The scrollable div element (subframe1) should be scrolled by moving mouse from subframe1 to the right edge of the div element (container is capturing mouse events)",
|
||||
prepare: function () {
|
||||
div_subframe1.style.display = "block";
|
||||
div_subframe1.onmousedown = function () { div_container.setCapture(); }
|
||||
},
|
||||
test: function () {
|
||||
synthesizeMouse(div_subframe1, 50, 50, { type: "mousedown" });
|
||||
synthesizeMouse(div_subframe1, div_subframe1.clientWidth - 10, 50,
|
||||
{ type: "mousemove" });
|
||||
return true;
|
||||
},
|
||||
resetAllElementsBeforeTest: true,
|
||||
testTarget: function () { return div_subframe1; },
|
||||
expectedScrollTop: function () { return 0; },
|
||||
expectedScrollLeft: function () { return getScrollRightMost(div_subframe1); },
|
||||
scrollIsExpected: true,
|
||||
},
|
||||
|
||||
{
|
||||
description: "The scrollable div element (subframe1) should be scrolled by moving mouse from subframe1 to the left edge of the div element (container is capturing mouse events)",
|
||||
test: function () {
|
||||
synthesizeMouse(div_subframe1, 50, 50, { type: "mousedown" });
|
||||
synthesizeMouse(div_subframe1, 10, 50, { type: "mousemove" });
|
||||
return true;
|
||||
},
|
||||
resetAllElementsBeforeTest: false,
|
||||
testTarget: function () { return div_subframe1; },
|
||||
expectedScrollTop: function () { return 0; },
|
||||
expectedScrollLeft: function () { return 0; },
|
||||
scrollIsExpected: true,
|
||||
},
|
||||
|
||||
{
|
||||
description: "The scrollable div element (subframe1) should be scrolled by moving mouse from subframe1 to the bottom edge of the div element (container is capturing mouse events)",
|
||||
test: function () {
|
||||
synthesizeMouse(div_subframe1, 50, 50, { type: "mousedown" });
|
||||
synthesizeMouse(div_subframe1, 50, div_subframe1.clientHeight - 10,
|
||||
{ type: "mousemove" });
|
||||
return true;
|
||||
},
|
||||
resetAllElementsBeforeTest: false,
|
||||
testTarget: function () { return div_subframe1; },
|
||||
expectedScrollTop: function () { return getScrollBottomMost(div_subframe1); },
|
||||
expectedScrollLeft: function () { return 0; },
|
||||
scrollIsExpected: true,
|
||||
},
|
||||
|
||||
{
|
||||
description: "The scrollable div element (subframe1) should be scrolled by moving mouse from subframe1 to the top edge of the div element (container is capturing mouse events)",
|
||||
test: function () {
|
||||
synthesizeMouse(div_subframe1, 50, 50, { type: "mousedown" });
|
||||
synthesizeMouse(div_subframe1, 50, 10, { type: "mousemove" });
|
||||
return true;
|
||||
},
|
||||
resetAllElementsBeforeTest: false,
|
||||
testTarget: function () { return div_subframe1; },
|
||||
expectedScrollTop: function () { return 0; },
|
||||
expectedScrollLeft: function () { return 0; },
|
||||
scrollIsExpected: true,
|
||||
},
|
||||
|
||||
// Scroll subframe1 even if subframe2 is moved under the cursor
|
||||
// visible scrollable elements: body, div_subframe1, div_subframe2
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user