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

Revert "Enable LayoutNG for BUTTON elements and INPUT buttons by default"

This reverts commit f1a2ccf7.

Reason for revert: Caused multiple memory regressions

Original change's description:
> Enable LayoutNG for BUTTON elements and INPUT buttons by default
> 
> Bug: 1040826
> Change-Id: I0a2f9db962e74a44758293e0711009617e6a42d3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354119
> Commit-Queue: Kent Tamura <tkent@chromium.org>
> Commit-Queue: Koji Ishii <kojii@chromium.org>
> Auto-Submit: Kent Tamura <tkent@chromium.org>
> Reviewed-by: Koji Ishii <kojii@chromium.org>
> Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#797991}

Change-Id: Iac0d9d51d658f1b45c854bf030f28821f907d94f
Tbr: yosin@chromium.org,tkent@chromium.org,kojii@chromium.org
Bug: 1040826, 1116415, 1116447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360104Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799010}
parent 7e9af624
......@@ -2535,6 +2535,7 @@ enum WebFeature {
kV8Document_HasTrustToken_Method = 3202,
kForceLoadAtTop = 3203,
kLegacyLayoutByButton = 3204,
kLegacyLayoutByDeprecatedFlexBox = 3205,
kLegacyLayoutByDetailsMarker = 3206,
kLegacyLayoutByEditing = 3207,
......
......@@ -33,6 +33,7 @@
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
......@@ -74,6 +75,14 @@ bool BaseButtonInputType::ShouldSaveAndRestoreFormControlState() const {
void BaseButtonInputType::AppendToFormData(FormData&) const {}
bool BaseButtonInputType::TypeShouldForceLegacyLayout() const {
if (RuntimeEnabledFeatures::LayoutNGForControlsEnabled())
return false;
UseCounter::Count(GetElement().GetDocument(),
WebFeature::kLegacyLayoutByButton);
return true;
}
LayoutObject* BaseButtonInputType::CreateLayoutObject(
const ComputedStyle& style,
LegacyLayout legacy) const {
......
......@@ -52,6 +52,7 @@ class BaseButtonInputType : public InputType,
InputTypeView* CreateView() override;
bool ShouldSaveAndRestoreFormControlState() const override;
void AppendToFormData(FormData&) const override;
bool TypeShouldForceLegacyLayout() const override;
LayoutObject* CreateLayoutObject(const ComputedStyle&,
LegacyLayout) const override;
ValueMode GetValueMode() const override;
......
......@@ -46,6 +46,13 @@ void HTMLButtonElement::setType(const AtomicString& type) {
setAttribute(html_names::kTypeAttr, type);
}
bool HTMLButtonElement::TypeShouldForceLegacyLayout() const {
if (RuntimeEnabledFeatures::LayoutNGForControlsEnabled())
return false;
UseCounter::Count(GetDocument(), WebFeature::kLegacyLayoutByButton);
return true;
}
LayoutObject* HTMLButtonElement::CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) {
// https://html.spec.whatwg.org/C/#button-layout
......
......@@ -60,6 +60,7 @@ class HTMLButtonElement final : public HTMLFormControlElement {
bool IsEnumeratable() const override { return true; }
bool IsLabelable() const override { return true; }
bool TypeShouldForceLegacyLayout() const final;
bool IsInteractiveContent() const override;
bool MatchesDefaultPseudoClass() const override;
......
......@@ -28544,7 +28544,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3201" label="OBSOLETE_WrongBaselineOfButtonElement"/>
<int value="3202" label="V8Document_HasTrustToken_Method"/>
<int value="3203" label="ForceLoadAtTop"/>
<int value="3204" label="OBSOLETE_LegacyLayoutByButton"/>
<int value="3204" label="LegacyLayoutByButton"/>
<int value="3205" label="LegacyLayoutByDeprecatedFlexBox"/>
<int value="3206" label="LegacyLayoutByDetailsMarker"/>
<int value="3207" label="LegacyLayoutByEditing"/>
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