ladybird/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.h
Sam Atkins 776b1f4548 LibWeb: Make CSS::Selector reference counted
The end goal is to make the PseudoClass::not_selector be a Selector
instead of a String that is repeatedly re-parsed. But since Selector
contains a Vector of ComplexSelectors, which each have a Vector of
SimpleSelectors, it's probably a good idea to not be passing them
around by value anyway. :^)
2021-07-14 13:31:00 +02:00

42 lines
1.4 KiB
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <AK/String.h>
#include <LibWeb/CSS/CSSStyleSheet.h>
namespace Web::CSS {
class DeprecatedParsingContext {
public:
DeprecatedParsingContext();
explicit DeprecatedParsingContext(const DOM::Document&);
explicit DeprecatedParsingContext(const DOM::ParentNode&);
bool in_quirks_mode() const;
URL complete_url(const String&) const;
private:
const DOM::Document* m_document { nullptr };
};
}
namespace Web {
RefPtr<CSS::CSSStyleSheet> parse_css(const CSS::DeprecatedParsingContext&, const StringView&);
RefPtr<CSS::CSSStyleDeclaration> parse_css_declaration(const CSS::DeprecatedParsingContext&, const StringView&);
RefPtr<CSS::StyleValue> parse_css_value(const CSS::DeprecatedParsingContext&, const StringView&, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
RefPtr<CSS::Selector> parse_selector(const CSS::DeprecatedParsingContext&, const StringView&);
RefPtr<CSS::LengthStyleValue> parse_line_width(const CSS::DeprecatedParsingContext&, const StringView&);
RefPtr<CSS::ColorStyleValue> parse_color(const CSS::DeprecatedParsingContext&, const StringView&);
RefPtr<CSS::IdentifierStyleValue> parse_line_style(const CSS::DeprecatedParsingContext&, const StringView&);
RefPtr<CSS::StyleValue> parse_html_length(const DOM::Document&, const StringView&);
}