https://bugs.webkit.org/show_bug.cgi?id=35146
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Mar 2010 00:53:19 +0000 (00:53 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Mar 2010 00:53:19 +0000 (00:53 +0000)
Support tiled backing store

Reviewed by Simon Hausmann.

QtLauncher support and build flag in build-webkit.

* QtLauncher/main.cpp:
(LauncherWindow::applyPrefs):
(LauncherWindow::toggleTiledBackingStore):
(LauncherWindow::toggleResizesToContents):
(LauncherWindow::createChrome):
(LauncherApplication::handleUserOptions):
* QtLauncher/webview.cpp:
(WebViewGraphicsBased::WebViewGraphicsBased):
(WebViewGraphicsBased::setResizesToContents):
(WebViewGraphicsBased::resizeEvent):
* QtLauncher/webview.h:
* Scripts/build-webkit:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55979 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/QtLauncher/main.cpp
WebKitTools/QtLauncher/webview.cpp
WebKitTools/QtLauncher/webview.h
WebKitTools/Scripts/build-webkit

index 6db8002..af46737 100644 (file)
@@ -1,3 +1,25 @@
+2010-03-14  Antti Koivisto  <koivisto@iki.fi>
+
+        Reviewed by Simon Hausmann.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35146
+        Support tiled backing store
+
+        QtLauncher support and build flag in build-webkit.
+
+        * QtLauncher/main.cpp:
+        (LauncherWindow::applyPrefs):
+        (LauncherWindow::toggleTiledBackingStore):
+        (LauncherWindow::toggleResizesToContents):
+        (LauncherWindow::createChrome):
+        (LauncherApplication::handleUserOptions):
+        * QtLauncher/webview.cpp:
+        (WebViewGraphicsBased::WebViewGraphicsBased):
+        (WebViewGraphicsBased::setResizesToContents):
+        (WebViewGraphicsBased::resizeEvent):
+        * QtLauncher/webview.h:
+        * Scripts/build-webkit:
+
 2010-03-13  Chris Jerdonek  <cjerdonek@webkit.org>
 
         Reviewed by Adam Barth.
index 6785ec8..a070385 100644 (file)
@@ -77,6 +77,8 @@ static bool gCacheWebView = false;
 static bool gShowFrameRate = false;
 static QGraphicsView::ViewportUpdateMode gViewportUpdateMode = QGraphicsView::MinimalViewportUpdate;
 static QUrl gInspectorUrl;
+static bool gResizesToContents = false;
+static bool gUseTiledBackingStore = false;
 
 class LauncherWindow : public MainWindow {
     Q_OBJECT
@@ -117,6 +119,9 @@ protected slots:
 
     void setTouchMocking(bool on);
     void toggleAcceleratedCompositing(bool toggle);
+    void toggleTiledBackingStore(bool toggle);
+    void toggleResizesToContents(bool toggle);
+    
     void toggleWebGL(bool toggle);
     void initializeView(bool useGraphicsView = false);
     void toggleSpatialNavigation(bool b);
@@ -235,6 +240,7 @@ void LauncherWindow::applyPrefs(LauncherWindow* source)
     QWebSettings* settings = page()->settings();
 
     applySetting(QWebSettings::AcceleratedCompositingEnabled, settings, other, gUseCompositing);
+    applySetting(QWebSettings::TiledBackingStoreEnabled, settings, other, gUseTiledBackingStore);;
     applySetting(QWebSettings::WebGLEnabled, settings, other, false);
 
     if (!isGraphicsBased())
@@ -526,6 +532,16 @@ void LauncherWindow::toggleAcceleratedCompositing(bool toggle)
     page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, toggle);
 }
 
+void LauncherWindow::toggleTiledBackingStore(bool toggle)
+{
+    page()->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, toggle);
+}
+
+void LauncherWindow::toggleResizesToContents(bool toggle)
+{
+    static_cast<WebViewGraphicsBased*>(m_view)->setResizesToContents(toggle);
+}
+
 void LauncherWindow::toggleWebGL(bool toggle)
 {
     page()->settings()->setAttribute(QWebSettings::WebGLEnabled, toggle);
@@ -695,6 +711,18 @@ void LauncherWindow::createChrome()
     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(false);
+    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(false);
+    toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
 
     QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool)));
     spatialNavigationAction->setCheckable(true);
@@ -837,6 +865,8 @@ void LauncherApplication::handleUserOptions()
              << "[-show-fps]"
              << "[-r list]"
              << "[-inspector-url location]"
+             << "[-tiled-backing-store]"
+             << "[-resizes-to-contents]"
              << "URLs";
         appQuit(0);
     }
@@ -859,6 +889,16 @@ void LauncherApplication::handleUserOptions()
         gCacheWebView = true;
     }
 
+    if (args.contains("-tiled-backing-store")) {
+        requiresGraphicsView("-tiled-backing-store");
+        gUseTiledBackingStore = true;
+    }
+
+    if (args.contains("-resizes-to-contents")) {
+        requiresGraphicsView("-resizes-to-contents");
+        gResizesToContents = true;
+    }
+
     QString arg1("-viewport-update-mode");
     int modeIndex = args.indexOf(arg1);
     if (modeIndex != -1) {
index dc2fa7b..591e2da 100644 (file)
@@ -41,6 +41,7 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
     , m_numPaintsTotal(0)
     , m_numPaintsSinceLastMeasure(0)
     , m_measureFps(false)
+    , m_resizesToContents(false)
 {
     setScene(new QGraphicsScene(this));
     scene()->addItem(m_item);
@@ -78,9 +79,24 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
     connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateFrameRate()));
 }
 
+void WebViewGraphicsBased::setResizesToContents(bool b)
+{
+    m_resizesToContents = b;
+    m_item->setResizesToContents(m_resizesToContents);
+    if (m_resizesToContents) {
+        setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+        setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+    } else {
+        setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+        setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    }
+}
+
 void WebViewGraphicsBased::resizeEvent(QResizeEvent* event)
 {
     QGraphicsView::resizeEvent(event);
+    if (m_resizesToContents)
+        return;
     QRectF rect(QPoint(0, 0), event->size());
     m_item->setGeometry(rect);
 }
index f7bce6f..b09fb1a 100644 (file)
@@ -79,6 +79,8 @@ public:
     bool frameRateMeasurementEnabled() { return m_measureFps; } 
 
     virtual void paintEvent(QPaintEvent* event);
+    
+    void setResizesToContents(bool b);
 
     void setYRotation(qreal angle)
     {
@@ -113,6 +115,7 @@ private:
     QTimer* m_updateTimer;
     bool m_measureFps;
     qreal m_yRotation;
+    bool m_resizesToContents;
 };
 
 #endif
index 413c971..20deea0 100755 (executable)
@@ -56,7 +56,7 @@ my ($threeDCanvasSupport, $threeDRenderingSupport, $channelMessagingSupport, $cl
     $javaScriptDebuggerSupport, $mathmlSupport, $offlineWebApplicationSupport, $rubySupport, $sandboxSupport, $sharedWorkersSupport,
     $svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport,
     $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport,
-    $xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport);
+    $xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport, $tiledBackingStoreSupport);
 
 my @features = (
     { option => "3d-canvas", desc => "Toggle 3D canvas support",
@@ -146,6 +146,9 @@ my @features = (
     { option => "svg-use", desc => "Toggle SVG use element support (implies SVG support)",
       define => "ENABLE_SVG_USE", default => 1, value => \$svgUseSupport },
 
+    { option => "tiled-backing-store", desc => "Toggle Tiled Backing Store support",
+      define => "ENABLE_TILED_BACKING_STORE", default => isQt(), value => \$tiledBackingStoreSupport },
+
     { option => "video", desc => "Toggle Video support",
       define => "ENABLE_VIDEO", default => (isAppleWebKit() || isGtk()), value => \$videoSupport },