diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index e44f76224021..c28678e86f32 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -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; diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 1dbc6c5c2692..d0b6a1259fac 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -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(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(); } }