diff --git a/Libraries/LibWeb/CSS/CSSImportRule.cpp b/Libraries/LibWeb/CSS/CSSImportRule.cpp index 1f3e699c336..61b2f541a1a 100644 --- a/Libraries/LibWeb/CSS/CSSImportRule.cpp +++ b/Libraries/LibWeb/CSS/CSSImportRule.cpp @@ -156,7 +156,7 @@ void CSSImportRule::fetch() } auto decoded = decoded_or_error.release_value(); - auto imported_style_sheet = parse_css_stylesheet(Parser::ParsingParams(*strong_this->m_document, parsed_url), decoded, parsed_url, strong_this->m_media_query_list); + auto imported_style_sheet = parse_css_stylesheet(Parser::ParsingParams(*strong_this->m_document), decoded, parsed_url, strong_this->m_media_query_list); // 5. Set importedStylesheet’s origin-clean flag to parentStylesheet’s origin-clean flag. imported_style_sheet->set_origin_clean(parent_style_sheet->is_origin_clean()); diff --git a/Libraries/LibWeb/CSS/FontFace.cpp b/Libraries/LibWeb/CSS/FontFace.cpp index 7a259862240..dcb67fe4dad 100644 --- a/Libraries/LibWeb/CSS/FontFace.cpp +++ b/Libraries/LibWeb/CSS/FontFace.cpp @@ -63,7 +63,6 @@ GC_DEFINE_ALLOCATOR(FontFace); GC::Ref FontFace::construct_impl(JS::Realm& realm, String family, FontFaceSource source, FontFaceDescriptors const& descriptors) { auto& vm = realm.vm(); - auto base_url = HTML::relevant_settings_object(realm.global_object()).api_base_url(); // 1. Let font face be a fresh FontFace object. Set font face’s status attribute to "unloaded", // Set its internal [[FontStatusPromise]] slot to a fresh pending Promise object. @@ -76,7 +75,7 @@ GC::Ref FontFace::construct_impl(JS::Realm& realm, String family, Font // set font face’s corresponding attributes to the empty string, and set font face’s status attribute to "error". // Otherwise, set font face’s corresponding attributes to the serialization of the parsed values. - Parser::ParsingParams parsing_params { realm, base_url }; + Parser::ParsingParams parsing_params { realm }; auto try_parse_descriptor = [&parsing_params, &font_face, &realm](DescriptorID descriptor_id, String const& string) -> String { auto result = parse_css_descriptor(parsing_params, AtRuleID::FontFace, descriptor_id, string); if (!result) { diff --git a/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Libraries/LibWeb/CSS/Parser/Parser.cpp index 93a6cba7cfc..846954ab302 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -45,25 +45,9 @@ ParsingParams::ParsingParams(JS::Realm& realm, ParsingMode mode) { } -ParsingParams::ParsingParams(JS::Realm& realm, ::URL::URL url, ParsingMode mode) - : realm(realm) - , url(move(url)) - , mode(mode) -{ -} - -ParsingParams::ParsingParams(DOM::Document const& document, ::URL::URL url, ParsingMode mode) - : realm(const_cast(document.realm())) - , document(&document) - , url(move(url)) - , mode(mode) -{ -} - ParsingParams::ParsingParams(DOM::Document const& document, ParsingMode mode) : realm(const_cast(document.realm())) , document(&document) - , url(document.url()) , mode(mode) { } @@ -77,7 +61,6 @@ Parser Parser::create(ParsingParams const& context, StringView input, StringView Parser::Parser(ParsingParams const& context, Vector tokens) : m_document(context.document) , m_realm(context.realm) - , m_url(context.url) , m_parsing_mode(context.mode) , m_tokens(move(tokens)) , m_token_stream(m_tokens) @@ -1864,13 +1847,4 @@ bool Parser::is_parsing_svg_presentation_attribute() const return m_parsing_mode == ParsingMode::SVGPresentationAttribute; } -// https://www.w3.org/TR/css-values-4/#relative-urls -// FIXME: URLs shouldn't be completed during parsing, but when used. -Optional<::URL::URL> Parser::complete_url(StringView relative_url) const -{ - if (!m_url.has_value()) - return ::URL::Parser::basic_parse(relative_url); - return m_url->complete_url(relative_url); -} - } diff --git a/Libraries/LibWeb/CSS/Parser/Parser.h b/Libraries/LibWeb/CSS/Parser/Parser.h index c23905cfb59..c9e336160ce 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Libraries/LibWeb/CSS/Parser/Parser.h @@ -71,13 +71,10 @@ enum class ParsingMode { struct ParsingParams { explicit ParsingParams(ParsingMode = ParsingMode::Normal); explicit ParsingParams(JS::Realm&, ParsingMode = ParsingMode::Normal); - explicit ParsingParams(JS::Realm&, ::URL::URL, ParsingMode = ParsingMode::Normal); - explicit ParsingParams(DOM::Document const&, ::URL::URL, ParsingMode = ParsingMode::Normal); explicit ParsingParams(DOM::Document const&, ParsingMode = ParsingMode::Normal); GC::Ptr realm; GC::Ptr document; - ::URL::URL url; ParsingMode mode { ParsingMode::Normal }; Vector rule_context; @@ -480,11 +477,9 @@ private: JS::Realm& realm() const; bool in_quirks_mode() const; bool is_parsing_svg_presentation_attribute() const; - Optional<::URL::URL> complete_url(StringView) const; GC::Ptr m_document; GC::Ptr m_realm; - Optional<::URL::URL> m_url; ParsingMode m_parsing_mode { ParsingMode::Normal }; Vector m_tokens; diff --git a/Libraries/LibWeb/CSS/StyleSheetList.cpp b/Libraries/LibWeb/CSS/StyleSheetList.cpp index 7a4b92d9ea7..07b1f1e3d14 100644 --- a/Libraries/LibWeb/CSS/StyleSheetList.cpp +++ b/Libraries/LibWeb/CSS/StyleSheetList.cpp @@ -68,7 +68,7 @@ GC::Ref StyleSheetList::create_a_css_style_sheet(String const& cs // AD-HOC: The spec never tells us when to parse this style sheet, but the most logical place is here. // AD-HOC: Are we supposed to use the document's URL for the stylesheet's location during parsing? Not doing it breaks things. auto location_url = location.value_or(document().url()); - auto sheet = parse_css_stylesheet(Parser::ParsingParams { document(), location_url }, css_text, location_url); + auto sheet = parse_css_stylesheet(Parser::ParsingParams { document() }, css_text, location_url); sheet->set_parent_css_style_sheet(parent_style_sheet); sheet->set_owner_css_rule(owner_rule);