Backed out changeset d192030869ef (bug 1266414) for eslint failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 12 Jul 2016 13:11:26 +0200
changeset 304600 829e9870eb1d9cd4e5acb894350d4bfc12e3345d
parent 304599 50bfdf605c5597c517e7a6b43f2f1b1bb2e7f5cc
child 304601 1f72857d283cfb5f7efd870cce464a10c5fb618c
push id19961
push usercbook@mozilla.com
push dateTue, 12 Jul 2016 11:11:36 +0000
treeherderfx-team@829e9870eb1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1266414
milestone50.0a1
backs outd192030869ef289c9fc5e9bdfcea37f2a24f7967
Backed out changeset d192030869ef (bug 1266414) for eslint failures
devtools/client/responsive.html/components/device-modal.js
devtools/client/responsive.html/index.css
--- a/devtools/client/responsive.html/components/device-modal.js
+++ b/devtools/client/responsive.html/components/device-modal.js
@@ -20,38 +20,30 @@ module.exports = createClass({
   },
 
   mixins: [ addons.PureRenderMixin ],
 
   getInitialState() {
     return {};
   },
 
-  componentDidMount() {
-    window.addEventListener("keydown", this.onKeyDown, true);
-  },
-
   componentWillReceiveProps(nextProps) {
     let {
       devices,
     } = nextProps;
 
     for (let type of devices.types) {
       for (let device of devices[type]) {
         this.setState({
           [device.name]: device.displayed,
         });
       }
     }
   },
 
-  componentWillUnmount() {
-    window.removeEventListener("keydown", this.onKeyDown, true);
-  },
-
   onDeviceCheckboxClick({ target }) {
     this.setState({
       [target.value]: !this.state[target.value]
     });
   },
 
   onDeviceModalSubmit() {
     let {
@@ -81,99 +73,80 @@ module.exports = createClass({
         }
       }
     }
 
     onDeviceListUpdate(preferredDevices);
     onUpdateDeviceModalOpen(false);
   },
 
-  onKeyDown(event) {
-    if (!this.props.devices.isModalOpen) {
-      return;
-    }
-    // Escape keycode
-    if (event.keyCode === 27) {
-      let {
-        onUpdateDeviceModalOpen
-      } = this.props;
-      onUpdateDeviceModalOpen(false);
-    }
-  },
-
   render() {
     let {
       devices,
       onUpdateDeviceModalOpen,
     } = this.props;
 
+    let modalClass = "device-modal container";
+
+    if (!devices.isModalOpen) {
+      modalClass += " hidden";
+    }
+
     const sortedDevices = {};
     for (let type of devices.types) {
       sortedDevices[type] = Object.assign([], devices[type])
         .sort((a, b) => a.name.localeCompare(b.name));
     }
 
     return dom.div(
       {
-        id: "device-modal-wrapper",
-        className: this.props.devices.isModalOpen ? "opened" : "closed",
+        className: modalClass,
       },
+      dom.button({
+        id: "device-close-button",
+        className: "toolbar-button devtools-button",
+        onClick: () => onUpdateDeviceModalOpen(false),
+      }),
       dom.div(
         {
-          className: "device-modal container",
+          className: "device-modal-content",
         },
-        dom.button({
-          id: "device-close-button",
-          className: "toolbar-button devtools-button",
-          onClick: () => onUpdateDeviceModalOpen(false),
-        }),
-        dom.div(
-          {
-            className: "device-modal-content",
-          },
-          devices.types.map(type => {
-            return dom.div(
+        devices.types.map(type => {
+          return dom.div(
+            {
+              className: "device-type",
+              key: type,
+            },
+            dom.header(
               {
-                className: "device-type",
-                key: type,
+                className: "device-header",
               },
-              dom.header(
+              type
+            ),
+            sortedDevices[type].map(device => {
+              return dom.label(
                 {
-                  className: "device-header",
+                  className: "device-label",
+                  key: device.name,
                 },
-                type
-              ),
-              sortedDevices[type].map(device => {
-                return dom.label(
-                  {
-                    className: "device-label",
-                    key: device.name,
-                  },
-                  dom.input({
-                    className: "device-input-checkbox",
-                    type: "checkbox",
-                    value: device.name,
-                    checked: this.state[device.name],
-                    onChange: this.onDeviceCheckboxClick,
-                  }),
-                  device.name
-                );
-              })
-            );
-          })
-        ),
-        dom.button(
-          {
-            id: "device-submit-button",
-            onClick: this.onDeviceModalSubmit,
-          },
-          getStr("responsive.done")
-        )
+                dom.input({
+                  className: "device-input-checkbox",
+                  type: "checkbox",
+                  value: device.name,
+                  checked: this.state[device.name],
+                  onChange: this.onDeviceCheckboxClick,
+                }),
+                device.name
+              );
+            })
+          );
+        })
       ),
-      dom.div(
+      dom.button(
         {
-          className: "modal-overlay",
-          onClick: () => onUpdateDeviceModalOpen(false),
-        }
+          id: "device-submit-button",
+          onClick: this.onDeviceModalSubmit,
+        },
+        getStr("responsive.done")
       )
     );
   },
 });
--- a/devtools/client/responsive.html/index.css
+++ b/devtools/client/responsive.html/index.css
@@ -34,29 +34,30 @@
 }
 
 * {
   box-sizing: border-box;
 }
 
 #root,
 html, body {
-  height: 100%;
   margin: 0;
 }
 
 #app {
   /* Center the viewports container */
   display: flex;
   align-items: center;
   flex-direction: column;
-  padding-top: 15px;
-  padding-bottom: 1%;
-  position: relative;
-  height: 100%;
+  height: 100vh;
+
+  /* Snap to the top of the app when there isn't enough vertical space anymore
+     to center the viewports (so we don't lose the global toolbar) */
+  position: sticky;
+  top: 0;
 }
 
 /**
  * Common style for containers and toolbar buttons
  */
 
 .container {
   background-color: var(--theme-toolbar-background);
@@ -80,17 +81,17 @@ html, body {
 /**
  * Global Toolbar
  */
 
 #global-toolbar {
   color: var(--theme-body-color-alt);
   border-radius: 2px;
   box-shadow: var(--rdm-box-shadow);
-  margin: 0 0 15px 0;
+  margin: 10% 0 30px 0;
   padding: 4px 5px;
   display: inline-flex;
   -moz-user-select: none;
 }
 
 #global-toolbar > .title {
   border-right: 1px solid var(--theme-splitter-color);
   padding: 1px 6px 0 2px;
@@ -330,76 +331,31 @@ html, body {
 .viewport-dimension-separator {
   -moz-user-select: none;
 }
 
 /**
  * Device Modal
  */
 
-@keyframes fade-in-and-up {
-  0% {
-    opacity: 0;
-    transform: translateY(5px);
-  }
-  100% {
-    opacity: 1;
-    transform: translateY(0px);
-  }
-}
-
-@keyframes fade-down-and-out {
-  0% {
-    opacity: 1;
-    transform: translateY(0px);
-  }
-  100% {
-    opacity: 0;
-    transform: translateY(5px);
-    visibility: hidden;
-  }
-}
-
 .device-modal {
   border-radius: 2px;
   box-shadow: var(--rdm-box-shadow);
-  display: none;
   position: absolute;
   margin: auto;
   top: 0;
   bottom: 0;
   left: 0;
   right: 0;
   width: 642px;
   height: 612px;
-  z-index: 1;
-}
-
-/* Handles the opening/closing of the modal */
-#device-modal-wrapper.opened .device-modal {
-  animation: fade-in-and-up 0.3s ease;
-  animation-fill-mode: forwards;
-  display: block;
 }
 
-#device-modal-wrapper.closed .device-modal {
-  animation: fade-down-and-out 0.3s ease;
-  animation-fill-mode: forwards;
-  display: block;
-}
-
-#device-modal-wrapper.opened .modal-overlay {
-  background-color: var(--theme-splitter-color);
-  position: absolute;
-  top: 0;
-  left: 0;
-  height: 100%;
-  width: 100%;
-  z-index: 0;
-  opacity: 0.5;
+.device-modal.hidden {
+  display: none;
 }
 
 .device-modal-content {
   display: flex;
   flex-direction: column;
   flex-wrap: wrap;
   overflow: auto;
   height: 550px;