Bug 894927 - Use xhtml instead of xul for b2g main window. r=ochameau

--HG--
rename : b2g/chrome/content/shell.xul => b2g/chrome/content/shell.html
This commit is contained in:
Fabrice Desré 2013-08-28 14:35:34 -07:00
parent c64a37787e
commit 595ce186af
10 changed files with 69 additions and 49 deletions

View File

@ -4,7 +4,7 @@
#filter substitution
pref("toolkit.defaultChromeURI", "chrome://browser/content/shell.xul");
pref("toolkit.defaultChromeURI", "chrome://browser/content/shell.html");
pref("browser.chromeURL", "chrome://browser/content/");
// Device pixel to CSS px ratio, in percent. Set to -1 to calculate based on display density.

View File

@ -11,7 +11,7 @@ window.addEventListener('ContentStart', function() {
let shell = document.getElementById('shell');
// The <browser> element inside it
let browser = document.getElementById('homescreen');
let browser = document.getElementById('systemapp');
// Figure out the native resolution of the screen
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)

View File

@ -0,0 +1,41 @@
<!DOCTYPE html>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html xmlns="http://www.w3.org/1999/xhtml "
id="shell"
windowtype="navigator:browser"
#ifdef ANDROID
sizemode="fullscreen"
#endif
style="background: black; overflow: hidden; width:100%; height:100%; padding: 0px !important"
onunload="shell.stop();">
<head>
<script type="application/javascript;version=1.8"
src="chrome://browser/content/settings.js"> </script>
<script type="application/javascript;version=1.8"
src="chrome://browser/content/shell.js"> </script>
#ifndef MOZ_WIDGET_GONK
<!-- this script handles the screen argument for desktop builds -->
<script type="application/javascript;version=1.8"
src="chrome://browser/content/screen.js"> </script>
<!-- this script handles the "runapp" argument for desktop builds -->
<script type="application/javascript;version=1.8"
src="chrome://browser/content/runapp.js"> </script>
#endif
</head>
<body id="container" style="margin: 0px; width:100%; height:100%;">
#ifdef MOZ_WIDGET_COCOA
<!--
If the document is empty at startup, we don't display the window
at all on Mac OS...
-->
<h1 id="placeholder">wtf mac os!</h1>
#endif
<!-- The html:iframe containing the UI is created here. -->
</body>
</html>

View File

@ -183,7 +183,7 @@ var shell = {
get contentBrowser() {
delete this.contentBrowser;
return this.contentBrowser = document.getElementById('homescreen');
return this.contentBrowser = document.getElementById('systemapp');
},
get homeURL() {
@ -266,25 +266,29 @@ var shell = {
}
let manifestURL = this.manifestURL;
// <html:iframe id="homescreen"
// <html:iframe id="systemapp"
// mozbrowser="true" allowfullscreen="true"
// style="overflow: hidden; -moz-box-flex: 1; border: none;"
// style="overflow: hidden; height: 100%; width: 100%; border: none;"
// src="data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
let browserFrame =
let systemAppFrame =
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:iframe');
browserFrame.setAttribute('id', 'homescreen');
browserFrame.setAttribute('mozbrowser', 'true');
browserFrame.setAttribute('mozapp', manifestURL);
browserFrame.setAttribute('allowfullscreen', 'true');
browserFrame.setAttribute('style', "overflow: hidden; -moz-box-flex: 1; border: none;");
browserFrame.setAttribute('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;");
document.getElementById('shell').appendChild(browserFrame);
systemAppFrame.setAttribute('id', 'systemapp');
systemAppFrame.setAttribute('mozbrowser', 'true');
systemAppFrame.setAttribute('mozapp', manifestURL);
systemAppFrame.setAttribute('allowfullscreen', 'true');
systemAppFrame.setAttribute('style', "overflow: hidden; height: 100%; width: 100%; border: none;");
systemAppFrame.setAttribute('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;");
let container = document.getElementById('container');
#ifdef MOZ_WIDGET_COCOA
container.removeChild(document.getElementById('placeholder'));
#endif
container.appendChild(systemAppFrame);
browserFrame.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
.createInstance(Ci.nsISHistory);
systemAppFrame.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
.createInstance(Ci.nsISHistory);
// Capture all key events so we can filter out hardware buttons
// And send them to Gaia via mozChromeEvents.

View File

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="shell"
windowtype="navigator:browser"
#ifdef ANDROID
sizemode="fullscreen"
#endif
style="background: black; overflow: hidden; width:320px; height:480px"
onunload="shell.stop();">
<script type="application/javascript" src="chrome://browser/content/settings.js"/>
<script type="application/javascript" src="chrome://browser/content/shell.js"/>
#ifndef MOZ_WIDGET_GONK
<!-- this script handles the screen argument for desktop builds -->
<script type="application/javascript" src="chrome://browser/content/screen.js"/>
<!-- this script handles the "runapp" argument for desktop builds -->
<script type="application/javascript" src="chrome://browser/content/runapp.js"/>
#endif
<!-- The html:iframe containing the UI is created here. -->
</window>

View File

@ -12,7 +12,7 @@ chrome.jar:
* content/dbg-browser-actors.js (content/dbg-browser-actors.js)
content/forms.js (content/forms.js)
* content/settings.js (content/settings.js)
* content/shell.xul (content/shell.xul)
* content/shell.html (content/shell.html)
* content/shell.js (content/shell.js)
#ifndef ANDROID
content/screen.js (content/screen.js)

View File

@ -272,7 +272,7 @@ this.OnRefTestLoad = function OnRefTestLoad(win)
#if BOOTSTRAP
#if REFTEST_B2G
var doc = gContainingWindow.document.getElementsByTagName("window")[0];
var doc = gContainingWindow.document.getElementsByTagName("html")[0];
#else
var doc = gContainingWindow.document.getElementById('main-window');
#endif

View File

@ -13,7 +13,8 @@ class testElementTouch(MarionetteTestCase):
button.tap()
expected = "button1-touchstart-touchend-mousemove-mousedown-mouseup-click"
self.wait_for_condition(lambda m: m.execute_script("return document.getElementById('button1').innerHTML;") == expected)
button.tap(0, 300)
button = self.marionette.find_element("id", "button2")
button.tap()
expected = "button2-touchstart-touchend-mousemove-mousedown-mouseup-click"
self.wait_for_condition(lambda m: m.execute_script("return document.getElementById('button2').innerHTML;") == expected)

View File

@ -9,7 +9,7 @@ const CHILD_SCRIPT = "chrome://specialpowers/content/specialpowers.js";
const CHILD_SCRIPT_API = "chrome://specialpowers/content/specialpowersAPI.js";
const CHILD_LOGGER_SCRIPT = "chrome://specialpowers/content/MozillaLogger.js";
let homescreen = document.getElementById('homescreen');
let homescreen = document.getElementById('systemapp');
let container = homescreen.contentWindow.document.getElementById('test-container');
function openWindow(aEvent) {

View File

@ -409,7 +409,7 @@ toolbar#nav-bar {
if options.browserChrome or options.chrome or options.a11y or options.webapprtChrome:
chrome += """
overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://browser/content/shell.xul chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://browser/content/shell.xhtml chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://webapprt/content/webapp.xul chrome://mochikit/content/browser-test-overlay.xul
"""