mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
script: Mark the entire shadow tree for restyle when its stylesheet is invalidated (#38529)
This change fix this bugs: modify stylesheet of shadow tree does not take effect if there is no other Dom change within the shadow tree happens. Fixes: This change fix some bugs reported by this issue #38211. Testing: This fixes some subtests in `/css/cssom/CSSStyleSheet-constructable.html` and `/css/cssom/CSSStyleSheet-constructable-disallow-import.tentative.html`, and make some subtest failed in `/css/cssom/CSSStyleSheet-constructable-baseURL.html`, because the `BaseUrl` is not yet supported for `CSSStylesheet`. Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
parent
5c885d61ad
commit
ce16fbce75
4 changed files with 12 additions and 9 deletions
|
@ -14,6 +14,7 @@ use script_bindings::script_runtime::JSContext;
|
|||
use servo_arc::Arc;
|
||||
use style::author_styles::AuthorStyles;
|
||||
use style::dom::TElement;
|
||||
use style::invalidation::element::restyle_hints::RestyleHint;
|
||||
use style::shared_lock::SharedRwLockReadGuard;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use style::stylist::{CascadeData, Stylist};
|
||||
|
@ -270,6 +271,11 @@ impl ShadowRoot {
|
|||
// Mark the host element dirty so a reflow will be performed.
|
||||
if let Some(host) = self.host.get() {
|
||||
host.upcast::<Node>().dirty(NodeDamage::Style);
|
||||
|
||||
// Also mark the host element with `RestyleHint::restyle_subtree` so a reflow
|
||||
// can traverse into the shadow tree.
|
||||
let mut restyle = self.document.ensure_pending_restyle(&host);
|
||||
restyle.hint.insert(RestyleHint::restyle_subtree());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue