Commit fb5eeb3d authored by cathiechen's avatar cathiechen Committed by Commit Bot

[LayoutNG] Paint symbol marker correctly when marker inside an anonymous block

The inside marker could be a child of anonymous block not LI. When we are
finding symbol marker if meet anonymous block we should check its parent.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I8127ff9d38b351f97171f7a0cc8c8c3fdd896e6c
Reviewed-on: https://chromium-review.googlesource.com/1102296
Commit-Queue: cathie chen <cathiechen@tencent.com>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568790}
parent 5a7f9ab3
......@@ -535,7 +535,6 @@ crbug.com/591099 fast/lists/003-vertical.html [ Failure ]
crbug.com/591099 fast/lists/003.html [ Failure ]
crbug.com/591099 fast/lists/004.html [ Failure ]
crbug.com/591099 fast/lists/009-vertical.html [ Failure ]
crbug.com/591099 fast/lists/inline-before-content-after-list-marker.html [ Failure ]
crbug.com/591099 fast/lists/list-item-line-height.html [ Failure ]
crbug.com/591099 fast/lists/marker-before-empty-inline.html [ Failure ]
crbug.com/591099 fast/masking/clip-path-selection.html [ Failure ]
......
......@@ -70,13 +70,8 @@ void CollectInlinesInternal(
builder->EnterBlock(block->Style());
LayoutObject* node = GetLayoutObjectForFirstChildNode(block);
LayoutObject* symbol = nullptr;
if (block->IsLayoutNGListMarker()) {
symbol = ToLayoutNGListMarker(block)->SymbolMarkerLayoutText();
} else if (block->IsLayoutNGListItem()) {
symbol = ToLayoutNGListItem(block)->SymbolMarkerLayoutText();
}
const LayoutObject* symbol =
LayoutNGListItem::FindSymbolMarkerLayoutText(block);
while (node) {
if (node->IsText()) {
LayoutText* layout_text = ToLayoutText(node);
......
......@@ -66,8 +66,8 @@ void LayoutNGListItem::SubtreeDidChange() {
if (!marker_)
return;
// Make sure marker is the direct child of ListItem.
if (marker_->Parent() && marker_->Parent() != this) {
// Make sure outside marker is the direct child of ListItem.
if (!IsInside() && marker_->Parent() != this) {
marker_->Remove();
AddChild(marker_, FirstChild());
}
......@@ -302,4 +302,21 @@ LayoutObject* LayoutNGListItem::SymbolMarkerLayoutText() const {
return marker_->SlowFirstChild();
}
const LayoutObject* LayoutNGListItem::FindSymbolMarkerLayoutText(
const LayoutObject* object) {
if (!object)
return nullptr;
if (object->IsLayoutNGListItem())
return ToLayoutNGListItem(object)->SymbolMarkerLayoutText();
if (object->IsLayoutNGListMarker())
return ToLayoutNGListMarker(object)->SymbolMarkerLayoutText();
if (object->IsAnonymousBlock())
return FindSymbolMarkerLayoutText(object->Parent());
return nullptr;
}
} // namespace blink
......@@ -37,6 +37,7 @@ class CORE_EXPORT LayoutNGListItem final : public LayoutNGBlockFlow {
void WillCollectInlines() override;
LayoutObject* SymbolMarkerLayoutText() const;
static const LayoutObject* FindSymbolMarkerLayoutText(const LayoutObject*);
const char* GetName() const override { return "LayoutNGListItem"; }
......
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