Bug 1510214 - Change the default minimum scale to match Chrome's. r=botond
☠☠ backed out by c302586458e0 ☠ ☠
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 29 Nov 2018 02:51:18 +0000
changeset 505091 30accf21bb0afe33b1459daa2dd80340fb05cb87
parent 505090 0f4be93319f6df5739f29fed76288e0861a5b7d1
child 505092 b6628da730a9dd6c5d88fd75e4b1b6878d357e4e
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1510214
milestone65.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 1510214 - Change the default minimum scale to match Chrome's. r=botond The reftest in this commit fails without changing the default value. The test image is shrunk too much. Differential Revision: https://phabricator.services.mozilla.com/D13172
dom/base/nsViewportInfo.h
dom/base/test/test_meta_viewport0.html
layout/reftests/meta-viewport/clamped-by-default-minimum-scale.html
layout/reftests/meta-viewport/initial-scale-0_25-ref.html
layout/reftests/meta-viewport/reftest.list
--- a/dom/base/nsViewportInfo.h
+++ b/dom/base/nsViewportInfo.h
@@ -7,17 +7,17 @@
 
 #include <stdint.h>
 #include "mozilla/Attributes.h"
 #include "Units.h"
 
 /**
  * Default values for the nsViewportInfo class.
  */
-static const mozilla::LayoutDeviceToScreenScale kViewportMinScale(0.1f);
+static const mozilla::LayoutDeviceToScreenScale kViewportMinScale(0.25f);
 static const mozilla::LayoutDeviceToScreenScale kViewportMaxScale(10.0f);
 static const mozilla::CSSIntSize kViewportMinSize(200, 40);
 static const mozilla::CSSIntSize kViewportMaxSize(10000, 10000);
 
 /**
  * Information retrieved from the <meta name="viewport"> tag. See
  * nsIDocument::GetViewportInfo for more information on this functionality.
  */
--- a/dom/base/test/test_meta_viewport0.html
+++ b/dom/base/test/test_meta_viewport0.html
@@ -16,23 +16,23 @@
     function fuzzeq(a, b, msg) {
       ok(Math.abs(a - b) < 1e-6, msg);
     }
 
     add_task(async function test1() {
       await SpecialPowers.pushPrefEnv(scaleRatio(1.0));
 
       let info = getViewportInfo(800, 480);
-      fuzzeq(info.defaultZoom, 0.1, "initial scale is unspecified");
-      fuzzeq(info.minZoom, 0.1,     "minimum scale defaults to the absolute minimum");
-      is(info.maxZoom,     10,      "maximum scale defaults to the absolute maximum");
-      is(info.width,       980,     "width is the default width");
-      is(info.height,      588,     "height is proportional to displayHeight");
-      is(info.autoSize,    false,   "autoSize is disabled by default");
-      is(info.allowZoom,   true,    "zooming is enabled by default");
+      fuzzeq(info.defaultZoom, 0.25, "initial scale is clamped to the default mimumim scale");
+      fuzzeq(info.minZoom, 0.25,     "minimum scale defaults to the absolute minimum");
+      is(info.maxZoom,     10,       "maximum scale defaults to the absolute maximum");
+      is(info.width,       980,      "width is the default width");
+      is(info.height,      588,      "height is proportional to displayHeight");
+      is(info.autoSize,    false,    "autoSize is disabled by default");
+      is(info.allowZoom,   true,     "zooming is enabled by default");
 
       info = getViewportInfo(490, 600);
       is(info.width,       980,     "width is still the default width");
       is(info.height,      1200,    "height is proportional to the new displayHeight");
     });
 
     add_task(async function test2() {
       await SpecialPowers.pushPrefEnv(scaleRatio(1.5));
new file mode 100644
--- /dev/null
+++ b/layout/reftests/meta-viewport/clamped-by-default-minimum-scale.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta name="viewport" content="width=device-width">
+<style>
+html, body {
+  margin: 0;
+  width: 100%;
+  height: 100%;
+  scrollbar-width: none;
+}
+#container {
+  /*
+   * This value should be greater than reftest viewport width 800px * (1 / 0.25).
+   * 0.25 is the initial scale value used in the reference.
+   */
+  min-width: 4000px;
+  /*
+   * This value should be greater than reftest viewport height
+   * 1000x * (1 / 0.25) to make the initial scale auto-calculation happen.
+   */
+  min-height: 8000px;
+  position: relative;
+}
+#inner {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<div id="container">
+  <div id="inner"></div>
+</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/meta-viewport/initial-scale-0_25-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta name="viewport" content="initial-scale=0.25,width=device-width">
+<style>
+html, body {
+  margin: 0;
+  width: 100%;
+  height: 100%;
+}
+#container {
+  position: relative;
+}
+#inner {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<div id="container">
+  <div id="inner"></div>
+</div>
--- a/layout/reftests/meta-viewport/reftest.list
+++ b/layout/reftests/meta-viewport/reftest.list
@@ -3,8 +3,9 @@ default-preferences pref(dom.meta-viewpo
 # These tests assume that viewport width in reftest is 800px.
 == box-shadow.html initial-scale-0_5-ref.html
 == initial-scale-0.html initial-scale-0_5-ref.html
 == initial-scale-100.html initial-scale-0_5-ref.html
 == no-viewport.html initial-scale-0_5-ref.html
 == viewport-width.html initial-scale-0_5-ref.html
 == initial-scale-1.html no-zoom-ref.html
 == minimum-scale.html no-zoom-ref.html
+== clamped-by-default-minimum-scale.html initial-scale-0_25-ref.html