Fix the issue that accelerated overflow scrolling become invisible
[framework/web/webkit-efl.git] / Source / WebKit2 / WebProcess / WebPage / LayerTreeCoordinator / LayerTreeCoordinator.cpp
index 30dadef..576d024 100644 (file)
@@ -99,16 +99,13 @@ LayerTreeCoordinator::LayerTreeCoordinator(WebPage* webPage)
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
     , m_suspendedJavaScript(false)
 #endif
-#if ENABLE(TIZEN_RECORDING_SURFACE_SET)
-    , m_compositedContentLayersCount(0)
-#endif
 #if ENABLE(TIZEN_ONESHOT_DRAWING_SYNCHRONIZATION)
     , m_needsOneShotDrawingSynchronization(false)
 #endif
-    , m_animationsLocked(false)
 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
     , m_isGLAccelerationMode(true)
 #endif
+    , m_animationsLocked(false)
 {
     // Create a root layer.
     m_rootLayer = GraphicsLayer::create(this);
@@ -122,11 +119,6 @@ LayerTreeCoordinator::LayerTreeCoordinator(WebPage* webPage)
     m_layerTreeContext.webLayerID = toWebGraphicsLayer(webRootLayer)->id();
 
     m_nonCompositedContentLayer = GraphicsLayer::create(this);
-#if ENABLE(TIZEN_RECORDING_SURFACE_SET)
-    WebGraphicsLayer* webNonCompositedLayer = toWebGraphicsLayer(m_nonCompositedContentLayer.get());
-    webNonCompositedLayer->setNonCompositedLayer(true);
-#endif
-
     toWebGraphicsLayer(m_rootLayer.get())->setWebGraphicsLayerClient(this);
 #ifndef NDEBUG
     m_nonCompositedContentLayer->setName("LayerTreeCoordinator non-composited content");
@@ -204,10 +196,6 @@ void LayerTreeCoordinator::setRootCompositingLayer(WebCore::GraphicsLayer* graph
     // Add the accelerated layer tree hierarchy.
     if (graphicsLayer)
         m_nonCompositedContentLayer->addChild(graphicsLayer);
-
-#if ENABLE(TIZEN_RECORDING_SURFACE_SET)
-    m_compositedContentLayersCount = compositedContentLayersCount(m_nonCompositedContentLayer.get());
-#endif
 }
 
 void LayerTreeCoordinator::invalidate()
@@ -391,10 +379,6 @@ void LayerTreeCoordinator::attachLayer(WebGraphicsLayer* layer)
 
     layer->setContentsScale(m_contentsScale);
     layer->adjustVisibleRect();
-
-#if ENABLE(TIZEN_RECORDING_SURFACE_SET)
-    m_compositedContentLayersCount = compositedContentLayersCount(m_nonCompositedContentLayer.get());
-#endif
 }
 
 void LayerTreeCoordinator::detachLayer(WebGraphicsLayer* layer)
@@ -403,10 +387,6 @@ void LayerTreeCoordinator::detachLayer(WebGraphicsLayer* layer)
     m_shouldSyncFrame = true;
     m_webPage->send(Messages::LayerTreeCoordinatorProxy::DeleteCompositingLayer(layer->id()));
 
-#if ENABLE(TIZEN_RECORDING_SURFACE_SET)
-    m_compositedContentLayersCount = compositedContentLayersCount(m_nonCompositedContentLayer.get());
-#endif
-
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
     m_compositedContentLayers.remove(layer->id());
 #endif
@@ -745,7 +725,11 @@ void LayerTreeCoordinator::renderNextFrame()
         m_webPage->resumeAnimationController();
 #endif
     scheduleLayerFlush();
+#if ENABLE(TIZEN_DAILY_UPVERSIONING)
+    for (size_t i = 0; i < m_updateAtlases.size(); ++i)
+#else
     for (int i = 0; i < m_updateAtlases.size(); ++i)
+#endif
         m_updateAtlases[i]->didSwapBuffers();
 
 #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME)
@@ -790,7 +774,11 @@ void LayerTreeCoordinator::purgeBackingStores()
 PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, ShareableSurface::Handle& handle, WebCore::IntPoint& offset)
 {
     OwnPtr<WebCore::GraphicsContext> graphicsContext;
+#if ENABLE(TIZEN_DAILY_UPVERSIONING)
+    for (size_t i = 0; i < m_updateAtlases.size(); ++i) {
+#else
     for (int i = 0; i < m_updateAtlases.size(); ++i) {
+#endif
         UpdateAtlas* atlas = m_updateAtlases[i].get();
         if (atlas->flags() == flags) {
             // This will return null if there is no available buffer space.
@@ -806,6 +794,21 @@ PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(co
     return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset);
 }
 
+#if ENABLE(TIZEN_WEBKIT2_TILED_AC) && !ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
+void LayerTreeCoordinator::pauseRendering()
+{
+    m_isSuspended = true;
+#if ENABLE(WEBGL)
+    // Make sure compositing webgl layer after returning from home screen.
+    HashSet<WebCore::WebGraphicsLayer*>::iterator end = m_registeredLayers.end();
+    for (HashSet<WebCore::WebGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it) {
+        if ((*it)->contentType() == WebLayerInfo::Canvas3DContentType)
+            (*it)->markCanvasPlatformLayerNeedsUpdate();
+    }
+#endif
+}
+#endif
+
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
 void LayerTreeCoordinator::freePlatformSurface(int layerID, int platformSurfaceId)
 {
@@ -838,54 +841,6 @@ void LayerTreeCoordinator::removePlatformSurface(int layerID, int platformSurfac
 }
 #endif
 
-#if ENABLE(TIZEN_RECORDING_SURFACE_SET)
-bool LayerTreeCoordinator::recordingSurfaceSetEnableGet()
-{
-    return recordingSurfaceAllowed() && m_webPage->recordingSurfaceEnabled();
-}
-
-bool LayerTreeCoordinator::recordingSurfaceSetLoadStartGet()
-{
-    if (m_webPage->recordingSurfaceLoadStart()) {
-        m_webPage->setRecordingSurfaceLoadStart(false);
-        return true;
-    }
-    return false;
-}
-
-bool LayerTreeCoordinator::recordingSurfaceSetLoadFinishedGet()
-{
-    if (m_webPage->recordingSurfaceLoadFinish()) {
-        m_webPage->setRecordingSurfaceLoadFinish(false);
-        return true;
-    }
-    return false;
-}
-
-bool LayerTreeCoordinator::recordingSurfaceAllowed()
-{
-    if (m_compositedContentLayersCount > 0)
-        return false;
-
-    return true;
-}
-
-int LayerTreeCoordinator::compositedContentLayersCount(GraphicsLayer* layer)
-{
-    int count = 0;
-    int contentType = toWebGraphicsLayer(layer)->contentType();
-
-    if (contentType == WebLayerInfo::Canvas3DContentType || contentType == WebLayerInfo::MediaContentType || contentType == WebLayerInfo::Canvas2DContentType)
-        count = 1;
-
-    const Vector<GraphicsLayer*>& childLayers = layer->children();
-    for (int i = 0; i < childLayers.size(); ++i)
-        count += compositedContentLayersCount(childLayers[i]);
-
-    return count;
-}
-#endif
-
 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
 void LayerTreeCoordinator::setVisibleContentsRectAndTrajectoryVectorForLayer(int layerID, const WebCore::IntRect& visibleRect, const WebCore::FloatPoint& trajectoryVector)
 {
@@ -893,14 +848,13 @@ void LayerTreeCoordinator::setVisibleContentsRectAndTrajectoryVectorForLayer(int
     if (!contentsLayer)
         return;
 
-    toWebGraphicsLayer(contentsLayer)->setVisibleRect(visibleRect);
     if (trajectoryVector != FloatPoint::zero()) {
         m_webPage->scrollOverflowWithTrajectoryVector(trajectoryVector);
         toWebGraphicsLayer(contentsLayer)->setVisibleContentRectTrajectoryVector(trajectoryVector);
 
 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_SCROLLBAR)
         const Vector<GraphicsLayer*>& childLayers = contentsLayer->children();
-        for (int i = 0; i < childLayers.size(); ++i)
+        for (size_t i = 0; i < childLayers.size(); ++i)
             if (childLayers[i]->isScrollbar())
                toWebGraphicsLayer(childLayers[i])->startAnimation();
 #endif
@@ -927,7 +881,6 @@ void LayerTreeCoordinator::addOrUpdateScrollingLayer(WebCore::GraphicsLayer* scr
     contentsLayer->setPosition(-offset);
 
     IntRect visibleRect(FloatRect(offset, scrollingLayer->size()));
-    toWebGraphicsLayer(contentsLayer)->setVisibleRect(visibleRect);
 
     // FIXME: Need to set trajectoryVector?
     // FloatPoint trajectoryVector(scrollingLayer->trajectoryVector());