Merge lp:~osomon/webbrowser-app/official-api into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 565
Proposed branch: lp:~osomon/webbrowser-app/official-api
Merge into: lp:webbrowser-app
Diff against target: 1259 lines (+524/-263)
25 files modified
.bzrignore (+2/-0)
CMakeLists.txt (+2/-0)
debian/control (+41/-19)
debian/qtdeclarative5-ubuntu-web-plugin.install (+1/-0)
debian/qtdeclarative5-ubuntu-web-plugin.lintian-overrides (+3/-0)
doc/CMakeLists.txt (+11/-0)
doc/SharedWebContext.qdoc (+39/-0)
doc/WebContext.qdoc (+70/-0)
doc/WebView.qdoc (+207/-0)
doc/ubuntu-web.qdoc (+22/-0)
doc/ubuntu-web.qdocconf (+10/-0)
src/Ubuntu/CMakeLists.txt (+22/-0)
src/Ubuntu/Components/Extras/Browser/CMakeLists.txt (+2/-22)
src/Ubuntu/Components/Extras/Browser/qmldir (+3/-1)
src/Ubuntu/Web/CMakeLists.txt (+26/-0)
src/Ubuntu/Web/UbuntuWebContext.qml (+7/-7)
src/Ubuntu/Web/UbuntuWebView02.qml (+17/-146)
src/Ubuntu/Web/plugin.cpp (+8/-5)
src/Ubuntu/Web/qmldir (+5/-0)
src/Ubuntu/Web/selection02.js (+0/-41)
src/app/WebViewImpl.qml (+2/-2)
src/app/webbrowser/TimelineView.qml (+0/-1)
src/app/webcontainer/WebViewImplOxide.qml (+15/-15)
tests/unittests/qml/tst_UbuntuWebView02.qml (+4/-4)
webbrowser-app.qmlproject (+5/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/official-api
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Łukasz Zemczak packaging Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+221436@code.launchpad.net

Commit message

Move version 0.2 of the API to "Ubuntu.Web" namespace, rename "UbuntuWebView" to "WebView", and document the public API intended for application developers.

The legacy namespace and component name are kept around for compatibility with existing applications.

Version 0.1 of the API remains untouched (it is deprecated).

Packaging changes:
 new qtdeclarative5-ubuntu-web-plugin package that contains the new namespace and name for the public QML API;
 updated runtime dependencies for webbrowser-app, webapp-container and qtdeclarative5-ubuntu-ui-extras-browser-plugin;
 updated descriptions for all packages;
 added missing multiarch stanza for webapp-container-autopilot;
 added missing predepends stanzas for multiarch packages.

Description of the change

Instructions for testing:

The name (UbuntuWebView → WebView) and namespace (Ubuntu.Components.Extras.Browser → Ubuntu.Web) changes should not break compatibility with existing applications, meaning that the current name and namespace will be kept around for the foreseeable future, while being advertised as deprecated in favour of the new name and namespace.

From public API point of view, there are three scenarii to test:

  import Ubuntu.Components.Extras.Browser 0.1 // legacy, QtWebKit based
  import Ubuntu.Components.Extras.Browser 0.2 // current, Oxide based
  import Ubuntu.Web 0.2 // new, same as above but renamed + API documentation

I have created three very simple click applications which can be used to test those scenarii, they all instantiate a webview that points to http://start.ubuntu.com, they are available there: http://people.canonical.com/~osomon/click/.

Existing webapps (that use the webapp container) should also be thoroughly tested to ensure no regressions.

Finally the webbrowser app itself should be tested as well (changes to the app itself are minimal, the autopilot tests should cover us reasonably well here).

The API documentation can be generated with "make doc", you can see a preview at http://people.canonical.com/~osomon/ubuntu-web-doc/ubuntu-web-qmlmodule.html, at present it looks rather ugly because it’s not themed, this will be addressed separately. Please have a quick read and let me know if it provides enough information for application developers.

There are debian packaging changes, I’ll make sure an ubuntu developer reviews them.

To post a comment you must log in.
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: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

Couple of things I noticed in the clicks:
- com.ubuntu.developer.osomon.test-ubuntu-web: scrollbars are thicker than normal
- com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-01: scrollbars are thicker than normal
- com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-02: DPR settings seem wrong, the initial size of the page is too small

Revision history for this message
Bill Filler (bfiller) wrote :

Sorry, correction
com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-01: DPR settings seem wrong, the initial size of the page is too small

com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-02: scrollbar issue with sizing

Revision history for this message
Bill Filler (bfiller) wrote :

- browser-02: popup menus don't display, I think the user-agent string isn't getting set correctly either as google images looks different than on main browser

- browser-01: same issues, also typing in google search field causes the shift key to get turned on after every character which is quite odd

- com.ubuntu.developer.osomon.test-ubuntu-web: popup menus don't work

564. By Olivier Tilloy

Merge the latest changes from trunk and resolve a conflict.

Revision history for this message
Olivier Tilloy (osomon) wrote :

The fact that popup menus don’t display is expected (and is not a regression): the application developer should provide a list of actions to be displayed (by default it is empty).

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

> The fact that popup menus don’t display is expected (and is not a regression):
> the application developer should provide a list of actions to be displayed (by
> default it is empty).

What’s not expected though is that an empty contextual menu is popped up. I filed bug #1326752 to track this issue.

Revision history for this message
Olivier Tilloy (osomon) wrote :

> com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-01: DPR
> settings seem wrong, the initial size of the page is too small
>
> com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-02:
> scrollbar issue with sizing
>
> browser-02: popup menus don't display, I think the user-agent string
> isn't getting set correctly either as google images looks different than
> on main browser
>
> browser-01: same issues, also typing in google search field causes the
> shift key to get turned on after every character which is quite odd
>
> com.ubuntu.developer.osomon.test-ubuntu-web: popup menus don't work

Except for the popup menu issue (which I explained above and for which I submitted a fix in a separate branch already), and for the google images one, I’m seeing all those issues in the current version of the image (without the changes this branch introduces). In other words, those are not new regressions, but existing bugs which I’ll investigate separately.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Note: regarding the issue with google images, I cannot reproduce it on my device, rendering looks the same within the test app and within the stock browser.

Revision history for this message
Olivier Tilloy (osomon) wrote :

> com.ubuntu.developer.osomon.test-ubuntu-components-extras-browser-02:
> scrollbar issue with sizing

Just tested on device with the latest oxide built from trunk, and the issue is gone, scrollbars are thin and semi-transparent as expected. I’m guessing this is a bug in the version of oxide that’s currently in the archive (based on revision 501 of lp:oxide, which is from two months ago). There’s a new release in preparation (based on revision 562 + selected bug fixes), it will hopefully resolve this issue and others.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

In overall it looks good packaging-wise. One small thing that I noticed is that all the libs are missing Pre-Depends: ${misc:Pre-Depends} for all Multi-Arch packages. Could you add that for those binary packages? It's not anything serious, but it would be nice to have everything as it's supposed to.

The rest seems to look fine.

review: Needs Fixing (packaging)
565. By Olivier Tilloy

Add missing pre-depends for multiarch packages.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2014-05-06 12:11:27 +0000
+++ .bzrignore 2014-06-09 09:55:59 +0000
@@ -24,12 +24,14 @@
24RE:tests/unittests/.+/tst_\w+Tests$24RE:tests/unittests/.+/tst_\w+Tests$
25tests/unittests/qml/undertest25tests/unittests/qml/undertest
26po/*.gmo26po/*.gmo
27doc/html
2728
28obj-*29obj-*
29debian/files30debian/files
30debian/tmp/31debian/tmp/
31debian/qtdeclarative5-ubuntu-ui-extras-browser-plugin/32debian/qtdeclarative5-ubuntu-ui-extras-browser-plugin/
32debian/qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets/33debian/qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets/
34debian/qtdeclarative5-ubuntu-web-plugin/
33debian/webapp-container/35debian/webapp-container/
34debian/webapp-container-autopilot/36debian/webapp-container-autopilot/
35debian/webbrowser-app/37debian/webbrowser-app/
3638
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-05-06 07:49:11 +0000
+++ CMakeLists.txt 2014-06-09 09:55:59 +0000
@@ -61,6 +61,8 @@
6161
62add_subdirectory(po)62add_subdirectory(po)
6363
64add_subdirectory(doc)
65
64install(FILES webbrowser-app.svg66install(FILES webbrowser-app.svg
65 DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)67 DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
66install(FILES screenshot.png68install(FILES screenshot.png
6769
=== modified file 'debian/control'
--- debian/control 2014-05-22 15:27:38 +0000
+++ debian/control 2014-06-09 09:55:59 +0000
@@ -32,10 +32,12 @@
32Depends: ${misc:Depends},32Depends: ${misc:Depends},
33 ${shlibs:Depends},33 ${shlibs:Depends},
34 liboxideqt-qmlplugin (>= 1.0.0~bzr490),34 liboxideqt-qmlplugin (>= 1.0.0~bzr490),
35 libqt5sql5-sqlite,
35 qtdeclarative5-dialogs-plugin,36 qtdeclarative5-dialogs-plugin,
36 qtdeclarative5-qtquick2-plugin,37 qtdeclarative5-qtquick2-plugin,
37 qtdeclarative5-ubuntu-ui-extras-browser-plugin (= ${binary:Version}),
38 qtdeclarative5-ubuntu-ui-toolkit-plugin,38 qtdeclarative5-ubuntu-ui-toolkit-plugin,
39 qtdeclarative5-ubuntu-web-plugin (= ${binary:Version}),
40 qtdeclarative5-unity-action-plugin,
39 qtdeclarative5-window-plugin,41 qtdeclarative5-window-plugin,
40Replaces: webbrowser-app-assets,42Replaces: webbrowser-app-assets,
41 qtdeclarative5-ubuntu-ui-extras-browser-plugin (<< 0.22),43 qtdeclarative5-ubuntu-ui-extras-browser-plugin (<< 0.22),
@@ -43,7 +45,7 @@
43Provides: webbrowser-app-assets45Provides: webbrowser-app-assets
44Breaks: qtdeclarative5-ubuntu-ui-extras-browser-plugin (<< 0.22)46Breaks: qtdeclarative5-ubuntu-ui-extras-browser-plugin (<< 0.22)
45Description: Ubuntu web browser47Description: Ubuntu web browser
46 A lightweight web browser tailored for Ubuntu, based on the Webkit rendering48 A lightweight web browser tailored for Ubuntu, based on the Oxide browser
47 engine and using the Ubuntu UI components.49 engine and using the Ubuntu UI components.
4850
49Package: webapp-container51Package: webapp-container
@@ -51,44 +53,63 @@
51Multi-Arch: foreign53Multi-Arch: foreign
52Depends: ${misc:Depends},54Depends: ${misc:Depends},
53 ${shlibs:Depends},55 ${shlibs:Depends},
54 libqt5webkit5-qmlwebkitplugin, 56 liboxideqt-qmlplugin,
57 libqt5sql5-sqlite,
58 libqt5webkit5-qmlwebkitplugin,
55 qtdeclarative5-accounts-plugin,59 qtdeclarative5-accounts-plugin,
56 qtdeclarative5-qtquick2-plugin (>= 5.2),60 qtdeclarative5-qtquick2-plugin (>= 5.2),
61 qtdeclarative5-ubuntu-ui-extras-browser-plugin (= ${binary:Version}),
62 qtdeclarative5-ubuntu-web-plugin (= ${binary:Version}),
63 qtdeclarative5-unity-action-plugin,
57 unity-webapps-qml,64 unity-webapps-qml,
58 webbrowser-app (= ${binary:Version}),65 webbrowser-app (= ${binary:Version}),
59Suggests: qtdeclarative5-online-accounts-client0.1 (>= 0.3),66Suggests: qtdeclarative5-online-accounts-client0.1 (>= 0.3),
60Description: Ubuntu web applications container67Description: Ubuntu web applications container
61 A lightweight webapps container tailored for Ubuntu, based on the Webkit68 A lightweight webapp container tailored for Ubuntu, based on the Oxide browser
62 rendering engine and using the Ubuntu UI components.69 engine and using the Ubuntu UI components.
6370
64Package: qtdeclarative5-ubuntu-ui-extras-browser-plugin71Package: qtdeclarative5-ubuntu-ui-extras-browser-plugin
65Architecture: any72Architecture: any
66Multi-Arch: same73Multi-Arch: same
74Pre-Depends: ${misc:Pre-Depends}
67Depends: ${misc:Depends},75Depends: ${misc:Depends},
68 ${shlibs:Depends},76 ${shlibs:Depends},
69 libqt5sql5-sqlite,
70 libqt5webkit5-qmlwebkitplugin,77 libqt5webkit5-qmlwebkitplugin,
71 liboxideqt-qmlplugin,
72 qtdeclarative5-qtquick2-plugin,78 qtdeclarative5-qtquick2-plugin,
73 qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets (>= ${source:Version}),79 qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets (>= ${source:Version}),
74 qtdeclarative5-ubuntu-ui-toolkit-plugin,80 qtdeclarative5-ubuntu-ui-toolkit-plugin,
75 qtdeclarative5-unity-action-plugin,81 qtdeclarative5-ubuntu-web-plugin (= ${binary:Version}),
76 qtdeclarative5-window-plugin,82 qtdeclarative5-window-plugin,
77Replaces: webbrowser-app (<< 0.21)83Replaces: webbrowser-app (<< 0.21)
78Breaks: webbrowser-app (<< 0.21)84Breaks: webbrowser-app (<< 0.21)
79Description: Ubuntu web browser QML plugin85Description: Ubuntu web QML plugin
80 A lightweight web browser tailored for Ubuntu, based on the Webkit rendering86 A standalone QML plugin that contains the UbuntuWebView component
81 engine and using the Ubuntu UI components. This package contains a standalone87 (versions 0.1 based on WebKit and 0.2 based on Oxide), in the
82 QML plugin that applications can use to embed a browser control.88 Ubuntu.Components.Extras.Browser module.
8389
84Package: qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets90Package: qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets
85Architecture: all91Architecture: all
86Multi-Arch: foreign92Multi-Arch: foreign
87Depends: ${misc:Depends},93Depends: ${misc:Depends},
88Description: Ubuntu web browser QML plugin assets94Description: Ubuntu web QML plugin assets
89 A lightweight web browser tailored for Ubuntu, based on the Webkit rendering95 A standalone QML plugin that contains the UbuntuWebView component
90 engine and using the Ubuntu UI components. This package contains the96 (versions 0.1 based on WebKit and 0.2 based on Oxide), in the
91 PNGs used as UI elements by the QML plugin.97 Ubuntu.Components.Extras.Browser module. This package contains the
98 PNGs used as UI elements by the plugin.
99
100Package: qtdeclarative5-ubuntu-web-plugin
101Architecture: any
102Multi-Arch: same
103Pre-Depends: ${misc:Pre-Depends}
104Depends: ${misc:Depends},
105 ${shlibs:Depends},
106 liboxideqt-qmlplugin,
107 qtdeclarative5-qtquick2-plugin,
108 qtdeclarative5-ubuntu-ui-toolkit-plugin,
109 qtdeclarative5-window-plugin,
110Description: Ubuntu web QML plugin
111 A standalone QML plugin that contains the WebView component,
112 in the Ubuntu.Web module.
92113
93Package: webbrowser-app-autopilot114Package: webbrowser-app-autopilot
94Architecture: all115Architecture: all
@@ -101,12 +122,13 @@
101 unity8-autopilot,122 unity8-autopilot,
102 webbrowser-app (>= ${binary:Version}),123 webbrowser-app (>= ${binary:Version}),
103Description: Ubuntu web browser autopilot tests124Description: Ubuntu web browser autopilot tests
104 A lightweight web browser tailored for Ubuntu, based on the Webkit rendering125 A lightweight web browser tailored for Ubuntu, based on the Oxide browser
105 engine and using the Ubuntu UI components. This package contains autopilot126 engine and using the Ubuntu UI components. This package contains autopilot
106 tests for it.127 tests for it.
107128
108Package: webapp-container-autopilot129Package: webapp-container-autopilot
109Architecture: all130Architecture: all
131Multi-Arch: foreign
110Depends: ${misc:Depends},132Depends: ${misc:Depends},
111 libautopilot-qt (>= 1.4),133 libautopilot-qt (>= 1.4),
112 libqt5test5,134 libqt5test5,
@@ -114,6 +136,6 @@
114 ubuntu-ui-toolkit-autopilot,136 ubuntu-ui-toolkit-autopilot,
115 webapp-container (>= ${binary:Version}),137 webapp-container (>= ${binary:Version}),
116Description: Ubuntu web applications container autopilot tests138Description: Ubuntu web applications container autopilot tests
117 A lightweight webapps container tailored for Ubuntu, based on the Webkit139 A lightweight webapp container tailored for Ubuntu, based on the Oxide browser
118 rendering engine and using the Ubuntu UI components. This package contains autopilot140 engine and using the Ubuntu UI components. This package contains autopilot
119 tests for it.141 tests for it.
120142
=== added file 'debian/qtdeclarative5-ubuntu-web-plugin.install'
--- debian/qtdeclarative5-ubuntu-web-plugin.install 1970-01-01 00:00:00 +0000
+++ debian/qtdeclarative5-ubuntu-web-plugin.install 2014-06-09 09:55:59 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/qt5/qml/Ubuntu/Web/*
02
=== added file 'debian/qtdeclarative5-ubuntu-web-plugin.lintian-overrides'
--- debian/qtdeclarative5-ubuntu-web-plugin.lintian-overrides 1970-01-01 00:00:00 +0000
+++ debian/qtdeclarative5-ubuntu-web-plugin.lintian-overrides 2014-06-09 09:55:59 +0000
@@ -0,0 +1,3 @@
1qtdeclarative5-ubuntu-web-plugin: pkg-has-shlibs-control-file-but-no-actual-shared-libs
2qtdeclarative5-ubuntu-web-plugin: postinst-has-useless-call-to-ldconfig
3qtdeclarative5-ubuntu-web-plugin: postrm-has-useless-call-to-ldconfig
04
=== added directory 'doc'
=== added file 'doc/CMakeLists.txt'
--- doc/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ doc/CMakeLists.txt 2014-06-09 09:55:59 +0000
@@ -0,0 +1,11 @@
1project(webbrowser-doc)
2
3find_program(QDOC_EXECUTABLE qdoc)
4if(QDOC_EXECUTABLE STREQUAL "QDOC_EXECUTABLE-NOTFOUND")
5 message(WARNING "qdoc not found, documentation cannot be built")
6else()
7 add_custom_target(doc
8 COMMAND ${QDOC_EXECUTABLE}
9 -outputdir ${CMAKE_CURRENT_BINARY_DIR}/html
10 ${CMAKE_CURRENT_SOURCE_DIR}/ubuntu-web.qdocconf)
11endif()
012
=== added file 'doc/SharedWebContext.qdoc'
--- doc/SharedWebContext.qdoc 1970-01-01 00:00:00 +0000
+++ doc/SharedWebContext.qdoc 2014-06-09 09:55:59 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This file is part of webbrowser-app.
5 *
6 * webbrowser-app is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * webbrowser-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*!
20 \qmltype SharedWebContext
21 \inqmlmodule Ubuntu.Web 0.2
22 \ingroup ubuntu
23 \brief A singleton that exposes a shared \l WebContext that can be used
24 by several \l WebView instances in the same application.
25
26 Note that the \l WebView component already uses the shared context.
27 */
28
29/*!
30 \qmlproperty WebContext SharedWebContext::sharedContext
31
32 The \l WebContext instance that several \l WebView instances can share.
33 */
34
35/*!
36 \qmlproperty string SharedWebContext::customUA
37
38 An alias to the shared context’s default user agent string.
39 */
040
=== added file 'doc/WebContext.qdoc'
--- doc/WebContext.qdoc 1970-01-01 00:00:00 +0000
+++ doc/WebContext.qdoc 2014-06-09 09:55:59 +0000
@@ -0,0 +1,70 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This file is part of webbrowser-app.
5 *
6 * webbrowser-app is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * webbrowser-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*!
20 \qmltype WebContext
21 \inqmlmodule Ubuntu.Web 0.2
22 \ingroup ubuntu
23 \brief A default context implementation for use with \l WebView.
24
25 This default WebContext implementation has the default user agent string
26 used by the Ubuntu browser as well as the UA override mechanism that allows
27 sending an overridden user agent for given domains/websites, based on the
28 form factor.
29
30 It has its data path (for cache and cookie database) set to the standard
31 writable data location for the current application, which is based on the
32 application name (see \c Qt.application.name), for example
33 \e ~/.local/share/myApp/.
34
35 Note that the \l WebView component already uses this default context, so
36 there is no need to explicitly instantiate a \c WebContext unless you
37 want to override some of its default properties.
38
39 \sa SharedWebContext
40 */
41
42// Note: only a subset of the properties of Oxide’s WebContext are documented
43// here. This is intentional, typical applications are not expected to be
44// needing the full set of properties and methods exposed by Oxide.
45
46/*!
47 \qmlproperty string WebContext::userAgent
48
49 The default user agent string that will be sent with each HTTP request.
50 */
51
52/*!
53 \qmlproperty url WebContext::dataPath
54
55 The local path where persistent data (such as cookies) will be stored.
56 */
57
58/*!
59 \qmlproperty url WebContext::cachePath
60
61 The local path where network data will be cached.
62 If not set, it defaults to \l dataPath.
63 */
64
65/*!
66 \qmlproperty string WebContext::acceptLangs
67
68 The list of accepted languages (the Accept-Language HTTP header),
69 as a comma-separated list of language codes.
70 */
071
=== added file 'doc/WebView.qdoc'
--- doc/WebView.qdoc 1970-01-01 00:00:00 +0000
+++ doc/WebView.qdoc 2014-06-09 09:55:59 +0000
@@ -0,0 +1,207 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This file is part of webbrowser-app.
5 *
6 * webbrowser-app is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * webbrowser-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*!
20 \qmltype WebView
21 \inqmlmodule Ubuntu.Web 0.2
22 \ingroup ubuntu
23 \brief A webview that can be used to render web content in an application.
24
25 Here is a very simple example of how to use a WebView to render a web page:
26 \qml
27 import QtQuick 2.0
28 import Ubuntu.Web 0.2
29
30 WebView {
31 url: "http://ubuntu.com"
32 }
33 \endqml
34
35 The \c WebView component defaults to using a \l {SharedWebContext}
36 {shared \c WebContext} that is shared across all \c WebView instances
37 in a given application.
38
39 \sa SharedWebContext
40 */
41
42/*!
43 \qmlproperty url WebView::url
44
45 The URL of the current page.
46 */
47
48/*!
49 \qmlproperty string WebView::title
50
51 The title of the current page.
52 */
53
54/*!
55 \qmlproperty url WebView::icon
56
57 The URL of the favicon of the current page.
58 */
59
60/*!
61 \qmlproperty bool WebView::canGoBack
62
63 Whether the navigation history has a previous entry to navigate back.
64
65 \sa goBack, canGoForward
66 */
67
68/*!
69 \qmlproperty bool WebView::canGoForward
70
71 Whether the navigation history has a next entry to navigate forward.
72
73 \sa goForward, canGoBack
74 */
75
76/*!
77 \qmlproperty bool WebView::incognito
78
79 Whether the WebView is being used in private browsing mode,
80 where no data is persisted across sessions.
81 */
82
83/*!
84 \qmlproperty bool WebView::loading
85
86 Whether the current page is loading.
87
88 \sa loadProgress, stop, reload
89 */
90
91/*!
92 \qmlproperty bool WebView::fullscreen
93
94 Whether the current page requested fullscreen display.
95 */
96
97/*!
98 \qmlproperty int WebView::loadProgress
99
100 The load progress of the current page
101 (as a integer value between 0 and 100).
102
103 \sa loading
104 */
105
106/*!
107 \qmlproperty component WebView::alertDialog
108
109 The QML component that will be instantiated to display
110 a JavaScript alert dialog.
111
112 \sa confirmDialog, promptDialog, beforeUnloadDialog
113 */
114
115/*!
116 \qmlproperty component WebView::confirmDialog
117
118 The QML component that will be instantiated to display
119 a JavaScript confirmation dialog.
120
121 \sa alertDialog, promptDialog, beforeUnloadDialog
122 */
123
124/*!
125 \qmlproperty component WebView::promptDialog
126
127 The QML component that will be instantiated to display
128 a JavaScript prompt dialog.
129
130 \sa alertDialog, confirmDialog, beforeUnloadDialog
131 */
132
133/*!
134 \qmlproperty component WebView::beforeUnloadDialog
135
136 The QML component that will be instantiated to display
137 a JavaScript confirmation when the user initiates a navigation away from
138 the current page, if the page has defined an \c onBeforeUnload handler.
139
140 \sa alertDialog, confirmDialog, promptDialog
141 */
142
143/*!
144 \qmlproperty component WebView::filePicker
145
146 The QML component that will be instantiated to let the user select files
147 when the user clicks an \c {<input type="file">} element
148 on the current page.
149 */
150
151/*!
152 \qmlproperty WebContext WebView::context
153
154 The web context associated to this WebView.
155 By default a \l {SharedWebContext} {shared context} is used which should
156 fit most use cases, do not override unless you really need a finer control
157 over the context.
158 */
159
160/*!
161 \qmlproperty list WebView::navigationHistory
162
163 The navigation history (back/forward entries) stored as a list model
164 with a \c currentIndex property. Each entry exposes the URL and title of
165 the corresponding page, as well as a timestamp of when it was visited.
166 */
167
168/*!
169 \qmlmethod void WebView::goBack()
170
171 Go back one entry in the navigation history.
172
173 \sa canGoBack, goForward
174 */
175
176/*!
177 \qmlmethod void WebView::goForward()
178
179 Go forward one entry in the navigation history.
180
181 \sa canGoForward, goBack
182 */
183
184/*!
185 \qmlmethod void WebView::stop()
186
187 Stop loading the current page.
188 Does nothing if there is no page currently loading.
189
190 \sa reload, loading
191 */
192
193/*!
194 \qmlmethod void WebView::reload()
195
196 Reload the current page.
197
198 \sa stop
199 */
200
201/*!
202 \qmlmethod void WebView::loadHtml(string html, url baseUrl)
203
204 Load HTML content from memory instead of loading it from a URL.
205 The \c baseUrl argument is used to resolve relative URLs in the provided
206 content.
207 */
0208
=== added file 'doc/ubuntu-web.qdoc'
--- doc/ubuntu-web.qdoc 1970-01-01 00:00:00 +0000
+++ doc/ubuntu-web.qdoc 2014-06-09 09:55:59 +0000
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This file is part of webbrowser-app.
5 *
6 * webbrowser-app is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * webbrowser-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*!
20 \qmlmodule Ubuntu.Web 0.2
21 \title Ubuntu Web module
22 */
023
=== added file 'doc/ubuntu-web.qdocconf'
--- doc/ubuntu-web.qdocconf 1970-01-01 00:00:00 +0000
+++ doc/ubuntu-web.qdocconf 2014-06-09 09:55:59 +0000
@@ -0,0 +1,10 @@
1project = UbuntuWeb
2description = Ubuntu Web module documentation
3sourcedirs = ./
4sources.fileextensions = "*.qdoc"
5outputdir = html
6outputformats = HTML
7version = 0.2
8syntaxhightlighting = true
9sourceencoding = UTF-8
10outputencoding = UTF-8
011
=== modified file 'src/Ubuntu/CMakeLists.txt'
--- src/Ubuntu/CMakeLists.txt 2013-07-02 07:58:19 +0000
+++ src/Ubuntu/CMakeLists.txt 2014-06-09 09:55:59 +0000
@@ -1,1 +1,23 @@
1if(NOT CMAKE_CROSSCOMPILING)
2 find_program(QMAKE_EXECUTABLE qmake)
3 if(QMAKE_EXECUTABLE STREQUAL "QMAKE_EXECUTABLE-NOTFOUND")
4 message(FATAL_ERROR "qmake not found")
5 endif()
6 execute_process(
7 COMMAND ${QMAKE_EXECUTABLE} -query QT_INSTALL_QML
8 RESULT_VARIABLE RESULT
9 OUTPUT_VARIABLE QT_INSTALL_QML
10 OUTPUT_STRIP_TRAILING_WHITESPACE
11 )
12 if(NOT RESULT EQUAL 0)
13 message(FATAL_ERROR "Failed to determine QT_INSTALL_QML from qmake")
14 endif()
15else()
16 # qmake isn't multi-arch aware as it installs arch-specific mkspec files
17 # in to /usr/share, so we can't use it here (we'd need a qmake binary
18 # for the host arch using data for the target arch)
19 set(QT_INSTALL_QML "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt5/qml")
20endif()
21
1add_subdirectory(Components)22add_subdirectory(Components)
23add_subdirectory(Web)
224
=== modified file 'src/Ubuntu/Components/Extras/Browser/CMakeLists.txt'
--- src/Ubuntu/Components/Extras/Browser/CMakeLists.txt 2014-05-06 07:49:11 +0000
+++ src/Ubuntu/Components/Extras/Browser/CMakeLists.txt 2014-06-09 09:55:59 +0000
@@ -1,25 +1,5 @@
1project(webbrowser-plugin)1project(webbrowser-plugin)
22
3if(NOT CMAKE_CROSSCOMPILING)
4 find_program(QMAKE_EXECUTABLE qmake)
5 if(QMAKE_EXECUTABLE STREQUAL "QMAKE_EXECUTABLE-NOTFOUND")
6 message(FATAL_ERROR "qmake not found")
7 endif()
8 execute_process(
9 COMMAND ${QMAKE_EXECUTABLE} -query QT_INSTALL_QML
10 RESULT_VARIABLE RESULT
11 OUTPUT_VARIABLE QT_INSTALL_QML
12 OUTPUT_STRIP_TRAILING_WHITESPACE
13 )
14 if(NOT RESULT EQUAL 0)
15 message(FATAL_ERROR "Failed to determine QT_INSTALL_QML from qmake")
16 endif()
17else()
18 # qmake isn't multi-arch aware as it installs arch-specific mkspec files
19 # in to /usr/share, so we can't use it here (we'd need a qmake binary
20 # for the host arch using data for the target arch)
21 set(QT_INSTALL_QML "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt5/qml")
22endif()
23set(WEBBROWSER_IMPORTS_DIR "${QT_INSTALL_QML}/Ubuntu/Components/Extras/Browser")3set(WEBBROWSER_IMPORTS_DIR "${QT_INSTALL_QML}/Ubuntu/Components/Extras/Browser")
244
25set(PLUGIN ubuntu-ui-extras-browser-plugin)5set(PLUGIN ubuntu-ui-extras-browser-plugin)
@@ -46,6 +26,6 @@
46 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file}26 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
47 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file})27 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file})
48 endforeach(_file)28 endforeach(_file)
49 add_custom_target(copy_files_to_build_dir DEPENDS ${copied})29 add_custom_target(copy_files_to_build_dir_legacy DEPENDS ${copied})
50 add_dependencies(${PLUGIN} copy_files_to_build_dir)30 add_dependencies(${PLUGIN} copy_files_to_build_dir_legacy)
51endif()31endif()
5232
=== added symlink 'src/Ubuntu/Components/Extras/Browser/ItemSelector02.qml'
=== target is u'../../../Web/ItemSelector02.qml'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/UbuntuSharedWebContext.qml'
=== target is u'../../../Web/UbuntuSharedWebContext.qml'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/UbuntuWebContext.qml'
=== target is u'../../../Web/UbuntuWebContext.qml'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/UbuntuWebView02.qml'
=== target is u'../../../Web/UbuntuWebView02.qml'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/UserAgent02.qml'
=== target is u'../../../Web/UserAgent02.qml'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/plugin.cpp'
=== target is u'../../../Web/plugin.cpp'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/plugin.h'
=== target is u'../../../Web/plugin.h'
=== modified file 'src/Ubuntu/Components/Extras/Browser/qmldir'
--- src/Ubuntu/Components/Extras/Browser/qmldir 2014-04-16 09:21:28 +0000
+++ src/Ubuntu/Components/Extras/Browser/qmldir 2014-06-09 09:55:59 +0000
@@ -3,6 +3,8 @@
3UbuntuWebView 0.1 UbuntuWebView01.qml3UbuntuWebView 0.1 UbuntuWebView01.qml
4UbuntuWebView 0.2 UbuntuWebView02.qml4UbuntuWebView 0.2 UbuntuWebView02.qml
5singleton UbuntuSharedWebContext 0.2 UbuntuSharedWebContext.qml5singleton UbuntuSharedWebContext 0.2 UbuntuSharedWebContext.qml
6singleton SharedWebContext 0.2 UbuntuSharedWebContext.qml
6UbuntuWebContext 0.2 UbuntuWebContext.qml7UbuntuWebContext 0.2 UbuntuWebContext.qml
7# Without the following line, importing version 0.1 of the module fails8# Without the following lines, importing version 0.1 of the module fails
8singleton UbuntuSharedWebContext 0.1 dummysingleton.qml9singleton UbuntuSharedWebContext 0.1 dummysingleton.qml
10singleton SharedWebContext 0.1 dummysingleton.qml
911
=== added symlink 'src/Ubuntu/Components/Extras/Browser/selection02.js'
=== target is u'../../../Web/selection02.js'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/ua-override-worker.js'
=== target is u'../../../Web/ua-override-worker.js'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/ua-overrides-desktop.js'
=== target is u'../../../Web/ua-overrides-desktop.js'
=== added symlink 'src/Ubuntu/Components/Extras/Browser/ua-overrides-mobile.js'
=== target is u'../../../Web/ua-overrides-mobile.js'
=== added directory 'src/Ubuntu/Web'
=== added file 'src/Ubuntu/Web/CMakeLists.txt'
--- src/Ubuntu/Web/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Web/CMakeLists.txt 2014-06-09 09:55:59 +0000
@@ -0,0 +1,26 @@
1project(ubuntu-web-plugin)
2
3set(UBUNTU_WEB_IMPORTS_DIR "${QT_INSTALL_QML}/Ubuntu/Web")
4
5set(PLUGIN ubuntu-web-plugin)
6
7set(PLUGIN_SRC plugin.cpp)
8
9add_library(${PLUGIN} MODULE ${PLUGIN_SRC})
10
11qt5_use_modules(${PLUGIN} Core Gui Qml)
12
13file(GLOB QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml qmldir *.js)
14install(TARGETS ${PLUGIN} DESTINATION ${UBUNTU_WEB_IMPORTS_DIR})
15install(FILES ${QML_FILES} DESTINATION ${UBUNTU_WEB_IMPORTS_DIR})
16
17if(NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
18 # copy qml files over to build dir to be able to import them uninstalled
19 foreach(_file ${QML_FILES})
20 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}
21 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
22 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file})
23 endforeach(_file)
24 add_custom_target(copy_files_to_build_dir DEPENDS ${QML_FILES})
25 add_dependencies(${PLUGIN} copy_files_to_build_dir)
26endif()
027
=== renamed file 'src/Ubuntu/Components/Extras/Browser/ItemSelector02.qml' => 'src/Ubuntu/Web/ItemSelector02.qml'
=== renamed file 'src/Ubuntu/Components/Extras/Browser/UbuntuSharedWebContext.qml' => 'src/Ubuntu/Web/UbuntuSharedWebContext.qml'
=== renamed file 'src/Ubuntu/Components/Extras/Browser/UbuntuWebContext.qml' => 'src/Ubuntu/Web/UbuntuWebContext.qml'
--- src/Ubuntu/Components/Extras/Browser/UbuntuWebContext.qml 2014-04-16 10:45:57 +0000
+++ src/Ubuntu/Web/UbuntuWebContext.qml 2014-06-09 09:55:59 +0000
@@ -17,12 +17,12 @@
17 */17 */
1818
19import QtQuick 2.019import QtQuick 2.0
20import com.canonical.Oxide 1.020import com.canonical.Oxide 1.0 as Oxide
2121
22WebContext {22Oxide.WebContext {
23 dataPath: dataLocation23 dataPath: dataLocation
24 userAgent: __ua.defaultUA24 userAgent: __ua.defaultUA
25 networkRequestDelegate: WebContextDelegateWorker {25 networkRequestDelegate: Oxide.WebContextDelegateWorker {
26 source: Qt.resolvedUrl("ua-override-worker.js")26 source: Qt.resolvedUrl("ua-override-worker.js")
27 onMessage: console.log("Overriden UA for", message.url, ":", message.override)27 onMessage: console.log("Overriden UA for", message.url, ":", message.override)
28 Component.onCompleted: {28 Component.onCompleted: {
@@ -44,15 +44,15 @@
44 sessionCookieMode: {44 sessionCookieMode: {
45 if (typeof webContextSessionCookieMode !== 'undefined') {45 if (typeof webContextSessionCookieMode !== 'undefined') {
46 if (webContextSessionCookieMode === "persistent") {46 if (webContextSessionCookieMode === "persistent") {
47 return WebContext.SessionCookieModePersistent47 return Oxide.WebContext.SessionCookieModePersistent
48 } else if (webContextSessionCookieMode === "restored") {48 } else if (webContextSessionCookieMode === "restored") {
49 return WebContext.SessionCookieModeRestored49 return Oxide.WebContext.SessionCookieModeRestored
50 }50 }
51 }51 }
52 return WebContext.SessionCookieModeEphemeral52 return Oxide.WebContext.SessionCookieModeEphemeral
53 }53 }
54 userScripts: [54 userScripts: [
55 UserScript {55 Oxide.UserScript {
56 context: "oxide://selection/"56 context: "oxide://selection/"
57 url: Qt.resolvedUrl("selection02.js")57 url: Qt.resolvedUrl("selection02.js")
58 incognitoEnabled: true58 incognitoEnabled: true
5959
=== renamed file 'src/Ubuntu/Components/Extras/Browser/UbuntuWebView02.qml' => 'src/Ubuntu/Web/UbuntuWebView02.qml'
--- src/Ubuntu/Components/Extras/Browser/UbuntuWebView02.qml 2014-06-05 11:49:42 +0000
+++ src/Ubuntu/Web/UbuntuWebView02.qml 2014-06-09 09:55:59 +0000
@@ -18,16 +18,14 @@
1818
19import QtQuick 2.019import QtQuick 2.0
20import QtQuick.Window 2.020import QtQuick.Window 2.0
21import com.canonical.Oxide 1.021import com.canonical.Oxide 1.0 as Oxide
22import Ubuntu.Components 0.122import Ubuntu.Components 0.1
23import Ubuntu.Components.Popups 0.123import Ubuntu.Components.Popups 0.1
24import "."24import "." // QTBUG-34418
2525
26WebView {26Oxide.WebView {
27 id: _webview27 id: _webview
2828
29 //interactive: !selection.visible
30
31 /**29 /**
32 * Client overridable function called before the default treatment of a30 * Client overridable function called before the default treatment of a
33 * valid navigation request. This function can stop the navigation request31 * valid navigation request. This function can stop the navigation request
@@ -51,16 +49,16 @@
51 return undefined49 return undefined
52 }50 }
5351
54 context: UbuntuSharedWebContext.sharedContext52 context: SharedWebContext.sharedContext
55 Component.onCompleted: {53 Component.onCompleted: {
56 var customUA = getUAString()54 var customUA = getUAString()
57 if (customUA !== undefined) {55 if (customUA !== undefined) {
58 UbuntuSharedWebContext.customUA = customUA56 SharedWebContext.customUA = customUA
59 }57 }
60 }58 }
6159
62 messageHandlers: [60 messageHandlers: [
63 ScriptMessageHandler {61 Oxide.ScriptMessageHandler {
64 msgId: "contextmenu"62 msgId: "contextmenu"
65 contexts: ["oxide://selection/"]63 contexts: ["oxide://selection/"]
66 callback: function(msg, frame) {64 callback: function(msg, frame) {
@@ -90,7 +88,7 @@
90 }88 }
91 }89 }
92 },90 },
93 ScriptMessageHandler {91 Oxide.ScriptMessageHandler {
94 msgId: "scroll"92 msgId: "scroll"
95 contexts: ["oxide://selection/"]93 contexts: ["oxide://selection/"]
96 callback: function(msg, frame) {94 callback: function(msg, frame) {
@@ -102,141 +100,14 @@
102 ]100 ]
103101
104 onNavigationRequested: {102 onNavigationRequested: {
105 request.action = NavigationRequest.ActionAccept;103 request.action = Oxide.NavigationRequest.ActionAccept;
106 navigationRequestedDelegate(request);104 navigationRequestedDelegate(request);
107 }105 }
108106
109 preferences.passwordEchoEnabled: formFactor === "mobile"107 preferences.passwordEchoEnabled: formFactor === "mobile"
110108
111 /*experimental.preferences.navigatorQtObjectEnabled: true
112 experimental.userScripts: [Qt.resolvedUrl("selection.js")]
113 experimental.onMessageReceived: {
114 var data = null
115 try {
116 data = JSON.parse(message.data)
117 } catch (error) {
118 console.debug('DEBUG:', message.data)
119 return
120 }
121 if ('event' in data) {
122 if (data.event === 'longpress') {
123 if (('img' in data) || ('href' in data)) {
124 contextualData.clear()
125 if ('img' in data) {
126 contextualData.img = data.img
127 }
128 if ('href' in data) {
129 contextualData.href = data.href
130 contextualData.title = data.title
131 }
132 contextualRectangle.position(data)
133 PopupUtils.open(contextualPopover, contextualRectangle)
134 return
135 }
136 }
137 if ((data.event === 'longpress') || (data.event === 'selectionadjusted')) {
138 selection.clearData()
139 selection.createData()
140 if ('html' in data) {
141 selection.mimedata.html = data.html
142 }
143 // FIXME: push the text and image data in the order
144 // they appear in the selected block.
145 if ('text' in data) {
146 selection.mimedata.text = data.text
147 }
148 if ('images' in data) {
149 // TODO: download and cache the images locally
150 // (grab them from the webview’s cache, if possible),
151 // and forward local URLs.
152 selection.mimedata.urls = data.images
153 }
154 selection.show(data.left, data.top, data.width, data.height)
155 }
156 }
157 }*/
158
159 popupMenu: ItemSelector02 {}109 popupMenu: ItemSelector02 {}
160110
161 /*property alias selection: selection
162 property ActionList selectionActions
163 Selection {
164 id: selection
165
166 anchors.fill: parent
167 visible: false
168
169 property Item __popover: null
170 property var mimedata: null
171
172 Component {
173 id: selectionPopover
174 ActionSelectionPopover {
175 grabDismissAreaEvents: false
176 actions: selectionActions
177 }
178 }
179
180 function createData() {
181 if (mimedata === null) {
182 mimedata = Clipboard.newData()
183 }
184 }
185
186 function clearData() {
187 if (mimedata !== null) {
188 delete mimedata
189 mimedata = null
190 }
191 }
192
193 function actionTriggered() {
194 selection.visible = false
195 }
196
197 function __showPopover() {
198 __popover = PopupUtils.open(selectionPopover, selection.rect)
199 var actions = __popover.actions.actions
200 for (var i in actions) {
201 actions[i].onTriggered.connect(actionTriggered)
202 }
203 }
204
205 function show(x, y, width, height) {
206 var scale = _webview.experimental.test.contentsScale * _webview.experimental.test.devicePixelRatio
207 rect.x = x * scale + _webview.contentX
208 rect.y = y * scale + _webview.contentY
209 rect.width = width * scale
210 rect.height = height * scale
211 visible = true
212 __showPopover()
213 }
214
215 onVisibleChanged: {
216 if (!visible && (__popover != null)) {
217 PopupUtils.close(__popover)
218 __popover = null
219 }
220 }
221
222 onResized: {
223 var message = new Object
224 message.query = 'adjustselection'
225 var rect = selection.rect
226 var scale = _webview.experimental.test.contentsScale * _webview.experimental.test.devicePixelRatio
227 message.left = (rect.x - _webview.contentX) / scale
228 message.right = (rect.x + rect.width - _webview.contentX) / scale
229 message.top = (rect.y - _webview.contentY) / scale
230 message.bottom = (rect.y + rect.height - _webview.contentY) / scale
231 _webview.experimental.postMessage(JSON.stringify(message))
232 }
233
234 function copy() {
235 Clipboard.push(mimedata)
236 clearData()
237 }
238 }*/
239
240 Item {111 Item {
241 id: contextualRectangle112 id: contextualRectangle
242113
@@ -275,9 +146,9 @@
275 property Item currentContextualMenu: null146 property Item currentContextualMenu: null
276 }147 }
277148
278 readonly property bool lastLoadSucceeded: internal.lastLoadRequestStatus === LoadEvent.TypeSucceeded149 readonly property bool lastLoadSucceeded: internal.lastLoadRequestStatus === Oxide.LoadEvent.TypeSucceeded
279 readonly property bool lastLoadStopped: internal.lastLoadRequestStatus === LoadEvent.TypeStopped150 readonly property bool lastLoadStopped: internal.lastLoadRequestStatus === Oxide.LoadEvent.TypeStopped
280 readonly property bool lastLoadFailed: internal.lastLoadRequestStatus === LoadEvent.TypeFailed151 readonly property bool lastLoadFailed: internal.lastLoadRequestStatus === Oxide.LoadEvent.TypeFailed
281 onLoadingChanged: {152 onLoadingChanged: {
282 if (loadEvent.url.toString() !== "data:text/html,chromewebdata") {153 if (loadEvent.url.toString() !== "data:text/html,chromewebdata") {
283 internal.lastLoadRequestStatus = loadEvent.type154 internal.lastLoadRequestStatus = loadEvent.type
@@ -293,15 +164,15 @@
293164
294 onJavaScriptConsoleMessage: {165 onJavaScriptConsoleMessage: {
295 var msg = "[JS] (%1:%2) %3".arg(sourceId).arg(lineNumber).arg(message)166 var msg = "[JS] (%1:%2) %3".arg(sourceId).arg(lineNumber).arg(message)
296 if (level === WebView.LogSeverityVerbose) {167 if (level === Oxide.WebView.LogSeverityVerbose) {
297 console.log(msg)168 console.log(msg)
298 } else if (level === WebView.LogSeverityInfo) {169 } else if (level === Oxide.WebView.LogSeverityInfo) {
299 console.info(msg)170 console.info(msg)
300 } else if (level === WebView.LogSeverityWarning) {171 } else if (level === Oxide.WebView.LogSeverityWarning) {
301 console.warn(msg)172 console.warn(msg)
302 } else if ((level === WebView.LogSeverityError) ||173 } else if ((level === Oxide.WebView.LogSeverityError) ||
303 (level === WebView.LogSeverityErrorReport) ||174 (level === Oxide.WebView.LogSeverityErrorReport) ||
304 (level === WebView.LogSeverityFatal)) {175 (level === Oxide.WebView.LogSeverityFatal)) {
305 console.error(msg)176 console.error(msg)
306 }177 }
307 }178 }
308179
=== renamed file 'src/Ubuntu/Components/Extras/Browser/UserAgent02.qml' => 'src/Ubuntu/Web/UserAgent02.qml'
=== renamed file 'src/Ubuntu/Components/Extras/Browser/plugin.cpp' => 'src/Ubuntu/Web/plugin.cpp'
--- src/Ubuntu/Components/Extras/Browser/plugin.cpp 2014-03-19 22:17:40 +0000
+++ src/Ubuntu/Web/plugin.cpp 2014-06-09 09:55:59 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013-2014 Canonical Ltd.
3 *3 *
4 * This file is part of webbrowser-app.4 * This file is part of webbrowser-app.
5 *5 *
@@ -74,14 +74,17 @@
74 QQmlContext* context = engine->rootContext();74 QQmlContext* context = engine->rootContext();
75 context->setContextProperty("dataLocation", dataLocation.absolutePath());75 context->setContextProperty("dataLocation", dataLocation.absolutePath());
7676
77 // Set the desired pixel ratio (not needed once we use Qt’s way of77 if (uri == QLatin1String("Ubuntu.Components.Extras.Browser")) {
78 // calculating the proper pixel ratio by device/screen).78 // Set the desired pixel ratio (not needed once we use Qt’s way of
79 context->setContextProperty("QtWebKitDPR", getQtWebkitDpr());79 // calculating the proper pixel ratio by device/screen).
80 context->setContextProperty("QtWebKitDPR", getQtWebkitDpr());
81 }
8082
81 context->setContextProperty("formFactor", getFormFactor());83 context->setContextProperty("formFactor", getFormFactor());
82}84}
8385
84void UbuntuBrowserPlugin::registerTypes(const char* uri)86void UbuntuBrowserPlugin::registerTypes(const char* uri)
85{87{
86 Q_ASSERT(uri == QLatin1String("Ubuntu.Components.Extras.Browser"));88 Q_ASSERT(uri == QLatin1String("Ubuntu.Components.Extras.Browser")
89 || uri == QLatin1String("Ubuntu.Web"));
87}90}
8891
=== renamed file 'src/Ubuntu/Components/Extras/Browser/plugin.h' => 'src/Ubuntu/Web/plugin.h'
=== added file 'src/Ubuntu/Web/qmldir'
--- src/Ubuntu/Web/qmldir 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Web/qmldir 2014-06-09 09:55:59 +0000
@@ -0,0 +1,5 @@
1module Ubuntu.Web
2plugin ubuntu-web-plugin
3WebView 0.2 UbuntuWebView02.qml
4WebContext 0.2 UbuntuWebContext.qml
5singleton SharedWebContext 0.2 UbuntuSharedWebContext.qml
06
=== renamed file 'src/Ubuntu/Components/Extras/Browser/selection02.js' => 'src/Ubuntu/Web/selection02.js'
--- src/Ubuntu/Components/Extras/Browser/selection02.js 2014-04-23 12:30:01 +0000
+++ src/Ubuntu/Web/selection02.js 2014-06-09 09:55:59 +0000
@@ -16,12 +16,6 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */17 */
1818
19function elementContainedInBox(element, box) {
20 var rect = element.getBoundingClientRect();
21 return ((box.left <= rect.left) && (box.right >= rect.right) &&
22 (box.top <= rect.top) && (box.bottom >= rect.bottom));
23}
24
25function getImgFullUri(uri) {19function getImgFullUri(uri) {
26 if ((uri.slice(0, 7) === 'http://') ||20 if ((uri.slice(0, 7) === 'http://') ||
27 (uri.slice(0, 8) === 'https://') ||21 (uri.slice(0, 8) === 'https://') ||
@@ -104,41 +98,6 @@
104 return data;98 return data;
105}99}
106100
107function adjustSelection(selection) {
108 // FIXME: allow selecting two consecutive blocks, instead of
109 // interpolating to the containing block.
110 var centerX = (selection.left + selection.right) / 2;
111 var centerY = (selection.top + selection.bottom) / 2;
112 var element = document.elementFromPoint(centerX, centerY);
113 var parent = element;
114 while (elementContainedInBox(parent, selection)) {
115 parent = parent.parentNode;
116 }
117 element = parent;
118 return getSelectedData(element);
119}
120
121function distance(touch1, touch2) {
122 return Math.sqrt(Math.pow(touch2.clientX - touch1.clientX, 2) +
123 Math.pow(touch2.clientY - touch1.clientY, 2));
124}
125
126/*navigator.qt.onmessage = function(message) {
127 var data = null;
128 try {
129 data = JSON.parse(message.data);
130 } catch (error) {
131 return;
132 }
133 if ('query' in data) {
134 if (data.query === 'adjustselection') {
135 var selection = adjustSelection(data);
136 selection.event = 'selectionadjusted';
137 navigator.qt.postMessage(JSON.stringify(selection));
138 }
139 }
140}*/
141
142document.documentElement.addEventListener('contextmenu', function(event) {101document.documentElement.addEventListener('contextmenu', function(event) {
143 var element = document.elementFromPoint(event.clientX, event.clientY);102 var element = document.elementFromPoint(event.clientX, event.clientY);
144 var data = getSelectedData(element);103 var data = getSelectedData(element);
145104
=== renamed file 'src/Ubuntu/Components/Extras/Browser/ua-override-worker.js' => 'src/Ubuntu/Web/ua-override-worker.js'
=== renamed file 'src/Ubuntu/Components/Extras/Browser/ua-overrides-desktop.js' => 'src/Ubuntu/Web/ua-overrides-desktop.js'
=== renamed file 'src/Ubuntu/Components/Extras/Browser/ua-overrides-mobile.js' => 'src/Ubuntu/Web/ua-overrides-mobile.js'
=== modified file 'src/app/WebViewImpl.qml'
--- src/app/WebViewImpl.qml 2014-04-11 11:42:07 +0000
+++ src/app/WebViewImpl.qml 2014-06-09 09:55:59 +0000
@@ -18,11 +18,11 @@
1818
19import QtQuick 2.019import QtQuick 2.0
20//import Ubuntu.Components 0.120//import Ubuntu.Components 0.1
21import Ubuntu.Components.Extras.Browser 0.221import Ubuntu.Web 0.2
22//import Ubuntu.Components.Popups 0.122//import Ubuntu.Components.Popups 0.1
23//import "actions" as Actions23//import "actions" as Actions
2424
25UbuntuWebView {25WebView {
26 id: webview26 id: webview
2727
28 property var currentWebview: webview28 property var currentWebview: webview
2929
=== modified file 'src/app/webbrowser/TimelineView.qml'
--- src/app/webbrowser/TimelineView.qml 2014-05-22 16:21:27 +0000
+++ src/app/webbrowser/TimelineView.qml 2014-06-09 09:55:59 +0000
@@ -18,7 +18,6 @@
1818
19import QtQuick 2.019import QtQuick 2.0
20import Ubuntu.Components 0.120import Ubuntu.Components 0.1
21//import Ubuntu.Components.Extras.Browser 0.1
22import Ubuntu.Components.ListItems 0.1 as ListItem21import Ubuntu.Components.ListItems 0.1 as ListItem
23import webbrowserapp.private 0.122import webbrowserapp.private 0.1
2423
2524
=== modified file 'src/app/webcontainer/WebViewImplOxide.qml'
--- src/app/webcontainer/WebViewImplOxide.qml 2014-05-06 17:21:19 +0000
+++ src/app/webcontainer/WebViewImplOxide.qml 2014-06-09 09:55:59 +0000
@@ -18,11 +18,11 @@
1818
19import QtQuick 2.019import QtQuick 2.0
20import QtQuick.Window 2.020import QtQuick.Window 2.0
21import com.canonical.Oxide 1.021import com.canonical.Oxide 1.0 as Oxide
22import Ubuntu.Components 0.122import Ubuntu.Components 0.1
23import Ubuntu.Components.Extras.Browser 0.223import Ubuntu.Components.Popups 0.1
24import Ubuntu.UnityWebApps 0.1 as UnityWebApps24import Ubuntu.UnityWebApps 0.1 as UnityWebApps
25import Ubuntu.Components.Popups 0.125import Ubuntu.Web 0.2
26import "../actions" as Actions26import "../actions" as Actions
27import ".."27import ".."
2828
@@ -66,8 +66,8 @@
66 }66 }
6767
68 function isNewForegroundWebViewDisposition(disposition) {68 function isNewForegroundWebViewDisposition(disposition) {
69 return disposition === NavigationRequest.DispositionNewPopup ||69 return disposition === Oxide.NavigationRequest.DispositionNewPopup ||
70 disposition === NavigationRequest.DispositionNewForegroundTab;70 disposition === Oxide.NavigationRequest.DispositionNewForegroundTab;
71 }71 }
7272
73 function shouldAllowNavigationTo(url) {73 function shouldAllowNavigationTo(url) {
@@ -104,14 +104,14 @@
104 // See https://developer.mozilla.org/en-US/docs/Web/API/Window.open104 // See https://developer.mozilla.org/en-US/docs/Web/API/Window.open
105 if (newForegroundPageRequest && url == 'about:blank') {105 if (newForegroundPageRequest && url == 'about:blank') {
106 console.log('Accepting a new window request to navigate to "about:blank"')106 console.log('Accepting a new window request to navigate to "about:blank"')
107 request.action = NavigationRequest.ActionAccept107 request.action = Oxide.NavigationRequest.ActionAccept
108 return;108 return;
109 }109 }
110110
111 if (newForegroundPageRequest && shouldOpenPopupsInDefaultBrowser()) {111 if (newForegroundPageRequest && shouldOpenPopupsInDefaultBrowser()) {
112 console.debug('Opening: popup window ' + url + ' in the browser window.')112 console.debug('Opening: popup window ' + url + ' in the browser window.')
113113
114 request.action = NavigationRequest.ActionReject114 request.action = Oxide.NavigationRequest.ActionReject
115 Qt.openUrlExternally(url);115 Qt.openUrlExternally(url);
116 return;116 return;
117 }117 }
@@ -120,20 +120,20 @@
120 // or if we dont have a list of url patterns specified to filter the120 // or if we dont have a list of url patterns specified to filter the
121 // browsing actions121 // browsing actions
122 if ( ! webview.haveValidUrlPatterns() && ! webview.isRunningAsANamedWebapp()) {122 if ( ! webview.haveValidUrlPatterns() && ! webview.isRunningAsANamedWebapp()) {
123 request.action = NavigationRequest.ActionAccept123 request.action = Oxide.NavigationRequest.ActionAccept
124 return124 return
125 }125 }
126126
127 request.action = NavigationRequest.ActionReject127 request.action = Oxide.NavigationRequest.ActionReject
128 if (webview.shouldAllowNavigationTo(url))128 if (webview.shouldAllowNavigationTo(url))
129 request.action = NavigationRequest.ActionAccept129 request.action = Oxide.NavigationRequest.ActionAccept
130130
131 // SAML requests are used for instance by Google Apps for your domain;131 // SAML requests are used for instance by Google Apps for your domain;
132 // they are implemented as a HTTP redirect to a URL containing the132 // they are implemented as a HTTP redirect to a URL containing the
133 // query parameter called "SAMLRequest".133 // query parameter called "SAMLRequest".
134 // Besides letting the request through, we must also add the SAML134 // Besides letting the request through, we must also add the SAML
135 // domain to the list of the allowed hosts.135 // domain to the list of the allowed hosts.
136 if (request.disposition === NavigationRequest.DispositionCurrentTab &&136 if (request.disposition === Oxide.NavigationRequest.DispositionCurrentTab &&
137 url.indexOf("SAMLRequest") > 0) {137 url.indexOf("SAMLRequest") > 0) {
138 var urlRegExp = new RegExp("https?://([^?/]+)")138 var urlRegExp = new RegExp("https?://([^?/]+)")
139 var match = urlRegExp.exec(url)139 var match = urlRegExp.exec(url)
@@ -142,10 +142,10 @@
142 var hostPattern = "https?://" + host.replace(escapeDotsRegExp, "\\.") + "/"142 var hostPattern = "https?://" + host.replace(escapeDotsRegExp, "\\.") + "/"
143 console.log("SAML request detected. Adding host pattern: " + hostPattern)143 console.log("SAML request detected. Adding host pattern: " + hostPattern)
144 webappUrlPatterns.push(hostPattern)144 webappUrlPatterns.push(hostPattern)
145 request.action = NavigationRequest.ActionAccept145 request.action = Oxide.NavigationRequest.ActionAccept
146 }146 }
147147
148 if (request.action === NavigationRequest.ActionReject) {148 if (request.action === Oxide.NavigationRequest.ActionReject) {
149 console.debug('Opening: ' + url + ' in the browser window.')149 console.debug('Opening: ' + url + ' in the browser window.')
150 Qt.openUrlExternally(url)150 Qt.openUrlExternally(url)
151 }151 }
@@ -160,7 +160,7 @@
160 Window {160 Window {
161 id: popup161 id: popup
162 property alias request: popupBrowser.request162 property alias request: popupBrowser.request
163 UbuntuWebView {163 WebView {
164 id: popupBrowser164 id: popupBrowser
165 anchors.fill: parent165 anchors.fill: parent
166166
@@ -170,7 +170,7 @@
170 // If we are to browse in the popup to a place where we are not allows170 // If we are to browse in the popup to a place where we are not allows
171 if ( ! isNewForegroundWebViewDisposition(request.disposition) &&171 if ( ! isNewForegroundWebViewDisposition(request.disposition) &&
172 ! webview.shouldAllowNavigationTo(url)) {172 ! webview.shouldAllowNavigationTo(url)) {
173 request.action = NavigationRequest.ActionReject173 request.action = Oxide.NavigationRequest.ActionReject
174 Qt.openUrlExternally(url);174 Qt.openUrlExternally(url);
175 popup.close()175 popup.close()
176 return;176 return;
177177
=== modified file 'tests/unittests/qml/tst_UbuntuWebView02.qml'
--- tests/unittests/qml/tst_UbuntuWebView02.qml 2014-04-16 12:33:49 +0000
+++ tests/unittests/qml/tst_UbuntuWebView02.qml 2014-06-09 09:55:59 +0000
@@ -18,10 +18,10 @@
1818
19import QtQuick 2.019import QtQuick 2.0
20import QtTest 1.020import QtTest 1.0
21import Ubuntu.Components.Extras.Browser 0.221import Ubuntu.Web 0.2
2222
23TestCase {23TestCase {
24 name: "UbuntuWebView"24 name: "WebView"
2525
26 function test_context_singleton() {26 function test_context_singleton() {
27 compare(webview1.context, webview2.context)27 compare(webview1.context, webview2.context)
@@ -33,11 +33,11 @@
33 compare(webview2.context.userAgent, "custom UA")33 compare(webview2.context.userAgent, "custom UA")
34 }34 }
3535
36 UbuntuWebView {36 WebView {
37 id: webview137 id: webview1
38 }38 }
3939
40 UbuntuWebView {40 WebView {
41 id: webview241 id: webview2
4242
43 function getUAString(url) {43 function getUAString(url) {
4444
=== modified file 'webbrowser-app.qmlproject'
--- webbrowser-app.qmlproject 2013-07-18 08:35:41 +0000
+++ webbrowser-app.qmlproject 2014-06-09 09:55:59 +0000
@@ -22,6 +22,11 @@
22 filter: "*.h;*.cpp;*.py"22 filter: "*.h;*.cpp;*.py"
23 }23 }
2424
25 Files {
26 directory: "doc"
27 filter: "*.qdoc;*.qdocconf"
28 }
29
25 /* List of plugin directories passed to QML runtime */30 /* List of plugin directories passed to QML runtime */
26 importPaths: [ "src" ]31 importPaths: [ "src" ]
27}32}

Subscribers

People subscribed via source and target branches

to status/vote changes: