Bug 1305036 - implement nsDisplayTextOverflowMarker::GetComponentAlphaBounds to handle ellipsis with subpixel AA. r=mstange

MozReview-Commit-ID: Bedd3JIvzKy
This commit is contained in:
Lee Salzman 2017-06-01 17:08:54 -04:00
parent 6283f668ef
commit a025094cbf
2 changed files with 16 additions and 3 deletions

View File

@ -183,6 +183,21 @@ public:
nsLayoutUtils::GetTextShadowRectsUnion(mRect, mFrame);
return mRect.Union(shadowRect);
}
virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) override
{
if (gfxPlatform::GetPlatform()->RespectsFontStyleSmoothing()) {
// On OS X, web authors can turn off subpixel text rendering using the
// CSS property -moz-osx-font-smoothing. If they do that, we don't need
// to use component alpha layers for the affected text.
if (mFrame->StyleFont()->mFont.smoothing == NS_FONT_SMOOTHING_GRAYSCALE) {
return nsRect();
}
}
bool snap;
return GetBounds(aBuilder, &snap);
}
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) override;

View File

@ -4904,9 +4904,7 @@ public:
// On OS X, web authors can turn off subpixel text rendering using the
// CSS property -moz-osx-font-smoothing. If they do that, we don't need
// to use component alpha layers for the affected text.
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
const nsStyleFont* fontStyle = f->StyleFont();
if (fontStyle->mFont.smoothing == NS_FONT_SMOOTHING_GRAYSCALE) {
if (mFrame->StyleFont()->mFont.smoothing == NS_FONT_SMOOTHING_GRAYSCALE) {
return nsRect();
}
}