Coordinated Graphics: Make CoordinatedGraphicsScene not know contents size.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 06:26:51 +0000 (06:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 06:26:51 +0000 (06:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108922

Source/WebCore:

Patch by Huang Dongsung <luxtella@company100.net> on 2013-02-11
Reviewed by Noam Rosenthal.

Currently, CoordinatedGraphicsScene has two methods to know contents
size: setContentsSize() and setVisibleContentsRect(). Contents size is
used when adjusting a scroll position, but adjustment is not needed
because EFL and Qt platform code (currently PageViewportController)
already adjusts a scroll position, and it is natural for each platform
to be in charge of adjusting. So this patch makes CoordinatedGraphicsScene
not know contents size.

In addition, now DrawingAreaProxy::coordinatedLayerTreeHostProxy() is only used
to get CoordinatedGraphicsScene.

This patch can only be tested manually since there is no automated
testing facilities for in-motion touch.
Test: ManualTests/fixed-position.html
      ManualTests/nested-fixed-position.html

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
(WebCore::CoordinatedGraphicsScene::setScrollPosition):
(WebCore::CoordinatedGraphicsScene::adjustPositionForFixedLayers):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
(CoordinatedGraphicsScene):

Source/WebKit2:

Patch by Huang Dongsung <luxtella@company100.net> on 2013-02-11
Reviewed by Noam Rosenthal.
Signed off for WebKit2 by Benjamin Poulain.

Currently, CoordinatedGraphicsScene has two methods to know contents
size: setContentsSize() and setVisibleContentsRect(). Contents size is
used when adjusting a scroll position, but adjustment is not needed
because EFL and Qt platform code (currently PageViewportController)
already adjusts a scroll position, and it is natural for each platform
to be in charge of adjusting. So this patch makes CoordinatedGraphicsScene
not know contents size.

In addition, now DrawingAreaProxy::coordinatedLayerTreeHostProxy() is only used
to get CoordinatedGraphicsScene.

* UIProcess/API/qt/qquickwebpage.cpp:
(QQuickWebPagePrivate::updateSize):
* UIProcess/API/qt/raw/qrawwebview.cpp:
(QRawWebView::setSize):
* UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
(WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect):
* UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
(CoordinatedLayerTreeHostProxy):
* UIProcess/efl/PageClientLegacyImpl.cpp:
(WebKit::PageClientLegacyImpl::didChangeContentsSize):
* UIProcess/efl/PageViewportControllerClientEfl.cpp:
(WebKit::PageViewportControllerClientEfl::didChangeContentsSize):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h
Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp
Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp

index 2919fa10ecb6141e421088d06b4a9970edf649bb..d290dfb82cd73f1c867e41a7f0bbcf4de2cc6ba9 100644 (file)
@@ -1,3 +1,34 @@
+2013-02-11  Huang Dongsung  <luxtella@company100.net>
+
+        Coordinated Graphics: Make CoordinatedGraphicsScene not know contents size.
+        https://bugs.webkit.org/show_bug.cgi?id=108922
+
+        Reviewed by Noam Rosenthal.
+
+        Currently, CoordinatedGraphicsScene has two methods to know contents
+        size: setContentsSize() and setVisibleContentsRect(). Contents size is
+        used when adjusting a scroll position, but adjustment is not needed
+        because EFL and Qt platform code (currently PageViewportController)
+        already adjusts a scroll position, and it is natural for each platform
+        to be in charge of adjusting. So this patch makes CoordinatedGraphicsScene
+        not know contents size.
+
+        In addition, now DrawingAreaProxy::coordinatedLayerTreeHostProxy() is only used
+        to get CoordinatedGraphicsScene.
+
+        This patch can only be tested manually since there is no automated
+        testing facilities for in-motion touch.
+        Test: ManualTests/fixed-position.html
+              ManualTests/nested-fixed-position.html
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
+        (WebCore::CoordinatedGraphicsScene::setScrollPosition):
+        (WebCore::CoordinatedGraphicsScene::adjustPositionForFixedLayers):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
+        (CoordinatedGraphicsScene):
+
 2013-02-11  Huang Dongsung  <luxtella@company100.net>
 
         Coordinated Graphics: remove the DidChangeScrollPosition message.
index edfe32078d8f21ab788a4acfe7d5c2bcf1f42906..ca32657bd0f61e6235b7f4abc4502dae322e8806 100644 (file)
@@ -607,6 +607,7 @@ void TextureMapperLayer::setScrollPositionDeltaIfNeeded(const FloatSize& delta)
     // in the web process. We add this delta to the position of fixed layers, to make
     // sure that they do not move while scrolling. We need to reset this delta to fixed layers
     // that have an ancestor which is also a fixed layer, because the delta will be added to the ancestor.
+    ASSERT(m_fixedToViewport);
     if (isAncestorFixedToViewport())
         m_scrollPositionDelta = FloatSize();
     else
index b609736b2ec20150a7398e22d878a40c4b43cc39..8e55920dea5f4834b68c3ea126047c597a37fad1 100644 (file)
@@ -52,16 +52,6 @@ void CoordinatedGraphicsScene::dispatchOnMainThread(const Function<void()>& func
         callOnMainThread(function);
 }
 
-static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const FloatRect& visibleContentRect, const FloatSize& contentSize)
-{
-    float scrollPositionX = std::max(scrollPosition.x(), 0.0f);
-    scrollPositionX = std::min(scrollPositionX, contentSize.width() - visibleContentRect.width());
-
-    float scrollPositionY = std::max(scrollPosition.y(), 0.0f);
-    scrollPositionY = std::min(scrollPositionY, contentSize.height() - visibleContentRect.height());
-    return FloatPoint(scrollPositionX, scrollPositionY);
-}
-
 static bool layerShouldHaveBackingStore(GraphicsLayer* layer)
 {
     return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty();
@@ -198,14 +188,9 @@ void CoordinatedGraphicsScene::paintToGraphicsContext(cairo_t* painter)
     m_textureMapper->setGraphicsContext(0);
 }
 
-void CoordinatedGraphicsScene::setContentsSize(const FloatSize& contentsSize)
-{
-    m_contentsSize = contentsSize;
-}
-
-void CoordinatedGraphicsScene::setVisibleContentsRect(const FloatRect& rect)
+void CoordinatedGraphicsScene::setScrollPosition(const FloatPoint& scrollPosition)
 {
-    m_visibleContentsRect = rect;
+    m_scrollPosition = scrollPosition;
 }
 
 void CoordinatedGraphicsScene::updateViewport()
@@ -223,9 +208,7 @@ void CoordinatedGraphicsScene::adjustPositionForFixedLayers()
     // Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position.
     // If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset
     // them by the delta between the current position and the position of the viewport used for the last layout.
-    FloatPoint scrollPosition = boundedScrollPosition(m_visibleContentsRect.location(), m_visibleContentsRect, m_contentsSize);
-    FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize);
-    FloatSize delta = scrollPosition - renderedScrollPosition;
+    FloatSize delta = m_scrollPosition - m_renderedContentsScrollPosition;
 
     LayerRawPtrMap::iterator end = m_fixedLayers.end();
     for (LayerRawPtrMap::iterator it = m_fixedLayers.begin(); it != end; ++it)
index 0b8d5dbce8fd41f5831c40d2ed093c5dadc76919..c7cc83cab3bc6878b6c7d7b68102e8e41c7289b7 100644 (file)
@@ -84,8 +84,7 @@ public:
 #elif USE(CAIRO)
     void paintToGraphicsContext(cairo_t*);
 #endif
-    void setContentsSize(const FloatSize&);
-    void setVisibleContentsRect(const FloatRect&);
+    void setScrollPosition(const FloatPoint&);
 #if USE(GRAPHICS_SURFACE)
     void createCanvas(CoordinatedLayerID, const IntSize&, PassRefPtr<GraphicsSurface>);
     void syncCanvas(CoordinatedLayerID, uint32_t frontBuffer);
@@ -175,9 +174,6 @@ private:
 
     void updateFPS(const FloatPoint&, const TransformationMatrix& = TransformationMatrix());
 
-    FloatSize m_contentsSize;
-    FloatRect m_visibleContentsRect;
-
     // Render queue can be accessed ony from main thread or updatePaintNode call stack!
     Vector<Function<void()> > m_renderQueue;
     Mutex m_renderQueueMutex;
@@ -212,6 +208,7 @@ private:
     typedef HashMap<CoordinatedLayerID, GraphicsLayer*> LayerRawPtrMap;
     LayerRawPtrMap m_fixedLayers;
     CoordinatedLayerID m_rootLayerID;
+    FloatPoint m_scrollPosition;
     FloatPoint m_renderedContentsScrollPosition;
     bool m_animationsLocked;
 #if ENABLE(REQUEST_ANIMATION_FRAME)
index ab31714ed77837350b2645eaaa17ad873e4c1cd2..96624773297c4c6bb2cf22c89180f4e4145de8ec 100644 (file)
@@ -1,3 +1,35 @@
+2013-02-11  Huang Dongsung  <luxtella@company100.net>
+
+        Coordinated Graphics: Make CoordinatedGraphicsScene not know contents size.
+        https://bugs.webkit.org/show_bug.cgi?id=108922
+
+        Reviewed by Noam Rosenthal.
+        Signed off for WebKit2 by Benjamin Poulain.
+
+        Currently, CoordinatedGraphicsScene has two methods to know contents
+        size: setContentsSize() and setVisibleContentsRect(). Contents size is
+        used when adjusting a scroll position, but adjustment is not needed
+        because EFL and Qt platform code (currently PageViewportController)
+        already adjusts a scroll position, and it is natural for each platform
+        to be in charge of adjusting. So this patch makes CoordinatedGraphicsScene
+        not know contents size.
+
+        In addition, now DrawingAreaProxy::coordinatedLayerTreeHostProxy() is only used
+        to get CoordinatedGraphicsScene.
+
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        (QQuickWebPagePrivate::updateSize):
+        * UIProcess/API/qt/raw/qrawwebview.cpp:
+        (QRawWebView::setSize):
+        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
+        (WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect):
+        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
+        (CoordinatedLayerTreeHostProxy):
+        * UIProcess/efl/PageClientLegacyImpl.cpp:
+        (WebKit::PageClientLegacyImpl::didChangeContentsSize):
+        * UIProcess/efl/PageViewportControllerClientEfl.cpp:
+        (WebKit::PageViewportControllerClientEfl::didChangeContentsSize):
+
 2013-02-11  Huang Dongsung  <luxtella@company100.net>
 
         Coordinated Graphics: remove the DidChangeScrollPosition message.
index 20761e2f9578895d8d06a30468bc1f79bafbd184..4f196e139a21102e4d0569ffb3831abc8cd8ab92 100644 (file)
@@ -175,9 +175,6 @@ void QQuickWebPagePrivate::updateSize()
 {
     QSizeF scaledSize = contentsSize * contentsScale;
 
-    if (coordinatedLayerTreeHostProxy())
-        coordinatedLayerTreeHostProxy()->setContentsSize(WebCore::FloatSize(contentsSize));
-
     q->setSize(scaledSize);
 
     if (viewportItem->experimental()->flickableViewportEnabled()) {
index d3481ea0162a53d3d0883e7d630c32f34703a1ef..38991ddf65c1c3e3c716a6d609dcd7fc9202d04d 100644 (file)
@@ -345,12 +345,6 @@ void QRawWebView::setSize(const QSize& size)
 
     if (d->m_webPageProxy->useFixedLayout())
         d->m_webPageProxy->setViewportSize(size);
-    else {
-        WebKit::CoordinatedLayerTreeHostProxy* coordinator = drawingArea->coordinatedLayerTreeHostProxy();
-        if (!coordinator)
-            return;
-        coordinator->setContentsSize(WebCore::FloatSize(size.width(), size.height()));
-    }
 
     d->m_size = size;
 
index 72af8035fc2627d32149a4369ef1bc0ffb68fc1d..c5f7e875a6d8bcfda4b7035e4190c2e553e736ba 100644 (file)
@@ -163,11 +163,6 @@ void CoordinatedLayerTreeHostProxy::removeImageBacking(CoordinatedImageBackingID
     dispatchUpdate(bind(&CoordinatedGraphicsScene::removeImageBacking, m_scene.get(), imageID));
 }
 
-void CoordinatedLayerTreeHostProxy::setContentsSize(const FloatSize& contentsSize)
-{
-    dispatchUpdate(bind(&CoordinatedGraphicsScene::setContentsSize, m_scene.get(), contentsSize));
-}
-
 void CoordinatedLayerTreeHostProxy::setLayerAnimations(CoordinatedLayerID id, const GraphicsLayerAnimations& animations)
 {
     dispatchUpdate(bind(&CoordinatedGraphicsScene::setLayerAnimations, m_scene.get(), id, animations));
@@ -181,7 +176,7 @@ void CoordinatedLayerTreeHostProxy::setAnimationsLocked(bool locked)
 void CoordinatedLayerTreeHostProxy::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector)
 {
     // Inform the renderer to adjust viewport-fixed layers.
-    dispatchUpdate(bind(&CoordinatedGraphicsScene::setVisibleContentsRect, m_scene.get(), rect));
+    dispatchUpdate(bind(&CoordinatedGraphicsScene::setScrollPosition, m_scene.get(), rect.location()));
 
     if (rect == m_lastSentVisibleRect && trajectoryVector == m_lastSentTrajectoryVector)
         return;
index e6fbf951f42c56b8bbb571550ab65b46cb22a5d5..946b39920d284883a844a7f1966911b0869ef9f5 100644 (file)
@@ -65,7 +65,6 @@ public:
     void createCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&);
     void deleteCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&);
     void setRootCompositingLayer(WebCore::CoordinatedLayerID);
-    void setContentsSize(const WebCore::FloatSize&);
     void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector);
     void didRenderFrame(const WebCore::FloatPoint& scrollPosition, const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
     void createTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&);
index 7a8a9fd51cef8cc78e35b7a24601373280c3230a..6553a9d6b2544c8fc7441a254cc343c91487456e 100644 (file)
@@ -71,9 +71,7 @@ void PageClientLegacyImpl::didChangeViewportProperties(const WebCore::ViewportAt
 
 void PageClientLegacyImpl::didChangeContentsSize(const WebCore::IntSize& size)
 {
-    m_view->page()->drawingArea()->coordinatedLayerTreeHostProxy()->setContentsSize(FloatSize(size.width(), size.height()));
     m_view->scheduleUpdateDisplay();
-
     m_view->smartCallback<ContentsSizeChanged>().call(size);
 }
 
index 1ff6c691fc6cfdd79c471075af73e342e11a336d..e2278c7c0e1fc18ad079789414989bcb197019d1 100644 (file)
@@ -68,7 +68,6 @@ void PageViewportControllerClientEfl::updateViewportSize()
 
 void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize& contentsSize)
 {
-    drawingArea()->coordinatedLayerTreeHostProxy()->setContentsSize(contentsSize);
     m_view->scheduleUpdateDisplay();
 }