зеркало из https://github.com/mozilla/gecko-dev.git
Minimum font-size wasn't working if no font props was specified, b=163785, r=dbaron, sr=bzbarsky
This commit is contained in:
Родитель
0cf7a22ec8
Коммит
1d2d905c1d
|
@ -1631,6 +1631,25 @@ ZoomFont(nsIPresContext* aPresContext, nscoord aInSize)
|
||||||
return nscoord(aInSize * textZoom);
|
return nscoord(aInSize * textZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PRBool
|
||||||
|
IsChrome(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
PRBool isChrome = PR_FALSE;
|
||||||
|
nsCOMPtr<nsISupports> container;
|
||||||
|
nsresult result = aPresContext->GetContainer(getter_AddRefs(container));
|
||||||
|
if (NS_SUCCEEDED(result) && container) {
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
|
||||||
|
if (NS_SUCCEEDED(result) && docShell) {
|
||||||
|
PRInt32 docShellType;
|
||||||
|
result = docShell->GetItemType(&docShellType);
|
||||||
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
isChrome = nsIDocShellTreeItem::typeChrome == docShellType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isChrome;
|
||||||
|
}
|
||||||
|
|
||||||
const nsStyleStruct*
|
const nsStyleStruct*
|
||||||
nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aContext)
|
nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aContext)
|
||||||
{
|
{
|
||||||
|
@ -1640,8 +1659,15 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aConte
|
||||||
const nsFont* defaultFont;
|
const nsFont* defaultFont;
|
||||||
mPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID, &defaultFont);
|
mPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID, &defaultFont);
|
||||||
nsStyleFont* fontData = new (mPresContext) nsStyleFont(*defaultFont);
|
nsStyleFont* fontData = new (mPresContext) nsStyleFont(*defaultFont);
|
||||||
fontData->mSize = fontData->mFont.size =
|
fontData->mSize = ZoomFont(mPresContext, fontData->mFont.size);
|
||||||
ZoomFont(mPresContext, fontData->mFont.size);
|
if (!IsChrome(mPresContext)) {
|
||||||
|
nscoord minimumFontSize = 0;
|
||||||
|
mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, minimumFontSize);
|
||||||
|
fontData->mFont.size = PR_MAX(fontData->mSize, minimumFontSize);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fontData->mFont.size = fontData->mSize;
|
||||||
|
}
|
||||||
aContext->SetStyle(eStyleStruct_Font, fontData);
|
aContext->SetStyle(eStyleStruct_Font, fontData);
|
||||||
return fontData;
|
return fontData;
|
||||||
}
|
}
|
||||||
|
@ -2216,18 +2242,7 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||||
// document fonts (overriding the useDocumentFonts flag), or to
|
// document fonts (overriding the useDocumentFonts flag), or to
|
||||||
// determine if we have to override the minimum font-size constraint.
|
// determine if we have to override the minimum font-size constraint.
|
||||||
if (!useDocumentFonts || minimumFontSize > 0) {
|
if (!useDocumentFonts || minimumFontSize > 0) {
|
||||||
nsCOMPtr<nsISupports> container;
|
chromeOverride = IsChrome(mPresContext);
|
||||||
nsresult result = mPresContext->GetContainer(getter_AddRefs(container));
|
|
||||||
if (NS_SUCCEEDED(result) && container) {
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
|
|
||||||
if (NS_SUCCEEDED(result) && docShell) {
|
|
||||||
PRInt32 docShellType;
|
|
||||||
result = docShell->GetItemType(&docShellType);
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
|
||||||
chromeOverride = nsIDocShellTreeItem::typeChrome == docShellType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have to use document fonts, then we are only entitled
|
// If we don't have to use document fonts, then we are only entitled
|
||||||
|
|
|
@ -1631,6 +1631,25 @@ ZoomFont(nsIPresContext* aPresContext, nscoord aInSize)
|
||||||
return nscoord(aInSize * textZoom);
|
return nscoord(aInSize * textZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PRBool
|
||||||
|
IsChrome(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
PRBool isChrome = PR_FALSE;
|
||||||
|
nsCOMPtr<nsISupports> container;
|
||||||
|
nsresult result = aPresContext->GetContainer(getter_AddRefs(container));
|
||||||
|
if (NS_SUCCEEDED(result) && container) {
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
|
||||||
|
if (NS_SUCCEEDED(result) && docShell) {
|
||||||
|
PRInt32 docShellType;
|
||||||
|
result = docShell->GetItemType(&docShellType);
|
||||||
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
isChrome = nsIDocShellTreeItem::typeChrome == docShellType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isChrome;
|
||||||
|
}
|
||||||
|
|
||||||
const nsStyleStruct*
|
const nsStyleStruct*
|
||||||
nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aContext)
|
nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aContext)
|
||||||
{
|
{
|
||||||
|
@ -1640,8 +1659,15 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aConte
|
||||||
const nsFont* defaultFont;
|
const nsFont* defaultFont;
|
||||||
mPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID, &defaultFont);
|
mPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID, &defaultFont);
|
||||||
nsStyleFont* fontData = new (mPresContext) nsStyleFont(*defaultFont);
|
nsStyleFont* fontData = new (mPresContext) nsStyleFont(*defaultFont);
|
||||||
fontData->mSize = fontData->mFont.size =
|
fontData->mSize = ZoomFont(mPresContext, fontData->mFont.size);
|
||||||
ZoomFont(mPresContext, fontData->mFont.size);
|
if (!IsChrome(mPresContext)) {
|
||||||
|
nscoord minimumFontSize = 0;
|
||||||
|
mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, minimumFontSize);
|
||||||
|
fontData->mFont.size = PR_MAX(fontData->mSize, minimumFontSize);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fontData->mFont.size = fontData->mSize;
|
||||||
|
}
|
||||||
aContext->SetStyle(eStyleStruct_Font, fontData);
|
aContext->SetStyle(eStyleStruct_Font, fontData);
|
||||||
return fontData;
|
return fontData;
|
||||||
}
|
}
|
||||||
|
@ -2216,18 +2242,7 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||||
// document fonts (overriding the useDocumentFonts flag), or to
|
// document fonts (overriding the useDocumentFonts flag), or to
|
||||||
// determine if we have to override the minimum font-size constraint.
|
// determine if we have to override the minimum font-size constraint.
|
||||||
if (!useDocumentFonts || minimumFontSize > 0) {
|
if (!useDocumentFonts || minimumFontSize > 0) {
|
||||||
nsCOMPtr<nsISupports> container;
|
chromeOverride = IsChrome(mPresContext);
|
||||||
nsresult result = mPresContext->GetContainer(getter_AddRefs(container));
|
|
||||||
if (NS_SUCCEEDED(result) && container) {
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
|
|
||||||
if (NS_SUCCEEDED(result) && docShell) {
|
|
||||||
PRInt32 docShellType;
|
|
||||||
result = docShell->GetItemType(&docShellType);
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
|
||||||
chromeOverride = nsIDocShellTreeItem::typeChrome == docShellType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have to use document fonts, then we are only entitled
|
// If we don't have to use document fonts, then we are only entitled
|
||||||
|
|
Загрузка…
Ссылка в новой задаче