Commit 5c8f724b authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Move HTMLSelectElement::SetOptionsChangedOnLayoutObject() to MenuListSelectType

and rename it to MaximumOptionWidthMightBeChanged().
This CL has no behavior changes.

Bug: 1052232
Change-Id: Ifb891a8c0bfb916075f44460ef85be301982932c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094475Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748104}
parent 8dda15b2
......@@ -616,15 +616,6 @@ void HTMLSelectElement::ScrollToSelection() {
cache->ListboxActiveIndexChanged(this);
}
void HTMLSelectElement::SetOptionsChangedOnLayoutObject() {
if (LayoutObject* layout_object = GetLayoutObject()) {
if (!UsesMenuList())
return;
layout_object->SetNeedsLayoutAndPrefWidthsRecalc(
layout_invalidation_reason::kMenuOptionsChanged);
}
}
const HTMLSelectElement::ListItems& HTMLSelectElement::GetListItems() const {
if (should_recalc_list_items_) {
RecalcListItems();
......@@ -651,7 +642,7 @@ void HTMLSelectElement::SetRecalcListItems() {
should_recalc_list_items_ = true;
SetOptionsChangedOnLayoutObject();
select_type_->MaximumOptionWidthMightBeChanged();
if (!isConnected()) {
if (HTMLOptionsCollection* collection =
CachedCollection<HTMLOptionsCollection>(kSelectOptions))
......
......@@ -255,7 +255,6 @@ class CORE_EXPORT HTMLSelectElement final
void ParseMultipleAttribute(const AtomicString&);
HTMLOptionElement* LastSelectedOption() const;
void UpdateSelectedState(HTMLOptionElement*, bool multi, bool shift);
void SetOptionsChangedOnLayoutObject();
wtf_size_t SearchOptionsForValue(const String&,
wtf_size_t list_index_start,
wtf_size_t list_index_end) const;
......
......@@ -86,6 +86,7 @@ class MenuListSelectType final : public SelectType {
const ComputedStyle* OptionStyle() const override {
return option_style_.get();
}
void MaximumOptionWidthMightBeChanged() const override;
void ShowPopup() override;
void HidePopup() override;
......@@ -501,6 +502,13 @@ void MenuListSelectType::DidUpdateActiveOption(HTMLOptionElement* option) {
select_->GetLayoutObject(), option_index);
}
void MenuListSelectType::MaximumOptionWidthMightBeChanged() const {
if (LayoutObject* layout_object = select_->GetLayoutObject()) {
layout_object->SetNeedsLayoutAndPrefWidthsRecalc(
layout_invalidation_reason::kMenuOptionsChanged);
}
}
// PopupUpdater notifies updates of the specified SELECT element subtree to
// a PopupMenu object.
class PopupUpdater : public MutationObserver::Delegate {
......@@ -945,6 +953,8 @@ const ComputedStyle* SelectType::OptionStyle() const {
return nullptr;
}
void SelectType::MaximumOptionWidthMightBeChanged() const {}
void SelectType::UpdateMultiSelectFocus() {}
void SelectType::SelectAll() {
......
......@@ -41,6 +41,7 @@ class SelectType : public GarbageCollected<SelectType> {
virtual void UpdateTextStyleAndContent();
virtual const ComputedStyle* OptionStyle() const;
virtual void MaximumOptionWidthMightBeChanged() const;
// Update :-internal-multi-select-focus state of selected OPTIONs.
virtual void UpdateMultiSelectFocus();
......
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