Orientation change

Cherry-picked commits from https://github.com/tmeshkova/mozilla-central/pull/48