Skip to content

Commit

Permalink
POC Bug 1112574 - EdgeSwipe/InputMgmt
Browse files Browse the repository at this point in the history
Add debug codes
  • Loading branch information
John Lu [:mnjul] committed Dec 19, 2014
1 parent 2ddef6f commit f6ab892
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
49 changes: 47 additions & 2 deletions apps/system/js/app_window.js
Expand Up @@ -293,19 +293,40 @@
* @return {Boolean} The instance is active or not.
*/
AppWindow.prototype.isActive = function aw_isActive() {
if (this.url.indexOf('sms') >= 0) {
console.trace();
console.log("AW isActive: 1");
}

if (!this.element) {
return false;
}

if (this.url.indexOf('sms') >= 0) {
console.log("AW isActive: 2");
}

if (this.element.classList.contains('will-become-active')) {
return true;
}

if (this.url.indexOf('sms') >= 0) {
console.log("AW isActive: 3");
}

if (this.element.classList.contains('will-become-inactive')) {
return false;
}

if (this.url.indexOf('sms') >= 0) {
console.log("AW isActive: 4");
}

if (this.transitionController) {
if (this.url.indexOf('sms') >= 0) {
console.log("AW isActive: 5; transitionState: ", this.transitionController._transitionState);
}

return (this.transitionController._transitionState == 'opened' ||
this.transitionController._transitionState == 'opening');
} else {
Expand Down Expand Up @@ -1470,18 +1491,42 @@
* ![AppWindow resize flow chart](http://i.imgur.com/bUMm4VM.png)
*/
AppWindow.prototype.resize = function aw_resize() {
if (this.url.indexOf('sms') >= 0) {
console.log("AW resize 1");
console.trace();
}
if (this.isDead()) {
return;
}
this.debug('request RESIZE...active? ', this.isActive());
if (this.url.indexOf('sms') >= 0) {
console.log("AW resize 2");
console.log('request RESIZE...active? ', this.isActive());
}
var bottom = this.getBottomMostWindow();
if (!bottom.isActive() || this.isTransitioning()) {

var bottomAct;
var isTrans;
if (this.url.indexOf('sms') >= 0) {
console.log("bottom.isActive(): ", bottomAct = bottom.isActive());
console.log("this.isTransitioning(): ", isTrans = this.isTransitioning());
}

if (!bottomAct || isTrans) {
return;
}
if (this.url.indexOf('sms') >= 0) {
console.log("AW resize 3");
}
if (this.frontWindow) {
if (this.url.indexOf('sms') >= 0) {
console.log("AW resize 4");
}
this._resize();
this.frontWindow.resize();
} else {
if (this.url.indexOf('sms') >= 0) {
console.log("AW resize 5");
}
// resize myself if no child.
this.debug(' will resize... ');
this._resize();
Expand Down
4 changes: 4 additions & 0 deletions apps/system/js/app_window_manager.js
Expand Up @@ -446,9 +446,13 @@
},

'_handle_system-resize': function() {
console.log("AWM system-resize 1");
if (this._activeApp) {
console.log("AWM system-resize 2");
this.debug(' Resizing ' + this._activeApp.name);
if (!this._activeApp.isTransitioning()) {
console.log("AWM system-resize 3");
console.log("AWM system-resize this._activeApp", this._activeApp);
this._activeApp.resize();
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions apps/system/js/input_window_manager.js
Expand Up @@ -203,6 +203,7 @@
}

inputWindow._setAsActiveInput(false);

if (!this._currentWindow) {
this._kbPublish('keyboardhidden', undefined);
}
Expand Down Expand Up @@ -463,6 +464,8 @@
}
};

console.log("InputWindowManager, kbPublish: ", type);

// We dispatch the events at the body level so we are able to intercept
// them and prevent page resizing where desired.
var evt = new CustomEvent(type, eventInitDict);
Expand Down
5 changes: 5 additions & 0 deletions apps/system/js/layout_manager.js
Expand Up @@ -62,6 +62,9 @@
height = Math.ceil(height * dpx) / dpx;
}

console.log("LayoutManager height getter, got height: ", height);
console.trace();

return height;
},

Expand Down Expand Up @@ -141,6 +144,7 @@
},

handleEvent: function lm_handleEvent(evt) {
console.log('LayoutManager, got: ', evt.type);
this.debug('resize event got: ', evt.type);
switch (evt.type) {
case 'keyboardchange':
Expand Down Expand Up @@ -176,6 +180,7 @@
if (evt.type === 'keyboardhide') {
this.keyboardEnabled = false;
}
console.log("LayoutManager, publishing system-resize");
this.publish('system-resize');
break;
}
Expand Down

0 comments on commit f6ab892

Please sign in to comment.