mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-16 07:20:46 +00:00
LibWeb/CSS: Remove URL parameter to the CSS Parser
We no longer complete any URLs during parsing.
This commit is contained in:
parent
9e2e796f2d
commit
bc1d323ba0
Notes:
github-actions[bot]
2025-05-03 11:02:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: bc1d323ba0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4536
5 changed files with 3 additions and 35 deletions
|
@ -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<JS::Realm&>(document.realm()))
|
||||
, document(&document)
|
||||
, url(move(url))
|
||||
, mode(mode)
|
||||
{
|
||||
}
|
||||
|
||||
ParsingParams::ParsingParams(DOM::Document const& document, ParsingMode mode)
|
||||
: realm(const_cast<JS::Realm&>(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<Token> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<JS::Realm> realm;
|
||||
GC::Ptr<DOM::Document const> document;
|
||||
::URL::URL url;
|
||||
ParsingMode mode { ParsingMode::Normal };
|
||||
|
||||
Vector<RuleContext> 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<DOM::Document const> m_document;
|
||||
GC::Ptr<JS::Realm> m_realm;
|
||||
Optional<::URL::URL> m_url;
|
||||
ParsingMode m_parsing_mode { ParsingMode::Normal };
|
||||
|
||||
Vector<Token> m_tokens;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue