diff --git a/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp b/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp index 97f8d454cf8..3831508ceab 100644 --- a/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp +++ b/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp @@ -47,14 +47,6 @@ ParsingContext::ParsingContext(DOM::Document const& document, Mode mode) { } -ParsingContext::ParsingContext(DOM::ParentNode& parent_node, Mode mode) - : m_realm(parent_node.realm()) - , m_document(&parent_node.document()) - , m_url(parent_node.document().url()) - , m_mode(mode) -{ -} - bool ParsingContext::in_quirks_mode() const { return m_document ? m_document->in_quirks_mode() : false; diff --git a/Libraries/LibWeb/CSS/Parser/ParsingContext.h b/Libraries/LibWeb/CSS/Parser/ParsingContext.h index 131f37d86fe..9923825f082 100644 --- a/Libraries/LibWeb/CSS/Parser/ParsingContext.h +++ b/Libraries/LibWeb/CSS/Parser/ParsingContext.h @@ -24,7 +24,6 @@ public: explicit ParsingContext(JS::Realm&, URL::URL, Mode = Mode::Normal); explicit ParsingContext(DOM::Document const&, Mode = Mode::Normal); explicit ParsingContext(DOM::Document const&, URL::URL, Mode = Mode::Normal); - explicit ParsingContext(DOM::ParentNode&, Mode = Mode::Normal); Mode mode() const { return m_mode; } bool is_parsing_svg_presentation_attribute() const { return m_mode == Mode::SVGPresentationAttribute; } diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index d85ada15443..5e85ef52654 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -744,7 +744,7 @@ GC::Ptr Element::shadow_root_for_bindings() const WebIDL::ExceptionOr Element::matches(StringView selectors) const { // 1. Let s be the result of parse a selector from selectors. - auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(static_cast(const_cast(*this))), selectors); + auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(document()), selectors); // 2. If s is failure, then throw a "SyntaxError" DOMException. if (!maybe_selectors.has_value()) @@ -764,7 +764,7 @@ WebIDL::ExceptionOr Element::matches(StringView selectors) const WebIDL::ExceptionOr Element::closest(StringView selectors) const { // 1. Let s be the result of parse a selector from selectors. - auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(static_cast(const_cast(*this))), selectors); + auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext(document()), selectors); // 2. If s is failure, then throw a "SyntaxError" DOMException. if (!maybe_selectors.has_value()) diff --git a/Libraries/LibWeb/DOM/ParentNode.cpp b/Libraries/LibWeb/DOM/ParentNode.cpp index ef5392d9b2e..250c652d52c 100644 --- a/Libraries/LibWeb/DOM/ParentNode.cpp +++ b/Libraries/LibWeb/DOM/ParentNode.cpp @@ -52,7 +52,7 @@ static WebIDL::ExceptionOr, GC::Ref>> scope_m { // To scope-match a selectors string selectors against a node, run these steps: // 1. Let s be the result of parse a selector selectors. - auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext { node }, selector_text); + auto maybe_selectors = parse_selector(CSS::Parser::ParsingContext { node.document() }, selector_text); // 2. If s is failure, then throw a "SyntaxError" DOMException. if (!maybe_selectors.has_value())