diff options
author | Kristian Monsen <kristianm@google.com> | 2010-07-30 10:46:49 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-08-04 13:01:34 +0100 |
commit | 0617145a89917ae7735fe1c9538688ab9a577df5 (patch) | |
tree | 56206078694427c37ed7bdf27eb5221398b833c0 /WebKitTools/QtTestBrowser | |
parent | ef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff) | |
download | external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2 |
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'WebKitTools/QtTestBrowser')
-rw-r--r-- | WebKitTools/QtTestBrowser/main.cpp | 146 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/webpage.cpp | 23 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/webpage.h | 3 |
3 files changed, 90 insertions, 82 deletions
diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp index 25765be..288472c 100644 --- a/WebKitTools/QtTestBrowser/main.cpp +++ b/WebKitTools/QtTestBrowser/main.cpp @@ -92,29 +92,6 @@ static bool gUseFrameFlattening = false; static bool gUseQGLWidgetViewport = false; #endif -class NotificationsPermissionController : public QObject { - Q_OBJECT -public: - NotificationsPermissionController(QObject* parent) : QObject(parent) - { - DumpRenderTreeSupportQt::setNotificationsReceiver(this); - DumpRenderTreeSupportQt::setCheckPermissionFunction(checkPermission); - DumpRenderTreeSupportQt::setRequestPermissionFunction(requestPermission); - } - - static void checkPermission(QObject*, const QUrl&, NotificationPermission& permission) - { - permission = NotificationAllowed; - } - - static void requestPermission(QObject*, const QString& origin) - { - DumpRenderTreeSupportQt::allowNotificationForOrigin(origin); - } -}; - -NotificationsPermissionController* notificationsPermissionController = 0; - class LauncherWindow : public MainWindow { Q_OBJECT @@ -233,8 +210,6 @@ LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene) } createChrome(); - if (!notificationsPermissionController) - notificationsPermissionController = new NotificationsPermissionController(QCoreApplication::instance()); } LauncherWindow::~LauncherWindow() @@ -885,16 +860,6 @@ void LauncherWindow::createChrome() toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool))); QMenu* toolsMenu = menuBar()->addMenu("&Develop"); - toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); - QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); - showInspectorAction->setCheckable(true); - showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool))); - touchMockAction->setCheckable(true); - touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T)); -#endif QWebSettings* settings = page()->settings(); @@ -907,24 +872,6 @@ void LauncherWindow::createChrome() toggleWebGL->setCheckable(true); toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled)); - QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); - toggleAcceleratedCompositing->setCheckable(true); - toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled)); - toggleAcceleratedCompositing->setEnabled(isGraphicsBased()); - toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); - toggleResizesToContents->setCheckable(true); - toggleResizesToContents->setChecked(false); - toggleResizesToContents->setEnabled(isGraphicsBased()); - toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); - toggleTiledBackingStore->setCheckable(true); - toggleTiledBackingStore->setChecked(false); - toggleTiledBackingStore->setEnabled(isGraphicsBased()); - toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool))); spatialNavigationAction->setCheckable(true); spatialNavigationAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S)); @@ -933,6 +880,14 @@ void LauncherWindow::createChrome() toggleFrameFlattening->setCheckable(true); toggleFrameFlattening->setChecked(settings->testAttribute(QWebSettings::FrameFlatteningEnabled)); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool))); + touchMockAction->setCheckable(true); + touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T)); +#endif + + toolsMenu->addSeparator(); + QAction* toggleInterruptingJavaScripteEnabled = toolsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool))); toggleInterruptingJavaScripteEnabled->setCheckable(true); toggleInterruptingJavaScripteEnabled->setChecked(false); @@ -941,44 +896,43 @@ void LauncherWindow::createChrome() toggleJavascriptCanOpenWindows->setCheckable(true); toggleJavascriptCanOpenWindows->setChecked(false); -#if defined(QT_CONFIGURED_WITH_OPENGL) - QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); - toggleQGLWidgetViewport->setCheckable(true); - toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport); - toggleQGLWidgetViewport->setEnabled(isGraphicsBased()); - toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); -#endif + toolsMenu->addSeparator(); QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog())); userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U)); - graphicsViewMenu->addSeparator(); - - m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); - m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - m_flipAnimated->setEnabled(isGraphicsBased()); + toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); - m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); - m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - m_flipYAnimated->setEnabled(isGraphicsBased()); + QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); + showInspectorAction->setCheckable(true); + showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); - if (isGraphicsBased()) { - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); - connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); - } + // GraphicsView sub menu. + QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); + toggleAcceleratedCompositing->setCheckable(true); + toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled)); + toggleAcceleratedCompositing->setEnabled(isGraphicsBased()); + toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - graphicsViewMenu->addSeparator(); + QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); + toggleResizesToContents->setCheckable(true); + toggleResizesToContents->setChecked(false); + toggleResizesToContents->setEnabled(isGraphicsBased()); + toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow())); - cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - cloneWindow->setEnabled(isGraphicsBased()); + QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); + toggleTiledBackingStore->setCheckable(true); + toggleTiledBackingStore->setChecked(false); + toggleTiledBackingStore->setEnabled(isGraphicsBased()); + toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool))); - showFPS->setCheckable(true); - showFPS->setEnabled(isGraphicsBased()); - showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - showFPS->setChecked(gShowFrameRate); +#if defined(QT_CONFIGURED_WITH_OPENGL) + QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); + toggleQGLWidgetViewport->setCheckable(true); + toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport); + toggleQGLWidgetViewport->setEnabled(isGraphicsBased()); + toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); +#endif QMenu* viewportUpdateMenu = graphicsViewMenu->addMenu("Change Viewport Update Mode"); viewportUpdateMenu->setEnabled(isGraphicsBased()); @@ -1025,6 +979,34 @@ void LauncherWindow::createChrome() viewportUpdateModeActions->addAction(smartUpdate); viewportUpdateModeActions->addAction(boundingRectUpdate); viewportUpdateModeActions->addAction(noUpdate); + + graphicsViewMenu->addSeparator(); + + m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); + m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + m_flipAnimated->setEnabled(isGraphicsBased()); + + m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); + m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + m_flipYAnimated->setEnabled(isGraphicsBased()); + + if (isGraphicsBased()) { + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); + connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); + } + + QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow())); + cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + cloneWindow->setEnabled(isGraphicsBased()); + + graphicsViewMenu->addSeparator(); + + QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool))); + showFPS->setCheckable(true); + showFPS->setEnabled(isGraphicsBased()); + showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + showFPS->setChecked(gShowFrameRate); } QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp index 2a3aae6..ee0232b 100644 --- a/WebKitTools/QtTestBrowser/webpage.cpp +++ b/WebKitTools/QtTestBrowser/webpage.cpp @@ -48,6 +48,9 @@ WebPage::WebPage(QObject* parent) connect(networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); + connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); + connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&))); + connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain))); } void WebPage::applyProxy() @@ -162,3 +165,23 @@ void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authe delete dialog; } + +void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain) +{ + setUserPermission(frame, domain, PermissionGranted); +} + +void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy) +{ + switch (domain) { + case NotificationsPermissionDomain: + policy = PermissionGranted; + break; + default: + break; + } +} + +void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain) +{ +} diff --git a/WebKitTools/QtTestBrowser/webpage.h b/WebKitTools/QtTestBrowser/webpage.h index 03cde43..15ae369 100644 --- a/WebKitTools/QtTestBrowser/webpage.h +++ b/WebKitTools/QtTestBrowser/webpage.h @@ -57,6 +57,9 @@ public slots: void setUserAgent(const QString& ua) { m_userAgent = ua; } bool shouldInterruptJavaScript(); void authenticationRequired(QNetworkReply*, QAuthenticator*); + void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); + void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy); + void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); private: void applyProxy(); |