diff options
author | Benjamin Dupont <bdupont@nds.com> | 2013-08-06 13:58:39 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-09 16:26:24 +0200 |
commit | a8257e82b8a4c41a0a0788943a2346d169a737a6 (patch) | |
tree | 03aabcb57ea8800c08519c0763289c4161732327 /Source/WebKit/qt/WidgetApi/qwebpage.cpp | |
parent | f3484678deb631b7d994dd400b609dcb7bbbc04b (diff) | |
download | qtwebkit-a8257e82b8a4c41a0a0788943a2346d169a737a6.tar.gz |
[Qt] Add Page Visibility API support
https://bugs.webkit.org/show_bug.cgi?id=109422
Patch by Benjamin Dupont <bdupont@nds.com> on 2013-08-06
Reviewed by Simon Hausmann.
* WebCoreSupport/QWebPageAdapter.cpp:
(webPageVisibilityStateToWebCoreVisibilityState):
(webCoreVisibilityStateToWebPageVisibilityState):
(QWebPageAdapter::setVisibilityState):
(QWebPageAdapter::visibilityState):
* WebCoreSupport/QWebPageAdapter.h:
* WidgetApi/qwebpage.cpp:
(QWebPage::setVisibilityState):
(QWebPage::visibilityState):
* WidgetApi/qwebpage.h:
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::changeVisibilityState):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Build fix after r153751
Unreviewed build fix.
Fix build when PAGE_VISIBILITY_API is disabled.
* WebCoreSupport/QWebPageAdapter.cpp:
(QWebPageAdapter::visibilityState):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change-Id: I7c99337a902d7d06cde03107ebf71e3fce430fdf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebKit/qt/WidgetApi/qwebpage.cpp')
-rw-r--r-- | Source/WebKit/qt/WidgetApi/qwebpage.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index 4931a4854..d6cdb013b 100644 --- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp @@ -1054,6 +1054,20 @@ QWebInspector* QWebPagePrivate::getOrCreateInspector() */ /*! + \enum QWebPage::VisibilityState + + This enum defines visibility states that a webpage can take. + + \value VisibilityStateVisible The webpage is at least partially visible at on at least one screen. + \value VisibilityStateHidden The webpage is not visible at all on any screen. + \value VisibilityStatePrerender The webpage is loaded off-screen and is not visible. + \value VisibilityStateUnloaded The webpage is unloading its content. + More information about this values can be found at \l{ http://www.w3.org/TR/page-visibility/#dom-document-visibilitystate}{W3C Recommendation: Page Visibility: visibilityState attribute}. + + \sa QWebPage::visibilityState +*/ + +/*! \enum QWebPage::LinkDelegationPolicy This enum defines the delegation policies a webpage can have when activating links and emitting @@ -3136,6 +3150,31 @@ quint64 QWebPage::bytesReceived() const return d->m_bytesReceived; } + +/*! + \property QWebPage::visibilityState + \brief the page's visibility state + + This property should be changed by Qt applications who want to notify the JavaScript application + that the visibility state has changed (e.g. by reimplementing QWidget::setVisible). + The visibility state will be updated with the \a state parameter value only if it's different from the previous set. + Then, HTML DOM Document Object attributes 'hidden' and 'visibilityState' + will be updated to the correct value and a 'visiblitychange' event will be fired. + More information about this HTML5 API can be found at \l{http://www.w3.org/TR/page-visibility/}{W3C Recommendation: Page Visibility}. + + By default, this property is set to VisibilityStateVisible. +*/ +void QWebPage::setVisibilityState(VisibilityState state) +{ + d->setVisibilityState(static_cast<QWebPageAdapter::VisibilityState>(state)); +} + +QWebPage::VisibilityState QWebPage::visibilityState() const +{ + return static_cast<VisibilityState>(d->visibilityState()); +} + + /*! \since 4.8 \fn void QWebPage::viewportChangeRequested() |