Bug 1556976, remove an old, mostly non-working hack to prevent zoom on form controls, r=masayuki
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 13 Dec 2019 13:07:23 +0000
changeset 506905 9f7039ca819d352fcda67fa542668af11fb3a751
parent 506904 12c94d0c2b70a678978c512d08e97b4875b7f570
child 506906 727a60b134e2db62109870ec5c79c754ddabe288
push id36915
push userrgurzau@mozilla.com
push dateFri, 13 Dec 2019 21:43:22 +0000
treeherdermozilla-central@f09f24f2b545 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1556976
milestone73.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 1556976, remove an old, mostly non-working hack to prevent zoom on form controls, r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D56966
dom/events/EventStateManager.cpp
dom/events/test/mochitest.ini
dom/events/test/test_wheel_zoom_on_form_controls.html
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2249,18 +2249,17 @@ void EventStateManager::DoScrollHistory(
     }
   }
 }
 
 void EventStateManager::DoScrollZoom(nsIFrame* aTargetFrame,
                                      int32_t adjustment) {
   // Exclude form controls and content in chrome docshells.
   nsIContent* content = aTargetFrame->GetContent();
-  if (content && !content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) &&
-      !nsContentUtils::IsInChromeDocshell(content->OwnerDoc())) {
+  if (content && !nsContentUtils::IsInChromeDocshell(content->OwnerDoc())) {
     // positive adjustment to decrease zoom, negative to increase
     int32_t change = (adjustment > 0) ? -1 : 1;
 
     EnsureDocument(mPresContext);
     if (Preferences::GetBool("browser.zoom.full") ||
         content->OwnerDoc()->IsSyntheticDocument()) {
       ChangeFullZoom(change);
     } else {
--- a/dom/events/test/mochitest.ini
+++ b/dom/events/test/mochitest.ini
@@ -219,8 +219,10 @@ support-files = file_bug1484371.html
 skip-if = toolkit == 'android' # Bug 1312791
 [test_bug1581192.html]
 [test_dnd_with_modifiers.html]
 [test_hover_mouseleave.html]
 [test_marquee_events.html]
 [test_slotted_mouse_event.html]
 [test_slotted_text_click.html]
 [test_unbound_before_in_active_chain.html]
+[test_wheel_zoom_on_form_controls.html]
+skip-if = verify
new file mode 100644
--- /dev/null
+++ b/dom/events/test/test_wheel_zoom_on_form_controls.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Zoom using wheel should work on form controls</title>
+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<button id="button" style="width:10px;height:10px;"></button><br>
+<input id="input" style="border: 10px solid green;"><br>
+<textarea id="textarea" style="border: 10px solid green;"></textarea><br>
+<select id="select"><option></option></select>
+<script>
+
+  function testControl(id) {
+    return new Promise(function(resolve) {
+      var initialZoom = SpecialPowers.getFullZoom(window);
+      var element = document.getElementById(id);
+      element.onwheel = function() {
+        window.requestAnimationFrame(function() {
+          setTimeout(function() {
+            isnot(SpecialPowers.getFullZoom(window), initialZoom,
+                  "Should have zoomed");
+            SpecialPowers.setFullZoom(window, initialZoom);
+            setTimeout(resolve);
+          });
+        });
+      }
+
+      let event = {
+        deltaMode: WheelEvent.DOM_DELTA_LINE,
+        deltaY: 3,
+        ctrlKey: true
+      };
+      synthesizeWheel(element, 5, 5, event);
+    });
+  }
+
+  async function test() {
+    await testControl("button");
+    await testControl("input");
+    await testControl("textarea");
+    await testControl("select");
+    SimpleTest.finish();
+  }
+
+  SimpleTest.waitForExplicitFinish();
+  SimpleTest.waitForFocus(test);
+</script>
+</body>
+</html>