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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user