[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

tonikitoo at webkit.org tonikitoo at webkit.org
Wed Dec 22 11:55:47 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9cf6d24ecbad999fadbb14f5fb809ff4cd71cfd7
Author: tonikitoo at webkit.org <tonikitoo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 11 15:56:40 2010 +0000

    2010-08-10  Antonio Gomes  <tonikitoo at webkit.org>
    
            Reviewed by Ariya Hidayat.
    
            [Qt] QtTestBrowser: lazy instantiate "YRotation" state machine and related objects
            https://bugs.webkit.org/show_bug.cgi?id=43831
    
            Only instantiate QStateMachine and friends associated to the YRotation action on demand.
    
            * QtTestBrowser/webview.cpp:
            (WebViewGraphicsBased::WebViewGraphicsBased):
            (WebViewGraphicsBased::animatedYFlip):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65159 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 847bc4a..fcaf05f 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-10  Antonio Gomes  <tonikitoo at webkit.org>
+
+        Reviewed by Ariya Hidayat.
+
+        [Qt] QtTestBrowser: lazy instantiate "YRotation" state machine and related objects
+        https://bugs.webkit.org/show_bug.cgi?id=43831
+
+        Only instantiate QStateMachine and friends associated to the YRotation action on demand.
+
+        * QtTestBrowser/webview.cpp:
+        (WebViewGraphicsBased::WebViewGraphicsBased):
+        (WebViewGraphicsBased::animatedYFlip):
+
 2010-08-11  Darin Adler  <darin at apple.com>
 
         Reviewed by John Sullivan.
diff --git a/WebKitTools/QtTestBrowser/webview.cpp b/WebKitTools/QtTestBrowser/webview.cpp
index c8eecd6..bc8fad1 100644
--- a/WebKitTools/QtTestBrowser/webview.cpp
+++ b/WebKitTools/QtTestBrowser/webview.cpp
@@ -42,6 +42,7 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
     , m_numPaintsSinceLastMeasure(0)
     , m_measureFps(false)
     , m_resizesToContents(false)
+    , m_machine(0)
 {
     setScene(new QGraphicsScene(this));
     scene()->addItem(m_item);
@@ -50,30 +51,6 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-    QStateMachine* machine = new QStateMachine(this);
-    QState* s0 = new QState(machine);
-    s0->assignProperty(this, "yRotation", 0);
-
-    QState* s1 = new QState(machine);
-    s1->assignProperty(this, "yRotation", 90);
-
-    QAbstractTransition* t1 = s0->addTransition(this, SIGNAL(yFlipRequest()), s1);
-    QPropertyAnimation* yRotationAnim = new QPropertyAnimation(this, "yRotation", this);
-    yRotationAnim->setDuration(1000);
-    t1->addAnimation(yRotationAnim);
-
-    QState* s2 = new QState(machine);
-    s2->assignProperty(this, "yRotation", -90);
-    s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2);
-
-    QAbstractTransition* t2 = s2->addTransition(s0);
-    t2->addAnimation(yRotationAnim);
-
-    machine->setInitialState(s0);
-    machine->start();
-#endif
-
     m_updateTimer = new QTimer(this);
     m_updateTimer->setInterval(1000);
     connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateFrameRate()));
@@ -193,7 +170,39 @@ void WebViewGraphicsBased::animatedFlip()
 
 void WebViewGraphicsBased::animatedYFlip()
 {
-    emit yFlipRequest();
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    if (!m_machine) {
+        m_machine = new QStateMachine(this);
+
+        QState* s0 = new QState(m_machine);
+        s0->assignProperty(this, "yRotation", 0);
+
+        QState* s1 = new QState(m_machine);
+        s1->assignProperty(this, "yRotation", 90);
+
+        QAbstractTransition* t1 = s0->addTransition(s1);
+        QPropertyAnimation* yRotationAnim = new QPropertyAnimation(this, "yRotation", this);
+        t1->addAnimation(yRotationAnim);
+
+        QState* s2 = new QState(m_machine);
+        s2->assignProperty(this, "yRotation", -90);
+        s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2);
+
+        QState* s3 = new QState(m_machine);
+        s3->assignProperty(this, "yRotation", 0);
+
+        QAbstractTransition* t2 = s2->addTransition(s3);
+        t2->addAnimation(yRotationAnim);
+
+        QFinalState* final = new QFinalState(m_machine);
+        s3->addTransition(s3, SIGNAL(propertiesAssigned()), final);
+
+        m_machine->setInitialState(s0);
+        yRotationAnim->setDuration(1000);
+    }
+
+    m_machine->start();
+#endif
 }
 
 void WebViewGraphicsBased::paintEvent(QPaintEvent* event)
diff --git a/WebKitTools/QtTestBrowser/webview.h b/WebKitTools/QtTestBrowser/webview.h
index 5e7c0c3..d0e1e57 100644
--- a/WebKitTools/QtTestBrowser/webview.h
+++ b/WebKitTools/QtTestBrowser/webview.h
@@ -41,6 +41,8 @@
 #include <QGraphicsWidget>
 #include <QTime>
 
+class QStateMachine;
+
 class WebViewTraditional : public QWebView {
     Q_OBJECT
 
@@ -110,7 +112,6 @@ public slots:
     void contentsSizeChanged(const QSize&);
 
 signals:
-    void yFlipRequest();
     void currentFPSUpdated(int fps);
 
 private:
@@ -123,6 +124,7 @@ private:
     bool m_measureFps;
     qreal m_yRotation;
     bool m_resizesToContents;
+    QStateMachine* m_machine;
     FpsTimer m_fpsTimer;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list