Bug 619019 - Use -moz-device-orientation when needed [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Wed, 15 Dec 2010 14:15:42 -0500
changeset 67116 8585e9912b6c116af1a6fa9c86d424f040522f32
parent 67115 11299d62079572fcda669de30bd8b1843a1d4c12
child 67117 a24571f5c880b9910e60bac46420a60721acca36
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs619019
Bug 619019 - Use -moz-device-orientation when needed [r=mbrubeck]
mobile/chrome/content/Util.js
mobile/themes/core/browser.css
--- a/mobile/chrome/content/Util.js
+++ b/mobile/chrome/content/Util.js
@@ -162,17 +162,23 @@ let Util = {
   },
 
   isParentProcess: function isInParentProcess() {
     let appInfo = Cc["@mozilla.org/xre/app-info;1"];
     return (!appInfo || appInfo.getService(Ci.nsIXULRuntime).processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT);
   },
 
   isPortrait: function isPortrait() {
-    return (window.innerWidth < 500);
+#ifdef MOZ_PLATFORM_MAEMO
+    return (screen.width <= screen.height);
+#elifdef ANDROID
+    return (screen.width <= screen.height);
+#else
+    return (window.innerWidth <= window.innerHeight);
+#endif
   }
 };
 
 
 /**
  * Helper class to nsITimer that adds a little more pizazz.  Callback can be an
  * object with a notify method or a function.
  */
--- a/mobile/themes/core/browser.css
+++ b/mobile/themes/core/browser.css
@@ -30,16 +30,24 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+%ifdef MOZ_PLATFORM_MAEMO
+%define ORIENTATION -moz-device-orientation
+%elifdef ANDROID
+%define ORIENTATION -moz-device-orientation
+%else
+%define ORIENTATION orientation
+%endif
+
 /* main toolbar (URL bar) -------------------------------------------------- */
 #toolbar-main {
   -moz-appearance: none;
   -moz-box-align: center;
   padding: 0;
   border: none;
   background: #5e6166;
 }
@@ -451,24 +459,24 @@ toolbarbutton.choice-remotetabs {
 }
 
 /* bug 597296 - The language.properties file is LTR and never translated */
 #prefs-languages .menulist-label {
   direction: ltr !important;
 }
 
 /* addons panel UI   ------------------------------------------------------- */
-@media (min-width: 500px) {
+%expand @media (__ORIENTATION__: landscape) {
   #addons-repo {
     -moz-box-orient: horizontal;
     -moz-box-align: center;
   }
 }
 
-@media (max-width: 499px) {
+%expand @media (__ORIENTATION__: portrait) {
   #addons-repo {
     -moz-box-orient: vertical;
     -moz-box-pack: center;
   }
 }
 
 .addon-image {
   list-style-image: url("chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png");
@@ -1202,17 +1210,17 @@ pageaction:not([image]) > hbox >.pageact
   -moz-margin-start: 16px;
 }
 
 .setting-subgroup + :not(.setting-subgroup) > .prefbox {
   border-top: 1px solid rgb(207,207,207);
 }
 
 /* Put setting textboxes on a separate row in portrait */
-@media (max-width: 499px) {
+%expand @media (__ORIENTATION__: portrait) {
   .setting-integer,
   .setting-string {
     -moz-box-align: start;
     -moz-box-orient: vertical;
   }
 
   .setting-integer > .setting-input > textbox,
   .setting-string > .setting-input > textbox {