Commit c32a1d02 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Remove kRestoreOnLoad flag in form_controller.cc

The behavior with kRestoreOnLoad==true caused one regression,
crbug.com/1035662, and it was fixed. We think the new behavior has no
major issues, and we don't need to keep the old behavior.
This CL has no behavior changes.

Bug: 1008708
Change-Id: I449a5d90489f9729dfd85aa9d0d229461967bc45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2038410Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738715}
parent 7050e61a
...@@ -42,10 +42,6 @@ namespace blink { ...@@ -42,10 +42,6 @@ namespace blink {
namespace { namespace {
// TODO(crbug.com/1008708): Remove this flag when we're sure the new behavior
// is better than the previous one.
constexpr bool kRestoreOnLoad = true;
inline HTMLFormElement* OwnerFormForState(const ListedElement& control) { inline HTMLFormElement* OwnerFormForState(const ListedElement& control) {
// Assume controls with form attribute have no owners because we restore // Assume controls with form attribute have no owners because we restore
// state during parsing and form owners of such controls might be // state during parsing and form owners of such controls might be
...@@ -568,7 +564,7 @@ void FormController::WillDeleteForm(HTMLFormElement* form) { ...@@ -568,7 +564,7 @@ void FormController::WillDeleteForm(HTMLFormElement* form) {
} }
void FormController::RestoreControlStateFor(ListedElement& control) { void FormController::RestoreControlStateFor(ListedElement& control) {
if (kRestoreOnLoad && !document_->HasFinishedParsing()) if (!document_->HasFinishedParsing())
return; return;
if (OwnerFormForState(control)) if (OwnerFormForState(control))
return; return;
...@@ -576,7 +572,7 @@ void FormController::RestoreControlStateFor(ListedElement& control) { ...@@ -576,7 +572,7 @@ void FormController::RestoreControlStateFor(ListedElement& control) {
} }
void FormController::RestoreControlStateIn(HTMLFormElement& form) { void FormController::RestoreControlStateIn(HTMLFormElement& form) {
if (kRestoreOnLoad && !document_->HasFinishedParsing()) if (!document_->HasFinishedParsing())
return; return;
EventQueueScope scope; EventQueueScope scope;
const ListedElement::List& elements = form.ListedElements(); const ListedElement::List& elements = form.ListedElements();
...@@ -620,8 +616,6 @@ void FormController::RestoreControlStateOnUpgrade(ListedElement& control) { ...@@ -620,8 +616,6 @@ void FormController::RestoreControlStateOnUpgrade(ListedElement& control) {
} }
void FormController::ScheduleRestore() { void FormController::ScheduleRestore() {
if (!kRestoreOnLoad)
return;
document_->GetTaskRunner(TaskType::kInternalLoading) document_->GetTaskRunner(TaskType::kInternalLoading)
->PostTask(FROM_HERE, ->PostTask(FROM_HERE,
WTF::Bind(&FormController::RestoreAllControlsInDocumentOrder, WTF::Bind(&FormController::RestoreAllControlsInDocumentOrder,
...@@ -629,8 +623,6 @@ void FormController::ScheduleRestore() { ...@@ -629,8 +623,6 @@ void FormController::ScheduleRestore() {
} }
void FormController::RestoreImmediately() { void FormController::RestoreImmediately() {
if (!kRestoreOnLoad)
return;
if (did_restore_all_ || !HasControlStates()) if (did_restore_all_ || !HasControlStates())
return; return;
RestoreAllControlsInDocumentOrder(); RestoreAllControlsInDocumentOrder();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment