Bug 786913 - Fix Azure short-circuiting of 0px fonts. r=roc

This commit is contained in:
Anthony Jones 2012-09-05 17:52:34 -04:00
Родитель 4cc4e12e7d
Коммит aefbf93eb8
3 изменённых файлов: 29 добавлений и 4 удалений

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

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<body>
<canvas id="canv" width="5" height="5"></canvas>
<script>
var canv = document.getElementById("canv");
var ctx = canv.getContext("2d");
ctx.fillStyle = "red";
// 0 size font shouldn't assert!
ctx.font = "0px Arial";
ctx.shadowColor = '#f00';
ctx.shadowBlur = 4;
ctx.fillText("A", 0, 0);
document.documentElement.className = "";
</script>
</body>
</html>

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

@ -4,6 +4,7 @@ load 553938-1.html
load 647480.html
load 727547.html
load 0px-size-font-667225.html
load 0px-size-font-shadow.html
load texImage2D.html
load 729116.html
load 745699-1.html

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

@ -3216,6 +3216,16 @@ nsCanvasRenderingContext2DAzure::DrawOrMeasureText(const nsAString& aRawText,
isRTL = GET_BIDI_OPTION_DIRECTION(document->GetBidiOptions()) == IBMBIDI_TEXTDIRECTION_RTL;
}
gfxFontGroup* currentFontStyle = GetCurrentFontStyle();
NS_ASSERTION(currentFontStyle, "font group is null");
if (currentFontStyle->GetStyle()->size == 0.0F) {
if (aWidth) {
*aWidth = 0;
}
return NS_OK;
}
const ContextState &state = CurrentState();
// This is only needed to know if we can know the drawing bounding box easily.
@ -3234,11 +3244,8 @@ nsCanvasRenderingContext2DAzure::DrawOrMeasureText(const nsAString& aRawText,
processor.mBoundingBox = gfxRect(0, 0, 0, 0);
processor.mDoMeasureBoundingBox = doDrawShadow || !mIsEntireFrameInvalid;
processor.mState = &CurrentState();
processor.mFontgrp = currentFontStyle;
processor.mFontgrp = GetCurrentFontStyle();
NS_ASSERTION(processor.mFontgrp, "font group is null");
nscoord totalWidthCoord;
// calls bidi algo twice since it needs the full text width and the