From 715503655ce940039280707a3d1bc6551cc23b60 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Wed, 24 Jun 2009 12:42:53 -0400 Subject: [PATCH] Bug 472426: listbox is rendered outside the fennec window, r=gavin --- mobile/chrome/content/bindings.xml | 175 ++++++++++++++++++ mobile/chrome/content/browser-ui.js | 130 +++++++++++++ mobile/chrome/content/browser.css | 4 + mobile/chrome/content/browser.js | 16 +- mobile/chrome/content/browser.xul | 9 +- mobile/chrome/content/content.css | 132 ++++++++----- .../content/{scrollbars.css => cursor.css} | 98 +++++----- mobile/chrome/jar.mn | 2 +- mobile/locales/en-US/chrome/browser.dtd | 3 + mobile/themes/hildon/browser.css | 47 +++++ .../themes/hildon/images/check-default-30.png | Bin 0 -> 341 bytes mobile/themes/hildon/jar.mn | 3 +- mobile/themes/wince/browser.css | 47 +++++ .../themes/wince/images/check-default-30.png | Bin 0 -> 341 bytes mobile/themes/wince/jar.mn | 3 +- 15 files changed, 559 insertions(+), 110 deletions(-) rename mobile/chrome/content/{scrollbars.css => cursor.css} (78%) create mode 100644 mobile/themes/hildon/images/check-default-30.png create mode 100644 mobile/themes/wince/images/check-default-30.png diff --git a/mobile/chrome/content/bindings.xml b/mobile/chrome/content/bindings.xml index ae7a203d5d9..358864b1a36 100644 --- a/mobile/chrome/content/bindings.xml +++ b/mobile/chrome/content/bindings.xml @@ -963,4 +963,179 @@ + + + + + + + + + + + + + + + + + "&selectListDisplay.format;" + + + document.getAnonymousElementByAttribute(this, "anonid", "select-label"); + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + = options.length) + index = 0; + } + this.selectedIndex = index; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 69672053322..65df1822ee8 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -263,6 +263,7 @@ var BrowserUI = { let browsers = document.getElementById("browsers"); browsers.addEventListener("DOMTitleChanged", this, true); browsers.addEventListener("DOMLinkAdded", this, true); + browsers.addEventListener("UIShowSelect", this, false, true); document.getElementById("tabs").addEventListener("TabSelect", this, true); @@ -490,6 +491,9 @@ var BrowserUI = { case "DOMLinkAdded": this._linkAdded(aEvent); break; + case "UIShowSelect": + SelectHelper.show(aEvent.target); + break; case "TabSelect": this._tabSelect(aEvent); break; @@ -776,3 +780,129 @@ var FolderPicker = { this.close(); } }; + +var SelectHelper = { + _panel: null, + _list: null, + _control: null, + _selectedIndex: -1, + + show: function(aControl) { + if (!aControl) + return; + + this._control = aControl; + this._selectedIndex = this._control.selectedIndex; + + this._list = document.getElementById("select-list"); + this._list.setAttribute("multiple", this._control.multiple ? "true" : "false") + + let optionIndex = 0; + let children = this._control.children; + for (let i=0; i option { + -moz-binding: url("chrome://browser/content/bindings.xml#chrome-select-option"); +} + /* richlist defaults ------------------------------------------------------- */ richlistitem { padding: 5px; diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 3cf34346a2a..dcb1b09edc2 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -83,7 +83,7 @@ var Browser = { // during startup a lot of viewportHandler calls happen due to content and window resizes ws.beginUpdateBatch(); - + function panHandler(vr, dx, dy) { if (dx) { let visibleNow = ws.isWidgetVisible("tabs-container") || ws.isWidgetVisible("browser-controls"); @@ -116,7 +116,7 @@ var Browser = { return; let h = window.innerHeight; - + // Tell the UI to resize the browser controls before calling updateSize BrowserUI.sizeControls(w, h); @@ -134,7 +134,7 @@ var Browser = { browserStyle.height = scaledH + "px"; } } - + ws.updateSize(w, h); } window.addEventListener("resize", resizeHandler, false); @@ -160,12 +160,12 @@ var Browser = { if (hideCursor) { window.QueryInterface(Ci.nsIDOMChromeWindow).setCursor("none"); - var styleURI = ios.newURI("chrome://browser/content/content.css", null, null); + var styleURI = ios.newURI("chrome://browser/content/cursor.css", null, null); styleSheets.loadAndRegisterSheet(styleURI, styleSheets.AGENT_SHEET); } // load styles for scrollbars - var styleURI = ios.newURI("chrome://browser/content/scrollbars.css", null, null); + var styleURI = ios.newURI("chrome://browser/content/content.css", null, null); styleSheets.loadAndRegisterSheet(styleURI, styleSheets.AGENT_SHEET); var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); @@ -235,7 +235,7 @@ var Browser = { if (whereURI) this.addTab(whereURI, true); } - + // JavaScript Error Console if (gPrefService.getBoolPref("browser.console.showInPanel")){ let tool_console = document.getElementById("tool-console"); @@ -1242,7 +1242,7 @@ ProgressController.prototype = { if (Browser._isStartup) { // force the urlbar into position ws.panTo(0, -BrowserUI.toolbarH); - + // now we can set the viewport to a real size and draw the page ws.endUpdateBatch(); Browser._isStartup = false; @@ -1367,7 +1367,7 @@ Tab.prototype = { browser.setAttribute("type", "content"); browser.setAttribute("src", uri); - // Attach the popup contextmenu + // Attach the popup contextmenu let canvas = document.getElementById("browser-canvas"); browser.setAttribute("contextmenu", canvas.getAttribute("contextmenu")); let autocompletepopup = canvas.getAttribute("autocompletepopup"); diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul index 8162007e86e..79571332092 100644 --- a/mobile/chrome/content/browser.xul +++ b/mobile/chrome/content/browser.xul @@ -173,7 +173,7 @@ - + @@ -406,6 +406,13 @@ +