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 ] ...@@ -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/003.html [ Failure ]
crbug.com/591099 fast/lists/004.html [ Failure ] crbug.com/591099 fast/lists/004.html [ Failure ]
crbug.com/591099 fast/lists/009-vertical.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/list-item-line-height.html [ Failure ]
crbug.com/591099 fast/lists/marker-before-empty-inline.html [ Failure ] crbug.com/591099 fast/lists/marker-before-empty-inline.html [ Failure ]
crbug.com/591099 fast/masking/clip-path-selection.html [ Failure ] crbug.com/591099 fast/masking/clip-path-selection.html [ Failure ]
......
...@@ -70,13 +70,8 @@ void CollectInlinesInternal( ...@@ -70,13 +70,8 @@ void CollectInlinesInternal(
builder->EnterBlock(block->Style()); builder->EnterBlock(block->Style());
LayoutObject* node = GetLayoutObjectForFirstChildNode(block); LayoutObject* node = GetLayoutObjectForFirstChildNode(block);
LayoutObject* symbol = nullptr; const LayoutObject* symbol =
if (block->IsLayoutNGListMarker()) { LayoutNGListItem::FindSymbolMarkerLayoutText(block);
symbol = ToLayoutNGListMarker(block)->SymbolMarkerLayoutText();
} else if (block->IsLayoutNGListItem()) {
symbol = ToLayoutNGListItem(block)->SymbolMarkerLayoutText();
}
while (node) { while (node) {
if (node->IsText()) { if (node->IsText()) {
LayoutText* layout_text = ToLayoutText(node); LayoutText* layout_text = ToLayoutText(node);
......
...@@ -66,8 +66,8 @@ void LayoutNGListItem::SubtreeDidChange() { ...@@ -66,8 +66,8 @@ void LayoutNGListItem::SubtreeDidChange() {
if (!marker_) if (!marker_)
return; return;
// Make sure marker is the direct child of ListItem. // Make sure outside marker is the direct child of ListItem.
if (marker_->Parent() && marker_->Parent() != this) { if (!IsInside() && marker_->Parent() != this) {
marker_->Remove(); marker_->Remove();
AddChild(marker_, FirstChild()); AddChild(marker_, FirstChild());
} }
...@@ -302,4 +302,21 @@ LayoutObject* LayoutNGListItem::SymbolMarkerLayoutText() const { ...@@ -302,4 +302,21 @@ LayoutObject* LayoutNGListItem::SymbolMarkerLayoutText() const {
return marker_->SlowFirstChild(); 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 } // namespace blink
...@@ -37,6 +37,7 @@ class CORE_EXPORT LayoutNGListItem final : public LayoutNGBlockFlow { ...@@ -37,6 +37,7 @@ class CORE_EXPORT LayoutNGListItem final : public LayoutNGBlockFlow {
void WillCollectInlines() override; void WillCollectInlines() override;
LayoutObject* SymbolMarkerLayoutText() const; LayoutObject* SymbolMarkerLayoutText() const;
static const LayoutObject* FindSymbolMarkerLayoutText(const LayoutObject*);
const char* GetName() const override { return "LayoutNGListItem"; } 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