Backed out changeset 29bbd5887d66 (bug 1680951) for failure on browser_blockingCookies.js. CLOSED TREE

This commit is contained in:
Butkovits Atila 2020-12-08 14:46:48 +02:00
Родитель fea36c6560
Коммит c405a6ab26
4 изменённых файлов: 13 добавлений и 58 удалений

Просмотреть файл

@ -3050,9 +3050,9 @@ void HTMLInputElement::Select() {
// HTMLInputElement::SetSelectionRange only applies to fewer types
// TODO(krosylight): This should pass eNone per the spec, but we don't support
// it yet. See bug 1541454.
state->SetSelectionRange(0, UINT32_MAX, Optional<nsAString>(),
IgnoredErrorResult(),
TextControlState::ScrollAfterSelection::No);
state->SetSelectionRange(0, UINT32_MAX,
nsITextControlFrame::SelectionDirection::eForward,
IgnoredErrorResult());
}
void HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext) {

Просмотреть файл

@ -2055,8 +2055,7 @@ nsITextControlFrame::SelectionDirection TextControlState::GetSelectionDirection(
void TextControlState::SetSelectionRange(
uint32_t aStart, uint32_t aEnd,
nsITextControlFrame::SelectionDirection aDirection, ErrorResult& aRv,
ScrollAfterSelection aScroll) {
nsITextControlFrame::SelectionDirection aDirection, ErrorResult& aRv) {
MOZ_ASSERT(IsSelectionCached() || mBoundFrame,
"How can we have a non-cached selection but no frame?");
@ -2083,7 +2082,7 @@ void TextControlState::SetSelectionRange(
handlingSetSelectionRange.IsTextControlStateDestroyed()) {
return;
}
if (aScroll == ScrollAfterSelection::Yes) {
if (mBoundFrame) {
mBoundFrame->ScrollSelectionIntoViewAsync();
}
// Press on to firing the event even if that failed, like our old code did.
@ -2225,12 +2224,11 @@ DirectionStringToSelectionDirection(const Optional<nsAString>& aDirection) {
void TextControlState::SetSelectionRange(uint32_t aSelectionStart,
uint32_t aSelectionEnd,
const Optional<nsAString>& aDirection,
ErrorResult& aRv,
ScrollAfterSelection aScroll) {
ErrorResult& aRv) {
nsITextControlFrame::SelectionDirection dir =
DirectionStringToSelectionDirection(aDirection);
SetSelectionRange(aSelectionStart, aSelectionEnd, dir, aRv, aScroll);
SetSelectionRange(aSelectionStart, aSelectionEnd, dir, aRv);
// The instance may have already been deleted here.
}

Просмотреть файл

@ -334,8 +334,6 @@ class TextControlState final : public SupportsWeakPtr {
nsITextControlFrame::SelectionDirection GetSelectionDirection(
ErrorResult& aRv);
enum class ScrollAfterSelection { No, Yes };
// Set the selection range (start, end, direction). aEnd is allowed to be
// smaller than aStart; in that case aStart will be reset to the same value as
// aEnd. This basically implements
@ -345,18 +343,19 @@ class TextControlState final : public SupportsWeakPtr {
// SelectionDirection.
//
// If we have a frame, this method will scroll the selection into view.
//
// XXXbz This should really take uint32_t, but none of our guts (either the
// frame or our cached selection state) work with uint32_t at the moment...
MOZ_CAN_RUN_SCRIPT void SetSelectionRange(
uint32_t aStart, uint32_t aEnd,
nsITextControlFrame::SelectionDirection aDirection, ErrorResult& aRv,
ScrollAfterSelection aScroll = ScrollAfterSelection::Yes);
nsITextControlFrame::SelectionDirection aDirection, ErrorResult& aRv);
// Set the selection range, but with an optional string for the direction.
// This will convert aDirection to an nsITextControlFrame::SelectionDirection
// and then call our other SetSelectionRange overload.
MOZ_CAN_RUN_SCRIPT void SetSelectionRange(
uint32_t aSelectionStart, uint32_t aSelectionEnd,
const dom::Optional<nsAString>& aDirection, ErrorResult& aRv,
ScrollAfterSelection aScroll = ScrollAfterSelection::Yes);
const dom::Optional<nsAString>& aDirection, ErrorResult& aRv);
// Set the selection start. This basically implements the
// https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-selectionstart

Просмотреть файл

@ -155,52 +155,10 @@
test(function() {
var el = createTextareaElement(sampleText);
var el = createInputElement(sampleText);
assert_in_array(el.selectionDirection, dirs, "SelectionDirection");
el.select();
assert_in_array(el.selectionDirection, dirs, "SelectionDirection");
el.parentNode.removeChild(el);
}, "test SelectionDirection for textarea");
promise_test(async () => {
// cause a layout overflow
const el = createInputElement(sampleText.repeat(100));
el.selectionEnd = 0;
await new Promise(requestAnimationFrame);
assert_equals(el.scrollLeft, 0);
el.select();
await new Promise(requestAnimationFrame);
assert_equals(el.scrollLeft, 0);
el.remove();
}, `test scrollLeft for input`);
promise_test(async () => {
// cause a layout overflow
const el = createInputElement(sampleText.repeat(100));
el.scrollLeft = 33;
el.select();
await new Promise(requestAnimationFrame);
assert_equals(el.scrollLeft, 33);
el.remove();
}, `test scrollLeft preservation for input`);
for (const localName of ["input", "textarea"]) {
promise_test(async () => {
const container = document.createElement("div");
container.style.height = "100px";
container.style.overflow = "scroll";
const element = document.createElement(localName);
element.style.marginTop = "120px";
container.append(element);
document.body.append(container);
element.select();
await new Promise(requestAnimationFrame);
assert_equals(container.scrollTop, 0);
container.remove();
}, `test container.scrollTop for ${localName}`);
}
</script>