Bug 1563484 - Add reftest support for text-zoom. r=dbaron a=RyanVM
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 05 Jul 2019 21:33:37 +0000
changeset 523086 b4a0946bc2db94c81c0cb64aec2c81e920f24c4b
parent 523085 32bae01305928d8d7f8953ba9dbeab4b66ac9126
child 523087 db86d910c6a254f2e106351123bf3937f826cd16
push id84
push userarchaeopteryx@coole-files.de
push dateThu, 18 Jul 2019 10:06:36 +0000
treeherdermozilla-esr68@8ccf0434f421 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, RyanVM
bugs1563484
milestone68.1.0
Bug 1563484 - Add reftest support for text-zoom. r=dbaron a=RyanVM 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")) {
@@ -847,16 +855,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;
@@ -1186,17 +1195,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 });
 }