Skip to content

Commit

Permalink
Bug 861846 - Landscape orientation locked apps render portrait in the…
Browse files Browse the repository at this point in the history
… task manager, which breaks the view of the app
  • Loading branch information
crdlc committed Apr 17, 2013
1 parent cc0e498 commit d05f1ef
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
20 changes: 16 additions & 4 deletions apps/system/js/cards_view.js
Expand Up @@ -205,6 +205,12 @@ var CardsView = (function() {
card.classList.add('card');
card.dataset.origin = origin;

var landscape = WindowManager.getOrientationForApp(origin) ===
'landscape-primary';
if (landscape) {
card.classList.add('landscape');
}

//display app icon on the tab
if (DISPLAY_APP_ICON) {
var iconURI = getIconURI(origin);
Expand Down Expand Up @@ -265,6 +271,16 @@ var CardsView = (function() {
card.style.backgroundImage = 'url(' + cachedLayer + ')';
}

// Set up event handling
// A click elsewhere in the card switches to that task
card.addEventListener('tap', runApp);

// We cannot take a screenshot here for landscape apps because the mobile
// is on portrait
if (landscape) {
return;
}

// rect is the final size (considering CSS transform) of the card.
var rect = card.getBoundingClientRect();

Expand All @@ -289,10 +305,6 @@ var CardsView = (function() {
}, 200);
}
};

// Set up event handling
// A click elsewhere in the card switches to that task
card.addEventListener('tap', runApp);
}
}

Expand Down
8 changes: 8 additions & 0 deletions apps/system/js/window_manager.js
Expand Up @@ -2158,6 +2158,14 @@ var WindowManager = (function() {
getCurrentDisplayedApp: function() {
return runningApps[displayedApp];
},
getOrientationForApp: function(origin) {
var app = runningApps[origin];

if (!app)
return;

return app.manifest.orientation;
},
hideCurrentApp: hideCurrentApp,
restoreCurrentApp: restoreCurrentApp,
retrieveHomescreen: retrieveHomescreen,
Expand Down
8 changes: 8 additions & 0 deletions apps/system/style/cards_view/cards_view.css
Expand Up @@ -28,6 +28,7 @@
}

#cards-view .card {
vertical-align: top;
display: inline-block;
width: 100%;
height: -moz-calc(100% - 20px);
Expand All @@ -41,6 +42,13 @@
transform: scale(0.6);
}

#cards-view .card.landscape {
/* calc(32rem * 0.6) */
height: 19.2rem;
/* calc(32rem * 0.6) -4rem */
margin-top: 15.2rem;
}

#cards-view .card h1 {
position: absolute;
top: 1.5rem;
Expand Down

0 comments on commit d05f1ef

Please sign in to comment.