mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
LibWeb: Apply shadow root style sheets in StyleComputer
Now, if an element belongs to a shadow tree, we use only the style sheets from the corresponding shadow root during style computation, instead of using all available style sheets as was the case previously. The only exception is the user agent style sheets, which are still taken into account for all elements. Tests/LibWeb/Layout/input/input-element-with-display-inline.html is affected because style of document no longer affects shadow tree of input element, like it is supposed to be. Co-authored-by: Simon Wanner <simon+git@skyrising.xyz>
This commit is contained in:
parent
91ec1d6f95
commit
33294aea86
7 changed files with 99 additions and 27 deletions
|
@ -20,7 +20,18 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
// https://www.w3.org/TR/css-cascade/#origin
|
||||
enum class CascadeOrigin {
|
||||
Author,
|
||||
User,
|
||||
UserAgent,
|
||||
Animation,
|
||||
Transition,
|
||||
};
|
||||
|
||||
struct MatchingRule {
|
||||
CascadeOrigin cascade_origin;
|
||||
JS::GCPtr<DOM::ShadowRoot const> shadow_root;
|
||||
JS::GCPtr<CSSStyleRule const> rule;
|
||||
JS::GCPtr<CSSStyleSheet const> sheet;
|
||||
size_t style_sheet_index { 0 };
|
||||
|
@ -55,15 +66,6 @@ public:
|
|||
NonnullRefPtr<StyleProperties> compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> = {}) const;
|
||||
RefPtr<StyleProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
|
||||
// https://www.w3.org/TR/css-cascade/#origin
|
||||
enum class CascadeOrigin {
|
||||
Author,
|
||||
User,
|
||||
UserAgent,
|
||||
Animation,
|
||||
Transition,
|
||||
};
|
||||
|
||||
Vector<MatchingRule> collect_matching_rules(DOM::Element const&, CascadeOrigin, Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
|
||||
void invalidate_rule_cache();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue