зеркало из https://github.com/mozilla/gecko-dev.git
Bug 516991, get the right scrollable view from within the selection scroll timer, otherwise scrolling is jumpy, r=roc
This commit is contained in:
Родитель
b145e6bde4
Коммит
a7f4a724cd
|
@ -99,6 +99,7 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
|||
#include "nsITimer.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
// notifications
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -470,9 +471,22 @@ public:
|
|||
|
||||
mFrameSelection->HandleDrag(frame, mPoint);
|
||||
|
||||
if (!frame.IsAlive())
|
||||
return NS_OK;
|
||||
|
||||
nsIFrame* checkFrame = frame;
|
||||
nsIScrollableFrame *scrollFrame = nsnull;
|
||||
while (checkFrame) {
|
||||
scrollFrame = do_QueryFrame(checkFrame);
|
||||
if (scrollFrame) {
|
||||
break;
|
||||
}
|
||||
checkFrame = checkFrame->GetParent();
|
||||
}
|
||||
nsIView* capturingView = scrollFrame ? scrollFrame->GetScrollableView()->View() : nsnull;
|
||||
|
||||
nsPoint pnt;
|
||||
mSelection->DoAutoScrollView(mPresContext,
|
||||
frame.IsAlive() ? frame->GetClosestView(&pnt) : nsnull,
|
||||
mSelection->DoAutoScrollView(mPresContext, capturingView,
|
||||
mPoint, PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -54,6 +54,38 @@ function framesetCallback(adjustment)
|
|||
is(newWidth, expectedWidth, "frameset after drag (" + adjustment + ")");
|
||||
}
|
||||
|
||||
var otherWindow = null;
|
||||
|
||||
function selectionScrollCheck()
|
||||
{
|
||||
var element = otherWindow.document.documentElement;
|
||||
|
||||
disableNonTestMouseEvents(true);
|
||||
synthesizeMouse(element, 2, 2, { type: "mousedown" }, otherWindow);
|
||||
synthesizeMouse(element, 4, otherWindow.innerHeight + 20, { type: "mousemove" }, otherWindow);
|
||||
|
||||
var count = 0;
|
||||
function selectionScrollDone() {
|
||||
// wait for 6 scroll events to occur
|
||||
if (count++ < 6)
|
||||
return;
|
||||
|
||||
otherWindow.removeEventListener("scroll", selectionScrollDone, false);
|
||||
|
||||
// should have scrolled 20 pixels from the mousemove above and six extra
|
||||
// times from the selection scroll timer for a total of 140
|
||||
var oldScrollY = otherWindow.scrollY;
|
||||
is(otherWindow.scrollY, 140, "selection scroll position after timer");
|
||||
|
||||
synthesizeMouse(element, 4, otherWindow.innerHeight + 25, { type: "mouseup" }, otherWindow);
|
||||
disableNonTestMouseEvents(false);
|
||||
otherWindow.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
otherWindow.addEventListener("scroll", selectionScrollDone, false);
|
||||
}
|
||||
|
||||
function runTests()
|
||||
{
|
||||
previousWidth = $("leftbox").getBoundingClientRect().width;
|
||||
|
@ -99,7 +131,9 @@ function runTests()
|
|||
originalWidth = previousWidth;
|
||||
runCaptureTest(frames[1].document.documentElement.lastChild, framesetCallback);
|
||||
|
||||
SimpleTest.finish();
|
||||
// check to ensure that selection dragging scrolls the right scrollable area
|
||||
otherWindow = window.open("data:text/html,<html><p style='margin-top: 4000px'>This is some text</p></html>", "_blank");
|
||||
SimpleTest.waitForFocus(selectionScrollCheck, otherWindow);
|
||||
}
|
||||
|
||||
function runCaptureTest(element, callback)
|
||||
|
|
Загрузка…
Ссылка в новой задаче