LibWeb: Rename CSSStyleProperties::property() -> get_property()

Verbs are nice, and `property` is too useful as a variable name.
This commit is contained in:
Sam Atkins 2025-09-25 15:58:32 +01:00
commit d60c8d80e5
Notes: github-actions[bot] 2025-10-02 12:48:09 +00:00
3 changed files with 12 additions and 12 deletions

View file

@ -156,7 +156,7 @@ String CSSStyleProperties::item(size_t index) const
return CSS::string_from_property_id(m_properties[index - custom_properties_count].property_id).to_string();
}
Optional<StyleProperty> CSSStyleProperties::property(PropertyID property_id) const
Optional<StyleProperty> CSSStyleProperties::get_property(PropertyID property_id) const
{
if (is_computed()) {
if (!owner_node().has_value())
@ -430,7 +430,7 @@ StringView CSSStyleProperties::get_property_priority(FlyString const& property_n
return {};
return maybe_custom_property.value().important == Important::Yes ? "important"sv : ""sv;
}
auto maybe_property = property(property_id.value());
auto maybe_property = get_property(property_id.value());
if (!maybe_property.has_value())
return {};
return maybe_property->important == Important::Yes ? "important"sv : ""sv;
@ -494,7 +494,7 @@ Optional<StyleProperty> CSSStyleProperties::get_property_internal(PropertyID pro
// NOTE: This is handled by the loop.
}
return property(property_id);
return get_property(property_id);
}
static RefPtr<StyleValue const> resolve_color_style_value(StyleValue const& style_value, Color computed_color)

View file

@ -33,7 +33,7 @@ public:
virtual size_t length() const override;
virtual String item(size_t index) const override;
Optional<StyleProperty> property(PropertyID) const;
Optional<StyleProperty> get_property(PropertyID) const;
Optional<StyleProperty const&> custom_property(FlyString const& custom_property_name) const;
WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority = ""sv);

View file

@ -615,7 +615,7 @@ Vector<GC::Ref<DOM::Node>> clear_the_value(FlyString const& command, GC::Ref<DOM
if (!inline_style)
return;
auto style_property = inline_style->property(CSS::PropertyID::TextDecoration);
auto style_property = inline_style->get_property(CSS::PropertyID::TextDecoration);
if (!style_property.has_value())
return;
@ -2470,20 +2470,20 @@ bool is_simple_modifiable_element(GC::Ref<DOM::Node> node)
// * It is a b or strong element with exactly one attribute, which is style, and the style attribute sets exactly
// one CSS property (including invalid or unrecognized properties), which is "font-weight".
if (html_element.local_name().is_one_of(HTML::TagNames::b, HTML::TagNames::strong)
&& inline_style->property(CSS::PropertyID::FontWeight).has_value())
&& inline_style->get_property(CSS::PropertyID::FontWeight).has_value())
return true;
// * It is an i or em element with exactly one attribute, which is style, and the style attribute sets exactly one
// CSS property (including invalid or unrecognized properties), which is "font-style".
if (html_element.local_name().is_one_of(HTML::TagNames::i, HTML::TagNames::em)
&& inline_style->property(CSS::PropertyID::FontStyle).has_value())
&& inline_style->get_property(CSS::PropertyID::FontStyle).has_value())
return true;
// * It is an a, font, or span element with exactly one attribute, which is style, and the style attribute sets
// exactly one CSS property (including invalid or unrecognized properties), and that property is not
// "text-decoration".
if (html_element.local_name().is_one_of(HTML::TagNames::a, HTML::TagNames::font, HTML::TagNames::span)
&& !inline_style->property(CSS::PropertyID::TextDecoration).has_value())
&& !inline_style->get_property(CSS::PropertyID::TextDecoration).has_value())
return true;
// * It is an a, font, s, span, strike, or u element with exactly one attribute, which is style, and the style
@ -2491,7 +2491,7 @@ bool is_simple_modifiable_element(GC::Ref<DOM::Node> node)
// "text-decoration", which is set to "line-through" or "underline" or "overline" or "none".
if (html_element.local_name().is_one_of(HTML::TagNames::a, HTML::TagNames::font, HTML::TagNames::s,
HTML::TagNames::span, HTML::TagNames::strike, HTML::TagNames::u)
&& inline_style->property(CSS::PropertyID::TextDecoration).has_value()) {
&& inline_style->get_property(CSS::PropertyID::TextDecoration).has_value()) {
auto text_decoration = inline_style->text_decoration();
if (first_is_one_of(text_decoration,
string_from_keyword(CSS::Keyword::LineThrough),
@ -2713,7 +2713,7 @@ void justify_the_selection(DOM::Document& document, JustifyAlignment alignment)
++number_of_matching_attributes;
if (element->has_attribute(HTML::AttributeNames::style) && element->inline_style()
&& element->inline_style()->length() == 1) {
auto text_align = element->inline_style()->property(CSS::PropertyID::TextAlign);
auto text_align = element->inline_style()->get_property(CSS::PropertyID::TextAlign);
if (text_align.has_value()) {
auto align_value = text_align.value().value->to_string(CSS::SerializationMode::Normal);
if (align_value.equals_ignoring_ascii_case(alignment_keyword))
@ -4692,7 +4692,7 @@ Optional<NonnullRefPtr<CSS::StyleValue const>> property_in_style_attribute(GC::R
return {};
// FIXME: This doesn't support shorthand properties.
auto style_property = inline_style->property(property_id);
auto style_property = inline_style->get_property(property_id);
if (!style_property.has_value())
return {};
@ -4726,7 +4726,7 @@ Optional<NonnullRefPtr<CSS::StyleValue const>> resolved_value(GC::Ref<DOM::Node>
// Retrieve resolved style value
auto resolved_css_style_declaration = CSS::CSSStyleProperties::create_resolved_style(element->realm(), DOM::AbstractElement { static_cast<DOM::Element&>(*element) });
auto optional_style_property = resolved_css_style_declaration->property(property_id);
auto optional_style_property = resolved_css_style_declaration->get_property(property_id);
if (!optional_style_property.has_value())
return {};
return optional_style_property.value().value;