Bug 1680951 - Do not scroll when calling select() r=masayuki
This is intended to be a hotfix for the URL bar regression. Ideally there should be a spec or this behavior should be removed completely. Previously select() scrolled back to the start position before the regression, but this fix does not restore that behavior. Differential Revision: https://phabricator.services.mozilla.com/D98972
This commit is contained in:
@@ -2055,7 +2055,8 @@ nsITextControlFrame::SelectionDirection TextControlState::GetSelectionDirection(
|
||||
|
||||
void TextControlState::SetSelectionRange(
|
||||
uint32_t aStart, uint32_t aEnd,
|
||||
nsITextControlFrame::SelectionDirection aDirection, ErrorResult& aRv) {
|
||||
nsITextControlFrame::SelectionDirection aDirection, ErrorResult& aRv,
|
||||
ScrollAfterSelection aScroll) {
|
||||
MOZ_ASSERT(IsSelectionCached() || mBoundFrame,
|
||||
"How can we have a non-cached selection but no frame?");
|
||||
|
||||
@@ -2082,7 +2083,7 @@ void TextControlState::SetSelectionRange(
|
||||
handlingSetSelectionRange.IsTextControlStateDestroyed()) {
|
||||
return;
|
||||
}
|
||||
if (mBoundFrame) {
|
||||
if (aScroll == ScrollAfterSelection::Yes) {
|
||||
mBoundFrame->ScrollSelectionIntoViewAsync();
|
||||
}
|
||||
// Press on to firing the event even if that failed, like our old code did.
|
||||
@@ -2224,11 +2225,12 @@ DirectionStringToSelectionDirection(const Optional<nsAString>& aDirection) {
|
||||
void TextControlState::SetSelectionRange(uint32_t aSelectionStart,
|
||||
uint32_t aSelectionEnd,
|
||||
const Optional<nsAString>& aDirection,
|
||||
ErrorResult& aRv) {
|
||||
ErrorResult& aRv,
|
||||
ScrollAfterSelection aScroll) {
|
||||
nsITextControlFrame::SelectionDirection dir =
|
||||
DirectionStringToSelectionDirection(aDirection);
|
||||
|
||||
SetSelectionRange(aSelectionStart, aSelectionEnd, dir, aRv);
|
||||
SetSelectionRange(aSelectionStart, aSelectionEnd, dir, aRv, aScroll);
|
||||
// The instance may have already been deleted here.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user