Commit 88e2bfbb authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Fix an edge case in FirstLetterPseudoElement::FirstLetterTextLayoutObject

FirstLetterPseudoElement::FirstLetterTextLayoutObject finds the
remaining text layout object by traversing in the subtree of the
block container and inspects the layout objects one by one.

There is one case where the code fails to move past the list marker
layout object when the list marker is wrapped in an anonymous block
flow, which is fixed by this patch.

Bug: 947422
Change-Id: I427ee77ae43be8464bddd9120b5c50f3c1dd84be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1548381
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646667}
parent a582e393
...@@ -148,7 +148,8 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject( ...@@ -148,7 +148,8 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
} else if (first_letter_text_layout_object->IsListMarker() || } else if (first_letter_text_layout_object->IsListMarker() ||
first_letter_text_layout_object == marker) { first_letter_text_layout_object == marker) {
first_letter_text_layout_object = first_letter_text_layout_object =
first_letter_text_layout_object->NextSibling(); first_letter_text_layout_object->NextInPreOrderAfterChildren(
parent_layout_object);
} else if (first_letter_text_layout_object } else if (first_letter_text_layout_object
->IsFloatingOrOutOfFlowPositioned()) { ->IsFloatingOrOutOfFlowPositioned()) {
if (first_letter_text_layout_object->Style()->StyleType() == if (first_letter_text_layout_object->Style()->StyleType() ==
......
...@@ -47,4 +47,14 @@ TEST_P(ElementInnerTest, SVGElementAsTableRow) { ...@@ -47,4 +47,14 @@ TEST_P(ElementInnerTest, SVGElementAsTableRow) {
EXPECT_EQ("abc", target.innerText()); EXPECT_EQ("abc", target.innerText());
} }
// https://crbug.com/947422
TEST_P(ElementInnerTest, OverflowingListItemWithFloatFirstLetter) {
InsertStyleElement(
"div { display: list-item; overflow: hidden; }"
"div::first-letter { float: right; }");
SetBodyContent("<div id=target>foo</div>");
Element& target = *GetDocument().getElementById("target");
EXPECT_EQ("foo", target.innerText());
}
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment