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
+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.
// 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
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();
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()
// 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)
#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);
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;
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)
+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.
{
QSizeF scaledSize = contentsSize * contentsScale;
- if (coordinatedLayerTreeHostProxy())
- coordinatedLayerTreeHostProxy()->setContentsSize(WebCore::FloatSize(contentsSize));
-
q->setSize(scaledSize);
if (viewportItem->experimental()->flickableViewportEnabled()) {
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;
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));
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;
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&);
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);
}
void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize& contentsSize)
{
- drawingArea()->coordinatedLayerTreeHostProxy()->setContentsSize(contentsSize);
m_view->scheduleUpdateDisplay();
}