mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-18 22:19:50 +00:00
Everywhere: Use Optional<T>::ensure() where useful
No functional changes.
This commit is contained in:
parent
0fe9255991
commit
c31eff6a47
Notes:
github-actions[bot]
2025-09-17 16:02:17 +00:00
Author: https://github.com/gmta
Commit: c31eff6a47
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6220
Reviewed-by: https://github.com/rmg-x
Reviewed-by: https://github.com/trflynn89 ✅
14 changed files with 53 additions and 87 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue