summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-10-07 12:30:27 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2019-10-10 10:40:56 +0200
commit22e88504ab61a622fb9bcf38cf54728286f33bce (patch)
tree6d9f21e2347285a5df01f5e31f8caf7d21f08daa
parentd922bce928618d2c1e1878831877fad99dc2b066 (diff)
Move lifecycle docs to features page
Also fix incorrect \since versions in QML API docs. Change-Id: I87b5899d4a55832dca2cd251aeb681e4bb2de2a2 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
-rw-r--r--examples/webengine/lifecycle/doc/src/lifecycle.qdoc67
-rw-r--r--src/webengine/doc/src/qtwebengine-features.qdoc78
-rw-r--r--src/webengine/doc/src/webengineview_lgpl.qdoc14
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp6
4 files changed, 90 insertions, 75 deletions
diff --git a/examples/webengine/lifecycle/doc/src/lifecycle.qdoc b/examples/webengine/lifecycle/doc/src/lifecycle.qdoc
index 4151d0597..d10e617e3 100644
--- a/examples/webengine/lifecycle/doc/src/lifecycle.qdoc
+++ b/examples/webengine/lifecycle/doc/src/lifecycle.qdoc
@@ -38,6 +38,8 @@
properties of the \l {WebEngineView} can be used to reduce the CPU and
memory usage of background tabs in a tabbed browser.
+ For an overview of the lifecycle feature, see \l {Page Lifecycle API}.
+
\include examples-run.qdocinc
\section1 UI Elements of the Example
@@ -53,71 +55,6 @@
window also has a \l {Drawer} for changing settings. The drawer can be
opened by clicking the "⋮" button on the tool bar.
- \section1 Overview of Lifecycle States
-
- Each \l {WebEngineView} item can be in one of three \e {lifecycle states}:
- active, frozen, or discarded. These states, like the sleep states of a CPU,
- control the resource usage of web views.
-
- The \e {active} state is the normal, unrestricted state of a web view. All
- visible web views are always in the active state, as are all web views that
- have not yet finished loading. Only invisible, idle web views can be
- transitioned to other lifecycle states.
-
- The \e {frozen} state is a low CPU usage state. In this state, most HTML
- task sources are suspended (frozen) and, as a result, most DOM event
- processing and JavaScript execution will also be suspended. The web view
- must be invisible in order to be frozen as rendering is not possible in this
- state.
-
- The \e {discarded} state is an extreme resource-saving state. In this state,
- the browsing context of the web view will be discarded and the corresponding
- renderer subprocess shut down. CPU and memory usage in this state is reduced
- virtually to zero. On exiting this state the web page will be automatically
- reloaded. The process of entering and exiting the discarded state is similar
- to serializing the browsing history of the web view and destroying the view,
- then creating a new view and restoring its history.
-
- See also \l {WebEngineView::LifecycleState}. The equivalent in the Widgets
- API is \l {QWebEnginePage::LifecycleState}.
-
- \section2 The \c {lifecycleState} and \c {recommendedState} Properties
-
- The \l {WebEngineView::}{lifecycleState} property of the \l {WebEngineView}
- type is a read-write property that controls the current lifecycle state of
- the web view. This property is designed to place as few restrictions as
- possible on what states can be transitioned to. For example, it is allowed
- to freeze a web view that is currently playing music in the background,
- stopping the music. In order to implement a less aggressive resource-saving
- strategy that avoids interrupting user-visible background activity, the \l
- {WebEngineView::} {recommendedState} property must be used.
-
- The \l {WebEngineView::}{recommendedState} property of the \l
- {WebEngineView} type is a read-only property that calculates a safe limit on
- the \l {WebEngineView::}{lifecycleState} property, taking into account the
- current activity of the web view. So, in the example of a web view playing
- music in the background, the recommended state will be \c {Active} since a
- more aggressive state would stop the music. If the application wants to
- avoid interrupting background activity, then it should avoid putting the web
- view into a more aggressively resource-saving lifecycle state than what's
- given by \l {WebEngineView::}{recommendedState}.
-
- See also \l {WebEngineView::lifecycleState} and \l
- {WebEngineView::recommendedState}. The equivalents in the Widgets API are \l
- {QWebEnginePage::lifecycleState} and \l {QWebEnginePage::recommendedState}.
-
- \section2 The Page Lifecycle API
-
- The \l {WebEngineView::}{lifecycleState} property is connected to the \l
- {https://wicg.github.io/page-lifecycle/spec.html}{Page Lifecycle API}, a
- work-in-progress extension to the HTML standard that specifies two new DOM
- events, \c {freeze} and \c {resume}, and adds a new \c
- {Document.wasDiscarded} boolean property. The \c {freeze} and \c {resume}
- events are fired when transitioning from the \c {Active} to the \c {Frozen
- state}, and vice-versa. The \c {Document.wasDiscarded} property is set to \c
- {true} when transition from the \c {Discarded} state to the \c {Active}
- state.
-
\section1 Lifecycle States in the Example
The example implements two ways of changing the lifecycle state: manual and
diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc
index 00b9cb496..4a2a67b6c 100644
--- a/src/webengine/doc/src/qtwebengine-features.qdoc
+++ b/src/webengine/doc/src/qtwebengine-features.qdoc
@@ -45,6 +45,7 @@
\li \l{Native Dialogs}
\li \l{Pepper Plugin API}
\li \l{PDF File Viewing}
+ \li \l{Page Lifecycle API}
\li \l{Print to PDF}
\li \l{Process Models}
\li \l{Spellchecker}
@@ -337,6 +338,83 @@
Support for this feature was added in Qt 5.13.0.
+ \section1 Page Lifecycle API
+
+ \QWE supports the \l {https://wicg.github.io/page-lifecycle/spec.html}{Page
+ Lifecycle API specification}, a work-in-progress extension to the HTML
+ standard for allowing user agents to reduce their resource consumption by
+ freezing or discarding background pages. The feature is exposed both in the
+ Widgets and QML APIs.
+
+ For an example of the QML API in use, see the \l {WebEngine Lifecycle
+ Example}.
+
+ Support for this feature was added in Qt 5.14.0.
+
+ \section2 Overview of Lifecycle States
+
+ Each \l {WebEngineView} item (or \l {QWebEnginePage} object) can be in one
+ of three \e {lifecycle states}: active, frozen, or discarded. These states,
+ like the sleep states of a CPU, control the resource usage of web views.
+
+ The \e {active} state is the normal, unrestricted state of a web view. All
+ visible web views are always in the active state, as are all web views that
+ have not yet finished loading. Only invisible, idle web views can be
+ transitioned to other lifecycle states.
+
+ The \e {frozen} state is a low CPU usage state. In this state, most HTML
+ task sources are suspended (frozen) and, as a result, most DOM event
+ processing and JavaScript execution will also be suspended. The web view
+ must be invisible in order to be frozen as rendering is not possible in this
+ state.
+
+ The \e {discarded} state is an extreme resource-saving state. In this state,
+ the browsing context of the web view will be discarded and the corresponding
+ renderer subprocess shut down. CPU and memory usage in this state is reduced
+ virtually to zero. On exiting this state the web page will be automatically
+ reloaded. The process of entering and exiting the discarded state is similar
+ to serializing the browsing history of the web view and destroying the view,
+ then creating a new view and restoring its history.
+
+ See also \l {WebEngineView::LifecycleState}. The equivalent in the Widgets
+ API is \l {QWebEnginePage::LifecycleState}.
+
+ \section2 The \c {lifecycleState} and \c {recommendedState} Properties
+
+ The \l {WebEngineView::}{lifecycleState} property of the \l {WebEngineView}
+ type is a read-write property that controls the current lifecycle state of
+ the web view. This property is designed to place as few restrictions as
+ possible on what states can be transitioned to. For example, it is allowed
+ to freeze a web view that is currently playing music in the background,
+ stopping the music. In order to implement a less aggressive resource-saving
+ strategy that avoids interrupting user-visible background activity, the \l
+ {WebEngineView::} {recommendedState} property must be used.
+
+ The \l {WebEngineView::}{recommendedState} property of the \l
+ {WebEngineView} type is a read-only property that calculates a safe limit on
+ the \l {WebEngineView::}{lifecycleState} property, taking into account the
+ current activity of the web view. So, in the example of a web view playing
+ music in the background, the recommended state will be \c {Active} since a
+ more aggressive state would stop the music. If the application wants to
+ avoid interrupting background activity, then it should avoid putting the web
+ view into a more aggressively resource-saving lifecycle state than what's
+ given by \l {WebEngineView::}{recommendedState}.
+
+ See also \l {WebEngineView::lifecycleState} and \l
+ {WebEngineView::recommendedState}. The equivalents in the Widgets API are \l
+ {QWebEnginePage::lifecycleState} and \l {QWebEnginePage::recommendedState}.
+
+ \section2 The DOM Extensions
+
+ The \l {WebEngineView::}{lifecycleState} property is connected to the \l
+ {https://wicg.github.io/page-lifecycle/spec.html}{Page Lifecycle API
+ specification}, which specifies two new DOM events, \c {freeze} and \c
+ {resume}, and adds a new \c {Document.wasDiscarded} boolean property. The \c
+ {freeze} and \c {resume} events are fired when transitioning from the \c
+ {Active} to the \c {Frozen state}, and vice-versa. The \c
+ {Document.wasDiscarded} property is set to \c {true} when transitioning from
+ the \c {Discarded} state to the \c {Active} state.
+
\section1 Print to PDF
\QWE supports printing a web page to a PDF file. For more
diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc
index 9abc8f37b..3a7717bd2 100644
--- a/src/webengine/doc/src/webengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/webengineview_lgpl.qdoc
@@ -1530,7 +1530,7 @@
/*!
\qmlproperty enumeration WebEngineView::LifecycleState
- \since QtWebEngine 1.11
+ \since QtWebEngine 1.10
This enum describes the lifecycle state of the page:
@@ -1541,12 +1541,12 @@
\value WebEngineView.LifecycleState.Discarded
Very low resource usage state where the entire browsing context is discarded.
- \sa lifecycleState
+ \sa lifecycleState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
/*!
\qmlproperty LifecycleState WebEngineView::lifecycleState
- \since QtWebEngine 1.11
+ \since QtWebEngine 1.10
\brief The current lifecycle state of the page.
@@ -1563,12 +1563,12 @@
These are the only hard limits on the lifecycle state, but see also
\l{recommendedState} for the recommended soft limits.
- \sa recommendedState, {WebEngine Lifecycle Example}
+ \sa recommendedState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
/*!
\qmlproperty LifecycleState WebEngineView::recommendedState
- \since QtWebEngine 1.11
+ \since QtWebEngine 1.10
\brief The recommended limit for the lifecycle state of the page.
@@ -1577,14 +1577,14 @@
playback or loss of HTML form input. Setting the lifecycle state to a higher
resource state is however completely safe.
- \sa lifecycleState, {WebEngine Lifecycle Example}
+ \sa lifecycleState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
/*!
\qmltype FindTextResult
\instantiates QWebEngineFindTextResult
\inqmlmodule QtWebEngine
- \since QtWebEngine 1.11
+ \since QtWebEngine 1.10
\brief A utility type for encapsulating the result of a string search on a page.
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index e4f4c4bc8..db3efa521 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -2543,7 +2543,7 @@ const QWebEngineContextMenuData &QWebEnginePage::contextMenuData() const
\value Discarded
Very low resource usage state where the entire browsing context is discarded.
- \sa lifecycleState, {WebEngine Lifecycle Example}
+ \sa lifecycleState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
/*!
@@ -2565,7 +2565,7 @@ const QWebEngineContextMenuData &QWebEnginePage::contextMenuData() const
These are the only hard limits on the lifecycle state, but see also
\l{recommendedState} for the recommended soft limits.
- \sa recommendedState, {WebEngine Lifecycle Example}
+ \sa recommendedState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
QWebEnginePage::LifecycleState QWebEnginePage::lifecycleState() const
@@ -2591,7 +2591,7 @@ void QWebEnginePage::setLifecycleState(LifecycleState state)
playback or loss of HTML form input. Setting the lifecycle state to a higher
resource state is however completely safe.
- \sa lifecycleState
+ \sa lifecycleState, {Page Lifecycle API}, {WebEngine Lifecycle Example}
*/
QWebEnginePage::LifecycleState QWebEnginePage::recommendedState() const