Commit 8719f165 authored by jongdeok.kim's avatar jongdeok.kim Committed by Commit Bot

Disallow LCD text for layers under normal filter.

Disallows LCD text if the effect node has normal filter operations.
This CL simply checks only the intermediate node.

Bug: 1074521
Change-Id: I6e9caec484599fa47e1649356e9762ca265bee22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2312059Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: jongdeok.kim <jongdeok.kim@navercorp.com>
Cr-Commit-Position: refs/heads/master@{#791698}
parent e347ca65
......@@ -339,6 +339,8 @@ SkColor DebugColors::NonLCDTextHighlightColor(LCDTextDisallowedReason reason) {
return SkColorSetARGB(96, 255, 0, 128);
case LCDTextDisallowedReason::kWillChangeTransform:
return SkColorSetARGB(96, 128, 0, 255);
case LCDTextDisallowedReason::kLayerHasFilterEffect:
return SkColorSetARGB(96, 0, 128, 0);
}
NOTREACHED();
return SK_ColorTRANSPARENT;
......
......@@ -863,6 +863,11 @@ LCDTextDisallowedReason PictureLayerImpl::ComputeLCDTextDisallowedReason()
if (has_will_change_transform_hint())
return LCDTextDisallowedReason::kWillChangeTransform;
EffectNode* effect_node = GetEffectTree().Node(effect_tree_index());
// TODO(crbug.com/1074521): Should also consider ancestor filters.
if (!effect_node->filters.IsEmpty())
return LCDTextDisallowedReason::kLayerHasFilterEffect;
return LCDTextDisallowedReason::kNone;
}
......
......@@ -27,6 +27,8 @@ const char* LCDTextDisallowedReasonToString(LCDTextDisallowedReason reason) {
return "non-integral-y-offset";
case LCDTextDisallowedReason::kWillChangeTransform:
return "will-change-transform";
case LCDTextDisallowedReason::kLayerHasFilterEffect:
return "layer-has-filter-effect";
}
NOTREACHED();
return "";
......
......@@ -24,7 +24,8 @@ enum class LCDTextDisallowedReason : uint8_t {
kNonIntegralXOffset = 5,
kNonIntegralYOffset = 6,
kWillChangeTransform = 7,
kMaxValue = kWillChangeTransform,
kLayerHasFilterEffect = 8,
kMaxValue = kLayerHasFilterEffect,
};
constexpr size_t kLCDTextDisallowedReasonCount =
static_cast<size_t>(LCDTextDisallowedReason::kMaxValue) + 1;
......
......@@ -3791,6 +3791,18 @@ TEST_P(LCDTextTest, CanUseLCDText) {
CheckCanUseLCDText(LCDTextDisallowedReason::kWillChangeTransform, child_);
// TODO(wangxianzhu): Is this correct?
CheckCanUseLCDText(LCDTextDisallowedReason::kNone, grand_child_);
// Case 12: Sanity check: restore will-change: transform.
child_->SetHasWillChangeTransformHint(false);
UpdateActiveTreeDrawProperties();
CheckCanUseLCDText(LCDTextDisallowedReason::kNone);
// Case 13: Normal filter.
FilterOperations blur_filter;
blur_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
SetFilter(child_, blur_filter);
UpdateActiveTreeDrawProperties();
CheckCanUseLCDText(LCDTextDisallowedReason::kLayerHasFilterEffect, child_);
}
TEST_P(LCDTextTest, CanUseLCDTextWithContentsOpaqueForText) {
......
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