bug 745699 - canvas2d rendering context needs to call gfxFontGroup::UpdateFontList() before MakeTextRun() to ensure user font generation is up to date. r=roc a=blassey

This commit is contained in:
Jonathan Kew 2012-04-18 20:56:19 +01:00
parent 3339111276
commit 7279366fca
4 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: "z";
src: url(invalid);
}
</style>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.font = "10px serif";
document.querySelector("style").appendChild(document.createTextNode(" "));
ctx.measureText("123");
}
</script>
</head>
<body onload="boom();">
<canvas width="100" height="100"></canvas>
</body>
</html>

View File

@ -5,3 +5,4 @@ load 647480.html
load 0px-size-font-667225.html
load texImage2D.html
load 729116.html
load 745699-1.html

View File

@ -2753,6 +2753,7 @@ struct NS_STACK_CLASS nsCanvasBidiProcessor : public nsBidiPresUtils::BidiProces
{
virtual void SetText(const PRUnichar* text, PRInt32 length, nsBidiDirection direction)
{
mFontgrp->UpdateFontList(); // ensure user font generation is current
mTextRun = mFontgrp->MakeTextRun(text,
length,
mThebes,
@ -3149,6 +3150,7 @@ nsCanvasRenderingContext2D::MakeTextRun(const PRUnichar* aText,
gfxFontGroup* currentFontStyle = GetCurrentFontStyle();
if (!currentFontStyle)
return nsnull;
currentFontStyle->UpdateFontList(); // ensure user font generation is current
return currentFontStyle->MakeTextRun(aText, aLength,
mThebes, aAppUnitsPerDevUnit, aFlags);
}

View File

@ -2970,6 +2970,7 @@ struct NS_STACK_CLASS nsCanvasBidiProcessorAzure : public nsBidiPresUtils::BidiP
virtual void SetText(const PRUnichar* text, PRInt32 length, nsBidiDirection direction)
{
mFontgrp->UpdateFontList(); // ensure user font generation is current
mTextRun = mFontgrp->MakeTextRun(text,
length,
mThebes,