mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibWeb: Switch to new CSS Parser :^)
Change all the places that were including the deprecated parser, to include the new one instead, and then delete the old parser code. `ParentNode::query_selector[_all]()` now treat their input as a comma-separated list of selectors, instead of just one, and return elements that match any of the selectors in that list. This is according to these specs: - querySelector/querySelectorAll: https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselector%E2%91%A0 - selector matching algorithm: https://www.w3.org/TR/selectors-4/#match-against-tree
This commit is contained in:
parent
4065eb169c
commit
3bd14941c7
13 changed files with 37 additions and 2074 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibWeb/CSS/Parser/DeprecatedCSSParser.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/Loader/CSSLoader.h>
|
||||
|
@ -21,7 +21,7 @@ CSSLoader::CSSLoader(DOM::Element& owner_element)
|
|||
|
||||
void CSSLoader::load_from_text(const String& text)
|
||||
{
|
||||
m_style_sheet = parse_css(CSS::DeprecatedParsingContext(m_owner_element.document()), text);
|
||||
m_style_sheet = parse_css(CSS::ParsingContext(m_owner_element.document()), text);
|
||||
if (!m_style_sheet) {
|
||||
m_style_sheet = CSS::CSSStyleSheet::create({});
|
||||
m_style_sheet->set_owner_node(&m_owner_element);
|
||||
|
@ -49,7 +49,7 @@ void CSSLoader::resource_did_load()
|
|||
dbgln_if(CSS_LOADER_DEBUG, "CSSLoader: Resource did load, has encoded data. URL: {}", resource()->url());
|
||||
}
|
||||
|
||||
auto sheet = parse_css(CSS::DeprecatedParsingContext(m_owner_element.document()), resource()->encoded_data());
|
||||
auto sheet = parse_css(CSS::ParsingContext(m_owner_element.document()), resource()->encoded_data());
|
||||
if (!sheet) {
|
||||
dbgln_if(CSS_LOADER_DEBUG, "CSSLoader: Failed to parse stylesheet: {}", resource()->url());
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue