bug 837461 - backout parts 2 and 3 of bug 808288 because pdf.js may paint missing chars to canvas if it failed to load fonts, which looks really ugly; better to skip them for now. r=bas

This commit is contained in:
Jonathan Kew 2013-02-08 16:52:55 +00:00
Родитель 6ecf6b192a
Коммит c651d057a4
3 изменённых файлов: 6 добавлений и 49 удалений

Просмотреть файл

@ -59,7 +59,6 @@
#include "gfxFont.h"
#include "gfxBlur.h"
#include "gfxUtils.h"
#include "gfxFontMissingGlyphs.h"
#include "nsFrameManager.h"
#include "nsFrameLoader.h"
@ -2358,52 +2357,7 @@ struct NS_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcesso
mTextRun->GetDetailedGlyphs(i);
if (glyphs[i].IsMissing()) {
float xpos;
float advance = detailedGlyphs[0].mAdvance * devUnitsPerAppUnit;
if (mTextRun->IsRightToLeft()) {
xpos = baselineOrigin.x - advanceSum - advance;
} else {
xpos = baselineOrigin.x + advanceSum;
}
advanceSum += advance;
// default-ignorable characters will have zero advance width.
// we don't draw a hexbox for them, just leave them invisible
if (advance > 0) {
// for now, we use gfxFontMissingGlyphs to draw the hexbox;
// some day we should replace this with a direct Azure version
// get the DrawTarget's transform, so we can apply it to the
// thebes context for gfxFontMissingGlyphs
Matrix matrix = mCtx->mTarget->GetTransform();
nsRefPtr<gfxContext> thebes;
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
// XXX See bug 808288 comment 5 - Bas says:
// This is a little tricky, potentially this could go wrong if
// we fell back to a Cairo context because of for example
// extremely large Canvas size. Cairo content is technically
// -not- supported, but SupportsAzureContent would return true
// as the browser uses D2D content.
// I'm thinking Cairo content will be good enough to do
// DrawMissingGlyph though.
thebes = new gfxContext(mCtx->mTarget);
} else {
nsRefPtr<gfxASurface> drawSurf;
mCtx->GetThebesSurface(getter_AddRefs(drawSurf));
thebes = new gfxContext(drawSurf);
}
thebes->SetMatrix(gfxMatrix(matrix._11, matrix._12, matrix._21,
matrix._22, matrix._31, matrix._32));
gfxFloat height = font->GetMetrics().maxAscent;
gfxRect glyphRect(xpos, baselineOrigin.y - height,
advance, height);
gfxFontMissingGlyphs::DrawMissingGlyph(thebes, glyphRect,
detailedGlyphs[0].mGlyphID,
nsDeviceContext::AppUnitsPerCSSPixel());
mCtx->mTarget->SetTransform(matrix);
}
advanceSum += detailedGlyphs[0].mAdvance * devUnitsPerAppUnit;
continue;
}

Просмотреть файл

@ -32,7 +32,6 @@ EXPORTS = \
gfxFont.h \
gfxFontConstants.h \
gfxFontFeatures.h \
gfxFontMissingGlyphs.h \
gfxFontUtils.h \
gfxFontTest.h \
gfxImageSurface.h \

Просмотреть файл

@ -51,7 +51,11 @@ fails-if(B2G) != text-font-lang.html text-font-lang-notref.html
# check that emoji character renders as something non-blank (for Apple Color Emoji font, bug 715798)
# apparently fails on some 10.7 systems for unknown reasons, bug 804522.
random-if(OSX==10.7) != text-emoji.html text-emoji-notref.html
## Currently fails most places due to partial backout of bug 808288, see bug 837461.
## (Marking "random" rather than "fails" because it would pass for people
## if they have an Emoji font installed when running the tests.)
## WAS: random-if(OSX==10.7) != text-emoji.html text-emoji-notref.html
random-if(!cocoaWidget||OSX==10.6||OSX==10.7) != text-emoji.html text-emoji-notref.html
# azure quartz uses CGDrawLinearGradient instead of DrawShading
# so we have less control over degenerate behaviour as tested by this