Commit 7f96fda6 authored by Oriol Brufau's avatar Oriol Brufau Committed by Commit Bot

[css-pseudo] Include inside markers in FindSymbolMarkerLayoutText

LayoutNGListItem::FindSymbolMarkerLayoutText is supposed to return the
LayoutObject* of the symbol text inside a ::marker.

This was working fine if the parameter was a list item, the method just
retrieved the marker of that list item (whether outside or inside) and
then relied on ListMarker::SymbolMarkerLayoutText.

It was also working fine for outside markers by a combination of
ToLayoutNGListMarker and ListMarker::SymbolMarkerLayoutText.

However, it was returning nullptr for inside markers. It doesn't seem
this was causing any issues, but this patch makes the method behave
properly. The code is also simpler this way.

This patch also removes LayoutNGListItem::SymbolMarkerLayoutText since
it had no other caller.

BUG=457718

Change-Id: I57dea247e0f8a638c251eff6d71788a5465d74b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2022946Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#735784}
parent fa583a88
......@@ -4,7 +4,7 @@
#include "third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.h"
#include "third_party/blink/renderer/core/layout/ng/list/layout_ng_list_marker.h"
#include "third_party/blink/renderer/core/layout/ng/list/list_marker.h"
namespace blink {
......@@ -112,26 +112,21 @@ int LayoutNGListItem::Value() const {
return ordinal_.Value(*GetNode());
}
LayoutObject* LayoutNGListItem::SymbolMarkerLayoutText() const {
LayoutObject* marker = Marker();
if (ListMarker* list_marker = ListMarker::Get(marker))
return list_marker->SymbolMarkerLayoutText(*marker);
return nullptr;
}
const LayoutObject* LayoutNGListItem::FindSymbolMarkerLayoutText(
const LayoutObject* object) {
if (!object)
return nullptr;
if (object->IsLayoutNGListItem())
return ToLayoutNGListItem(object)->SymbolMarkerLayoutText();
if (object->IsLayoutNGListMarker()) {
return ToLayoutNGListMarker(object)->Marker().SymbolMarkerLayoutText(
*object);
if (object->IsLayoutNGListItem()) {
const LayoutObject* marker = ToLayoutNGListItem(object)->Marker();
if (const ListMarker* list_marker = ListMarker::Get(marker))
return list_marker->SymbolMarkerLayoutText(*marker);
return nullptr;
}
if (const ListMarker* list_marker = ListMarker::Get(object))
return list_marker->SymbolMarkerLayoutText(*object);
if (object->IsAnonymousBlock())
return FindSymbolMarkerLayoutText(object->Parent());
......
......@@ -33,7 +33,6 @@ class CORE_EXPORT LayoutNGListItem final : public LayoutNGBlockFlow {
void OrdinalValueChanged();
void WillCollectInlines() override;
LayoutObject* SymbolMarkerLayoutText() const;
static const LayoutObject* FindSymbolMarkerLayoutText(const LayoutObject*);
// Find the LayoutNGListItem from a marker.
......
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