Skip to content

Commit

Permalink
[text-autospace] Add tests for modifying TextNode
Browse files Browse the repository at this point in the history
Following up crrev.com/c/4835563, this patch adds tests for
modifying `TextNode`. In Blink, this goes to the optimized
code path to `NGInlineNode::SetTextWithOffset`.

Note these tests pass when the `text-autospace` is not
supported.

Bug: 1463890
Change-Id: I5b1c346a7671d9cfd7efcd5064376a391c6ad598
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4835849
Auto-Submit: Koji Ishii <[email protected]>
Reviewed-by: Lingqi Chi <[email protected]>
Commit-Queue: Koji Ishii <[email protected]>
Commit-Queue: Lingqi Chi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1191984}
  • Loading branch information
kojiishi authored and Lightning00Blade committed Dec 11, 2023
1 parent f249b18 commit 140d526
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<div id="target">国国AA国国AA国々</div>
11 changes: 11 additions & 0 deletions css/css-text/text-autospace/text-autospace-dynamic-text-001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-autospace-property">
<link rel="help" href="text-autospace-dynamic-text-001-ref.html">
<div id="target">国国</div>
<script>
const target_text = document.getElementById('target').firstChild;
for (const ch of 'AA国国AA国国') {
document.body.offsetTop; // Force layout.
target_text.appendData(ch);
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-autospace-property">
<link rel="help" href="text-autospace-dynamic-text-001-ref.html">
<div id="target">国国国国</div>
<script>
const target_text = document.getElementById('target').firstChild;
document.body.offsetTop; // Force layout.
target_text.insertData(2, 'AA国国AA');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-autospace-property">
<link rel="help" href="text-autospace-dynamic-text-001-ref.html">
<div id="target">国国国国国</div>
<script>
const target_text = document.getElementById('target').firstChild;
document.body.offsetTop; // Force layout.
target_text.replaceData(2, 1, 'AA国国AA');
</script>
11 changes: 11 additions & 0 deletions css/css-text/text-autospace/text-autospace-dynamic-text-004.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-autospace-property">
<link rel="help" href="text-autospace-dynamic-text-001-ref.html">
<div id="target">国国AAAA国国AAAA国国</div>
<script>
const target_text = document.getElementById('target').firstChild;
document.body.offsetTop; // Force layout.
target_text.deleteData(2, 2);
document.body.offsetTop; // Force layout.
target_text.deleteData(6, 2);
</script>

0 comments on commit 140d526

Please sign in to comment.