mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
LibWeb: Move CSS ParsingContext to its own header
The implementation is already its own file, so having the class defined in Parser.h feels weird.
This commit is contained in:
parent
f176e04323
commit
c40e441894
2 changed files with 40 additions and 24 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
|
#include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
|
||||||
#include <LibWeb/CSS/Parser/Dimension.h>
|
#include <LibWeb/CSS/Parser/Dimension.h>
|
||||||
#include <LibWeb/CSS/Parser/Function.h>
|
#include <LibWeb/CSS/Parser/Function.h>
|
||||||
|
#include <LibWeb/CSS/Parser/ParsingContext.h>
|
||||||
#include <LibWeb/CSS/Parser/Rule.h>
|
#include <LibWeb/CSS/Parser/Rule.h>
|
||||||
#include <LibWeb/CSS/Parser/TokenStream.h>
|
#include <LibWeb/CSS/Parser/TokenStream.h>
|
||||||
#include <LibWeb/CSS/Parser/Tokenizer.h>
|
#include <LibWeb/CSS/Parser/Tokenizer.h>
|
||||||
|
@ -36,30 +37,6 @@
|
||||||
|
|
||||||
namespace Web::CSS::Parser {
|
namespace Web::CSS::Parser {
|
||||||
|
|
||||||
class ParsingContext {
|
|
||||||
public:
|
|
||||||
explicit ParsingContext(JS::Realm&);
|
|
||||||
explicit ParsingContext(DOM::Document const&);
|
|
||||||
explicit ParsingContext(DOM::Document const&, AK::URL);
|
|
||||||
explicit ParsingContext(DOM::ParentNode&);
|
|
||||||
|
|
||||||
bool in_quirks_mode() const;
|
|
||||||
DOM::Document const* document() const { return m_document; }
|
|
||||||
HTML::Window const* window() const;
|
|
||||||
AK::URL complete_url(StringView) const;
|
|
||||||
|
|
||||||
PropertyID current_property_id() const { return m_current_property_id; }
|
|
||||||
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
|
||||||
|
|
||||||
JS::Realm& realm() const { return m_realm; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
JS::NonnullGCPtr<JS::Realm> m_realm;
|
|
||||||
JS::GCPtr<DOM::Document const> m_document;
|
|
||||||
PropertyID m_current_property_id { PropertyID::Invalid };
|
|
||||||
AK::URL m_url;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Parser {
|
class Parser {
|
||||||
public:
|
public:
|
||||||
static ErrorOr<Parser> create(ParsingContext const&, StringView input, StringView encoding = "utf-8"sv);
|
static ErrorOr<Parser> create(ParsingContext const&, StringView input, StringView encoding = "utf-8"sv);
|
||||||
|
|
39
Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.h
Normal file
39
Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/DOM/Document.h>
|
||||||
|
|
||||||
|
namespace Web::CSS::Parser {
|
||||||
|
|
||||||
|
class ParsingContext {
|
||||||
|
public:
|
||||||
|
explicit ParsingContext(JS::Realm&);
|
||||||
|
explicit ParsingContext(DOM::Document const&);
|
||||||
|
explicit ParsingContext(DOM::Document const&, AK::URL);
|
||||||
|
explicit ParsingContext(DOM::ParentNode&);
|
||||||
|
|
||||||
|
bool in_quirks_mode() const;
|
||||||
|
DOM::Document const* document() const { return m_document; }
|
||||||
|
HTML::Window const* window() const;
|
||||||
|
AK::URL complete_url(StringView) const;
|
||||||
|
|
||||||
|
PropertyID current_property_id() const { return m_current_property_id; }
|
||||||
|
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
||||||
|
|
||||||
|
JS::Realm& realm() const { return m_realm; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
JS::NonnullGCPtr<JS::Realm> m_realm;
|
||||||
|
JS::GCPtr<DOM::Document const> m_document;
|
||||||
|
PropertyID m_current_property_id { PropertyID::Invalid };
|
||||||
|
AK::URL m_url;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue