[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:23:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 045895d0bb4a13fb85518919450f28a3440cb409
Author: antti at apple.com <antti at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 16 16:49:29 2010 +0000

    WebCore: https://bugs.webkit.org/show_bug.cgi?id=36121
    [Qt] Make WebKit scrollbars work with tiling
    
    Reviewed by Simon Hausmann.
    
    Translate coordinates correctly.
    
    * page/Frame.cpp:
    (WebCore::Frame::tiledBackingStorePaintEnd):
    
    WebKit/qt: https://bugs.webkit.org/show_bug.cgi?id=36121
    [Qt] Make WebKit scrollbars work with tiling
    
    Reviewed by Simon Hausmann.
    
    - Use the scrollbar overlay (implemented for accelerated compositing) when in tiled mode.
    - Make overlay compile unconditionally, enable on demand. This removes bunch of unneeded ifdefs.
    - Update the scroll position to the backing store as needed.
    - Renamed some methods.
    
    * Api/qgraphicswebview.cpp:
    (QGraphicsWebViewPrivate::):
    (QGraphicsWebViewPrivate::createOrDeleteOverlay):
    (QGraphicsWebViewPrivate::setRootGraphicsLayer):
    (QGraphicsWebViewPrivate::updateCompositingScrollPosition):
    (QGraphicsWebViewPrivate::scroll):
    (QGraphicsWebViewPrivate::update):
    (QGraphicsWebViewPrivate::graphicsItemVisibleRect):
    (QGraphicsWebView::paint):
    (QGraphicsWebView::setPage):
    (QGraphicsWebView::updateGeometry):
    (QGraphicsWebView::setGeometry):
    * Api/qwebframe.cpp:
    (QWebFramePrivate::renderFromTiledBackingStore):
    * Api/qwebframe_p.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56068 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2af32c6..0001f4a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-03-15  Antti Koivisto  <koivisto at iki.fi>
+
+        Reviewed by Simon Hausmann.
+
+        https://bugs.webkit.org/show_bug.cgi?id=36121
+        [Qt] Make WebKit scrollbars work with tiling
+         
+        Translate coordinates correctly.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::tiledBackingStorePaintEnd):
+
 2010-03-16  Jakub Wieczorek  <jwieczorek at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 819755d..6e33664 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -1841,7 +1841,7 @@ void Frame::tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea)
     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);
+        m_page->chrome()->invalidateContentsAndWindow(m_view->contentsToWindow(paintedArea[n]), false);
 }
 
 IntRect Frame::tiledBackingStoreContentsRect()
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index e133577..b9dd6c4 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -45,8 +45,6 @@
 #endif
 #include <Settings.h>
 
-#if USE(ACCELERATED_COMPOSITING)
-
 // the overlay is here for one reason only: to have the scroll-bars and other
 // extra UI elements appear on top of any QGraphicsItems created by CSS compositing layers
 class QGraphicsWebViewOverlay : public QGraphicsItem {
@@ -74,8 +72,6 @@ class QGraphicsWebViewOverlay : public QGraphicsItem {
     QGraphicsWebView* q;
 };
 
-#endif
-
 class QGraphicsWebViewPrivate : public QWebPageClient {
 public:
     QGraphicsWebViewPrivate(QGraphicsWebView* parent)
@@ -124,7 +120,9 @@ public:
 #endif
     
     void updateResizesToContentsForPage();
-    QRectF visibleRect() const;
+    QRectF graphicsItemVisibleRect() const;
+
+    void createOrDeleteOverlay();
 
     void syncLayers();
     void _q_doLoadFinished(bool success);
@@ -135,21 +133,20 @@ public:
 
     bool resizesToContents;
 
-#if USE(ACCELERATED_COMPOSITING)
-    QGraphicsItem* rootGraphicsLayer;
-
     // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached
     QSharedPointer<QGraphicsWebViewOverlay> overlay;
 
+    // we need to put the root graphics layer behind the overlay (which contains the scrollbar)
+    enum { RootGraphicsLayerZValue, OverlayZValue };
+
+#if USE(ACCELERATED_COMPOSITING)
+    QGraphicsItem* rootGraphicsLayer;
     // we need to sync the layers if we get a special call from the WebCore
     // compositor telling us to do so. We'll get that call from ChromeClientQt
     bool shouldSync;
 
     // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue
     QMetaMethod syncMetaMethod;
-
-    // we need to put the root graphics layer behind the overlay (which contains the scrollbar)
-    enum { RootGraphicsLayerZValue, OverlayZValue };
 #endif
 };
 
@@ -165,6 +162,26 @@ QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
 #endif
 }
 
+void QGraphicsWebViewPrivate::createOrDeleteOverlay()
+{
+    bool useOverlay = false;
+    if (!resizesToContents) {
+#if USE(ACCELERATED_COMPOSITING)
+        useOverlay = useOverlay || rootGraphicsLayer;
+#endif
+#if ENABLE(TILED_BACKING_STORE)
+        useOverlay = useOverlay || QWebFramePrivate::core(q->page()->mainFrame())->tiledBackingStore();
+#endif
+    }
+    if (useOverlay == !!overlay)
+        return;
+    if (useOverlay) {
+        overlay = QSharedPointer<QGraphicsWebViewOverlay>(new QGraphicsWebViewOverlay(q));
+        overlay->setZValue(OverlayZValue);
+    } else
+        overlay.clear();
+}
+
 #if USE(ACCELERATED_COMPOSITING)
 void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer)
 {
@@ -180,15 +197,9 @@ void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer)
         layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
         layer->setParentItem(q);
         layer->setZValue(RootGraphicsLayerZValue);
-        if (!overlay) {
-            overlay = QSharedPointer<QGraphicsWebViewOverlay>(new QGraphicsWebViewOverlay(q));
-            overlay->setZValue(OverlayZValue);
-        }
         updateCompositingScrollPosition();
-    } else {
-        // we don't have compositing layers, we can render the scrollbars and content in one go
-        overlay.clear();
     }
+    createOrDeleteOverlay();
 }
 
 void QGraphicsWebViewPrivate::markForSync(bool scheduleSync)
@@ -205,7 +216,6 @@ void QGraphicsWebViewPrivate::updateCompositingScrollPosition()
         rootGraphicsLayer->setPos(-scrollPosition);
     }
 }
-
 #endif
 
 void QGraphicsWebViewPrivate::syncLayers()
@@ -230,6 +240,7 @@ void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success)
 void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
 {
     q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll));
+
 #if USE(ACCELERATED_COMPOSITING)
     updateCompositingScrollPosition();
 #endif
@@ -238,9 +249,11 @@ void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
 void QGraphicsWebViewPrivate::update(const QRect & dirtyRect)
 {
     q->update(QRectF(dirtyRect));
-#if USE(ACCELERATED_COMPOSITING)
+
+    createOrDeleteOverlay();
     if (overlay)
         overlay->update(QRectF(dirtyRect));
+#if USE(ACCELERATED_COMPOSITING)
     syncLayers();
 #endif
 }
@@ -345,7 +358,7 @@ void QGraphicsWebViewPrivate::_q_contentsSizeChanged(const QSize& size)
     q->setGeometry(QRectF(q->geometry().topLeft(), size));
 }
 
-QRectF QGraphicsWebViewPrivate::visibleRect() const
+QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const
 {
     if (!q->scene())
         return QRectF();
@@ -505,13 +518,17 @@ QWebPage* QGraphicsWebView::page() const
 void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*)
 {
 #if ENABLE(TILED_BACKING_STORE)
-    // FIXME: Scrollbars could be drawn with the overlay layer when using tiling.
     if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) {
-        // FIXME: We should set the backing store viewpart earlier than in paint.
-        backingStore->viewportChanged(WebCore::IntRect(d->visibleRect()));
+        // FIXME: We should set the backing store viewport earlier than in paint
+        if (d->resizesToContents)
+            backingStore->viewportChanged(WebCore::IntRect(d->graphicsItemVisibleRect()));
+        else {
+            QRectF visibleRect(d->page->mainFrame()->scrollPosition(), d->page->mainFrame()->geometry().size());
+            backingStore->viewportChanged(WebCore::IntRect(visibleRect));
+        }
         // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change.
         WebCore::GraphicsContext context(painter); 
-        page()->mainFrame()->d->renderContentsLayerAbsoluteCoords(&context, option->exposedRect.toAlignedRect());
+        page()->mainFrame()->d->renderFromTiledBackingStore(&context, option->exposedRect.toAlignedRect());
         return;
     } 
 #endif
@@ -647,10 +664,8 @@ void QGraphicsWebView::setPage(QWebPage* page)
     d->page = page;
     if (!d->page)
         return;
-#if USE(ACCELERATED_COMPOSITING)
     if (d->overlay)
         d->overlay->prepareGeometryChange();
-#endif
     d->page->d->client = d; // set the page client
 
     QSize size = geometry().size().toSize();
@@ -757,11 +772,8 @@ qreal QGraphicsWebView::zoomFactor() const
 */
 void QGraphicsWebView::updateGeometry()
 {
-
-#if USE(ACCELERATED_COMPOSITING)
     if (d->overlay)
         d->overlay->prepareGeometryChange();
-#endif
 
     QGraphicsWidget::updateGeometry();
 
@@ -778,10 +790,8 @@ void QGraphicsWebView::setGeometry(const QRectF& rect)
 {
     QGraphicsWidget::setGeometry(rect);
 
-#if USE(ACCELERATED_COMPOSITING)
     if (d->overlay)
         d->overlay->prepareGeometryChange();
-#endif
 
     if (!d->page)
         return;
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index fc81eba..1185c85 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -328,8 +328,10 @@ WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const
     return frame->view()->verticalScrollbar();
 }
 
-void QWebFramePrivate::renderContentsLayerAbsoluteCoords(GraphicsContext* context, const QRegion& clip)
+void QWebFramePrivate::renderFromTiledBackingStore(GraphicsContext* context, const QRegion& clip)
 {
+    ASSERT(frame->tiledBackingStore());
+
     if (!frame->view() || !frame->contentRenderer())
         return;
 
@@ -341,29 +343,19 @@ void QWebFramePrivate::renderContentsLayerAbsoluteCoords(GraphicsContext* contex
 
     WebCore::FrameView* view = frame->view();
     
-#if ENABLE(TILED_BACKING_STORE)
-    if (!frame->tiledBackingStore())
-        view->layoutIfNeededRecursive();
-#else
-    view->layoutIfNeededRecursive();
-#endif
+    int scrollX = view->scrollX();
+    int scrollY = view->scrollY();
+    context->translate(-scrollX, -scrollY);
 
     for (int i = 0; i < vector.size(); ++i) {
         const QRect& clipRect = vector.at(i);
 
         painter->save();
-        painter->setClipRect(clipRect, Qt::IntersectClip);
+        
+        QRect rect = clipRect.translated(scrollX, scrollY);
+        painter->setClipRect(rect, Qt::IntersectClip);
 
-        context->save();
-#if ENABLE(TILED_BACKING_STORE)
-        if (frame->tiledBackingStore())
-            frame->tiledBackingStore()->paint(context, clipRect);
-        else
-            view->paintContents(context, clipRect);
-#else
-        view->paintContents(context, clipRect);
-#endif
-        context->restore();
+        frame->tiledBackingStore()->paint(context, rect);
 
         painter->restore();
     }
diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h
index 7d79474..0a5459b 100644
--- a/WebKit/qt/Api/qwebframe_p.h
+++ b/WebKit/qt/Api/qwebframe_p.h
@@ -84,7 +84,7 @@ public:
     static QWebFrame* kit(WebCore::Frame*);
 
     void renderRelativeCoords(WebCore::GraphicsContext*, QWebFrame::RenderLayer, const QRegion& clip);
-    void renderContentsLayerAbsoluteCoords(WebCore::GraphicsContext*, const QRegion& clip);
+    void renderFromTiledBackingStore(WebCore::GraphicsContext*, const QRegion& clip);
 
     bool scrollOverflow(int dx, int dy);
 
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index e071661..ab907f4 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,31 @@
+2010-03-15  Antti Koivisto  <koivisto at iki.fi>
+
+        Reviewed by Simon Hausmann.
+
+        https://bugs.webkit.org/show_bug.cgi?id=36121
+        [Qt] Make WebKit scrollbars work with tiling
+        
+        - Use the scrollbar overlay (implemented for accelerated compositing) when in tiled mode. 
+        - Make overlay compile unconditionally, enable on demand. This removes bunch of unneeded ifdefs.
+        - Update the scroll position to the backing store as needed.
+        - Renamed some methods.
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebViewPrivate::):
+        (QGraphicsWebViewPrivate::createOrDeleteOverlay):
+        (QGraphicsWebViewPrivate::setRootGraphicsLayer):
+        (QGraphicsWebViewPrivate::updateCompositingScrollPosition):
+        (QGraphicsWebViewPrivate::scroll):
+        (QGraphicsWebViewPrivate::update):
+        (QGraphicsWebViewPrivate::graphicsItemVisibleRect):
+        (QGraphicsWebView::paint):
+        (QGraphicsWebView::setPage):
+        (QGraphicsWebView::updateGeometry):
+        (QGraphicsWebView::setGeometry):
+        * Api/qwebframe.cpp:
+        (QWebFramePrivate::renderFromTiledBackingStore):
+        * Api/qwebframe_p.h:
+
 2010-03-15  Robert Hogan  <robert at webkit.org>
 
         Reviewed by Simon Hausmann.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list