aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlstyleelement.rs
diff options
context:
space:
mode:
authorJonathan Chan <jyc@eqv.io>2017-06-07 10:22:49 -0700
committerJonathan Chan <jyc@eqv.io>2017-06-22 15:51:59 -0700
commit80dee7a65f8b4b7d1d93c92e4641c70633734803 (patch)
tree7ff320035556a5db6e251545e1382a8b568e993d /components/script/dom/htmlstyleelement.rs
parentb9d66df2f5d23ea85fbfb19e3cbc7ec88259390f (diff)
downloadservo-80dee7a65f8b4b7d1d93c92e4641c70633734803.tar.gz
servo-80dee7a65f8b4b7d1d93c92e4641c70633734803.zip
Force HTMLStyleElement to create a new CSSStyleSheet when re-parsing.
We already call Document::invalidate_style_sheets and set the stylesheet member to a new Stylesheet. This matches the behavior of Firefox, and means the new CSSStyleSheet you get from accessing .sheet from JS will be correct instead of stale. (::get_cssom_stylesheet already tries to use the new Stylesheet, but MutNullableJS::or_init is called, so if we already created a CSSStyleSheet we will continue to return that one).
Diffstat (limited to 'components/script/dom/htmlstyleelement.rs')
-rw-r--r--components/script/dom/htmlstyleelement.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index bf4266e1875..bbce33f3d52 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -111,6 +111,7 @@ impl HTMLStyleElement {
win.layout_chan().send(Msg::AddStylesheet(sheet.clone())).unwrap();
*self.stylesheet.borrow_mut() = Some(sheet);
+ self.cssom_stylesheet.set(None);
doc.invalidate_stylesheets();
}