[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

antti at apple.com antti at apple.com
Thu Apr 8 02:22:08 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit bba8e8db2f392a0756dd0297ffee25e7f1cdbbca
Author: antti at apple.com <antti at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Mar 14 23:40:29 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=35146
    Support tiled backing store
    
    Reviewed by Simon Hausmann.
    
    Implements a basic tiled backing store mechanism. Tiles are created and
    deleted on demand. The page content is cached to the tiles. Tile content
    is kept in sync with the document. Since the backing store covers area
    larger than the currently visible viewport, the document can be scrolled
    quickly without having to enter rendering tree painting.
    
    The tile management code is platform independent. This patch has simple QPixmap
    based tile implementation for Qt.
    
    The feature is behind ENABLE_TILED_BACKING_STORE flag.
    
    * WebCore.pri:
    * WebCore.pro:
    * page/Frame.cpp:
    (WebCore::Frame::Frame):
    (WebCore::Frame::setTiledBackingStoreEnabled):
    (WebCore::Frame::tiledBackingStorePaintBegin):
    (WebCore::Frame::tiledBackingStorePaint):
    (WebCore::Frame::tiledBackingStorePaintEnd):
    (WebCore::Frame::tiledBackingStoreContentsRect):
    * page/Frame.h:
    (WebCore::Frame::tiledBackingStore):
    * page/FrameView.cpp:
    (WebCore::FrameView::repaintContentRectangle):
    (WebCore::FrameView::doDeferredRepaints):
    * page/Settings.cpp:
    (WebCore::Settings::Settings):
    (WebCore::Settings::setTiledBackingStoreEnabled):
    * page/Settings.h:
    (WebCore::Settings::tiledBackingStoreEnabled):
    * platform/graphics/Tile.h: Added.
    (WebCore::Tile::create):
    (WebCore::Tile::coordinate):
    (WebCore::Tile::rect):
    * platform/graphics/TiledBackingStore.cpp: Added.
    (WebCore::TiledBackingStore::TiledBackingStore):
    (WebCore::TiledBackingStore::~TiledBackingStore):
    (WebCore::TiledBackingStore::invalidate):
    (WebCore::TiledBackingStore::updateTileBuffers):
    (WebCore::TiledBackingStore::paint):
    (WebCore::TiledBackingStore::viewportChanged):
    (WebCore::TiledBackingStore::setContentsScale):
    (WebCore::TiledBackingStore::tileDistance):
    (WebCore::TiledBackingStore::createTiles):
    (WebCore::TiledBackingStore::dropOverhangingTiles):
    (WebCore::TiledBackingStore::dropTilesOutsideRect):
    (WebCore::TiledBackingStore::tileAt):
    (WebCore::TiledBackingStore::setTile):
    (WebCore::TiledBackingStore::removeTile):
    (WebCore::TiledBackingStore::mapToContents):
    (WebCore::TiledBackingStore::mapFromContents):
    (WebCore::TiledBackingStore::contentsRect):
    (WebCore::TiledBackingStore::tileRectForCoordinate):
    (WebCore::TiledBackingStore::tileCoordinateForPoint):
    (WebCore::TiledBackingStore::startTileBufferUpdateTimer):
    (WebCore::TiledBackingStore::tileBufferUpdateTimerFired):
    (WebCore::TiledBackingStore::startTileCreationTimer):
    (WebCore::TiledBackingStore::tileCreationTimerFired):
    (WebCore::TiledBackingStore::setContentsFrozen):
    * platform/graphics/TiledBackingStore.h: Added.
    (WebCore::TiledBackingStore::contentsScale):
    (WebCore::TiledBackingStore::contentsFrozen):
    * platform/graphics/TiledBackingStoreClient.h: Added.
    * platform/graphics/qt/TileQt.cpp: Added.
    (WebCore::checkeredPixmap):
    (WebCore::Tile::Tile):
    (WebCore::Tile::~Tile):
    (WebCore::Tile::isDirty):
    (WebCore::Tile::isReadyToPaint):
    (WebCore::Tile::invalidate):
    (WebCore::Tile::updateBackBuffer):
    (WebCore::Tile::swapBackBufferToFront):
    (WebCore::Tile::paint):
    (WebCore::Tile::paintCheckerPattern):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55976 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cae94af..63e93b6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,85 @@
+2010-03-14  Antti Koivisto  <koivisto at iki.fi>
+
+        Reviewed by Simon Hausmann.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=35146
+        Support tiled backing store
+
+        Implements a basic tiled backing store mechanism. Tiles are created and 
+        deleted on demand. The page content is cached to the tiles. Tile content
+        is kept in sync with the document. Since the backing store covers area
+        larger than the currently visible viewport, the document can be scrolled
+        quickly without having to enter rendering tree painting.
+        
+        The tile management code is platform independent. This patch has simple QPixmap
+        based tile implementation for Qt.
+        
+        The feature is behind ENABLE_TILED_BACKING_STORE flag.
+
+        * WebCore.pri:
+        * WebCore.pro:
+        * page/Frame.cpp:
+        (WebCore::Frame::Frame):
+        (WebCore::Frame::setTiledBackingStoreEnabled):
+        (WebCore::Frame::tiledBackingStorePaintBegin):
+        (WebCore::Frame::tiledBackingStorePaint):
+        (WebCore::Frame::tiledBackingStorePaintEnd):
+        (WebCore::Frame::tiledBackingStoreContentsRect):
+        * page/Frame.h:
+        (WebCore::Frame::tiledBackingStore):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::repaintContentRectangle):
+        (WebCore::FrameView::doDeferredRepaints):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::setTiledBackingStoreEnabled):
+        * page/Settings.h:
+        (WebCore::Settings::tiledBackingStoreEnabled):
+        * platform/graphics/Tile.h: Added.
+        (WebCore::Tile::create):
+        (WebCore::Tile::coordinate):
+        (WebCore::Tile::rect):
+        * platform/graphics/TiledBackingStore.cpp: Added.
+        (WebCore::TiledBackingStore::TiledBackingStore):
+        (WebCore::TiledBackingStore::~TiledBackingStore):
+        (WebCore::TiledBackingStore::invalidate):
+        (WebCore::TiledBackingStore::updateTileBuffers):
+        (WebCore::TiledBackingStore::paint):
+        (WebCore::TiledBackingStore::viewportChanged):
+        (WebCore::TiledBackingStore::setContentsScale):
+        (WebCore::TiledBackingStore::tileDistance):
+        (WebCore::TiledBackingStore::createTiles):
+        (WebCore::TiledBackingStore::dropOverhangingTiles):
+        (WebCore::TiledBackingStore::dropTilesOutsideRect):
+        (WebCore::TiledBackingStore::tileAt):
+        (WebCore::TiledBackingStore::setTile):
+        (WebCore::TiledBackingStore::removeTile):
+        (WebCore::TiledBackingStore::mapToContents):
+        (WebCore::TiledBackingStore::mapFromContents):
+        (WebCore::TiledBackingStore::contentsRect):
+        (WebCore::TiledBackingStore::tileRectForCoordinate):
+        (WebCore::TiledBackingStore::tileCoordinateForPoint):
+        (WebCore::TiledBackingStore::startTileBufferUpdateTimer):
+        (WebCore::TiledBackingStore::tileBufferUpdateTimerFired):
+        (WebCore::TiledBackingStore::startTileCreationTimer):
+        (WebCore::TiledBackingStore::tileCreationTimerFired):
+        (WebCore::TiledBackingStore::setContentsFrozen):
+        * platform/graphics/TiledBackingStore.h: Added.
+        (WebCore::TiledBackingStore::contentsScale):
+        (WebCore::TiledBackingStore::contentsFrozen):
+        * platform/graphics/TiledBackingStoreClient.h: Added.
+        * platform/graphics/qt/TileQt.cpp: Added.
+        (WebCore::checkeredPixmap):
+        (WebCore::Tile::Tile):
+        (WebCore::Tile::~Tile):
+        (WebCore::Tile::isDirty):
+        (WebCore::Tile::isReadyToPaint):
+        (WebCore::Tile::invalidate):
+        (WebCore::Tile::updateBackBuffer):
+        (WebCore::Tile::swapBackBufferToFront):
+        (WebCore::Tile::paint):
+        (WebCore::Tile::paintCheckerPattern):
+
 2010-03-14  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index d738e3c..b01e9b2 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -78,6 +78,9 @@ greaterThan(QT_MINOR_VERSION, 5) {
 # HTML5 datalist support
 !contains(DEFINES, ENABLE_DATALIST=.): DEFINES += ENABLE_DATALIST=1
 
+# Tiled Backing Store support
+!contains(DEFINES, ENABLE_TILED_BACKING_STORE=.): DEFINES += ENABLE_TILED_BACKING_STORE=1
+
 # Nescape plugins support (NPAPI)
 !contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) {
     unix|win32-*:!embedded:!wince*: {
@@ -151,6 +154,7 @@ contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=1): FEATURE_DEFINES_JAVASCRIPT += E
 contains(DEFINES, ENABLE_OFFLINE_WEB_APPLICATIONS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_OFFLINE_WEB_APPLICATIONS=1
 contains(DEFINES, ENABLE_WEB_SOCKETS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_WEB_SOCKETS=1
 contains(DEFINES, ENABLE_TOUCH_EVENTS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_TOUCH_EVENTS=1
+contains(DEFINES, ENABLE_TILED_BACKING_STORE=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_TILED_BACKING_STORE=1
 
 
 ## Derived source generators
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 7d1a56a..1f89f56 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -831,6 +831,7 @@ SOURCES += \
     platform/graphics/Pen.cpp \
     platform/graphics/SegmentedFontData.cpp \
     platform/graphics/SimpleFontData.cpp \
+    platform/graphics/TiledBackingStore.cpp \
     platform/graphics/transforms/AffineTransform.cpp \
     platform/graphics/transforms/TransformationMatrix.cpp \
     platform/graphics/transforms/MatrixTransformOperation.cpp \
@@ -1547,6 +1548,9 @@ HEADERS += \
     platform/graphics/qt/StillImageQt.h \
     platform/graphics/SegmentedFontData.h \
     platform/graphics/SimpleFontData.h \
+    platform/graphics/Tile.h \
+    platform/graphics/TiledBackingStore.h \    
+    platform/graphics/TiledBackingStoreClient.h \
     platform/graphics/transforms/Matrix3DTransformOperation.h \
     platform/graphics/transforms/MatrixTransformOperation.h \
     platform/graphics/transforms/PerspectiveTransformOperation.h \
@@ -2040,6 +2044,7 @@ SOURCES += \
     platform/graphics/qt/FontCustomPlatformDataQt.cpp \
     platform/graphics/qt/GlyphPageTreeNodeQt.cpp \
     platform/graphics/qt/SimpleFontDataQt.cpp \
+    platform/graphics/qt/TileQt.cpp \
     platform/qt/KURLQt.cpp \
     platform/qt/Localizations.cpp \
     platform/qt/MIMETypeRegistryQt.cpp \
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 6d38f63..819755d 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -104,6 +104,10 @@
 #include "MathMLNames.h"
 #endif
 
+#if ENABLE(TILED_BACKING_STORE)
+#include "TiledBackingStore.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -167,9 +171,13 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient*
     XMLNSNames::init();
     XMLNames::init();
 
-    if (!ownerElement)
+    if (!ownerElement) {
         page->setMainFrame(this);
-    else {
+#if ENABLE(TILED_BACKING_STORE)
+        // Top level frame only for now.
+        setTiledBackingStoreEnabled(page->settings()->tiledBackingStoreEnabled());
+#endif
+    } else {
         page->incrementFrameCount();
         // Make sure we will not end up with two frames referencing the same owner element.
         ASSERT((!(ownerElement->m_contentFrame)) || (ownerElement->m_contentFrame->ownerElement() != ownerElement));
@@ -1799,4 +1807,49 @@ void Frame::createView(const IntSize& viewportSize,
         view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff);
 }
 
+#if ENABLE(TILED_BACKING_STORE)
+void Frame::setTiledBackingStoreEnabled(bool enabled)
+{
+    if (!enabled) {
+        m_tiledBackingStore.clear();
+        return;
+    }
+    if (m_tiledBackingStore)
+        return;
+    m_tiledBackingStore.set(new TiledBackingStore(this));
+}
+
+void Frame::tiledBackingStorePaintBegin()
+{
+    if (!m_view)
+        return;
+    m_view->layoutIfNeededRecursive();
+    m_view->flushDeferredRepaints();
+}
+
+void Frame::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect)
+{
+    if (!m_view)
+        return;
+    m_view->paintContents(context, rect);
+}
+
+void Frame::tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea)
+{
+    if (!m_page || !m_view)
+        return;
+    unsigned size = paintedArea.size();
+    // Request repaint from the system
+    for (int n = 0; n < size; ++n)
+        m_page->chrome()->invalidateContentsAndWindow(m_view->convertToContainingWindow(paintedArea[n]), true);
+}
+
+IntRect Frame::tiledBackingStoreContentsRect()
+{
+    if (!m_view)
+        return IntRect();
+    return IntRect(IntPoint(), m_view->contentsSize());
+}
+#endif
+
 } // namespace WebCore
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index 867153a..ae70149 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -44,6 +44,10 @@
 #include "FrameWin.h"
 #endif
 
+#if ENABLE(TILED_BACKING_STORE)
+#include "TiledBackingStoreClient.h"
+#endif
+
 #if PLATFORM(MAC)
 #ifndef __OBJC__
 class NSArray;
@@ -63,8 +67,13 @@ namespace WebCore {
     class CSSMutableStyleDeclaration;
     class HTMLTableCellElement;
     class RegularExpression;
+    class TiledBackingStore;
 
-    class Frame : public RefCounted<Frame> {
+    class Frame : public RefCounted<Frame>
+#if ENABLE(TILED_BACKING_STORE)
+        , public TiledBackingStoreClient
+#endif
+    {
     public:
         static PassRefPtr<Frame> create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
         {
@@ -164,6 +173,11 @@ namespace WebCore {
             return document() ? document()->displayStringModifiedByEncoding(str) : str;
         }
 
+#if ENABLE(TILED_BACKING_STORE)
+        TiledBackingStore* tiledBackingStore() const { return m_tiledBackingStore.get(); }
+        void setTiledBackingStoreEnabled(bool);
+#endif
+
     private:
         void lifeSupportTimerFired(Timer<Frame>*);
 
@@ -265,6 +279,15 @@ namespace WebCore {
 
         VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
         Document* documentAtPoint(const IntPoint& windowPoint);
+        
+    private:
+#if ENABLE(TILED_BACKING_STORE)
+        // TiledBackingStoreClient interface
+        virtual void tiledBackingStorePaintBegin();
+        virtual void tiledBackingStorePaint(GraphicsContext*, const IntRect&);
+        virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea);
+        virtual IntRect tiledBackingStoreContentsRect();
+#endif
 
     #if PLATFORM(MAC)
 
@@ -343,6 +366,10 @@ namespace WebCore {
         bool m_needsReapplyStyles;
         bool m_isDisconnected;
         bool m_excludeFromTextSearch;
+
+#if ENABLE(TILED_BACKING_STORE)        
+        OwnPtr<TiledBackingStore> m_tiledBackingStore;
+#endif
     };
 
 } // namespace WebCore
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 0d9d07f..fa346ee 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -70,6 +70,9 @@
 #include "SVGViewSpec.h"
 #endif
 
+#if ENABLE(TILED_BACKING_STORE)
+#include "TiledBackingStore.h"
+#endif
 
 namespace WebCore {
 
@@ -1083,6 +1086,12 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate)
     if (!immediate && isOffscreen() && !shouldUpdateWhileOffscreen())
         return;
 
+#if ENABLE(TILED_BACKING_STORE)
+    if (frame()->tiledBackingStore()) {
+        frame()->tiledBackingStore()->invalidate(r);
+        return;
+    }
+#endif
     ScrollView::repaintContentRectangle(r, immediate);
 }
 
@@ -1154,8 +1163,15 @@ void FrameView::doDeferredRepaints()
         return;
     }
     unsigned size = m_repaintRects.size();
-    for (unsigned i = 0; i < size; i++)
+    for (unsigned i = 0; i < size; i++) {
+#if ENABLE(TILED_BACKING_STORE)
+        if (frame()->tiledBackingStore()) {
+            frame()->tiledBackingStore()->invalidate(m_repaintRects[i]);
+            continue;
+        }
+#endif
         ScrollView::repaintContentRectangle(m_repaintRects[i], false);
+    }
     m_repaintRects.clear();
     m_repaintCount = 0;
     
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index ce5a215..a791f74 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -125,6 +125,7 @@ Settings::Settings(Page* page)
     , m_experimentalNotificationsEnabled(false)
     , m_webGLEnabled(false)
     , m_loadDeferringEnabled(true)
+    , m_tiledBackingStoreEnabled(false)
 {
     // A Frame may not have been created yet, so we initialize the AtomicString 
     // hash before trying to use it.
@@ -573,4 +574,13 @@ void Settings::setLoadDeferringEnabled(bool enabled)
     m_loadDeferringEnabled = enabled;
 }
 
+void Settings::setTiledBackingStoreEnabled(bool enabled)
+{
+    m_tiledBackingStoreEnabled = enabled;
+#if ENABLE(TILED_BACKING_STORE)
+    if (m_page->mainFrame())
+        m_page->mainFrame()->setTiledBackingStoreEnabled(enabled);
+#endif
+}
+
 } // namespace WebCore
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index b380708..9b7ccd6 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -287,6 +287,9 @@ namespace WebCore {
 
         void setLoadDeferringEnabled(bool);
         bool loadDeferringEnabled() const { return m_loadDeferringEnabled; }
+        
+        void setTiledBackingStoreEnabled(bool);
+        bool tiledBackingStoreEnabled() const { return m_tiledBackingStoreEnabled; }
 
     private:
         Page* m_page;
@@ -361,6 +364,7 @@ namespace WebCore {
         bool m_experimentalNotificationsEnabled : 1;
         bool m_webGLEnabled : 1;
         bool m_loadDeferringEnabled : 1;
+        bool m_tiledBackingStoreEnabled : 1;
 
 #if USE(SAFARI_THEME)
         static bool gShouldPaintNativeControls;
diff --git a/WebCore/platform/graphics/Tile.h b/WebCore/platform/graphics/Tile.h
new file mode 100644
index 0000000..c55fcaf
--- /dev/null
+++ b/WebCore/platform/graphics/Tile.h
@@ -0,0 +1,76 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+ 
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Tile_h
+#define Tile_h
+
+#if ENABLE(TILED_BACKING_STORE)
+
+#include "IntPoint.h"
+#include "IntPointHash.h"
+#include "IntRect.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+#if PLATFORM(QT)
+class QPixmap;
+class QRegion;
+#endif
+
+namespace WebCore {
+    
+class GraphicsContext;
+class TiledBackingStore;
+
+class Tile : public RefCounted<Tile> {
+public:
+    typedef IntPoint Coordinate;
+
+    static PassRefPtr<Tile> create(TiledBackingStore* backingStore, const Coordinate& tileCoordinate) { return adoptRef(new Tile(backingStore, tileCoordinate)); }
+    ~Tile();
+    
+    bool isDirty() const;
+    void invalidate(const IntRect&);
+    void updateBackBuffer();
+    void swapBackBufferToFront();
+    bool isReadyToPaint() const;
+    void paint(GraphicsContext*, const IntRect&);
+
+    const Tile::Coordinate& coordinate() const { return m_coordinate; }
+    const IntRect& rect() const { return m_rect; }
+    
+    static void paintCheckerPattern(GraphicsContext*, const FloatRect&);
+
+private:
+    Tile(TiledBackingStore*, const Coordinate&);
+    
+    TiledBackingStore* m_backingStore;
+    Coordinate m_coordinate;
+    IntRect m_rect;
+
+#if PLATFORM(QT)
+    QPixmap* m_buffer;
+    QPixmap* m_backBuffer;
+    QRegion* m_dirtyRegion;
+#endif
+};
+
+}
+#endif
+#endif
diff --git a/WebCore/platform/graphics/TiledBackingStore.cpp b/WebCore/platform/graphics/TiledBackingStore.cpp
new file mode 100644
index 0000000..d1782e5
--- /dev/null
+++ b/WebCore/platform/graphics/TiledBackingStore.cpp
@@ -0,0 +1,363 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+ 
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "TiledBackingStore.h"
+
+#if ENABLE(TILED_BACKING_STORE)
+
+#include "GraphicsContext.h"
+#include "TiledBackingStoreClient.h"
+
+namespace WebCore {
+    
+static const int defaultTileWidth = 512;
+static const int defaultTileHeight = 512;
+
+TiledBackingStore::TiledBackingStore(TiledBackingStoreClient* client)
+    : m_client(client)
+    , m_tileBufferUpdateTimer(new TileTimer(this, &TiledBackingStore::tileBufferUpdateTimerFired))
+    , m_tileCreationTimer(new TileTimer(this, &TiledBackingStore::tileCreationTimerFired))
+    , m_tileSize(defaultTileWidth, defaultTileHeight)
+    , m_contentsScale(1.f)
+    , m_contentsFrozen(false)
+{
+}
+
+TiledBackingStore::~TiledBackingStore()
+{
+    delete m_tileBufferUpdateTimer;
+    delete m_tileCreationTimer;
+}
+
+void TiledBackingStore::invalidate(const IntRect& contentsDirtyRect)
+{
+    IntRect dirtyRect(mapFromContents(contentsDirtyRect));
+    
+    Tile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft());
+    Tile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight());
+    
+    for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
+        for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
+            RefPtr<Tile> currentTile = tileAt(Tile::Coordinate(xCoordinate, yCoordinate));
+            if (!currentTile)
+                continue;
+            currentTile->invalidate(dirtyRect);
+        }
+    }
+
+    startTileBufferUpdateTimer();
+}
+
+void TiledBackingStore::updateTileBuffers()
+{
+    if (m_contentsFrozen)
+        return;
+    
+    Vector<IntRect> paintedArea;
+    Vector<RefPtr<Tile> > dirtyTiles;
+    TileMap::iterator end = m_tiles.end();
+    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
+        if (!it->second->isDirty())
+            continue;
+        dirtyTiles.append(it->second);
+        // FIXME: should not request system repaint for the full tile.
+        paintedArea.append(mapToContents(it->second->rect()));
+    }
+    
+    if (dirtyTiles.isEmpty())
+        return;
+    
+    m_client->tiledBackingStorePaintBegin();
+
+    // FIXME: In single threaded case, tile back buffers could be updated asynchronously 
+    // one by one and then swapped to front in one go. This would minimize the time spent
+    // blocking on tile updates.
+    unsigned size = dirtyTiles.size();
+    for (unsigned n = 0; n < size; ++n)
+        dirtyTiles[n]->updateBackBuffer();
+
+    for (unsigned n = 0; n < size; ++n)
+        dirtyTiles[n]->swapBackBufferToFront();
+
+    m_client->tiledBackingStorePaintEnd(paintedArea);
+}
+
+void TiledBackingStore::paint(GraphicsContext* context, const IntRect& rect)
+{
+    context->save();
+    
+    // Assumes the backing store is painted with the scale transform applied.
+    // Since tile content is already scaled, first revert the scaling from the painter.
+    context->scale(FloatSize(1.f / m_contentsScale, 1.f / m_contentsScale));
+    
+    IntRect dirtyRect = mapFromContents(rect);
+    
+    Tile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft());
+    Tile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight());
+
+    for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
+        for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
+            Tile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
+            RefPtr<Tile> currentTile = tileAt(currentCoordinate);
+            if (currentTile && currentTile->isReadyToPaint())
+                currentTile->paint(context, dirtyRect);
+            else {
+                FloatRect tileRect = tileRectForCoordinate(currentCoordinate);
+                FloatRect target = intersection(tileRect, FloatRect(rect));
+                Tile::paintCheckerPattern(context, target);
+            }
+        }
+    }
+    context->restore();
+}
+
+void TiledBackingStore::viewportChanged(const IntRect& contentsViewport)
+{
+    IntRect viewport = mapFromContents(contentsViewport);
+    if (m_viewport == viewport)
+        return;
+
+    m_viewport = viewport;
+
+    startTileCreationTimer();
+}
+
+void TiledBackingStore::setContentsScale(float scale)
+{
+    if (m_contentsScale == scale)
+        return;
+    m_contentsScale = scale;
+
+    invalidate(m_client->tiledBackingStoreContentsRect());
+}
+    
+double TiledBackingStore::tileDistance(const IntRect& viewport, const Tile::Coordinate& tileCoordinate)
+{
+    if (viewport.intersects(tileRectForCoordinate(tileCoordinate)))
+        return 0;
+    
+    IntPoint viewCenter = viewport.location() + IntSize(viewport.width() / 2, viewport.height() / 2);
+    Tile::Coordinate centerCoordinate = tileCoordinateForPoint(viewCenter);
+    
+    // Manhattan distance, biased so that vertical distances are shorter.
+    const double horizontalBias = 1.3;
+    return abs(centerCoordinate.y() - tileCoordinate.y()) + horizontalBias * abs(centerCoordinate.x() - tileCoordinate.x());
+}
+
+void TiledBackingStore::createTiles()
+{
+    if (m_contentsFrozen)
+        return;
+
+    if (m_viewport.isEmpty())
+        return;
+
+    // Remove tiles that extend outside the current contents rect.
+    dropOverhangingTiles();
+
+    // FIXME: Make configurable/adapt to memory.
+    IntRect keepRect = m_viewport;
+    keepRect.inflateX(m_viewport.width());
+    keepRect.inflateY(3 * m_viewport.height());
+    keepRect.intersect(contentsRect());
+    
+    dropTilesOutsideRect(keepRect);
+    
+    IntRect coverRect = m_viewport;
+    coverRect.inflateX(m_viewport.width() / 2);
+    coverRect.inflateY(2 * m_viewport.height());
+    coverRect.intersect(contentsRect());
+    
+    // Search for the tile position closest to the viewport center that does not yet contain a tile. 
+    // Which position is considered the closest depends on the tileDistance function.
+    double shortestDistance = std::numeric_limits<double>::infinity();
+    Vector<Tile::Coordinate> tilesToCreate;
+    unsigned requiredTileCount = 0;
+    Tile::Coordinate topLeft = tileCoordinateForPoint(coverRect.topLeft());
+    Tile::Coordinate bottomRight = tileCoordinateForPoint(coverRect.bottomRight());
+    for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
+        for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
+            Tile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
+            if (tileAt(currentCoordinate))
+                continue;
+            ++requiredTileCount;
+            // Distance is 0 for all currently visible tiles.
+            double distance = tileDistance(m_viewport, currentCoordinate);
+            if (distance > shortestDistance)
+                continue;
+            if (distance < shortestDistance) {
+                tilesToCreate.clear();
+                shortestDistance = distance;
+            }
+            tilesToCreate.append(currentCoordinate);
+        }
+    }
+    
+    // Now construct the tile(s)
+    unsigned tilesToCreateCount = tilesToCreate.size();
+    for (unsigned n = 0; n < tilesToCreateCount; ++n) {
+        Tile::Coordinate coordinate = tilesToCreate[n];
+        setTile(coordinate, Tile::create(this, coordinate));
+    }
+    requiredTileCount -= tilesToCreateCount;
+    
+    // Paint the content of the newly created tiles
+    if (tilesToCreateCount)
+        updateTileBuffers();
+
+    // Keep creating tiles until the whole coverRect is covered.
+    if (requiredTileCount)
+        m_tileCreationTimer->startOneShot(0);
+}
+
+void TiledBackingStore::dropOverhangingTiles()
+{    
+    IntRect contentsRect = this->contentsRect();
+
+    Vector<Tile::Coordinate> tilesToRemove;
+    TileMap::iterator end = m_tiles.end();
+    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
+        Tile::Coordinate tileCoordinate = it->second->coordinate();
+        IntRect tileRect = it->second->rect();
+        IntRect expectedTileRect = tileRectForCoordinate(tileCoordinate);
+        if (expectedTileRect != tileRect || !contentsRect.contains(tileRect))
+            tilesToRemove.append(tileCoordinate);
+    }
+    unsigned removeCount = tilesToRemove.size();
+    for (unsigned n = 0; n < removeCount; ++n)
+        removeTile(tilesToRemove[n]);
+}
+
+void TiledBackingStore::dropTilesOutsideRect(const IntRect& keepRect)
+{
+    FloatRect keepRectF = keepRect;
+
+    Vector<Tile::Coordinate> toRemove;
+    TileMap::iterator end = m_tiles.end();
+    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
+        Tile::Coordinate coordinate = it->second->coordinate();
+        FloatRect tileRect = it->second->rect();
+        if (!tileRect.intersects(keepRectF))
+            toRemove.append(coordinate);
+    }
+    unsigned removeCount = toRemove.size();
+    for (unsigned n = 0; n < removeCount; ++n)
+        removeTile(toRemove[n]);
+}
+
+PassRefPtr<Tile> TiledBackingStore::tileAt(const Tile::Coordinate& coordinate) const
+{
+    return m_tiles.get(coordinate);
+}
+
+void TiledBackingStore::setTile(const Tile::Coordinate& coordinate, PassRefPtr<Tile> tile)
+{
+    m_tiles.set(coordinate, tile);
+}
+
+void TiledBackingStore::removeTile(const Tile::Coordinate& coordinate)
+{
+    m_tiles.remove(coordinate);
+}
+
+IntRect TiledBackingStore::mapToContents(const IntRect& rect) const
+{
+    return enclosingIntRect(FloatRect(rect.x() / m_contentsScale,
+        rect.y() / m_contentsScale,
+        rect.width() / m_contentsScale,
+        rect.height() / m_contentsScale));
+}
+
+IntRect TiledBackingStore::mapFromContents(const IntRect& rect) const
+{
+    return enclosingIntRect(FloatRect(rect.x() * m_contentsScale,
+        rect.y() * m_contentsScale,
+        rect.width() * m_contentsScale,
+        rect.height() * m_contentsScale));
+}
+
+IntRect TiledBackingStore::contentsRect() const
+{
+    return mapFromContents(m_client->tiledBackingStoreContentsRect());
+}
+
+IntRect TiledBackingStore::tileRectForCoordinate(const Tile::Coordinate& coordinate) const
+{
+    IntRect rect(coordinate.x() * m_tileSize.width(),
+        coordinate.y() * m_tileSize.height(),
+        m_tileSize.width(),
+        m_tileSize.height());
+
+    rect.intersect(contentsRect());
+    return rect;
+}
+    
+Tile::Coordinate TiledBackingStore::tileCoordinateForPoint(const IntPoint& point) const
+{
+    int x = point.x() / m_tileSize.width();
+    int y = point.y() / m_tileSize.height();
+    return Tile::Coordinate(std::max(x, 0), std::max(y, 0));
+}
+
+
+void TiledBackingStore::startTileBufferUpdateTimer()
+{
+    if (m_tileBufferUpdateTimer->isActive() || m_contentsFrozen)
+        return;
+    m_tileBufferUpdateTimer->startOneShot(0);
+}
+
+void TiledBackingStore::tileBufferUpdateTimerFired(TileTimer*)
+{
+    updateTileBuffers();
+}
+
+void TiledBackingStore::startTileCreationTimer()
+{
+    if (m_tileCreationTimer->isActive() || m_contentsFrozen)
+        return;
+    m_tileCreationTimer->startOneShot(0);
+}
+
+void TiledBackingStore::tileCreationTimerFired(TileTimer*)
+{
+    createTiles();
+}
+
+void TiledBackingStore::setContentsFrozen(bool freeze)
+{
+    if (m_contentsFrozen == freeze)
+        return;
+
+    m_contentsFrozen = freeze;
+
+    // Restart the timers. There might be pending invalidations that
+    // were not painted or created because tiles are not created or
+    // painted when in frozen state.
+    if (!m_contentsFrozen) {
+        startTileCreationTimer();
+        startTileBufferUpdateTimer();
+    }
+    // stopping is handled when the timers fire
+}
+
+}
+
+#endif
diff --git a/WebCore/platform/graphics/TiledBackingStore.h b/WebCore/platform/graphics/TiledBackingStore.h
new file mode 100644
index 0000000..77248d5
--- /dev/null
+++ b/WebCore/platform/graphics/TiledBackingStore.h
@@ -0,0 +1,107 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+ 
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TiledBackingStore_h
+#define TiledBackingStore_h
+
+#if ENABLE(TILED_BACKING_STORE)
+
+#include "FloatSize.h"
+#include "IntPoint.h"
+#include "IntRect.h"
+#include "Tile.h"
+#include "Timer.h"
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GraphicsContext;
+class TiledBackingStoreClient;
+
+class TiledBackingStore : public Noncopyable {
+public:
+    TiledBackingStore(TiledBackingStoreClient*);
+    ~TiledBackingStore();
+
+    void viewportChanged(const IntRect& viewportRect);
+    
+    float contentsScale() { return m_contentsScale; }
+    void setContentsScale(float);
+    
+    bool contentsFrozen() const { return m_contentsFrozen; }
+    void setContentsFrozen(bool);
+
+    void invalidate(const IntRect& dirtyRect);
+    void paint(GraphicsContext*, const IntRect&);
+
+private:
+    void startTileBufferUpdateTimer();
+    void startTileCreationTimer();
+    
+    typedef Timer<TiledBackingStore> TileTimer;
+
+    void tileBufferUpdateTimerFired(TileTimer*);
+    void tileCreationTimerFired(TileTimer*);
+    
+    void updateTileBuffers();
+    void createTiles();
+
+    void dropOverhangingTiles();
+    void dropTilesOutsideRect(const IntRect&);
+    
+    PassRefPtr<Tile> tileAt(const Tile::Coordinate&) const;
+    void setTile(const Tile::Coordinate& coordinate, PassRefPtr<Tile> tile);
+    void removeTile(const Tile::Coordinate& coordinate);
+
+    IntRect mapToContents(const IntRect&) const;
+    IntRect mapFromContents(const IntRect&) const;
+    
+    IntRect contentsRect() const;
+    
+    IntRect tileRectForCoordinate(const Tile::Coordinate&) const;
+    Tile::Coordinate tileCoordinateForPoint(const IntPoint&) const;
+    double tileDistance(const IntRect& viewport, const Tile::Coordinate&);
+    
+    void paintCheckerPattern(GraphicsContext*, const IntRect&, const Tile::Coordinate&);
+
+private:
+    TiledBackingStoreClient* m_client;
+
+    typedef HashMap<Tile::Coordinate, RefPtr<Tile> > TileMap;
+    TileMap m_tiles;
+
+    TileTimer* m_tileBufferUpdateTimer;
+    TileTimer* m_tileCreationTimer;
+
+    IntSize m_tileSize;
+    
+    IntRect m_viewport;
+    float m_contentsScale;
+
+    bool m_contentsFrozen;
+
+    friend class Tile;
+};
+
+}
+
+#endif
+#endif
diff --git a/WebCore/platform/graphics/TiledBackingStoreClient.h b/WebCore/platform/graphics/TiledBackingStoreClient.h
new file mode 100644
index 0000000..4adbbab
--- /dev/null
+++ b/WebCore/platform/graphics/TiledBackingStoreClient.h
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+ 
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TiledBackingStoreClient_h
+#define TiledBackingStoreClient_h
+
+namespace WebCore {
+
+#if ENABLE(TILED_BACKING_STORE)
+class TiledBackingStoreClient {
+public:
+    virtual void tiledBackingStorePaintBegin() = 0;
+    virtual void tiledBackingStorePaint(GraphicsContext*, const IntRect&) = 0;
+    virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) = 0;
+    virtual IntRect tiledBackingStoreContentsRect() = 0;
+};
+
+#else
+class TiledBackingStoreClient {};
+#endif
+
+}
+
+#endif
diff --git a/WebCore/platform/graphics/qt/TileQt.cpp b/WebCore/platform/graphics/qt/TileQt.cpp
new file mode 100644
index 0000000..9628448
--- /dev/null
+++ b/WebCore/platform/graphics/qt/TileQt.cpp
@@ -0,0 +1,178 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+ 
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "Tile.h"
+
+#if ENABLE(TILED_BACKING_STORE)
+
+#include "GraphicsContext.h"
+#include "TiledBackingStore.h"
+#include "TiledBackingStoreClient.h"
+#include <QApplication>
+#include <QObject>
+#include <QPainter>
+#include <QRegion>
+
+namespace WebCore {
+    
+static const unsigned checkerSize = 16;
+static const unsigned checkerColor1 = 0xff555555;
+static const unsigned checkerColor2 = 0xffaaaaaa;
+    
+static QPixmap& checkeredPixmap()
+{
+    static QPixmap* pixmap;
+    if (!pixmap) {
+        pixmap = new QPixmap(checkerSize, checkerSize);
+        QPainter painter(pixmap);
+        QColor color1(checkerColor1);
+        QColor color2(checkerColor2);
+        for (unsigned y = 0; y < checkerSize; y += checkerSize / 2) {
+            bool alternate = y % checkerSize;
+            for (unsigned x = 0; x < checkerSize; x += checkerSize / 2) {
+                painter.fillRect(x, y, checkerSize / 2, checkerSize / 2, alternate ? color1 : color2);
+                alternate = !alternate;
+            }
+        }
+    }
+    return *pixmap;
+}
+    
+Tile::Tile(TiledBackingStore* backingStore, const Coordinate& tileCoordinate)
+    : m_backingStore(backingStore)
+    , m_coordinate(tileCoordinate)
+    , m_rect(m_backingStore->tileRectForCoordinate(tileCoordinate))
+    , m_buffer(0)
+    , m_backBuffer(0)
+    , m_dirtyRegion(new QRegion(m_rect))
+{
+}
+
+Tile::~Tile()
+{
+    delete m_buffer;
+    delete m_backBuffer;
+    delete m_dirtyRegion;
+}
+
+bool Tile::isDirty() const 
+{ 
+    return !m_dirtyRegion->isEmpty(); 
+}
+
+bool Tile::isReadyToPaint() const
+{ 
+    return m_buffer; 
+}
+
+void Tile::invalidate(const IntRect& dirtyRect)
+{
+    IntRect tileDirtyRect = intersection(dirtyRect, m_rect);
+    if (tileDirtyRect.isEmpty())
+        return;
+
+    *m_dirtyRegion += tileDirtyRect;
+}
+    
+void Tile::updateBackBuffer()
+{
+    if (m_buffer && !isDirty())
+        return;
+
+    if (!m_backBuffer) {
+        if (!m_buffer)
+            m_backBuffer = new QPixmap(m_backingStore->m_tileSize.width(), m_backingStore->m_tileSize.height());
+        else {
+            // Currently all buffers are updated synchronously at the same time so there is no real need
+            // to have separate back and front buffers. Just use the existing buffer.
+            m_backBuffer = m_buffer;
+            m_buffer = 0;
+        }
+    }
+
+    QVector<QRect> dirtyRects = m_dirtyRegion->rects();
+    *m_dirtyRegion = QRegion();
+    
+    QPainter painter(m_backBuffer);
+    GraphicsContext context(&painter);
+    context.translate(-m_rect.x(), -m_rect.y());
+
+    int size = dirtyRects.size();
+    for (int n = 0; n < size; ++n)  {
+        context.save();
+        IntRect rect = dirtyRects[n];
+        context.clip(FloatRect(rect));
+        context.scale(FloatSize(m_backingStore->m_contentsScale, m_backingStore->m_contentsScale));
+        m_backingStore->m_client->tiledBackingStorePaint(&context, m_backingStore->mapToContents(rect));
+        context.restore();
+    }
+}
+
+void Tile::swapBackBufferToFront()
+{
+    if (!m_backBuffer)
+        return;
+    delete m_buffer;
+    m_buffer = m_backBuffer;
+    m_backBuffer = 0;
+}
+
+void Tile::paint(GraphicsContext* context, const IntRect& rect)
+{
+    if (!m_buffer)
+        return;
+    
+    IntRect target = intersection(rect, m_rect);
+    IntRect source((target.x() - m_rect.x()),
+                   (target.y() - m_rect.y()),
+                   target.width(),
+                   target.height());
+    
+    context->platformContext()->drawPixmap(target, *m_buffer, source);
+}
+    
+void Tile::paintCheckerPattern(GraphicsContext* context, const FloatRect& target)
+{
+    QPainter* painter = context->platformContext();
+    QTransform worldTransform = painter->worldTransform();
+    qreal scaleX = worldTransform.m11();
+    qreal scaleY = worldTransform.m22();
+    
+    QRect targetViewRect = QRectF(target.x() * scaleX,
+                                  target.y() * scaleY,
+                                  target.width() * scaleX,
+                                  target.height() * scaleY).toAlignedRect();
+    
+    QTransform adjustedTransform(1., worldTransform.m12(), worldTransform.m13(),
+                  worldTransform.m21(), 1., worldTransform.m23(),
+                  worldTransform.m31(), worldTransform.m32(), worldTransform.m33());
+    painter->setWorldTransform(adjustedTransform);
+    
+    painter->drawTiledPixmap(targetViewRect,
+                             checkeredPixmap(),
+                             QPoint(targetViewRect.left() % checkerSize,
+                                    targetViewRect.top() % checkerSize));
+    
+    painter->setWorldTransform(worldTransform);
+}
+
+}
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list