Commit 11053573 authored by prashant.n's avatar prashant.n Committed by Commit Bot

Add a separate element role for list item markers.

Having separate role |kListSymbol| for list item markers will help
classify list symbols separately against being considered as text.
This patch uses text color classifier only as of now and can be
changed if needed.

Bug: 1030457
Change-Id: I82a1bbe1842bee4e79214c99eec3ed914086dbaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108416Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Prashant Nevase <prashant.n@samsung.com>
Cr-Commit-Position: refs/heads/master@{#754060}
parent 84fba7cb
......@@ -25,8 +25,8 @@ void ListMarkerPainter::PaintSymbol(const PaintInfo& paint_info,
const IntRect& marker) {
DCHECK(object);
GraphicsContext& context = paint_info.context;
ScopedDarkModeElementRoleOverride ensure_inverted_like_text(
&context, DarkModeFilter::ElementRole::kText);
ScopedDarkModeElementRoleOverride list_symbol(
&context, DarkModeFilter::ElementRole::kListSymbol);
Color color(object->ResolveColor(GetCSSPropertyColor()));
if (BoxModelObjectPainter::ShouldForceWhiteBackgroundForPrintEconomy(
object->GetDocument(), style))
......
......@@ -187,6 +187,13 @@ bool DarkModeFilter::ShouldApplyToColor(const Color& color, ElementRole role) {
DCHECK(text_classifier_);
return text_classifier_->ShouldInvertColor(color) ==
DarkModeClassification::kApplyFilter;
case ElementRole::kListSymbol:
// TODO(prashant.n): Rename text_classifier_ to foreground_classifier_,
// so that same classifier can be used for all roles which are supposed
// to be at foreground.
DCHECK(text_classifier_);
return text_classifier_->ShouldInvertColor(color) ==
DarkModeClassification::kApplyFilter;
case ElementRole::kBackground:
DCHECK(background_classifier_);
return background_classifier_->ShouldInvertColor(color) ==
......
......@@ -38,7 +38,7 @@ class PLATFORM_EXPORT DarkModeFilter {
// TODO(gilmanmh): Add a role for shadows. In general, we don't want to
// invert shadows, but we may need to do some other kind of processing for
// them.
enum class ElementRole { kText, kBackground, kSVG };
enum class ElementRole { kText, kListSymbol, kBackground, kSVG };
Color InvertColorIfNeeded(const Color& color, ElementRole element_role);
base::Optional<cc::PaintFlags> ApplyToFlagsIfNeeded(
const cc::PaintFlags& flags,
......
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