mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibWeb: Streamline how inline CSS style declarations are constructed
When parsing the "style" attribute on elements, we'd previously ask the CSS parser for a PropertyOwningCSSStyleDeclaration. Then we'd create a new ElementCSSInlineStyleDeclaration and transfer the properties from the first object to the second object. This patch teaches the parser to make ElementCSSInlineStyleDeclaration objects directly.
This commit is contained in:
parent
3efa6cedec
commit
427beb97b5
5 changed files with 34 additions and 36 deletions
|
@ -105,7 +105,7 @@ public:
|
|||
Vector<StyleComponentValueRule> parse_as_list_of_component_values();
|
||||
Vector<Vector<StyleComponentValueRule>> parse_as_comma_separated_list_of_component_values();
|
||||
|
||||
RefPtr<PropertyOwningCSSStyleDeclaration> parse_as_style_attribute();
|
||||
RefPtr<ElementInlineCSSStyleDeclaration> parse_as_style_attribute(DOM::Element&);
|
||||
|
||||
enum class SelectorParsingMode {
|
||||
Standard,
|
||||
|
@ -343,6 +343,13 @@ private:
|
|||
static bool has_ignored_vendor_prefix(StringView);
|
||||
static bool is_builtin(StringView);
|
||||
|
||||
struct PropertiesAndCustomProperties {
|
||||
Vector<StyleProperty> properties;
|
||||
HashMap<String, StyleProperty> custom_properties;
|
||||
};
|
||||
|
||||
PropertiesAndCustomProperties extract_properties(Vector<DeclarationOrAtRule> const&);
|
||||
|
||||
ParsingContext m_context;
|
||||
|
||||
Tokenizer m_tokenizer;
|
||||
|
@ -355,7 +362,7 @@ private:
|
|||
namespace Web {
|
||||
|
||||
RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const&, StringView);
|
||||
RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_style_attribute(CSS::ParsingContext const&, StringView);
|
||||
RefPtr<CSS::ElementInlineCSSStyleDeclaration> parse_css_style_attribute(CSS::ParsingContext const&, StringView, DOM::Element&);
|
||||
RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
|
||||
Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const&, StringView);
|
||||
RefPtr<CSS::CSSRule> parse_css_rule(CSS::ParsingContext const&, StringView);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue