Missing text node reattach for first-letter changes

Sometimes we have LayoutText which does not contain anything considered
to be a rendered first letter. For instance, if it only contains
punctuation. Modifying the character data to something which constitutes
a first letter will require a layout object reattach to correctly
(re-)construct the LayoutTextFragment for the rendered ::first-letter.

Bug: 1229931, 1214543
Change-Id: I5befff0d89b207321a1357076d823d1274dae6d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3067348
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#907918}
diff --git a/css/css-pseudo/first-letter-punctuation-dynamic-ref.html b/css/css-pseudo/first-letter-punctuation-dynamic-ref.html
new file mode 100644
index 0000000..c02b8bf
--- /dev/null
+++ b/css/css-pseudo/first-letter-punctuation-dynamic-ref.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test Reference</title>
+<p>Only the 'A' below should be green.</p>
+<span style="color:green">A</span> .B
diff --git a/css/css-pseudo/first-letter-punctuation-dynamic.html b/css/css-pseudo/first-letter-punctuation-dynamic.html
new file mode 100644
index 0000000..0a72956
--- /dev/null
+++ b/css/css-pseudo/first-letter-punctuation-dynamic.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Pseudo-Elements Test: ::first-letter modified text node with punctuation</title>
+<link rel="help" href="https://drafts.csswg.org/css-pseudo/#first-letter-pseudo">
+<link rel="match" href="first-letter-punctuation-dynamic-ref.html">
+<style>
+  #target::first-letter { color: green; }
+</style>
+<p>Only the 'A' below should be green.</p>
+<div id="target"> .<span>B</span></div>
+<script>
+  target.offsetTop;
+  target.firstChild.insertData(0, 'A');
+</script>