Commit e24d9a49 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] QWebPage viewMode property
        https://bugs.webkit.org/show_bug.cgi?id=38119

        Replacing method qt_wrt_setViewMode by wrt_viewMode property.

        * Api/qwebpage.cpp:
        (QWebPagePrivate::dynamicPropertyChangeEvent):
        (QWebPage::event):
        * Api/qwebpage_p.h:
        * tests/qwebpage/tst_qwebpage.cpp:
        (tst_QWebPage::wrt_viewModes):
2010-04-28  Luiz Agostini  <luiz.agostini@openbossa.org>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] QWebPage viewMode property
        https://bugs.webkit.org/show_bug.cgi?id=38119

        Replacing method qt_wrt_setViewMode by wrt_viewMode property.

        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::setViewModeMediaFeature):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58405 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 294a60ac
......@@ -121,15 +121,6 @@
using namespace WebCore;
void QWEBKIT_EXPORT qt_wrt_setViewMode(QWebPage* page, const QString& mode)
{
QWebPagePrivate::priv(page)->viewMode = mode;
WebCore::Frame* frame = QWebFramePrivate::core(page->mainFrame());
WebCore::FrameView* view = frame->view();
frame->document()->updateStyleSelector();
view->forceLayout();
}
bool QWebPagePrivate::drtRun = false;
// Lookup table mapping QWebPage::WebActions to the associated Editor commands
......@@ -1216,6 +1207,20 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
ev->accept();
}
void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event)
{
if (event->propertyName() == "wrt_viewMode") {
QString mode = q->property("wrt_viewMode").toString();
if (mode != viewMode) {
viewMode = mode;
WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame());
WebCore::FrameView* view = frame->view();
frame->document()->updateStyleSelector();
view->forceLayout();
}
}
}
void QWebPagePrivate::shortcutOverrideEvent(QKeyEvent* event)
{
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
......@@ -2564,6 +2569,9 @@ bool QWebPage::event(QEvent *ev)
d->touchEvent(static_cast<QTouchEvent*>(ev));
break;
#endif
case QEvent::DynamicPropertyChange:
d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev));
break;
default:
return QObject::event(ev);
}
......
......@@ -113,6 +113,8 @@ public:
void inputMethodEvent(QInputMethodEvent*);
void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*);
void shortcutOverrideEvent(QKeyEvent*);
void leaveEvent(QEvent*);
void handleClipboard(QEvent*, Qt::MouseButton);
......
2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] QWebPage viewMode property
https://bugs.webkit.org/show_bug.cgi?id=38119
Replacing method qt_wrt_setViewMode by wrt_viewMode property.
* Api/qwebpage.cpp:
(QWebPagePrivate::dynamicPropertyChangeEvent):
(QWebPage::event):
* Api/qwebpage_p.h:
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::wrt_viewModes):
2010-04-28 Janne Koskinen <janne.p.koskinen@digia.com>
 
Reviewed by Simon Hausmann <simon.hausmann@nokia.com>
......
......@@ -108,6 +108,8 @@ private slots:
void errorPageExtensionInIFrames();
void errorPageExtensionInFrameset();
void wrt_viewModes();
void crashTests_LazyInitializationOfMainFrame();
void screenshot_data();
......@@ -355,6 +357,21 @@ void tst_QWebPage::userStyleSheet()
QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
}
void tst_QWebPage::wrt_viewModes()
{
m_view->setHtml("<body></body>");
m_page->setProperty("wrt_viewMode", "minimized");
QVariant empty = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode)\")");
QVERIFY(empty.type() == QVariant::Bool && empty.toBool());
QVariant minimized = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode: minimized)\")");
QVERIFY(minimized.type() == QVariant::Bool && minimized.toBool());
QVariant maximized = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode: maximized)\")");
QVERIFY(maximized.type() == QVariant::Bool && !maximized.toBool());
}
void tst_QWebPage::modified()
{
m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>blub"));
......
2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] QWebPage viewMode property
https://bugs.webkit.org/show_bug.cgi?id=38119
Replacing method qt_wrt_setViewMode by wrt_viewMode property.
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::setViewModeMediaFeature):
2010-04-28 Chris Jerdonek <cjerdonek@webkit.org>
 
Reviewed by Shinichiro Hamaji.
......@@ -37,7 +37,6 @@
#include <QLocale>
#include <qwebsettings.h>
extern void qt_wrt_setViewMode(QWebPage* page, const QString& mode);
extern void qt_dump_editing_callbacks(bool b);
extern void qt_dump_frame_loader(bool b);
extern void qt_dump_resource_load_callbacks(bool b);
......@@ -141,7 +140,7 @@ QString LayoutTestController::counterValueForElementById(const QString& id)
void LayoutTestController::setViewModeMediaFeature(const QString& mode)
{
qt_wrt_setViewMode(m_drt->webPage(), mode);
m_drt->webPage()->setProperty("wrt_viewMode", mode);
}
int LayoutTestController::webHistoryItemCount()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment