Bug 1328868 - Part 3 - Make the effective text zoom retrievable from JS. r?tnikkel
We want to read this value during testing.
MozReview-Commit-ID: FVA7VdvSTEt
--- a/docshell/base/nsIContentViewer.idl
+++ b/docshell/base/nsIContentViewer.idl
@@ -195,16 +195,19 @@ interface nsIContentViewer : nsISupports
/*
Scrolls to a given DOM content node.
*/
void scrollToNode(in nsIDOMNode node);
/** The amount by which to scale all text. Default is 1.0. */
attribute float textZoom;
+ /** The actual text zoom in effect, as modified by the system font scale. */
+ readonly attribute float effectiveTextZoom;
+
/** The amount by which to scale all lengths. Default is 1.0. */
attribute float fullZoom;
/**
* The value used to override devicePixelRatio and media queries dppx.
* Default is 0.0, that means no overriding is done (only a positive value
* is applied).
*/
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -3012,16 +3012,25 @@ nsDocumentViewer::GetTextZoom(float* aTe
{
NS_ENSURE_ARG_POINTER(aTextZoom);
nsPresContext* pc = GetPresContext();
*aTextZoom = pc ? pc->TextZoom() : 1.0f;
return NS_OK;
}
NS_IMETHODIMP
+nsDocumentViewer::GetEffectiveTextZoom(float* aEffectiveTextZoom)
+{
+ NS_ENSURE_ARG_POINTER(aEffectiveTextZoom);
+ nsPresContext* pc = GetPresContext();
+ *aEffectiveTextZoom = pc ? pc->EffectiveTextZoom() : 1.0f;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsDocumentViewer::SetMinFontSize(int32_t aMinFontSize)
{
// If we don't have a document, then we need to bail.
if (!mDocument) {
return NS_ERROR_FAILURE;
}
if (GetIsPrintPreview()) {
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -547,16 +547,23 @@
<getter><![CDATA[
return this.markupDocumentViewer.textZoom;
]]></getter>
<setter><![CDATA[
this.markupDocumentViewer.textZoom = val;
]]></setter>
</property>
+ <property name="effectiveTextZoom"
+ readonly="true">
+ <getter><![CDATA[
+ return this.markupDocumentViewer.effectiveTextZoom;
+ ]]></getter>
+ </property>
+
<property name="isSyntheticDocument">
<getter><![CDATA[
return this.contentDocument.mozSyntheticDocument;
]]></getter>
</property>
<property name="hasContentOpener">
<getter><![CDATA[