#416: M1265568 M1305036

This commit is contained in:
Cameron Kaiser 2017-07-18 20:55:41 -07:00
parent 1bc1dd390d
commit 257cfd9290
4 changed files with 42 additions and 0 deletions

View File

@ -403,6 +403,12 @@ public:
*/
virtual bool RequiresLinearZoom() { return false; }
/**
* Whether the frame->StyleFont().mFont.smoothing field is respected by
* text rendering on this platform.
*/
virtual bool RespectsFontStyleSmoothing() const { return false; }
/**
* Whether to check all font cmaps during system font fallback
*/

View File

@ -100,6 +100,11 @@ public:
return true;
}
bool RespectsFontStyleSmoothing() const override {
// gfxMacFont respects the font smoothing hint.
return true;
}
bool RequiresAcceleratedGLContextForCompositorOGL() const override {
// On OS X in a VM, unaccelerated CompositorOGL shows black flashes, so we
// require accelerated GL for CompositorOGL but allow unaccelerated GL for

View File

@ -180,6 +180,25 @@ public:
nsLayoutUtils::GetTextShadowRectsUnion(mRect, mFrame);
return mRect.Union(shadowRect);
}
virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) override
{
#ifdef XP_MACOSX
{
#else
if (gfxPlatform::GetPlatform()->RespectsFontStyleSmoothing()) {
#endif
// 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

@ -4680,6 +4680,18 @@ public:
virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) override
{
#ifdef XP_MACOSX
{
#else
if (gfxPlatform::GetPlatform()->RespectsFontStyleSmoothing()) {
#endif
// 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);
}