mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Ensure notify_invalidations()
is always called when modifying stylesheets (#38530)
This change supplements the missing stylesheet invalidation notifications to fix some bugs that the modification of stylesheet does not take effect. Additionally, this PR add a RAII thing to mark the modification scope of stylesheet rules, which will facilitate to add extra logic before the modification happens. Fixes: there is relevant issue #38211 , but it can't be fixed by this PR. Testing: This fixes some subtests in `/css/cssom/CSSStyleSheet-constructable.html`. Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
parent
aca4bde93d
commit
8b574539d1
5 changed files with 8 additions and 11 deletions
|
@ -126,6 +126,7 @@ impl MediaListMethods<crate::DomTypeHolder> for MediaList {
|
|||
let mut guard = self.shared_lock().write();
|
||||
let media_queries = self.media_queries.write_with(&mut guard);
|
||||
*media_queries = Self::parse_media_list(&value, global.as_window());
|
||||
self.parent_stylesheet.notify_invalidations();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-medialist-length
|
||||
|
@ -171,6 +172,7 @@ impl MediaListMethods<crate::DomTypeHolder> for MediaList {
|
|||
}
|
||||
// Step 4
|
||||
mq.media_queries.push(m.unwrap());
|
||||
self.parent_stylesheet.notify_invalidations();
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/cssom/#dom-medialist-deletemedium>
|
||||
|
@ -192,5 +194,6 @@ impl MediaListMethods<crate::DomTypeHolder> for MediaList {
|
|||
.filter(|q| m_serialized != q.to_css_string())
|
||||
.collect();
|
||||
media_list.media_queries = new_vec;
|
||||
self.parent_stylesheet.notify_invalidations();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue