зеркало из https://github.com/mozilla/pjs.git
Pass the user font set through more reliably and make it a required parameter. (Bug 467084) r+sr=roc a=blocking1.9.1+
This commit is contained in:
Родитель
8f16d3c819
Коммит
5ecdb26ff8
|
@ -272,16 +272,6 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
|
|||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, screenRect);
|
||||
|
||||
nsCOMPtr<nsIRenderingContext> rc;
|
||||
shell->CreateRenderingContext(frame, getter_AddRefs(rc));
|
||||
NS_ENSURE_TRUE(rc, screenRect);
|
||||
|
||||
const nsStyleFont *font = frame->GetStyleFont();
|
||||
const nsStyleVisibility *visibility = frame->GetStyleVisibility();
|
||||
|
||||
rv = rc->SetFont(font->mFont, visibility->mLangGroup);
|
||||
NS_ENSURE_SUCCESS(rv, screenRect);
|
||||
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
|
||||
while (frame && startContentOffset < endContentOffset) {
|
||||
|
|
|
@ -251,7 +251,7 @@ __try {
|
|||
|
||||
nsIFrame *frame = GetFrame();
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
if (!frame || !presShell) {
|
||||
if (!frame || !presShell || !presShell->GetPresContext()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,8 @@ __try {
|
|||
|
||||
const nsStyleVisibility *visibility = frame->GetStyleVisibility();
|
||||
|
||||
if (NS_FAILED(rc->SetFont(font->mFont, visibility->mLangGroup))) {
|
||||
if (NS_FAILED(rc->SetFont(font->mFont, visibility->mLangGroup,
|
||||
presShell->GetPresContext()->GetUserFontSet()))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ public:
|
|||
virtual nsresult Init(nsIDeviceContext* aContext);
|
||||
virtual nsresult GetDeviceContext(nsIDeviceContext *&aContext) const;
|
||||
virtual nsresult GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
nsIFontMetrics *&aMetrics, gfxUserFontSet *aUserFontSet = nsnull);
|
||||
gfxUserFontSet* aUserFontSet,
|
||||
nsIFontMetrics *&aMetrics);
|
||||
|
||||
nsresult FontMetricsDeleted(const nsIFontMetrics* aFontMetrics);
|
||||
nsresult Compact();
|
||||
|
@ -100,9 +101,11 @@ public:
|
|||
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
|
||||
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
nsIFontMetrics*& aMetrics, gfxUserFontSet *aUserFontSet = nsnull);
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics,
|
||||
gfxUserFontSet *aUserFontSet = nsnull);
|
||||
gfxUserFontSet* aUserFontSet,
|
||||
nsIFontMetrics*& aMetrics);
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont,
|
||||
gfxUserFontSet* aUserFontSet,
|
||||
nsIFontMetrics*& aMetrics);
|
||||
|
||||
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName);
|
||||
|
||||
|
|
|
@ -169,10 +169,10 @@ const PRUint8 kUseAltDCFor_CREATERC_PAINT = 0x04; // Use when creating Renderin
|
|||
const PRUint8 kUseAltDCFor_SURFACE_DIM = 0x08; // Use it for getting the Surface Dimensions
|
||||
#endif
|
||||
|
||||
// 92a1e76c-adbd-441e-aae6-243d6004e0ee
|
||||
// eca27eb2-ef6f-4142-bf77-89c14e595171
|
||||
#define NS_IDEVICE_CONTEXT_IID \
|
||||
{ 0x92a1e76c, 0xadbd, 0x441e, \
|
||||
{ 0xaa, 0xe6, 0x24, 0x3d, 0x60, 0x4, 0xe0, 0xee } }
|
||||
{ 0xeca27eb2, 0xef6f, 0x4142, \
|
||||
{ 0xbf, 0x77, 0x89, 0xc1, 0x4e, 0x59, 0x51, 0x71 } }
|
||||
|
||||
//a cross platform way of specifying a native palette handle
|
||||
typedef void * nsPalette;
|
||||
|
@ -335,8 +335,8 @@ public:
|
|||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
nsIFontMetrics*& aMetrics,
|
||||
gfxUserFontSet *aUserFontSet = nsnull) = 0;
|
||||
gfxUserFontSet* aUserFontSet,
|
||||
nsIFontMetrics*& aMetrics) = 0;
|
||||
|
||||
/**
|
||||
* Get the nsIFontMetrics that describe the properties of
|
||||
|
@ -346,8 +346,8 @@ public:
|
|||
* @param aUserFontSet user font set
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics,
|
||||
gfxUserFontSet *aUserFontSet = nsnull) = 0;
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, gfxUserFontSet* aUserFontSet,
|
||||
nsIFontMetrics*& aMetrics) = 0;
|
||||
|
||||
/**
|
||||
* Check to see if a particular named font exists.
|
||||
|
|
|
@ -60,6 +60,7 @@ class nsIAtom;
|
|||
|
||||
struct nsFont;
|
||||
struct nsTextDimensions;
|
||||
class gfxUserFontSet;
|
||||
#ifdef MOZ_MATHML
|
||||
struct nsBoundingMetrics;
|
||||
#endif
|
||||
|
@ -97,10 +98,10 @@ typedef enum
|
|||
|
||||
|
||||
// IID for the nsIRenderingContext interface
|
||||
// 3a6209e8-d80d-42ab-ad6a-b8832f7fb09f
|
||||
// 37762dd8-8df0-48cd-a5d6-24573ffdb5b6
|
||||
#define NS_IRENDERING_CONTEXT_IID \
|
||||
{ 0x3a6209e8, 0xd80d, 0x42ab, \
|
||||
{ 0xad, 0x6a, 0xb8, 0x83, 0x2f, 0x7f, 0xb0, 0x9f } }
|
||||
{ 0x37762dd8, 0x8df0, 0x48cd, \
|
||||
{ 0xa5, 0xd6, 0x24, 0x57, 0x3f, 0xfd, 0xb5, 0xb6 } }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -202,7 +203,8 @@ public:
|
|||
* Sets the font for the RenderingContext
|
||||
* @param aFont The font to use in the RenderingContext
|
||||
*/
|
||||
NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLangGroup) = 0;
|
||||
NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
gfxUserFontSet *aUserFontSet) = 0;
|
||||
|
||||
/**
|
||||
* Sets the font for the RenderingContext
|
||||
|
|
|
@ -215,7 +215,7 @@ DeviceContextImpl::GetLocaleLangGroup(void)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont,
|
||||
nsIAtom* aLangGroup, nsIFontMetrics*& aMetrics, gfxUserFontSet *aUserFontSet)
|
||||
nsIAtom* aLangGroup, gfxUserFontSet *aUserFontSet, nsIFontMetrics*& aMetrics)
|
||||
{
|
||||
if (nsnull == mFontCache) {
|
||||
nsresult rv = CreateFontCache();
|
||||
|
@ -232,12 +232,12 @@ NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont,
|
|||
aLangGroup = mLocaleLangGroup;
|
||||
}
|
||||
|
||||
return mFontCache->GetMetricsFor(aFont, aLangGroup, aMetrics, aUserFontSet);
|
||||
return mFontCache->GetMetricsFor(aFont, aLangGroup, aUserFontSet, aMetrics);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont,
|
||||
nsIFontMetrics*& aMetrics,
|
||||
gfxUserFontSet *aUserFontSet)
|
||||
gfxUserFontSet *aUserFontSet,
|
||||
nsIFontMetrics*& aMetrics)
|
||||
{
|
||||
if (nsnull == mFontCache) {
|
||||
nsresult rv = CreateFontCache();
|
||||
|
@ -248,8 +248,8 @@ NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont,
|
|||
// XXX temporary fix for performance problem -- erik
|
||||
GetLocaleLangGroup();
|
||||
}
|
||||
return mFontCache->GetMetricsFor(aFont, mLocaleLangGroup,
|
||||
aMetrics, aUserFontSet);
|
||||
return mFontCache->GetMetricsFor(aFont, mLocaleLangGroup, aUserFontSet,
|
||||
aMetrics);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetDepth(PRUint32& aDepth)
|
||||
|
@ -474,7 +474,7 @@ nsFontCache::GetDeviceContext(nsIDeviceContext *&aContext) const
|
|||
|
||||
nsresult
|
||||
nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
nsIFontMetrics *&aMetrics, gfxUserFontSet *aUserFontSet)
|
||||
gfxUserFontSet *aUserFontSet, nsIFontMetrics *&aMetrics)
|
||||
{
|
||||
// First check our cache
|
||||
// start from the end, which is where we put the most-recent-used element
|
||||
|
|
|
@ -783,12 +783,14 @@ nsThebesRenderingContext::SetTextRunRTL(PRBool aIsRTL)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsThebesRenderingContext::SetFont(const nsFont& aFont, nsIAtom* aLangGroup)
|
||||
nsThebesRenderingContext::SetFont(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
gfxUserFontSet *aUserFontSet)
|
||||
{
|
||||
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetFont %p\n", this, &aFont));
|
||||
|
||||
nsCOMPtr<nsIFontMetrics> newMetrics;
|
||||
mDeviceContext->GetMetricsFor(aFont, aLangGroup, *getter_AddRefs(newMetrics));
|
||||
mDeviceContext->GetMetricsFor(aFont, aLangGroup, aUserFontSet,
|
||||
*getter_AddRefs(newMetrics));
|
||||
mFontMetrics = reinterpret_cast<nsIThebesFontMetrics*>(newMetrics.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,8 @@ public:
|
|||
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine);
|
||||
NS_IMETHOD SetColor(nscolor aColor);
|
||||
NS_IMETHOD GetColor(nscolor &aColor) const;
|
||||
NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLangGroup);
|
||||
NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
gfxUserFontSet *aUserFontSet);
|
||||
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics);
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics);
|
||||
NS_IMETHOD Translate(nscoord aX, nscoord aY);
|
||||
|
|
|
@ -1509,7 +1509,7 @@ nsLayoutUtils::GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
|
|||
return aStyleContext->PresContext()->DeviceContext()->GetMetricsFor(
|
||||
aStyleContext->GetStyleFont()->mFont,
|
||||
aStyleContext->GetStyleVisibility()->mLangGroup,
|
||||
*aFontMetrics, fs);
|
||||
fs, *aFontMetrics);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
@ -2914,7 +2914,8 @@ nsLayoutUtils::SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
|
|||
const nsStyleFont* font = aSC->GetStyleFont();
|
||||
const nsStyleVisibility* visibility = aSC->GetStyleVisibility();
|
||||
|
||||
aRC->SetFont(font->mFont, visibility->mLangGroup);
|
||||
aRC->SetFont(font->mFont, visibility->mLangGroup,
|
||||
aSC->PresContext()->GetUserFontSet());
|
||||
}
|
||||
|
||||
static PRBool NonZeroStyleCoord(const nsStyleCoord& aCoord)
|
||||
|
|
|
@ -1104,7 +1104,7 @@ already_AddRefed<nsIFontMetrics>
|
|||
nsPresContext::GetMetricsFor(const nsFont& aFont)
|
||||
{
|
||||
nsIFontMetrics* metrics = nsnull;
|
||||
mDeviceContext->GetMetricsFor(aFont, mLangGroup, metrics);
|
||||
mDeviceContext->GetMetricsFor(aFont, mLangGroup, GetUserFontSet(), metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
|
@ -1708,7 +1708,7 @@ InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet,
|
|||
}
|
||||
|
||||
gfxUserFontSet*
|
||||
nsPresContext::GetUserFontSet()
|
||||
nsPresContext::GetUserFontSetInternal()
|
||||
{
|
||||
// We want to initialize the user font set lazily the first time the
|
||||
// user asks for it, rather than building it too early and forcing
|
||||
|
@ -1740,6 +1740,12 @@ nsPresContext::GetUserFontSet()
|
|||
return mUserFontSet;
|
||||
}
|
||||
|
||||
gfxUserFontSet*
|
||||
nsPresContext::GetUserFontSetExternal()
|
||||
{
|
||||
return GetUserFontSetInternal();
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::FlushUserFontSet()
|
||||
{
|
||||
|
|
|
@ -745,7 +745,14 @@ public:
|
|||
|
||||
PRBool SupressingResizeReflow() const { return mSupressResizeReflow; }
|
||||
|
||||
gfxUserFontSet* GetUserFontSet();
|
||||
virtual NS_HIDDEN_(gfxUserFontSet*) GetUserFontSetExternal();
|
||||
NS_HIDDEN_(gfxUserFontSet*) GetUserFontSetInternal();
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
gfxUserFontSet* GetUserFontSet() { return GetUserFontSetInternal(); }
|
||||
#else
|
||||
gfxUserFontSet* GetUserFontSet() { return GetUserFontSetExternal(); }
|
||||
#endif
|
||||
|
||||
void FlushUserFontSet();
|
||||
void RebuildUserFontSet(); // asynchronously
|
||||
|
||||
|
|
|
@ -1877,36 +1877,27 @@ nsListControlFrame::IsLeftButton(nsIDOMEvent* aMouseEvent)
|
|||
nscoord
|
||||
nsListControlFrame::CalcFallbackRowHeight(PRInt32 aNumOptions)
|
||||
{
|
||||
const nsStyleFont* styleFont = nsnull;
|
||||
nsIFrame *fontFrame = nsnull;
|
||||
|
||||
if (aNumOptions > 0) {
|
||||
// Try the first option
|
||||
nsCOMPtr<nsIContent> option = GetOptionContent(0);
|
||||
if (option) {
|
||||
nsIFrame * optFrame = PresContext()->PresShell()->
|
||||
GetPrimaryFrameFor(option);
|
||||
if (optFrame) {
|
||||
styleFont = optFrame->GetStyleFont();
|
||||
}
|
||||
fontFrame = PresContext()->PresShell()->GetPrimaryFrameFor(option);
|
||||
}
|
||||
}
|
||||
|
||||
if (!styleFont) {
|
||||
if (!fontFrame) {
|
||||
// Fall back to our own font
|
||||
styleFont = GetStyleFont();
|
||||
fontFrame = this;
|
||||
}
|
||||
|
||||
NS_ASSERTION(styleFont, "Must have font style by now!");
|
||||
|
||||
nscoord rowHeight = 0;
|
||||
|
||||
nsCOMPtr<nsIFontMetrics> fontMet;
|
||||
nsresult result = PresContext()->DeviceContext()->
|
||||
GetMetricsFor(styleFont->mFont, *getter_AddRefs(fontMet));
|
||||
if (NS_SUCCEEDED(result) && fontMet) {
|
||||
if (fontMet) {
|
||||
fontMet->GetHeight(rowHeight);
|
||||
}
|
||||
nsLayoutUtils::GetFontMetricsForFrame(fontFrame, getter_AddRefs(fontMet));
|
||||
if (fontMet) {
|
||||
fontMet->GetHeight(rowHeight);
|
||||
}
|
||||
|
||||
return rowHeight;
|
||||
|
|
|
@ -500,13 +500,16 @@ nsPageFrame::PaintHeaderFooter(nsIRenderingContext& aRenderingContext,
|
|||
nsRect rect(aPt.x, aPt.y, mRect.width - mPD->mShadowSize.width,
|
||||
mRect.height - mPD->mShadowSize.height);
|
||||
|
||||
aRenderingContext.SetFont(*mPD->mHeadFootFont, nsnull);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
|
||||
// Get the FontMetrics to determine width.height of strings
|
||||
nsCOMPtr<nsIFontMetrics> fontMet;
|
||||
pc->DeviceContext()->GetMetricsFor(*mPD->mHeadFootFont, nsnull,
|
||||
pc->GetUserFontSet(),
|
||||
*getter_AddRefs(fontMet));
|
||||
|
||||
aRenderingContext.SetFont(fontMet);
|
||||
|
||||
nscoord ascent = 0;
|
||||
nscoord visibleHeight = 0;
|
||||
if (fontMet) {
|
||||
|
|
|
@ -1159,7 +1159,8 @@ insert:
|
|||
|
||||
// Update the font and rendering context if there is a family change
|
||||
static void
|
||||
SetFontFamily(nsIRenderingContext& aRenderingContext,
|
||||
SetFontFamily(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsFont& aFont,
|
||||
const nsGlyphTable* aGlyphTable,
|
||||
const nsGlyphCode& aGlyphCode,
|
||||
|
@ -1169,7 +1170,7 @@ SetFontFamily(nsIRenderingContext& aRenderingContext,
|
|||
aGlyphCode.font ? aGlyphTable->FontNameFor(aGlyphCode) : aDefaultFamily;
|
||||
if (! family.Equals(aFont.name)) {
|
||||
aFont.name = family;
|
||||
aRenderingContext.SetFont(aFont, nsnull);
|
||||
aRenderingContext.SetFont(aFont, nsnull, aPresContext->GetUserFontSet());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1260,7 +1261,8 @@ nsMathMLChar::StretchEnumContext::TryVariants(nsGlyphTable* aGlyphTable,
|
|||
nsGlyphCode ch;
|
||||
while ((ch = aGlyphTable->BigOf(mPresContext, mChar, size)).Exists()) {
|
||||
|
||||
SetFontFamily(mRenderingContext, font, aGlyphTable, ch, aFamily);
|
||||
SetFontFamily(mChar->mStyleContext->PresContext(), mRenderingContext,
|
||||
font, aGlyphTable, ch, aFamily);
|
||||
|
||||
NS_ASSERTION(maxWidth || ch.code != mChar->mGlyph.code ||
|
||||
!font.name.Equals(mChar->mFamily),
|
||||
|
@ -1384,7 +1386,8 @@ nsMathMLChar::StretchEnumContext::TryParts(nsGlyphTable* aGlyphTable,
|
|||
sizedata[i] = mTargetSize;
|
||||
}
|
||||
else {
|
||||
SetFontFamily(mRenderingContext, font, aGlyphTable, ch, aFamily);
|
||||
SetFontFamily(mChar->mStyleContext->PresContext(), mRenderingContext,
|
||||
font, aGlyphTable, ch, aFamily);
|
||||
nsresult rv = mRenderingContext.GetBoundingMetrics(&ch.code, 1, bm);
|
||||
if (NS_FAILED(rv)) {
|
||||
// stop if we failed to compute the bounding metrics of a part.
|
||||
|
@ -1583,7 +1586,7 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
|
|||
mFamily = families;
|
||||
}
|
||||
|
||||
aRenderingContext.SetFont(font, nsnull);
|
||||
aRenderingContext.SetFont(font, nsnull, aPresContext->GetUserFontSet());
|
||||
nsresult rv =
|
||||
aRenderingContext.GetBoundingMetrics(mData.get(), PRUint32(mData.Length()),
|
||||
aDesiredStretchSize);
|
||||
|
@ -2094,7 +2097,7 @@ nsMathMLChar::PaintForeground(nsPresContext* aPresContext,
|
|||
if (! mFamily.IsEmpty()) {
|
||||
theFont.name = mFamily;
|
||||
}
|
||||
aRenderingContext.SetFont(theFont, nsnull);
|
||||
aRenderingContext.SetFont(theFont, nsnull, aPresContext->GetUserFontSet());
|
||||
|
||||
if (NS_STRETCH_DIRECTION_UNSUPPORTED == mDirection) {
|
||||
// normal drawing if there is nothing special about this char ...
|
||||
|
@ -2210,7 +2213,8 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
|
|||
if (!ch.Exists()) ch = chGlue;
|
||||
// if (!ch.Exists()) glue is null, leave bounding metrics at 0
|
||||
if (ch.Exists()) {
|
||||
SetFontFamily(aRenderingContext, aFont, aGlyphTable, ch, mFamily);
|
||||
SetFontFamily(aPresContext, aRenderingContext,
|
||||
aFont, aGlyphTable, ch, mFamily);
|
||||
rv = aRenderingContext.GetBoundingMetrics(&ch.code, 1, bmdata[i]);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("GetBoundingMetrics failed");
|
||||
|
@ -2298,7 +2302,8 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
|
|||
}
|
||||
if (!clipRect.IsEmpty()) {
|
||||
AutoPushClipRect clip(aRenderingContext, clipRect);
|
||||
SetFontFamily(aRenderingContext, aFont, aGlyphTable, ch, mFamily);
|
||||
SetFontFamily(aPresContext, aRenderingContext,
|
||||
aFont, aGlyphTable, ch, mFamily);
|
||||
aRenderingContext.DrawString(&ch.code, 1, dx, dy);
|
||||
}
|
||||
}
|
||||
|
@ -2354,7 +2359,8 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
|
|||
bm.descent -= oneDevPixel;
|
||||
}
|
||||
|
||||
SetFontFamily(aRenderingContext, aFont, aGlyphTable, chGlue, mFamily);
|
||||
SetFontFamily(aPresContext, aRenderingContext,
|
||||
aFont, aGlyphTable, chGlue, mFamily);
|
||||
nsRect clipRect = unionRect;
|
||||
|
||||
for (i = 0; i < bottom; ++i) {
|
||||
|
@ -2440,7 +2446,8 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
|
|||
if (!ch.Exists()) ch = chGlue;
|
||||
// if (!ch.Exists()) glue is null, leave bounding metrics at 0.
|
||||
if (ch.Exists()) {
|
||||
SetFontFamily(aRenderingContext, aFont, aGlyphTable, ch, mFamily);
|
||||
SetFontFamily(aPresContext, aRenderingContext,
|
||||
aFont, aGlyphTable, ch, mFamily);
|
||||
rv = aRenderingContext.GetBoundingMetrics(&ch.code, 1, bmdata[i]);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("GetBoundingMetrics failed");
|
||||
|
@ -2523,7 +2530,8 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
|
|||
}
|
||||
if (!clipRect.IsEmpty()) {
|
||||
AutoPushClipRect clip(aRenderingContext, clipRect);
|
||||
SetFontFamily(aRenderingContext, aFont, aGlyphTable, ch, mFamily);
|
||||
SetFontFamily(aPresContext, aRenderingContext,
|
||||
aFont, aGlyphTable, ch, mFamily);
|
||||
aRenderingContext.DrawString(&ch.code, 1, dx, dy);
|
||||
}
|
||||
}
|
||||
|
@ -2578,7 +2586,8 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
|
|||
bm.rightBearing -= oneDevPixel;
|
||||
}
|
||||
|
||||
SetFontFamily(aRenderingContext, aFont, aGlyphTable, chGlue, mFamily);
|
||||
SetFontFamily(aPresContext, aRenderingContext,
|
||||
aFont, aGlyphTable, chGlue, mFamily);
|
||||
nsRect clipRect = unionRect;
|
||||
|
||||
for (i = 0; i < right; ++i) {
|
||||
|
|
|
@ -94,7 +94,7 @@ nsMathMLContainerFrame::ReflowError(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
///////////////
|
||||
// Set font
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
nsLayoutUtils::SetFontFromStyle(&aRenderingContext, GetStyleContext());
|
||||
|
||||
// bounding metrics
|
||||
nsAutoString errorMsg; errorMsg.AssignLiteral("invalid-markup");
|
||||
|
@ -144,7 +144,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
|
||||
{
|
||||
// Set color and font ...
|
||||
aCtx->SetFont(mFrame->GetStyleFont()->mFont, nsnull);
|
||||
nsLayoutUtils::SetFontFromStyle(aCtx, mFrame->GetStyleContext());
|
||||
|
||||
nsPoint pt = aBuilder->ToReferenceFrame(mFrame);
|
||||
aCtx->SetColor(NS_RGB(255,0,0));
|
||||
|
|
|
@ -272,7 +272,8 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
PRInt32 i;
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
const nsStyleFont* font = aForFrame->GetStyleFont();
|
||||
aReflowState.rendContext->SetFont(font->mFont, nsnull);
|
||||
aReflowState.rendContext->SetFont(font->mFont, nsnull,
|
||||
aPresContext->GetUserFontSet());
|
||||
aReflowState.rendContext->GetFontMetrics(*getter_AddRefs(fm));
|
||||
nscoord axisHeight, em;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
|
|
|
@ -305,7 +305,8 @@ nsMathMLmfracFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
nsPresContext* presContext = PresContext();
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
presContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -159,7 +159,8 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
// get x-height (an ex)
|
||||
const nsStyleFont* font = GetStyleFont();
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -632,7 +632,8 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
// get the axis height;
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
PresContext()->GetUserFontSet());
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
nscoord axisHeight, height;
|
||||
GetAxisHeight(aRenderingContext, fm, axisHeight);
|
||||
|
|
|
@ -280,7 +280,8 @@ nsMathMLmoverFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
////////////////////
|
||||
// Place Children
|
||||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -257,7 +257,8 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
|||
////////////
|
||||
// Prepare the radical symbol and the overline bar
|
||||
|
||||
renderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
renderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
renderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -185,7 +185,8 @@ nsMathMLmsqrtFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
////////////
|
||||
// Prepare the radical symbol and the overline bar
|
||||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -192,7 +192,8 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
|
|||
// subScriptShift1 = subscriptshift attribute * x-height
|
||||
nscoord subScriptShift1, subScriptShift2;
|
||||
|
||||
aRenderingContext.SetFont(baseFrame->GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(baseFrame->GetStyleFont()->mFont, nsnull,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -609,7 +609,8 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
case eAlign_axis:
|
||||
default: {
|
||||
// XXX should instead use style data from the row of reference here ?
|
||||
aReflowState.rendContext->SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aReflowState.rendContext->SetFont(GetStyleFont()->mFont, nsnull,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aReflowState.rendContext->GetFontMetrics(*getter_AddRefs(fm));
|
||||
nscoord axisHeight;
|
||||
|
|
|
@ -277,7 +277,8 @@ nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
////////////////////
|
||||
// Place Children
|
||||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -318,7 +318,8 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
////////////////////
|
||||
// Place Children
|
||||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<title>Testcase, bug 467084</title>
|
||||
<style>
|
||||
body { background: white; }
|
||||
body > div { background: blue; height: 100px; width: 100px; padding: 5px; }
|
||||
body > div > div { background: aqua; height: 100px; width: 100px; }
|
||||
</style>
|
||||
<div><div></div></div>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<title>Testcase, bug 467084</title>
|
||||
<style>
|
||||
html { background: white; }
|
||||
@font-face { font-family: "AcidAhemTest"; src: url(../fonts/Ahem.ttf); }
|
||||
body { background: blue; height: 100px; width: 100px; padding: 5px; }
|
||||
div { color: aqua; font: 100px/1 AcidAhemTest; }
|
||||
</style>
|
||||
<div>X</div>
|
||||
|
|
@ -55,3 +55,5 @@ HTTP(..) == delete-rule-1.html delete-rule-1-ref.html
|
|||
skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == media-query-add-1.html media-query-add-1-ref.html
|
||||
skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == media-query-remove-1.html media-query-remove-1-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != media-query-add-1-ref.html media-query-remove-1-ref.html
|
||||
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == ahem-metrics-1.html ahem-metrics-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче