Skip to content

Commit 483d3bf

Browse files
committed
Use datalist() instead of list() internally.
This reserves list() for use in bindings.
1 parent 028f2f1 commit 483d3bf

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

Source/WebCore/html/HTMLInputElement.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,10 @@ RefPtr<HTMLElement> HTMLInputElement::list() const
18911891
return dataList();
18921892
}
18931893

1894+
bool HTMLInputElement::hasDataList() const {
1895+
return dataList();
1896+
}
1897+
18941898
RefPtr<HTMLDataListElement> HTMLInputElement::dataList() const
18951899
{
18961900
if (!m_hasNonEmptyList || !m_inputType->shouldRespectListAttribute())

Source/WebCore/html/HTMLInputElement.h

+1
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ class HTMLInputElement final : public HTMLTextFormControlElement {
288288
bool willRespondToMouseClickEventsWithEditability(Editability) const final;
289289

290290
WEBCORE_EXPORT bool isFocusingWithDataListDropdown() const;
291+
bool hasDataList() const;
291292
RefPtr<HTMLDataListElement> dataList() const;
292293
void dataListMayHaveChanged();
293294

Source/WebCore/html/TextFieldInputType.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange
183183

184184
void TextFieldInputType::handleClickEvent(MouseEvent&)
185185
{
186-
if (element()->focused() && element()->list())
186+
if (element()->focused() && element()->hasDataList())
187187
displaySuggestions(DataListSuggestionActivationType::ControlClicked);
188188
}
189189

190190
void TextFieldInputType::showPicker()
191191
{
192192
#if !PLATFORM(IOS_FAMILY)
193-
if (element()->list())
193+
if (element()->hasDataList())
194194
displaySuggestions(DataListSuggestionActivationType::ControlClicked);
195195
#endif
196196
}
@@ -334,7 +334,7 @@ void TextFieldInputType::createShadowSubtree()
334334
bool shouldHaveSpinButton = this->shouldHaveSpinButton();
335335
bool shouldHaveCapsLockIndicator = this->shouldHaveCapsLockIndicator();
336336
bool shouldDrawAutoFillButton = this->shouldDrawAutoFillButton();
337-
bool hasDataList = element()->list();
337+
bool hasDataList = element()->hasDataList();
338338
bool createsContainer = shouldHaveSpinButton || shouldHaveCapsLockIndicator || shouldDrawAutoFillButton || hasDataList || needsContainer();
339339

340340
Ref innerText = TextControlInnerTextElement::create(document, element()->isInnerTextElementEditable());
@@ -698,7 +698,7 @@ void TextFieldInputType::didSetValueByUserEdit()
698698
return;
699699
if (RefPtr frame = element()->document().frame())
700700
frame->editor().textDidChangeInTextField(*element());
701-
if (element()->list())
701+
if (element()->hasDataList())
702702
displaySuggestions(DataListSuggestionActivationType::TextChanged);
703703
}
704704

@@ -897,7 +897,7 @@ void TextFieldInputType::dataListMayHaveChanged()
897897
if (!element())
898898
return;
899899
m_dataListDropdownIndicator->setInlineStyleProperty(CSSPropertyDisplay, element()->list() ? CSSValueBlock : CSSValueNone, IsImportant::Yes);
900-
if (element()->list() && element()->focused())
900+
if (element()->hasDataList() && element()->focused())
901901
displaySuggestions(DataListSuggestionActivationType::DataListMayHaveChanged);
902902
}
903903

@@ -909,7 +909,7 @@ HTMLElement* TextFieldInputType::dataListButtonElement() const
909909
void TextFieldInputType::dataListButtonElementWasClicked()
910910
{
911911
Ref<HTMLInputElement> input(*element());
912-
if (input->list()) {
912+
if (input->hasDataList()) {
913913
m_isFocusingWithDataListDropdown = true;
914914
unsigned max = visibleValue().length();
915915
input->setSelectionRange(max, max);

Source/WebCore/html/shadow/SliderThumbElement.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ RenderBox::LogicalExtentComputedValues RenderSliderContainer::computeLogicalHeig
111111
auto& input = downcast<HTMLInputElement>(*element()->shadowHost());
112112
bool isVertical = hasVerticalAppearance(input);
113113

114-
if (input.renderer()->isRenderSlider() && !isVertical && input.list()) {
114+
if (input.renderer()->isRenderSlider() && !isVertical && input.hasDataList()) {
115115
int offsetFromCenter = theme().sliderTickOffsetFromTrackCenter();
116116
LayoutUnit trackHeight;
117117
if (offsetFromCenter < 0)

Source/WebCore/rendering/RenderTheme.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ bool RenderTheme::isDefault(const RenderObject& o) const
12221222
bool RenderTheme::hasListButton(const RenderObject& renderer) const
12231223
{
12241224
RefPtr input = dynamicDowncast<HTMLInputElement>(renderer.generatingNode());
1225-
return input && input->list();
1225+
return input && input->hasDataList();
12261226
}
12271227

12281228
bool RenderTheme::hasListButtonPressed(const RenderObject& renderer) const

0 commit comments

Comments
 (0)