From 73c5a11c8cece4fd36f27969a64646517d5e67ab Mon Sep 17 00:00:00 2001 From: Rune Lillesveen Date: Fri, 19 Jul 2019 12:40:04 +0000 Subject: [PATCH] Bug 1561130 [wpt PR 17447] - Handle null ::first-letter text layout object., a=testonly Automatic update from web-platform-tests Handle null ::first-letter text layout object. Ideally, UpdateFirstLetterPseudoElement() will remove the ::first-letter pseudo element from the DOM when there is no text which can contain the first letter. Hence, we should not end up in a situation where we try to AttachLayoutTree for the FirstLetterPseudoElement with a null first_letter_text. However, the layout tree is different in AttachLayoutTree() than in UpdateFirstLetterPseudoElement() in the case where there already was a ::first-letter pseudo element, since we detached it right before AttachLayoutTree. This means we may have different results for FirstLetterTextLayoutObject() at those two points if the method has bugs. Such a bug was found here where a list item marker inside an anonymous block had an out-of-flow sibling, but we were not able to traverse out of the anonymous block to find the first letter text. Add a DCHECK to let us trigger cases where FirstLetterTextLayoutObject() is buggy, but also add if-tests to make sure we don't crash. Bug: 977044 Change-Id: Id80f8aad5c04678d64927e7a7ca4d60cdb6a4b8e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672845 Reviewed-by: Morten Stenshorne Commit-Queue: Rune Lillesveen Cr-Commit-Position: refs/heads/master@{#671629} -- wpt-commits: 53ebe42e282c9cd4c49d8e615b30eee06c2211a0 wpt-pr: 17447 --- ...irst-letter-list-item-dynamic-001-ref.html | 4 ++++ .../first-letter-list-item-dynamic-001.html | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001-ref.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001.html diff --git a/testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001-ref.html b/testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001-ref.html new file mode 100644 index 000000000000..26d50ade6259 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001-ref.html @@ -0,0 +1,4 @@ + +CSS Test Reference +

The X below should be green.

+
X
diff --git a/testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001.html b/testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001.html new file mode 100644 index 000000000000..f990cd2bb716 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-letter-list-item-dynamic-001.html @@ -0,0 +1,24 @@ + +CSS Test: Move ::first-letter text node (required: list item, float, fixed, contenteditable). + + + + +

The X below should be green.

+
X
+