Merge lp:~osomon/webbrowser-app/exit-fullscreen-bg into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Bill Filler
Approved revision: 973
Merged at revision: 978
Proposed branch: lp:~osomon/webbrowser-app/exit-fullscreen-bg
Merge into: lp:webbrowser-app
Diff against target: 173 lines (+95/-5)
2 files modified
src/app/webbrowser/Browser.qml (+78/-3)
tests/autopilot/webbrowser_app/tests/test_fullscreen.py (+17/-2)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/exit-fullscreen-bg
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+256025@code.launchpad.net

Commit message

Always exit fullscreen mode when the application becomes inactive.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
967. By Olivier Tilloy

Display a hint when entering fullscreen to inform the user how to exit.

968. By Olivier Tilloy

Actually exit fullscreen mode when dragging the bottom edge upwards.

969. By Olivier Tilloy

Show the bottom edge hint while the text message is visible.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
970. By Olivier Tilloy

On non-mobile form factors, hook up the ESC key to exiting fullscreen.

971. By Olivier Tilloy

Do not delay the destruction of the hint when exiting fullscreen.

972. By Olivier Tilloy

New autopilot test to exit fullscreen.

973. By Olivier Tilloy

Remove superfluous comment.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

works well

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/Browser.qml'
2--- src/app/webbrowser/Browser.qml 2015-04-07 17:10:56 +0000
3+++ src/app/webbrowser/Browser.qml 2015-04-17 15:49:06 +0000
4@@ -129,6 +129,13 @@
5 top: recentView.visible ? invisibleTabChrome.bottom : parent.top
6 }
7 height: parent.height - osk.height - (recentView.visible ? invisibleTabChrome.height : 0)
8+
9+ Keys.onEscapePressed: {
10+ if (browser.currentWebview && browser.currentWebview.fullscreen) {
11+ event.accepted = true
12+ browser.currentWebview.fullscreen = false
13+ }
14+ }
15 }
16
17 Loader {
18@@ -399,10 +406,14 @@
19
20 enabled: (formFactor == "mobile") && (recentView.state == "") &&
21 (Screen.orientation == Screen.primaryOrientation) &&
22- browser.currentWebview && !browser.currentWebview.fullscreen
23+ browser.currentWebview
24
25 onDraggingChanged: {
26- if (!dragging) {
27+ if (dragging) {
28+ if (browser.currentWebview) {
29+ browser.currentWebview.fullscreen = false
30+ }
31+ } else {
32 if (stage == 1) {
33 if (tabsModel.count > 1) {
34 tabslist.selectAndAnimateTab(1)
35@@ -422,12 +433,14 @@
36 }
37
38 Image {
39+ id: bottomEdgeHint
40 objectName: "bottomEdgeHint"
41 source: (formFactor == "mobile") ? "assets/bottom_edge_hint.png" : ""
42+ property bool forceShow: false
43 anchors {
44 horizontalCenter: parent.horizontalCenter
45 bottom: parent.bottom
46- bottomMargin: (chrome.state == "shown") ? 0 : -height
47+ bottomMargin: (((chrome.state == "shown") && browser.currentWebview && !browser.currentWebview.fullscreen) || forceShow) ? 0 : -height
48 Behavior on bottomMargin {
49 UbuntuNumberAnimation {}
50 }
51@@ -643,6 +656,65 @@
52 }
53 }
54
55+ onFullscreenChanged: {
56+ if (fullscreen) {
57+ fullscreenExitHintComponent.createObject(webviewimpl)
58+ }
59+ }
60+ Component {
61+ id: fullscreenExitHintComponent
62+
63+ Rectangle {
64+ id: fullscreenExitHint
65+ objectName: "fullscreenExitHint"
66+
67+ anchors.centerIn: parent
68+ height: units.gu(6)
69+ width: Math.min(units.gu(50), parent.width - units.gu(12))
70+ radius: units.gu(1)
71+ color: "#3e3b39"
72+ opacity: 0.85
73+
74+ Behavior on opacity {
75+ UbuntuNumberAnimation {
76+ duration: UbuntuAnimation.SlowDuration
77+ }
78+ }
79+ onOpacityChanged: {
80+ if (opacity == 0.0) {
81+ fullscreenExitHint.destroy()
82+ }
83+ }
84+
85+ Label {
86+ color: "white"
87+ font.weight: Font.Light
88+ anchors.centerIn: parent
89+ text: (formFactor == "mobile") ?
90+ i18n.tr("Swipe Up To Exit Full Screen") :
91+ i18n.tr("Press ESC To Exit Full Screen")
92+ }
93+
94+ Timer {
95+ running: true
96+ interval: 2000
97+ onTriggered: fullscreenExitHint.opacity = 0
98+ }
99+
100+ Connections {
101+ target: webviewimpl
102+ onFullscreenChanged: {
103+ if (!webviewimpl.fullscreen) {
104+ fullscreenExitHint.destroy()
105+ }
106+ }
107+ }
108+
109+ Component.onCompleted: bottomEdgeHint.forceShow = true
110+ Component.onDestruction: bottomEdgeHint.forceShow = false
111+ }
112+ }
113+
114 Loader {
115 id: newTabViewLoader
116 anchors.fill: parent
117@@ -818,6 +890,9 @@
118 onStateChanged: {
119 if (Qt.application.state != Qt.ApplicationActive) {
120 session.save()
121+ if (browser.currentWebview) {
122+ browser.currentWebview.fullscreen = false
123+ }
124 }
125 }
126 onAboutToQuit: session.save()
127
128=== modified file 'tests/autopilot/webbrowser_app/tests/test_fullscreen.py'
129--- tests/autopilot/webbrowser_app/tests/test_fullscreen.py 2014-12-13 02:46:27 +0000
130+++ tests/autopilot/webbrowser_app/tests/test_fullscreen.py 2015-04-17 15:49:06 +0000
131@@ -1,6 +1,6 @@
132 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
133 #
134-# Copyright 2014 Canonical
135+# Copyright 2014-2015 Canonical
136 #
137 # This program is free software: you can redistribute it and/or modify it
138 # under the terms of the GNU General Public License version 3, as published
139@@ -18,11 +18,12 @@
140
141 from testtools.matchers import Equals, LessThan
142 from autopilot.matchers import Eventually
143+from autopilot.platform import model
144
145
146 class TestFullscreen(StartOpenRemotePageTestCaseBase):
147
148- # Ref: http://qt-project.org/doc/qt-5/qwindow.html#Visibility-enum
149+ # Ref: http://doc.qt.io/qt-5/qwindow.html#Visibility-enum
150 QWINDOW_FULLSCREEN = 5
151
152 def assert_eventually_windowed(self):
153@@ -46,6 +47,20 @@
154 webview = self.main_window.get_current_webview()
155 self.pointing_device.click_object(webview)
156 self.assert_eventually_fullscreen()
157+ hint = webview.wait_select_single(objectName="fullscreenExitHint")
158+ self.pointing_device.click_object(webview)
159+ self.assert_eventually_windowed()
160+ hint.wait_until_destroyed()
161+
162+ def test_exit_fullscreen(self):
163+ url = self.base_url + "/fullscreen"
164+ self.main_window.go_to_url(url)
165+ self.main_window.wait_until_page_loaded(url)
166 webview = self.main_window.get_current_webview()
167 self.pointing_device.click_object(webview)
168+ self.assert_eventually_fullscreen()
169+ if model() == 'Desktop':
170+ self.keyboard.press_and_release('Escape')
171+ else:
172+ self.open_tabs_view()
173 self.assert_eventually_windowed()

Subscribers

People subscribed via source and target branches

to status/vote changes: