Bug 1563484 - Add reftest support for text-zoom. r=dbaron
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 05 Jul 2019 21:33:37 +0000
changeset 481529 fe26c79a01914291de159a3a2abc132e80497d2c
parent 481528 ea1d0ea4b5e5ae2c728ceb4bd128de3397848f82
child 481530 139c0aa658a163b441de8c526b632b0d094ba4f3
push id36249
push userrmaries@mozilla.com
push dateSat, 06 Jul 2019 21:46:28 +0000
treeherdermozilla-central@88f4a687f039 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1563484
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1563484 - Add reftest support for text-zoom. r=dbaron Seems we had no reftests for this feature :( Depends on D36893 Differential Revision: https://phabricator.services.mozilla.com/D36894
layout/reftests/reftest-sanity/reftest.list
layout/reftests/reftest-sanity/text-zoom-notref.html
layout/reftests/reftest-sanity/text-zoom-ref.html
layout/reftests/reftest-sanity/text-zoom.html
layout/tools/reftest/reftest-content.js
--- a/layout/reftests/reftest-sanity/reftest.list
+++ b/layout/reftests/reftest-sanity/reftest.list
@@ -4,16 +4,19 @@
 
 # these tests make sure async reftests work:
 == test-async.xul test-async-ref.xul
 == test-async.html test-async-ref.html
 
 # test that zoom works (and really zooms, not just scales)
 == test-zoom.html test-zoom-ref.html
 
+== text-zoom.html text-zoom-ref.html
+!= text-zoom.html text-zoom-notref.html
+
 # make sure we don't fall over if the root is missing
 == no-root.html about:blank
 
 # Makes sure that the file: protocol handler and HTTP server both
 # choose HTML vs. XHTML processing based on the file extensions.
 != html-vs-xhtml-by-extension.html html-vs-xhtml-by-extension.xhtml
 HTTP != html-vs-xhtml-by-extension.html html-vs-xhtml-by-extension.xhtml
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/reftest-sanity/text-zoom-notref.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<div style="font: 16px/1 monospace">Foo</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/reftest-sanity/text-zoom-ref.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<div style="font: 32px/1 monospace">Foo</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/reftest-sanity/text-zoom.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<html reftest-text-zoom="2">
+<div style="font: 16px/1 monospace">Foo</div>
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -171,25 +171,33 @@ function StartTestURI(type, uri, uriTarg
     if (gFailureTimeout != null) {
         SendException("program error managing timeouts\n");
     }
     SetFailureTimeout(LoadFailed, timeout, uri);
 
     LoadURI(gCurrentURL);
 }
 
+function setupTextZoom(contentRootElement) {
+    if (!contentRootElement || !contentRootElement.hasAttribute('reftest-text-zoom'))
+        return;
+    markupDocumentViewer().textZoom =
+        contentRootElement.getAttribute('reftest-text-zoom');
+}
+
 function setupFullZoom(contentRootElement) {
     if (!contentRootElement || !contentRootElement.hasAttribute('reftest-zoom'))
         return;
     markupDocumentViewer().fullZoom =
         contentRootElement.getAttribute('reftest-zoom');
 }
 
-function resetZoom() {
+function resetZoomAndTextZoom() {
     markupDocumentViewer().fullZoom = 1.0;
+    markupDocumentViewer().textZoom = 1.0;
 }
 
 function doPrintMode(contentRootElement) {
     // use getAttribute because className works differently in HTML and SVG
     if (contentRootElement &&
         contentRootElement.hasAttribute('class')) {
         var classList = contentRootElement.getAttribute('class').split(/\s+/);
         if (classList.includes("reftest-print")) {
@@ -854,16 +862,17 @@ function OnDocumentLoad(event)
         'textarea:not([spellcheck="false"]),' +
         'input[spellcheck]:-moz-any([spellcheck=""],[spellcheck="true"]),' +
         '*[contenteditable]:-moz-any([contenteditable=""],[contenteditable="true"])';
     var spellCheckedElements = currentDoc.querySelectorAll(querySelector);
 
     var contentRootElement = currentDoc ? currentDoc.documentElement : null;
     currentDoc = null;
     setupFullZoom(contentRootElement);
+    setupTextZoom(contentRootElement);
     setupViewport(contentRootElement);
     setupDisplayport(contentRootElement);
     var inPrintMode = false;
 
     function AfterOnLoadScripts() {
         // Regrab the root element, because the document may have changed.
         var contentRootElement =
           content.document ? content.document.documentElement : null;
@@ -1193,17 +1202,17 @@ function RecvLoadScriptTest(uri, timeout
 
 function RecvLoadPrintTest(uri, timeout)
 {
     StartTestURI(TYPE_PRINT, uri, URL_TARGET_TYPE_TEST, timeout);
 }
 
 function RecvResetRenderingState()
 {
-    resetZoom();
+    resetZoomAndTextZoom();
     resetDisplayportAndViewport();
 }
 
 function SendAssertionCount(numAssertions)
 {
     sendAsyncMessage("reftest:AssertionCount", { count: numAssertions });
 }