mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #19384 - CYBAI:fix-19177, r=emilio
Call children_changed on the parent node consistently - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #19177 - [x] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19384) <!-- Reviewable:end -->
This commit is contained in:
commit
5568c4e3d3
4 changed files with 54 additions and 10 deletions
|
@ -70,6 +70,16 @@ impl CharacterData {
|
|||
fn content_changed(&self) {
|
||||
let node = self.upcast::<Node>();
|
||||
node.dirty(NodeDamage::OtherNodeDamage);
|
||||
|
||||
// If this is a Text node, we might need to re-parse (say, if our parent
|
||||
// is a <style> element.) We don't need to if this is a Comment or
|
||||
// ProcessingInstruction.
|
||||
if self.is::<Text>() {
|
||||
if let Some(parent_node) = node.GetParentNode() {
|
||||
let mutation = ChildrenMutation::ChangeText;
|
||||
vtable_for(&parent_node).children_changed(&mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,16 +97,6 @@ impl CharacterDataMethods for CharacterData {
|
|||
self.content_changed();
|
||||
let node = self.upcast::<Node>();
|
||||
node.ranges().replace_code_units(node, 0, old_length, new_length);
|
||||
|
||||
// If this is a Text node, we might need to re-parse (say, if our parent
|
||||
// is a <style> element.) We don't need to if this is a Comment or
|
||||
// ProcessingInstruction.
|
||||
if self.is::<Text>() {
|
||||
if let Some(parent_node) = node.GetParentNode() {
|
||||
let mutation = ChildrenMutation::ChangeText;
|
||||
vtable_for(&parent_node).children_changed(&mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-length
|
||||
|
|
|
@ -154981,6 +154981,18 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/cssom/stylesheet-replacedata-dynamic.html": [
|
||||
[
|
||||
"/css/cssom/stylesheet-replacedata-dynamic.html",
|
||||
[
|
||||
[
|
||||
"/css/cssom/stylesheet-replacedata-dynamic-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/filter-effects/css-filters-animation-blur.html": [
|
||||
[
|
||||
"/css/filter-effects/css-filters-animation-blur.html",
|
||||
|
@ -253079,6 +253091,11 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/cssom/stylesheet-replacedata-dynamic-ref.html": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/cssom/stylesheet-same-origin.css": [
|
||||
[
|
||||
{}
|
||||
|
@ -511223,6 +511240,14 @@
|
|||
"875598ca4271d4adaa11fbb01981b290e6235019",
|
||||
"testharness"
|
||||
],
|
||||
"css/cssom/stylesheet-replacedata-dynamic-ref.html": [
|
||||
"e733dc40a41b899ab6c184211d75def5e52af3d4",
|
||||
"support"
|
||||
],
|
||||
"css/cssom/stylesheet-replacedata-dynamic.html": [
|
||||
"defc259c76eb8ab8b7e3c6ad90951bf4c6f18ab3",
|
||||
"reftest"
|
||||
],
|
||||
"css/cssom/stylesheet-same-origin.css": [
|
||||
"268fb9a72d33b3d18bbb82aaaac48bb15c89a88e",
|
||||
"support"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<title>(Ref #1) CSS Test Reference</title>
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@mozilla.com">
|
||||
<link rel="author" title="Cheng You Bai" href="mailto:cyb.ai.815@gmail.com">
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-characterdata-replacedata">
|
||||
<style>.pass { color: green }</style>
|
||||
<div class="pass">Should be green</div>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<title>(Test #1) CSS Test: Dynamic changes to the stylesheet contents using replaceData are reflected</title>
|
||||
<link rel="match" href="stylesheet-replacedata-dynamic-ref.html">
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@mozilla.com">
|
||||
<link rel="author" title="Cheng You Bai" href="mailto:cyb.ai.815@gmail.com">
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-characterdata-replacedata">
|
||||
<style>.fail { color: green }</style>
|
||||
<div class="pass">Should be green</div>
|
||||
<script>
|
||||
document.body.offsetTop;
|
||||
document.querySelector('style').firstChild.replaceData(1, 4, "pass");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue