mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 14:12:52 +00:00
LibHTML: Fix incorrect CSS object model
A StyleRule has a StyleDeclaration which has many StyleProperty. :^)
This commit is contained in:
parent
ac20919b13
commit
8d797fc62e
Notes:
sideshowbarker
2024-07-19 11:52:29 +09:00
Author: https://github.com/awesomekling
Commit: 8d797fc62e
7 changed files with 26 additions and 31 deletions
|
@ -50,7 +50,7 @@ NonnullRefPtr<StyleSheet> parse_css(const String& css)
|
|||
|
||||
struct CurrentRule {
|
||||
Vector<Selector> selectors;
|
||||
NonnullRefPtrVector<StyleDeclaration> declarations;
|
||||
Vector<StyleProperty> properties;
|
||||
};
|
||||
|
||||
CurrentRule current_rule;
|
||||
|
@ -146,7 +146,7 @@ NonnullRefPtr<StyleSheet> parse_css(const String& css)
|
|||
auto property_value = String::copy(buffer);
|
||||
buffer.clear();
|
||||
consume_specific(';');
|
||||
current_rule.declarations.append(StyleDeclaration::create(property_name, parse_css_value(property_value)));
|
||||
current_rule.properties.append({ property_name, parse_css_value(property_value) });
|
||||
};
|
||||
|
||||
auto parse_declarations = [&] {
|
||||
|
@ -163,7 +163,7 @@ NonnullRefPtr<StyleSheet> parse_css(const String& css)
|
|||
consume_specific('{');
|
||||
parse_declarations();
|
||||
consume_specific('}');
|
||||
rules.append(StyleRule::create(move(current_rule.selectors), move(current_rule.declarations)));
|
||||
rules.append(StyleRule::create(move(current_rule.selectors), StyleDeclaration::create(move(current_rule.properties))));
|
||||
consume_whitespace();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue