mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 687297 - The per-presentation base minimum font size is now propagated without being max’ed with the language-specific global minimum font size preference, r=dbaron
A separate accessor has been added to nsPresContext to enable TransferZoomLevels and nsDocumentViewer::GetMinFontSize to access the minimum font size that has not been max’ed against the language specific minimum font size preset. nsPresContext::mMinFontSize, its getter, and its setter have been renamed to more clearly distinguish them from minFontSize used elsewhere.
This commit is contained in:
parent
71bd285faa
commit
f01fd0c51e
@ -963,7 +963,7 @@ TransferZoomLevels(nsIDocument* aFromDoc,
|
||||
return;
|
||||
|
||||
toCtxt->SetFullZoom(fromCtxt->GetFullZoom());
|
||||
toCtxt->SetMinFontSize(fromCtxt->MinFontSize(nullptr));
|
||||
toCtxt->SetBaseMinFontSize(fromCtxt->BaseMinFontSize());
|
||||
toCtxt->SetTextZoom(fromCtxt->TextZoom());
|
||||
}
|
||||
|
||||
|
@ -683,7 +683,7 @@ nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow)
|
||||
mViewManager->SetWindowDimensions(width, height);
|
||||
mPresContext->SetTextZoom(mTextZoom);
|
||||
mPresContext->SetFullZoom(mPageZoom);
|
||||
mPresContext->SetMinFontSize(mMinFontSize);
|
||||
mPresContext->SetBaseMinFontSize(mMinFontSize);
|
||||
|
||||
p2a = mPresContext->AppUnitsPerDevPixel(); // zoom may have changed it
|
||||
width = p2a * mBounds.width;
|
||||
@ -2805,7 +2805,7 @@ SetExtResourceMinFontSize(nsIDocument* aDocument, void* aClosure)
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
ctxt->SetMinFontSize(NS_PTR_TO_INT32(aClosure));
|
||||
ctxt->SetBaseMinFontSize(NS_PTR_TO_INT32(aClosure));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2897,7 +2897,7 @@ nsDocumentViewer::SetMinFontSize(int32_t aMinFontSize)
|
||||
// Now change our own min font
|
||||
nsPresContext* pc = GetPresContext();
|
||||
if (pc && aMinFontSize != mPresContext->MinFontSize(nullptr)) {
|
||||
pc->SetMinFontSize(aMinFontSize);
|
||||
pc->SetBaseMinFontSize(aMinFontSize);
|
||||
}
|
||||
|
||||
// And do the external resources
|
||||
@ -2912,7 +2912,7 @@ nsDocumentViewer::GetMinFontSize(int32_t* aMinFontSize)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMinFontSize);
|
||||
nsPresContext* pc = GetPresContext();
|
||||
*aMinFontSize = pc ? pc->MinFontSize(nullptr) : 0;
|
||||
*aMinFontSize = pc ? pc->BaseMinFontSize() : 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ IsVisualCharset(const nsCString& aCharset)
|
||||
// bother initializing members to 0.
|
||||
|
||||
nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
|
||||
: mType(aType), mDocument(aDocument), mMinFontSize(0),
|
||||
: mType(aType), mDocument(aDocument), mBaseMinFontSize(0),
|
||||
mTextZoom(1.0), mFullZoom(1.0), mLastFontInflationScreenWidth(-1.0),
|
||||
mPageSize(-1, -1), mPPScale(1.0f),
|
||||
mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
|
||||
|
@ -535,18 +535,32 @@ public:
|
||||
|
||||
/**
|
||||
* Get the minimum font size for the specified language. If aLanguage
|
||||
* is nullptr, then the document's language is used.
|
||||
* is nullptr, then the document's language is used. This combines
|
||||
* the language-specific global preference with the per-presentation
|
||||
* base minimum font size.
|
||||
*/
|
||||
int32_t MinFontSize(nsIAtom *aLanguage) const {
|
||||
const LangGroupFontPrefs *prefs = GetFontPrefsForLang(aLanguage);
|
||||
return std::max(mMinFontSize, prefs->mMinimumFontSize);
|
||||
return std::max(mBaseMinFontSize, prefs->mMinimumFontSize);
|
||||
}
|
||||
|
||||
void SetMinFontSize(int32_t aMinFontSize) {
|
||||
if (aMinFontSize == mMinFontSize)
|
||||
|
||||
/**
|
||||
* Get the per-presentation base minimum font size. This size is
|
||||
* independent of the language-specific global preference.
|
||||
*/
|
||||
int32_t BaseMinFontSize() const {
|
||||
return mBaseMinFontSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the per-presentation base minimum font size. This size is
|
||||
* independent of the language-specific global preference.
|
||||
*/
|
||||
void SetBaseMinFontSize(int32_t aMinFontSize) {
|
||||
if (aMinFontSize == mBaseMinFontSize)
|
||||
return;
|
||||
|
||||
mMinFontSize = aMinFontSize;
|
||||
mBaseMinFontSize = aMinFontSize;
|
||||
if (HasCachedStyleData()) {
|
||||
// Media queries could have changed, since we changed the meaning
|
||||
// of 'em' units in them.
|
||||
@ -1179,7 +1193,8 @@ protected:
|
||||
|
||||
PRCList mDOMMediaQueryLists;
|
||||
|
||||
int32_t mMinFontSize; // Min font size, defaults to 0
|
||||
// Base minimum font size, independent of the language-specific global preference. Defaults to 0
|
||||
int32_t mBaseMinFontSize;
|
||||
float mTextZoom; // Text zoom, defaults to 1.0
|
||||
float mFullZoom; // Page zoom, defaults to 1.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user