Commit 3a051562 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Enable LayoutNG for checkboxes and radio buttons

blink::BaseCheckableInputType is the super class of
blink::CheckboxInputType and blink::RadioInputType, and it has no
other subclasses.

This CL should have no behavior changes.

Bug: 1040826
Change-Id: I706672c9ff34544adbe068f7bd16d143c98c7d05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000397
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731851}
parent a8b0219d
...@@ -121,4 +121,8 @@ bool BaseCheckableInputType::IsCheckable() { ...@@ -121,4 +121,8 @@ bool BaseCheckableInputType::IsCheckable() {
return true; return true;
} }
bool BaseCheckableInputType::TypeShouldForceLegacyLayout() const {
return false;
}
} // namespace blink } // namespace blink
...@@ -70,6 +70,7 @@ class BaseCheckableInputType : public InputType, public InputTypeView { ...@@ -70,6 +70,7 @@ class BaseCheckableInputType : public InputType, public InputTypeView {
TextControlSetValueSelection) final; TextControlSetValueSelection) final;
void ReadingChecked() const final; void ReadingChecked() const final;
bool IsCheckable() final; bool IsCheckable() final;
bool TypeShouldForceLegacyLayout() const final;
}; };
} // namespace blink } // namespace blink
......
...@@ -61,7 +61,7 @@ class CORE_EXPORT HTMLFormControlElementWithState ...@@ -61,7 +61,7 @@ class CORE_EXPORT HTMLFormControlElementWithState
bool IsFormControlElementWithState() const final; bool IsFormControlElementWithState() const final;
private: private:
bool TypeShouldForceLegacyLayout() const final { return true; } bool TypeShouldForceLegacyLayout() const override { return true; }
int DefaultTabIndex() const override; int DefaultTabIndex() const override;
// https://html.spec.whatwg.org/C/#autofill-anchor-mantle // https://html.spec.whatwg.org/C/#autofill-anchor-mantle
......
...@@ -882,6 +882,11 @@ bool HTMLInputElement::LayoutObjectIsNeeded(const ComputedStyle& style) const { ...@@ -882,6 +882,11 @@ bool HTMLInputElement::LayoutObjectIsNeeded(const ComputedStyle& style) const {
TextControlElement::LayoutObjectIsNeeded(style); TextControlElement::LayoutObjectIsNeeded(style);
} }
// TODO(crbug.com/1040826): Remove this override.
bool HTMLInputElement::TypeShouldForceLegacyLayout() const {
return input_type_view_->TypeShouldForceLegacyLayout();
}
LayoutObject* HTMLInputElement::CreateLayoutObject(const ComputedStyle& style, LayoutObject* HTMLInputElement::CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) { LegacyLayout legacy) {
return input_type_view_->CreateLayoutObject(style, legacy); return input_type_view_->CreateLayoutObject(style, legacy);
......
...@@ -365,6 +365,7 @@ class CORE_EXPORT HTMLInputElement ...@@ -365,6 +365,7 @@ class CORE_EXPORT HTMLInputElement
void CloneNonAttributePropertiesFrom(const Element&, CloneChildrenFlag) final; void CloneNonAttributePropertiesFrom(const Element&, CloneChildrenFlag) final;
bool TypeShouldForceLegacyLayout() const final;
void AttachLayoutTree(AttachContext&) final; void AttachLayoutTree(AttachContext&) final;
void AppendToFormData(FormData&) final; void AppendToFormData(FormData&) final;
......
...@@ -87,6 +87,10 @@ HTMLFormElement* InputTypeView::FormForSubmission() const { ...@@ -87,6 +87,10 @@ HTMLFormElement* InputTypeView::FormForSubmission() const {
return GetElement().Form(); return GetElement().Form();
} }
bool InputTypeView::TypeShouldForceLegacyLayout() const {
return true;
}
LayoutObject* InputTypeView::CreateLayoutObject(const ComputedStyle& style, LayoutObject* InputTypeView::CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) const { LegacyLayout legacy) const {
return LayoutObject::CreateObject(&GetElement(), style, legacy); return LayoutObject::CreateObject(&GetElement(), style, legacy);
......
...@@ -99,6 +99,7 @@ class CORE_EXPORT InputTypeView : public GarbageCollectedMixin { ...@@ -99,6 +99,7 @@ class CORE_EXPORT InputTypeView : public GarbageCollectedMixin {
void DispatchSimulatedClickIfActive(KeyboardEvent&) const; void DispatchSimulatedClickIfActive(KeyboardEvent&) const;
virtual void SubtreeHasChanged(); virtual void SubtreeHasChanged();
virtual bool TypeShouldForceLegacyLayout() const;
virtual LayoutObject* CreateLayoutObject(const ComputedStyle&, virtual LayoutObject* CreateLayoutObject(const ComputedStyle&,
LegacyLayout) const; LegacyLayout) const;
virtual scoped_refptr<ComputedStyle> CustomStyleForLayoutObject( virtual scoped_refptr<ComputedStyle> CustomStyleForLayoutObject(
......
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