зеркало из https://github.com/mozilla/gecko-dev.git
Bug 442113 - Canvas text size depends on browser text zoom r=vlad
This commit is contained in:
Родитель
4b5c0b5b3f
Коммит
ab5953d90b
|
@ -1699,15 +1699,18 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
|
||||||
nsRefPtr<nsStyleContext> sc = styleSet->ResolveStyleForRules(parentContext, rules);
|
nsRefPtr<nsStyleContext> sc = styleSet->ResolveStyleForRules(parentContext, rules);
|
||||||
if (!sc)
|
if (!sc)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
const nsStyleFont *fontStyle = sc->GetStyleFont();
|
const nsStyleFont* fontStyle = sc->GetStyleFont();
|
||||||
|
|
||||||
NS_ASSERTION(fontStyle, "Could not obtain font style");
|
NS_ASSERTION(fontStyle, "Could not obtain font style");
|
||||||
|
|
||||||
PRUint32 aupdp = presShell->GetPresContext()->AppUnitsPerDevPixel();
|
// use CSS pixels instead of dev pixels to avoid being affected by page zoom
|
||||||
|
const PRUint32 aupcp = nsPresContext::AppUnitsPerCSSPixel();
|
||||||
|
// un-zoom the font size to avoid being affected by text-only zoom
|
||||||
|
const nscoord fontSize = nsStyleFont::UnZoomText(parentContext->PresContext(), fontStyle->mFont.size);
|
||||||
|
|
||||||
gfxFontStyle style(fontStyle->mFont.style,
|
gfxFontStyle style(fontStyle->mFont.style,
|
||||||
fontStyle->mFont.weight,
|
fontStyle->mFont.weight,
|
||||||
NSAppUnitsToFloatPixels(fontStyle->mFont.size,aupdp),
|
NSAppUnitsToFloatPixels(fontSize, aupcp),
|
||||||
langGroup,
|
langGroup,
|
||||||
fontStyle->mFont.sizeAdjust,
|
fontStyle->mFont.sizeAdjust,
|
||||||
fontStyle->mFont.systemFont,
|
fontStyle->mFont.systemFont,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче