Everywhere: Use Optional<T>::ensure() where useful

No functional changes.
This commit is contained in:
Jelle Raaijmakers 2025-09-17 15:48:22 +02:00 committed by Tim Flynn
commit c31eff6a47
Notes: github-actions[bot] 2025-09-17 16:02:17 +00:00
14 changed files with 53 additions and 87 deletions

View file

@ -213,9 +213,7 @@ void HTMLTextAreaElement::set_raw_value(Utf16String value)
Utf16String HTMLTextAreaElement::api_value() const
{
// The algorithm for obtaining the element's API value is to return the element's raw value, with newlines normalized.
if (!m_api_value.has_value())
m_api_value = Infra::normalize_newlines(m_raw_value);
return *m_api_value;
return m_api_value.ensure([&] { return Infra::normalize_newlines(m_raw_value); });
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-textarea/input-relevant-value