Commit da306295 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[cleanup] Remove LayoutTheme::ShouldHaveSpinButton

In favour of having logic within:
TextFieldInputType::ShouldHaveSpinButton

There should be no behaviour change.

Change-Id: I07b3222931687c96139ac791d9aca9692caa6659
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363464
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799953}
parent d701f479
......@@ -294,17 +294,12 @@ LayoutObject* TextFieldInputType::CreateLayoutObject(const ComputedStyle&,
return new LayoutTextControlSingleLine(&GetElement());
}
bool TextFieldInputType::ShouldHaveSpinButton() const {
return LayoutTheme::GetTheme().ShouldHaveSpinButton(&GetElement());
}
void TextFieldInputType::CreateShadowSubtree() {
DCHECK(IsShadowHost(GetElement()));
ShadowRoot* shadow_root = GetElement().UserAgentShadowRoot();
DCHECK(!shadow_root->HasChildren());
Document& document = GetElement().GetDocument();
bool should_have_spin_button = ShouldHaveSpinButton();
bool should_have_spin_button = GetElement().IsSteppable();
bool should_have_data_list_indicator = GetElement().HasValidDataListOptions();
bool creates_container = should_have_spin_button ||
should_have_data_list_indicator || NeedsContainer();
......@@ -315,6 +310,7 @@ void TextFieldInputType::CreateShadowSubtree() {
return;
}
Document& document = GetElement().GetDocument();
auto* container = MakeGarbageCollected<HTMLDivElement>(document);
container->SetIdAttribute(shadow_element_names::TextFieldContainer());
container->SetShadowPseudoId(
......
......@@ -78,7 +78,6 @@ class TextFieldInputType : public InputType,
virtual void DidSetValueByUserEdit();
void HandleKeydownEventForSpinButton(KeyboardEvent&);
bool ShouldHaveSpinButton() const;
Element* ContainerElement() const;
private:
......
......@@ -532,11 +532,6 @@ void LayoutTheme::AdjustMenuListStyle(ComputedStyle& style, Element*) const {
style.SetOverflowY(EOverflow::kVisible);
}
bool LayoutTheme::ShouldHaveSpinButton(HTMLInputElement* input_element) const {
return input_element->IsSteppable() &&
input_element->type() != input_type_names::kRange;
}
void LayoutTheme::AdjustMenuListButtonStyle(ComputedStyle&, Element*) const {}
void LayoutTheme::AdjustSliderContainerStyle(ComputedStyle& style,
......
......@@ -45,7 +45,6 @@ class ComputedStyle;
class Element;
class File;
class FontDescription;
class HTMLInputElement;
class LengthSize;
class LocalFrame;
class Node;
......@@ -190,8 +189,6 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> {
// Returns the distance of slider tick origin from the slider track center.
virtual int SliderTickOffsetFromTrackCenter() const = 0;
virtual bool ShouldHaveSpinButton(HTMLInputElement*) const;
// Functions for <select> elements.
virtual bool DelegatesMenuListRendering() const;
// This function has no effect for LayoutThemeAndroid, of which
......
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