Skip to content

Commit

Permalink
[css-pseudo] Let ListMarker::IsMarkerImage reject non-normal markers
Browse files Browse the repository at this point in the history
ListMarker::IsMarkerImage was only checking the 'list-style-image' of
the list item. However, even if its value is an image, if the ::marker
has e.g. 'content: "foo"', then that takes precedence and the marker
won't be an image.

This patch makes it return true only if 'content' is 'normal'.

Most callers were already checking 'content' independently so there
shouldn't be much difference in practice, only in LayoutTreeAsText's
MarkerTextForListItem and AXLayoutObject's TextAlternative.

BUG=457718

Change-Id: If74ed3e847d9989b33a99de62306fd2cbc223ca6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107631
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#777319}
  • Loading branch information
Loirooriol authored and Commit Bot committed Jun 11, 2020
1 parent 31e2ab0 commit bbc8277
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 6 additions & 0 deletions third_party/blink/renderer/core/layout/list_marker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,10 @@ LayoutObject* ListMarker::SymbolMarkerLayoutText(
return marker.SlowFirstChild();
}

bool ListMarker::IsMarkerImage(const LayoutObject& marker) const {
DCHECK_EQ(Get(&marker), this);
return marker.StyleRef().ContentBehavesAsNormal() &&
ListItem(marker)->StyleRef().GeneratesMarkerImage();
}

} // namespace blink
5 changes: 1 addition & 4 deletions third_party/blink/renderer/core/layout/list_marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ class CORE_EXPORT ListMarker {
// Marker text with suffix, e.g. "1. ", for use in accessibility.
String TextAlternative(const LayoutObject&) const;

bool IsMarkerImage(const LayoutObject& marker) const {
DCHECK_EQ(Get(&marker), this);
return ListItem(marker)->StyleRef().GeneratesMarkerImage();
}
bool IsMarkerImage(const LayoutObject&) const;

void UpdateMarkerTextIfNeeded(LayoutObject& marker) {
DCHECK_EQ(Get(&marker), this);
Expand Down

0 comments on commit bbc8277

Please sign in to comment.