Bug 1499430 - Make PresShell::PageMove() use result of nsFrameSelection::GetFrameToPageSelect() when PresShell::GetScrollableFrameToScroll() returns nullptr r=smaug

If there is no scrollable frame, PresShell::GetScrollableFrameToScroll() returns
nullptr.  However, even when we don't expand selection, we need to move caret
in current selection root.  Therefore, it should call
nsFrameSelection::CommonPageMove() with the result of
nsFrameSelection::GetFrameToPageSelect() to move caret.

Differential Revision: https://phabricator.services.mozilla.com/D16020
This commit is contained in:
Masayuki Nakano
2019-01-10 05:02:56 +00:00
parent dfbe7cc179
commit ef44e52a83
4 changed files with 365 additions and 317 deletions

View File

@@ -2266,14 +2266,16 @@ PresShell::IntraLineMove(bool aForward, bool aExtend) {
NS_IMETHODIMP
PresShell::PageMove(bool aForward, bool aExtend) {
nsIFrame* frame;
nsIFrame* frame = nullptr;
if (!aExtend) {
frame = do_QueryFrame(GetScrollableFrameToScroll(nsIPresShell::eVertical));
} else {
frame = mSelection->GetFrameToPageSelect();
// If there is no scrollable frame, get the frame to move caret instead.
}
if (!frame) {
return NS_OK;
frame = mSelection->GetFrameToPageSelect();
if (!frame) {
return NS_OK;
}
}
RefPtr<nsFrameSelection> frameSelection = mSelection;
frameSelection->CommonPageMove(aForward, aExtend, frame);