mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
LibWeb: Move UnresolvedStyleValue resolution into the CSS Parser
Resolving typed `attr()` functions is going to involve using more internal Parser methods, so this is the simplest solution for that. Also... resolving these is basically parsing them, so it makes more sense for that process to live here. This is just moving code, with minimal changes so it still works.
This commit is contained in:
parent
cab8b3e180
commit
7d10484660
Notes:
sideshowbarker
2024-07-16 23:08:48 +09:00
Author: https://github.com/AtkinsSJ
Commit: 7d10484660
Pull-request: https://github.com/SerenityOS/serenity/pull/20945
Reviewed-by: https://github.com/shannonbooth
4 changed files with 287 additions and 308 deletions
|
@ -14,8 +14,6 @@
|
|||
#include <LibWeb/CSS/CSSFontFaceRule.h>
|
||||
#include <LibWeb/CSS/CSSKeyframesRule.h>
|
||||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
||||
#include <LibWeb/CSS/Parser/ComponentValue.h>
|
||||
#include <LibWeb/CSS/Parser/TokenStream.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/FontCache.h>
|
||||
|
@ -33,24 +31,6 @@ struct MatchingRule {
|
|||
bool contains_pseudo_element { false };
|
||||
};
|
||||
|
||||
class PropertyDependencyNode : public RefCounted<PropertyDependencyNode> {
|
||||
public:
|
||||
static NonnullRefPtr<PropertyDependencyNode> create(String name)
|
||||
{
|
||||
return adopt_ref(*new PropertyDependencyNode(move(name)));
|
||||
}
|
||||
|
||||
void add_child(NonnullRefPtr<PropertyDependencyNode>);
|
||||
bool has_cycles();
|
||||
|
||||
private:
|
||||
explicit PropertyDependencyNode(String name);
|
||||
|
||||
String m_name;
|
||||
Vector<NonnullRefPtr<PropertyDependencyNode>> m_children;
|
||||
bool m_marked { false };
|
||||
};
|
||||
|
||||
struct FontFaceKey {
|
||||
FlyString family_name;
|
||||
int weight { 0 };
|
||||
|
@ -153,10 +133,6 @@ private:
|
|||
|
||||
void compute_defaulted_property_value(StyleProperties&, DOM::Element const*, CSS::PropertyID, Optional<CSS::Selector::PseudoElement>) const;
|
||||
|
||||
NonnullRefPtr<StyleValue> resolve_unresolved_style_value(DOM::Element&, Optional<CSS::Selector::PseudoElement>, PropertyID, UnresolvedStyleValue const&) const;
|
||||
bool expand_variables(DOM::Element&, Optional<CSS::Selector::PseudoElement>, StringView property_name, HashMap<FlyString, NonnullRefPtr<PropertyDependencyNode>>& dependencies, Parser::TokenStream<Parser::ComponentValue>& source, Vector<Parser::ComponentValue>& dest) const;
|
||||
bool expand_unresolved_values(DOM::Element&, StringView property_name, Parser::TokenStream<Parser::ComponentValue>& source, Vector<Parser::ComponentValue>& dest) const;
|
||||
|
||||
void set_all_properties(DOM::Element&, Optional<CSS::Selector::PseudoElement>, StyleProperties&, StyleValue const&, DOM::Document&, CSS::CSSStyleDeclaration const*, StyleProperties::PropertyValues const& properties_for_revert) const;
|
||||
|
||||
template<typename Callback>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue