mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
LibWeb: Make create_a_css_style_sheet() take String arguments
This commit is contained in:
parent
d344c50663
commit
4ced88b4e5
2 changed files with 11 additions and 12 deletions
|
@ -61,10 +61,12 @@ void StyleElementUtils::update_a_style_block(DOM::Element& style_element)
|
||||||
// 6. Create a CSS style sheet with the following properties...
|
// 6. Create a CSS style sheet with the following properties...
|
||||||
create_a_css_style_sheet(
|
create_a_css_style_sheet(
|
||||||
style_element.document(),
|
style_element.document(),
|
||||||
"text/css"sv,
|
"text/css"_string,
|
||||||
&style_element,
|
&style_element,
|
||||||
style_element.deprecated_attribute(HTML::AttributeNames::media),
|
style_element.attribute(HTML::AttributeNames::media).value_or({}),
|
||||||
style_element.in_a_document_tree() ? style_element.deprecated_attribute(HTML::AttributeNames::title) : DeprecatedString::empty(),
|
style_element.in_a_document_tree()
|
||||||
|
? style_element.attribute(HTML::AttributeNames::title).value_or({})
|
||||||
|
: String {},
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
{},
|
{},
|
||||||
|
@ -86,7 +88,7 @@ void StyleElementUtils::remove_a_css_style_sheet(DOM::Document& document, CSS::C
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/cssom/#create-a-css-style-sheet
|
// https://www.w3.org/TR/cssom/#create-a-css-style-sheet
|
||||||
void StyleElementUtils::create_a_css_style_sheet(DOM::Document& document, DeprecatedString type, DOM::Element* owner_node, DeprecatedString media, DeprecatedString title, bool alternate, bool origin_clean, Optional<DeprecatedString> location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, CSS::CSSStyleSheet& sheet)
|
void StyleElementUtils::create_a_css_style_sheet(DOM::Document& document, String type, DOM::Element* owner_node, String media, String title, bool alternate, bool origin_clean, Optional<String> location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, CSS::CSSStyleSheet& sheet)
|
||||||
{
|
{
|
||||||
// 1. Create a new CSS style sheet object and set its properties as specified.
|
// 1. Create a new CSS style sheet object and set its properties as specified.
|
||||||
// FIXME: We receive `sheet` from the caller already. This is weird.
|
// FIXME: We receive `sheet` from the caller already. This is weird.
|
||||||
|
@ -94,15 +96,12 @@ void StyleElementUtils::create_a_css_style_sheet(DOM::Document& document, Deprec
|
||||||
sheet.set_parent_css_style_sheet(parent_style_sheet);
|
sheet.set_parent_css_style_sheet(parent_style_sheet);
|
||||||
sheet.set_owner_css_rule(owner_rule);
|
sheet.set_owner_css_rule(owner_rule);
|
||||||
sheet.set_owner_node(owner_node);
|
sheet.set_owner_node(owner_node);
|
||||||
sheet.set_type(MUST(String::from_deprecated_string(type)));
|
sheet.set_type(move(type));
|
||||||
sheet.set_media(MUST(String::from_deprecated_string(media)));
|
sheet.set_media(move(media));
|
||||||
sheet.set_title(MUST(String::from_deprecated_string(title)));
|
sheet.set_title(move(title));
|
||||||
sheet.set_alternate(alternate);
|
sheet.set_alternate(alternate);
|
||||||
sheet.set_origin_clean(origin_clean);
|
sheet.set_origin_clean(origin_clean);
|
||||||
if (!location.has_value())
|
sheet.set_location(move(location));
|
||||||
sheet.set_location({});
|
|
||||||
else
|
|
||||||
sheet.set_location(MUST(String::from_deprecated_string(*location)));
|
|
||||||
|
|
||||||
// 2. Then run the add a CSS style sheet steps for the newly created CSS style sheet.
|
// 2. Then run the add a CSS style sheet steps for the newly created CSS style sheet.
|
||||||
add_a_css_style_sheet(document, sheet);
|
add_a_css_style_sheet(document, sheet);
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void remove_a_css_style_sheet(DOM::Document& document, CSS::CSSStyleSheet& sheet);
|
void remove_a_css_style_sheet(DOM::Document& document, CSS::CSSStyleSheet& sheet);
|
||||||
void create_a_css_style_sheet(DOM::Document& document, DeprecatedString type, DOM::Element* owner_node, DeprecatedString media, DeprecatedString title, bool alternate, bool origin_clean, Optional<DeprecatedString> location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, CSS::CSSStyleSheet& sheet);
|
void create_a_css_style_sheet(DOM::Document& document, String type, DOM::Element* owner_node, String media, String title, bool alternate, bool origin_clean, Optional<String> location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, CSS::CSSStyleSheet& sheet);
|
||||||
void add_a_css_style_sheet(DOM::Document& document, CSS::CSSStyleSheet& sheet);
|
void add_a_css_style_sheet(DOM::Document& document, CSS::CSSStyleSheet& sheet);
|
||||||
|
|
||||||
// https://www.w3.org/TR/cssom/#associated-css-style-sheet
|
// https://www.w3.org/TR/cssom/#associated-css-style-sheet
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue