Commit 3239828a authored by cathiechen's avatar cathiechen Committed by Commit Bot

[LayoutNG] Skip marker while FirstLetterPseudoElement find first letter

Like legacy layout, skip list marker while finding the first letter.

Bug: 725277
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I467c766f8e362f7e12b8d9c7b0251fee02e1b0a2
Reviewed-on: https://chromium-review.googlesource.com/1156111
Commit-Queue: cathie chen <cathiechen@tencent.com>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580202}
parent ffac89b5
......@@ -428,7 +428,6 @@ crbug.com/591099 fast/css/outline-narrowLine.html [ Failure ]
crbug.com/591099 fast/css/transform-inline-style-remove.html [ Failure ]
crbug.com/591099 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under.html [ Failure ]
crbug.com/591099 fast/dom/nodesFromRect/nodesFromRect-basic.html [ Failure ]
crbug.com/591099 fast/dynamic/first-letter-after-list-marker.html [ Failure ]
crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
crbug.com/591099 fast/events/wheel/mainthread-touchpad-fling-latching.html [ Pass ]
crbug.com/591099 fast/events/wheel/wheel-scroll-latching-on-scrollbar.html [ Pass ]
......
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutNGBlockFlow {HTML} at (0,0) size 800x600
LayoutNGBlockFlow {BODY} at (8,8) size 784x492
LayoutNGBlockFlow {UL} at (0,0) size 784x100
LayoutNGListItem {LI} at (40,0) size 744x100
LayoutNGListMarker (anonymous) at (-61,0) size 29x100
LayoutText (anonymous) at (0,0) size 29x100
text run at (0,0) width 29: "\x{2022} "
LayoutInline {<pseudo:first-letter>} at (0,0) size 100x100 [color=#008000]
LayoutTextFragment (anonymous) at (0,0) size 100x100
text run at (0,0) width 100: "a"
LayoutTextFragment {#text} at (0,0) size 0x0
......@@ -31,6 +31,7 @@
#include "third_party/blink/renderer/core/layout/layout_object_inlines.h"
#include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/layout/layout_text_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.h"
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"
#include "third_party/blink/renderer/platform/wtf/text/unicode.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
......@@ -113,6 +114,10 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
!parent_layout_object->BehavesLikeBlockContainer())
return nullptr;
LayoutObject* marker =
parent_layout_object->IsLayoutNGListItem()
? ToLayoutNGListItem(parent_layout_object)->Marker()
: nullptr;
// Drill down into our children and look for our first text child.
LayoutObject* first_letter_text_layout_object =
parent_layout_object->SlowFirstChild();
......@@ -139,7 +144,8 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
break;
first_letter_text_layout_object =
first_letter_text_layout_object->NextSibling();
} 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 =
first_letter_text_layout_object->NextSibling();
} else if (first_letter_text_layout_object
......@@ -170,6 +176,9 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
// setting up the first letter then.
return nullptr;
} else {
if (first_letter_text_layout_object->IsLayoutNGListItem())
marker = ToLayoutNGListItem(first_letter_text_layout_object)->Marker();
first_letter_text_layout_object =
first_letter_text_layout_object->SlowFirstChild();
}
......
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