@@ -1137,19 +1137,19 @@ Optional<Utf16String> effective_command_value(GC::Ptr<DOM::Node> node, FlyString
11371137 auto resolved_background_color = [&] { return resolved_value (*node, CSS::PropertyID::BackgroundColor); };
11381138 auto resolved_background_alpha = [&] {
11391139 auto background_color = resolved_background_color ();
1140- if (!background_color. has_value () )
1140+ if (!background_color)
11411141 return NumericLimits<u8 >::max ();
11421142 VERIFY (is<Layout::NodeWithStyle>(node->layout_node ()));
1143- return background_color. value () ->to_color (CSS::ColorResolutionContext::for_layout_node_with_style (*static_cast <Layout::NodeWithStyle*>(node->layout_node ()))).value ().alpha ();
1143+ return background_color->to_color (CSS::ColorResolutionContext::for_layout_node_with_style (*static_cast <Layout::NodeWithStyle*>(node->layout_node ()))).value ().alpha ();
11441144 };
11451145 while (resolved_background_alpha () == 0 && node->parent () && is<DOM::Element>(*node->parent ()))
11461146 node = node->parent ();
11471147
11481148 // 2. Return the resolved value of "background-color" for node.
11491149 auto resolved_value = resolved_background_color ();
1150- if (!resolved_value. has_value () )
1150+ if (!resolved_value)
11511151 return {};
1152- return Utf16String::from_utf8_without_validation (resolved_value. value () ->to_string (CSS::SerializationMode::ResolvedValue));
1152+ return Utf16String::from_utf8_without_validation (resolved_value->to_string (CSS::SerializationMode::ResolvedValue));
11531153 }
11541154
11551155 // 5. If command is "subscript" or "superscript":
@@ -1196,7 +1196,7 @@ Optional<Utf16String> effective_command_value(GC::Ptr<DOM::Node> node, FlyString
11961196 auto inclusive_ancestor = node;
11971197 do {
11981198 auto text_decoration_line = resolved_value (*node, CSS::PropertyID::TextDecorationLine);
1199- if (text_decoration_line. has_value () && value_contains_keyword (text_decoration_line. value () , CSS::Keyword::LineThrough))
1199+ if (text_decoration_line && value_contains_keyword (* text_decoration_line, CSS::Keyword::LineThrough))
12001200 return " line-through" _utf16;
12011201 inclusive_ancestor = inclusive_ancestor->parent ();
12021202 } while (inclusive_ancestor);
@@ -1210,7 +1210,7 @@ Optional<Utf16String> effective_command_value(GC::Ptr<DOM::Node> node, FlyString
12101210 auto inclusive_ancestor = node;
12111211 do {
12121212 auto text_decoration_line = resolved_value (*node, CSS::PropertyID::TextDecorationLine);
1213- if (text_decoration_line. has_value () && value_contains_keyword (text_decoration_line. value () , CSS::Keyword::Underline))
1213+ if (text_decoration_line && value_contains_keyword (* text_decoration_line, CSS::Keyword::Underline))
12141214 return " underline" _utf16;
12151215 inclusive_ancestor = inclusive_ancestor->parent ();
12161216 } while (inclusive_ancestor);
@@ -1223,9 +1223,9 @@ Optional<Utf16String> effective_command_value(GC::Ptr<DOM::Node> node, FlyString
12231223 VERIFY (command_definition.relevant_css_property .has_value ());
12241224
12251225 auto optional_value = resolved_value (*node, command_definition.relevant_css_property .value ());
1226- if (!optional_value. has_value () )
1226+ if (!optional_value)
12271227 return {};
1228- return Utf16String::from_utf8_without_validation (optional_value. value () ->to_string (CSS::SerializationMode::ResolvedValue));
1228+ return Utf16String::from_utf8_without_validation (optional_value->to_string (CSS::SerializationMode::ResolvedValue));
12291229}
12301230
12311231// https://w3c.github.io/editing/docs/execCommand/#first-equivalent-point
@@ -2621,7 +2621,7 @@ void justify_the_selection(DOM::Document& document, JustifyAlignment alignment)
26212621
26222622 auto & element = static_cast <DOM::Element&>(*node);
26232623 if (element.has_attribute_ns (Namespace::HTML, HTML::AttributeNames::align)
2624- || property_in_style_attribute (element, CSS::PropertyID::TextAlign). has_value ()
2624+ || property_in_style_attribute (element, CSS::PropertyID::TextAlign)
26252625 || element.local_name () == HTML::TagNames::center)
26262626 element_list.append (element);
26272627
@@ -3847,10 +3847,10 @@ Optional<Utf16String> specified_command_value(GC::Ref<DOM::Element> element, Fly
38473847 // "text-decoration":
38483848 if (command == CommandNames::strikethrough) {
38493849 auto text_decoration_style = property_in_style_attribute (element, CSS::PropertyID::TextDecoration);
3850- if (text_decoration_style. has_value () ) {
3850+ if (text_decoration_style) {
38513851 // 1. If element's style attribute sets "text-decoration" to a value containing "line-through", return
38523852 // "line-through".
3853- if (value_contains_keyword (text_decoration_style. value () , CSS::Keyword::LineThrough))
3853+ if (value_contains_keyword (* text_decoration_style, CSS::Keyword::LineThrough))
38543854 return " line-through" _utf16;
38553855
38563856 // 2. Return null.
@@ -3865,9 +3865,9 @@ Optional<Utf16String> specified_command_value(GC::Ref<DOM::Element> element, Fly
38653865 // 6. If command is "underline", and element has a style attribute set, and that attribute sets "text-decoration":
38663866 if (command == CommandNames::underline) {
38673867 auto text_decoration_style = property_in_style_attribute (element, CSS::PropertyID::TextDecoration);
3868- if (text_decoration_style. has_value () ) {
3868+ if (text_decoration_style) {
38693869 // 1. If element's style attribute sets "text-decoration" to a value containing "underline", return "underline".
3870- if (value_contains_keyword (text_decoration_style. value () , CSS::Keyword::Underline))
3870+ if (value_contains_keyword (* text_decoration_style, CSS::Keyword::Underline))
38713871 return " underline" _utf16;
38723872
38733873 // 2. Return null.
@@ -4683,7 +4683,7 @@ Array<Utf16View, 7> named_font_sizes()
46834683 return { " x-small" sv, " small" sv, " medium" sv, " large" sv, " x-large" sv, " xx-large" sv, " xxx-large" sv };
46844684}
46854685
4686- Optional<NonnullRefPtr< CSS::StyleValue const > > property_in_style_attribute (GC::Ref<DOM::Element> element, CSS::PropertyID property_id)
4686+ RefPtr< CSS::StyleValue const > property_in_style_attribute (GC::Ref<DOM::Element> element, CSS::PropertyID property_id)
46874687{
46884688 auto inline_style = element->inline_style ();
46894689 if (!inline_style)
@@ -4699,20 +4699,20 @@ Optional<NonnullRefPtr<CSS::StyleValue const>> property_in_style_attribute(GC::R
46994699Optional<CSS::Display> resolved_display (GC::Ref<DOM::Node> node)
47004700{
47014701 auto resolved_property = resolved_value (node, CSS::PropertyID::Display);
4702- if (!resolved_property. has_value () || !resolved_property. value () ->is_display ())
4702+ if (!resolved_property || !resolved_property->is_display ())
47034703 return {};
4704- return resolved_property. value () ->as_display ().display ();
4704+ return resolved_property->as_display ().display ();
47054705}
47064706
47074707Optional<CSS::Keyword> resolved_keyword (GC::Ref<DOM::Node> node, CSS::PropertyID property_id)
47084708{
47094709 auto resolved_property = resolved_value (node, property_id);
4710- if (!resolved_property. has_value () || !resolved_property. value () ->is_keyword ())
4710+ if (!resolved_property || !resolved_property->is_keyword ())
47114711 return {};
4712- return resolved_property. value () ->as_keyword ().keyword ();
4712+ return resolved_property->as_keyword ().keyword ();
47134713}
47144714
4715- Optional<NonnullRefPtr< CSS::StyleValue const > > resolved_value (GC::Ref<DOM::Node> node, CSS::PropertyID property_id)
4715+ RefPtr< CSS::StyleValue const > resolved_value (GC::Ref<DOM::Node> node, CSS::PropertyID property_id)
47164716{
47174717 // Find the nearest inclusive ancestor of node that is an Element. This allows for passing in a DOM::Text node.
47184718 GC::Ptr<DOM::Node> element = node;
0 commit comments