Revert "Merge pull request #1224 from PinZhang/pzhang/resize-canvas"

This reverts commit 13d066c76e, reversing
changes made to 721b0b6ad8.

Conflicts:
	midp/gfx.js
	midp/midp.js
This commit is contained in:
Marco Castelluccio 2015-03-27 12:57:59 +01:00
Родитель 231601c840
Коммит 7711c89d00
9 изменённых файлов: 202 добавлений и 308 удалений

Просмотреть файл

@ -111,173 +111,165 @@
<!-- The raw console is used for unit tests, so it's not visible by default: -->
<pre id="raw-console" style="display: none"></pre>
<div id="display-container">
<div id="display">
<section id="sidebar" data-type="sidebar" style="display:none">
<header>
<h1>Menu</h1>
</header>
<nav>
<ul>
</ul>
</nav>
</section>
<section id="drawer" role="region">
<header style="display:none">
<a href="#"><span class="icon icon-menu">hide sidebar</span></a>
<a id="header-drawer-button" href="#drawer"><span class="icon icon-menu">show sidebar</span></a>
<menu id="header-ok-button" type="toolbar" style="display:none"><button></button></menu>
<h1 id="display_title"></h1>
</header>
<div id="main" role="main">
<canvas id="canvas"></canvas>
<input id="password-editor" class="text-editor" type="password">
<input id="tel-editor" class="text-editor" type="tel">
<input id="number-editor" class="text-editor" type="number">
<input id="email-editor" class="text-editor" type="email">
<input id="url-editor" class="text-editor" type="url">
<div id="textarea-editor" class="text-editor" contenteditable="true"></div>
<!-- The hidden textarea editor is used to measure the content height -->
<div id="hidden-textarea-editor" class="text-editor"></div>
<button id="back-button">Back</button>
</div>
</section>
<div id="gamepad">
<button id="up">up</button>
<button id="down">down</button>
<button id="left">left</button>
<button id="right">right</button>
<button id="fire">fire</button>
<div id="settings">
<section>
<div>BytecodeCount: <span id="bytecodeCount"></span></div>
<div>InterpreterCount: <span id="interpreterCount"></span></div>
<div>CompiledCount: <span id="compiledCount"></span></div>
<div>OnStackReplacementCount: <span id="onStackReplacementCount"></span></div>
<div>UnwindCount: <span id="unwindCount"></span></div>
<div>PreemptionCount: <span id="preemptionCount"></span></div>
</section>
<section>
<select id="loglevel">
<option value="0">Log Level: Trace
<option value="1">Log Level: Log
<option value="2">Log Level: Info
<option value="3">Log Level: Warn
<option value="4">Log Level: Error
<option value="5">Log Level: Silent
</select>
<input id="console-filter-input" type="text" placeholder="Filter Console Output" value="">
<button id="console-clear">Clear console</button>
<button id="console-save">Save console</button>
<label><input type="checkbox" id="perfWriter">Perf</label>
</section>
<section>
<button id="deleteDatabase">Delete Database</button>
<button id="exportstorage">Export storage</button>
<div>Import storage:</div>
<input type="file" id="importstoragefile">
<input type="text" id="importstorageurl" placeholder="URL to FS backup">
<button id="importstorage">Import</button>
<button id="clearCompiledMethodCache">Clear Compiled Method Cache</button>
<button id="printAllExceptions">Print all exceptions: OFF</button>
<button id="clearCounters">Clear Counters</button>
<button id="dumpCounters">Dump Counters</button>
<button id="sampleCounters1">One sample for 1s</button>
<button id="sampleCounters2">One sample for 100ms (2s)</button>
<button id="start">Start</button>
</section>
<!-- #if BENCHMARK == "true" -->
<section id="benchmark">
<button id="benchmark-startup-run">Run Startup Benchmark</button>
<button id="benchmark-startup-baseline">Build Benchmark Baseline</button>
<label><input type="number" min="1" max="100" id="benchmark-num-rounds"> Rounds</label>
<label><input type="number" id="benchmark-round-delay" min="0" max="20000"> Round Delay(ms)</label>
<label><input type="checkbox" id="benchmark-delete-fs">Delete FS before round</label>
<label><input type="checkbox" id="benchmark-delete-jit-cache">Delete JIT cache before round</label>
</section>
<!-- #endif -->
</div>
<div id="display">
<section id="sidebar" data-type="sidebar" style="display:none">
<header>
<h1>Menu</h1>
</header>
<nav>
<ul>
</ul>
</nav>
</section>
<section id="drawer" role="region">
<header style="display:none">
<a href="#"><span class="icon icon-menu">hide sidebar</span></a>
<a id="header-drawer-button" href="#drawer"><span class="icon icon-menu">show sidebar</span></a>
<menu id="header-ok-button" type="toolbar" style="display:none"><button></button></menu>
<h1 id="display_title"></h1>
</header>
<div id="main" role="main">
<canvas id="canvas"></canvas>
<input id="password-editor" class="text-editor" type="password">
<input id="tel-editor" class="text-editor" type="tel">
<input id="number-editor" class="text-editor" type="number">
<input id="email-editor" class="text-editor" type="email">
<input id="url-editor" class="text-editor" type="url">
<div id="textarea-editor" class="text-editor" contenteditable="true"></div>
<!-- The hidden textarea editor is used to measure the content height -->
<div id="hidden-textarea-editor" class="text-editor"></div>
<button id="back-button">Back</button>
</div>
</section>
</div>
<div id="gamepad">
<button id="up">up</button>
<button id="down">down</button>
<button id="left">left</button>
<button id="right">right</button>
<button id="fire">fire</button>
</div>
<div class="splash-screen" id="splash-screen">
<h1 class="title">Loading</h1>
<div class="splash-progress-container">
<progress></progress>
</div>
</div>
<div class="splash-screen" id="exit-screen">
<div class="splash-progress-container">
<progress></progress>
</div>
</div>
<div id="background-screen">
</div>
<form role="dialog" data-type="confirm"
class="lcdui-alert"
id="lcdui-alert" style="display: none">
<section>
<h1 class="title"></h1>
<p class="text"></p>
<p style="border-top: 0"><progress style="display: none"></progress></p>
</section>
<menu>
<button class="button0" style="display: none"></button>
<button class="button1" style="display: none"></button>
</menu>
</form>
<form role="dialog" data-type="confirm"
class="sms-listener-prompt"
id="sms-listener-prompt" style="display: none">
<section>
<h1>SMS Verification</h1>
<p class="verificationText"></p>
<input type="text" placeholder="Type SMS Here">
<p class="timeLeft"></p>
<progress class="timeLeftBar" value="0" max="100"></progress>
</section>
<menu>
<button class="cancel">Cancel</button>
<button class="recommend">Done</button>
</menu>
</form>
<form role="dialog" data-type="confirm"
class="nokia-fileui-prompt"
id="nokia-fileui-prompt" style="display: none">
<section>
<h1>Select a file</h1>
<p><input type="file" name="nokia-fileui-file">
</section>
<menu>
<button class="cancel">Cancel</button>
<button class="recommend">Done</button>
</menu>
</form>
<form role="dialog" data-type="confirm"
class="download-progress-dialog"
id="download-progress-dialog" style="display: none">
<section>
<h1 class="download-dialog-text"></h1>
<progress class="pack-activity" value="0" max="100"></progress>
</section>
<menu>
<button class="recommend" style="display: none">Retry</button>
</menu>
</form>
<div class="splash-screen" id="splash-screen">
<h1 class="title">Loading</h1>
<div class="splash-progress-container">
<progress></progress>
</div>
<div id="settings">
<section>
<div>BytecodeCount: <span id="bytecodeCount"></span></div>
<div>InterpreterCount: <span id="interpreterCount"></span></div>
<div>CompiledCount: <span id="compiledCount"></span></div>
<div>OnStackReplacementCount: <span id="onStackReplacementCount"></span></div>
<div>UnwindCount: <span id="unwindCount"></span></div>
<div>PreemptionCount: <span id="preemptionCount"></span></div>
</section>
<section>
<select id="loglevel">
<option value="0">Log Level: Trace
<option value="1">Log Level: Log
<option value="2">Log Level: Info
<option value="3">Log Level: Warn
<option value="4">Log Level: Error
<option value="5">Log Level: Silent
</select>
<input id="console-filter-input" type="text" placeholder="Filter Console Output" value="">
<button id="console-clear">Clear console</button>
<button id="console-save">Save console</button>
<label><input type="checkbox" id="perfWriter">Perf</label>
</section>
<section>
<button id="deleteDatabase">Delete Database</button>
<button id="exportstorage">Export storage</button>
<div>Import storage:</div>
<input type="file" id="importstoragefile">
<input type="text" id="importstorageurl" placeholder="URL to FS backup">
<button id="importstorage">Import</button>
<button id="clearCompiledMethodCache">Clear Compiled Method Cache</button>
<button id="printAllExceptions">Print all exceptions: OFF</button>
<button id="clearCounters">Clear Counters</button>
<button id="dumpCounters">Dump Counters</button>
<button id="sampleCounters1">One sample for 1s</button>
<button id="sampleCounters2">One sample for 100ms (2s)</button>
<select id="canvasSize">
<option value="" selected>Display size: 240x320</option>
<option value="size-320x240">Display size: 320x240</option>
<option value="size-320x480">Display size: 320x480</option>
<option value="size-480x320">Display size: 480x320</option>
</select>
<button id="start">Start</button>
</div>
</section>
<!-- #if BENCHMARK == "true" -->
<section id="benchmark">
<button id="benchmark-startup-run">Run Startup Benchmark</button>
<button id="benchmark-startup-baseline">Build Benchmark Baseline</button>
<label><input type="number" min="1" max="100" id="benchmark-num-rounds"> Rounds</label>
<label><input type="number" id="benchmark-round-delay" min="0" max="20000"> Round Delay(ms)</label>
<label><input type="checkbox" id="benchmark-delete-fs">Delete FS before round</label>
<label><input type="checkbox" id="benchmark-delete-jit-cache">Delete JIT cache before round</label>
</section>
<!-- #endif -->
<div class="splash-screen" id="exit-screen">
<div class="splash-progress-container">
<progress></progress>
</div>
</div>
</div>
<div id="background-screen">
</div>
<form role="dialog" data-type="confirm"
class="lcdui-alert"
id="lcdui-alert" style="display: none">
<section>
<h1 class="title"></h1>
<p class="text"></p>
<p style="border-top: 0"><progress style="display: none"></progress></p>
</section>
<menu>
<button class="button0" style="display: none"></button>
<button class="button1" style="display: none"></button>
</menu>
</form>
<form role="dialog" data-type="confirm"
class="sms-listener-prompt"
id="sms-listener-prompt" style="display: none">
<section>
<h1>SMS Verification</h1>
<p class="verificationText"></p>
<input type="text" placeholder="Type SMS Here">
<p class="timeLeft"></p>
<progress class="timeLeftBar" value="0" max="100"></progress>
</section>
<menu>
<button class="cancel">Cancel</button>
<button class="recommend">Done</button>
</menu>
</form>
<form role="dialog" data-type="confirm"
class="nokia-fileui-prompt"
id="nokia-fileui-prompt" style="display: none">
<section>
<h1>Select a file</h1>
<p><input type="file" name="nokia-fileui-file">
</section>
<menu>
<button class="cancel">Cancel</button>
<button class="recommend">Done</button>
</menu>
</form>
<form role="dialog" data-type="confirm"
class="download-progress-dialog"
id="download-progress-dialog" style="display: none">
<section>
<h1 class="download-dialog-text"></h1>
<progress class="pack-activity" value="0" max="100"></progress>
</section>
<menu>
<button class="recommend" style="display: none">Retry</button>
</menu>
</form>
</body>

21
main.js
Просмотреть файл

@ -131,11 +131,10 @@ if (config.downloadJAD) {
return;
}
var progressTemplateNode = document.getElementById('download-progress-dialog');
var dialog = progressTemplateNode.cloneNode(true);
var dialog = document.getElementById('download-progress-dialog').cloneNode(true);
dialog.style.display = 'block';
dialog.classList.add('visible');
progressTemplateNode.parentNode.appendChild(dialog);
document.body.appendChild(dialog);
performDownload(config.downloadJAD, dialog, function(data) {
dialog.parentElement.removeChild(dialog);
@ -225,22 +224,6 @@ document.getElementById("start").onclick = function() {
start();
};
document.getElementById("canvasSize").onchange = function() {
Array.prototype.forEach.call(document.body.classList, function(c) {
if (c.indexOf('size-') == 0) {
document.body.classList.remove(c);
}
});
if (this.value) {
document.body.classList.add(this.value);
}
MIDP.updatePhysicalScreenSize();
MIDP.updateCanvas();
start();
};
if (typeof Benchmark !== "undefined") {
Benchmark.initUI("benchmark");
}

Просмотреть файл

@ -1562,12 +1562,10 @@ var currentlyFocusedTextEditor;
Native["javax/microedition/lcdui/AlertLFImpl.createNativeResource0.(Ljava/lang/String;Ljava/lang/String;I)I"] = function(title, ticker, type) {
var nativeId = nextMidpDisplayableId++;
var alertTemplateNode = document.getElementById("lcdui-alert");
var el = alertTemplateNode.cloneNode(true);
var el = document.getElementById("lcdui-alert").cloneNode(true);
el.id = "displayable-" + nativeId;
el.querySelector('h1.title').textContent = J2ME.fromJavaString(title);
alertTemplateNode.parentNode.appendChild(el);
document.body.appendChild(el);
return nativeId;
};

Просмотреть файл

@ -620,8 +620,7 @@ NokiaFileUILocalMsgConnection.prototype.sendMessageToServer = function(message)
throw new Error("Media type '" + mediaType + "' not supported");
}
var promptTemplateNode = document.getElementById('nokia-fileui-prompt');
var el = promptTemplateNode.cloneNode(true);
var el = document.getElementById('nokia-fileui-prompt').cloneNode(true);
el.style.display = 'block';
el.classList.add('visible');
@ -681,7 +680,7 @@ NokiaFileUILocalMsgConnection.prototype.sendMessageToServer = function(message)
});
}).bind(this));
promptTemplateNode.parentNode.appendChild(el);
document.body.appendChild(el);
break;
default:

Просмотреть файл

@ -14,13 +14,6 @@ var MIDP = (function() {
updateCanvas();
};
function updatePhysicalScreenSize() {
if (!config.autosize || /no|0/.test(config.autosize)) {
physicalScreenWidth = document.getElementById('display').clientWidth;
physicalScreenHeight = document.getElementById('display').clientHeight;
}
}
function updateCanvas() {
var sidebar = document.getElementById("sidebar");
var header = document.getElementById("drawer").querySelector("header");
@ -273,8 +266,8 @@ var MIDP = (function() {
window.addEventListener("resize", onWindowResize);
} else {
document.documentElement.classList.add('debug-mode');
physicalScreenWidth = document.getElementById('display').clientWidth;
physicalScreenHeight = document.getElementById('display').clientHeight;
physicalScreenWidth = 240;
physicalScreenHeight = 320;
updateCanvas();
isVKVisible = function() {
@ -650,11 +643,10 @@ var MIDP = (function() {
}
// Perform updating.
var dialogTemplateNode = document.getElementById('download-progress-dialog');
var dialog = dialogTemplateNode.cloneNode(true);
var dialog = document.getElementById('download-progress-dialog').cloneNode(true);
dialog.style.display = 'block';
dialog.classList.add('visible');
dialogTemplateNode.parentNode.appendChild(dialog);
document.body.appendChild(dialog);
performDownload(pendingMIDletUpdate, dialog, function(data) {
dialog.parentElement.removeChild(dialog);
@ -1231,8 +1223,6 @@ var MIDP = (function() {
keyRelease: keyRelease,
displayId: displayId,
context2D: context2D,
updatePhysicalScreenSize: updatePhysicalScreenSize,
updateCanvas: updateCanvas,
localizedStrings: localizedStrings,
};
})();

Просмотреть файл

@ -40,8 +40,7 @@ function receiveSms(text, addr) {
* the app.
*/
function promptForMessageText() {
var smsTemplateNode = document.getElementById('sms-listener-prompt');
var el = smsTemplateNode.cloneNode(true);
var el = document.getElementById('sms-listener-prompt').cloneNode(true);
el.style.display = 'block';
el.classList.add('visible');
@ -91,7 +90,7 @@ function promptForMessageText() {
el.querySelector('p.timeLeft').textContent = toTimeText(MIDlet.SMSDialogTimeout) +
" " + MIDlet.SMSDialogTimeoutText;
smsTemplateNode.parentNode.appendChild(el);
document.body.appendChild(el);
if (currentlyFocusedTextEditor) {
currentlyFocusedTextEditor.blur();
currentlyFocusedTextEditor = null;

Просмотреть файл

@ -886,6 +886,16 @@ Native["com/nokia/mid/impl/jms/core/Launcher.handleContent.(Ljava/lang/String;)V
} else {
mask = document.createElement("div");
mask.id = maskId;
mask.style.position = "absolute";
mask.style.top = 0;
mask.style.left = 0;
mask.style.height = MIDP.context2D.canvas.height + "px";
mask.style.width = MIDP.context2D.canvas.width + "px";
mask.style.backgroundColor = "#000";
mask.style.backgroundPosition = "center center";
mask.style.backgroundRepeat = "no-repeat";
mask.style.backgroundSize = "contain";
mask.onclick = mask.ontouchstart = function() {
_revokeImageURL();
mask.parentNode.removeChild(mask);

Просмотреть файл

@ -3,8 +3,6 @@ html {
padding: 0;
font-family: sans-serif;
font-size: 10px;
height: 100%;
overflow: hidden;
}
body {
@ -14,73 +12,17 @@ body {
height: 100%;
}
#display-container {
position: relative;
float: right;
width: 240px;
height: 100%;
}
#display {
position: relative;
position: fixed;
top: 0px;
right: 0px;
border-bottom: 1px solid #ababab;
width: 100%;
width: 240px;
height: 320px;
z-index: 1;
background: black;
}
/* Set the display size. */
.size-320x240 #display-container {
width: 320px !important;
}
.size-320x240 #pageContainer {
width: calc(100% - 320px) !important;
}
.size-320x240 #display {
height: 240px !important;
}
.size-320x240 #settings {
height: calc(100% - 240px) !important;
}
.size-320x480 #display-container {
width: 320px !important;
}
.size-320x480 #pageContainer {
width: calc(100% - 320px) !important;
}
.size-320x480 #display {
height: 480px !important;
}
.size-320x480 #settings {
height: calc(100% - 480px) !important;
}
.size-480x320 #display-container {
width: 480px !important;
}
.size-480x320 #pageContainer {
width: calc(100% - 480px) !important;
}
.size-480x320 #display {
height: 320px !important;
}
.size-480x320 #settings {
height: calc(100% - 320px) !important;
}
/* Float the back button to the bottom right corner */
#back-button {
position: absolute;
@ -109,9 +51,12 @@ button {
#settings {
background: #f4f4f4;
box-sizing: border-box;
position: fixed;
bottom: 0;
top: 0;
right: 1px;
width: 100%;
height: calc(100% - 320px);
width: 240px;
padding: 320px 0 0;
border-left: 1px solid #ababab;
overflow-y: auto;
}
@ -134,7 +79,6 @@ button {
padding-top: 0.2rem;
padding-bottom: 0.2rem;
font-size: 12px;
text-align: center;
}
.log-item-log {
@ -159,7 +103,7 @@ button {
#gamepad button {
display: none;
position: absolute;
z-index: 102;
z-index: 2;
height: 40px;
width: 40px;
}
@ -172,7 +116,7 @@ button {
.gamepad body > #gamepad {
display: block;
z-index: 102;
z-index: 2;
}
.gamepad body > #gamepad button {
@ -185,15 +129,10 @@ button {
display: none;
}
.autosize #display-container {
position: absolute;
display: block;
overflow: hidden;
width: 100%;
height: 100%;
}
.autosize #display {
overflow: hidden;
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
@ -204,10 +143,6 @@ button {
background: black;
}
.autosize #settings {
display: none;
}
/* Prevent scrolling. */
.autosize, .autosize body {
overflow: hidden;
@ -227,16 +162,6 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
overflow: auto;
}
#image-launcher {
position: absolute;
z-index: 102;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: none center center / contain no-repeat #000;
}
.lcdui-alert menu,
.download-progress-dialog menu {
text-align: center;
@ -244,7 +169,7 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
.splash-screen {
display: none;
z-index: 102;
z-index: 2;
background: #2d2d2d;
overflow: hidden;
color: #fff;
@ -270,7 +195,7 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
}
#background-screen {
z-index: 102;
z-index: 2;
position: absolute;
top: 0;
right: 0;
@ -283,8 +208,8 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
}
.debug-mode #background-screen {
width: 100%;
height: 100%;
width: 240px;
height: 320px;
}
.autosize #background-screen {
@ -309,14 +234,14 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
.debug-mode form[role="dialog"][data-type="confirm"].sms-listener-prompt,
.debug-mode form[role="dialog"][data-type="confirm"].nokia-fileui-prompt,
.debug-mode form[role="dialog"][data-type="confirm"].download-progress-dialog {
position: absolute;
position: fixed;
top: 0px;
right: 0px;
left: auto;
bottom: auto;
width: 100%;
height: 100%;
z-index: 102;
width: 240px;
height: 320px;
z-index: 2;
background: black;
box-sizing: border-box;
}
@ -335,9 +260,9 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
}
.debug-mode .splash-screen {
position: absolute;
width: 100%;
height: 100%;
position: fixed;
width: 240px;
height: 320px;
top: 0px;
right: 0px;
left: auto;
@ -346,14 +271,12 @@ form[role="dialog"][data-type="confirm"].lcdui-alert section {
}
#pageContainer {
position: relative;
position: absolute;
background-color: #333333;
top: 0;
left: 0;
width: calc(100% - 240px);
height: 100%;
float: left;
overflow: hidden;
right: 240px;
bottom: 0;
}
#consoleContainer {

Двоичные данные
tests/gfx/LauncherTest.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB