Skip to content

Commit

Permalink
<option> label attribute updates are not shown until focus is moved
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258862

Reviewed by Tim Nguyen.

HTMLOptionElement::label updates from JavaScript were not rendered on parent
<select> element, unless focus was moved to/from it. This change informs the
HTMLSelectElement about <option> child update whenever the label attribute
changes, which allows it to render the updated label.

* LayoutTests/TestExpectations:
* Source/WebCore/html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::attributeChanged):

Canonical link: https://commits.webkit.org/265942@main
  • Loading branch information
krzysdz authored and nt1m committed Jul 11, 2023
1 parent 124bb51 commit 06461c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,8 @@ imported/w3c/web-platform-tests/html/rendering/the-details-element/details-page-
imported/w3c/web-platform-tests/html/rendering/the-details-element/details-page-break-after-2-print.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/the-details-element/details-page-break-before-1-print.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/the-details-element/details-page-break-before-2-print.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/option-add-label.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/option-empty-label-to-empty-string.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/option-empty-label.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/option-rm-label.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-modify-scrolling-attr-to-yes.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/adopt-from-image-document.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-slow-aspect-ratio.html [ ImageOnlyFailure ]
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/html/HTMLOptionElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ void HTMLOptionElement::attributeChanged(const QualifiedName& name, const AtomSt
setSelected(!newValue.isNull());
break;
}
case AttributeNames::labelAttr: {
if (RefPtr select = ownerSelectElement())
select->optionElementChildrenChanged();
break;
}
#if ENABLE(DATALIST_ELEMENT)
case AttributeNames::valueAttr:
for (auto& dataList : ancestorsOfType<HTMLDataListElement>(*this))
Expand Down

0 comments on commit 06461c5

Please sign in to comment.