Fix the issue that accelerated overflow scrolling become invisible
authorHurnjoo Lee <hurnjoo.lee@samsung.com>
Tue, 6 Aug 2013 08:15:26 +0000 (17:15 +0900)
committerHurnjoo Lee <hurnjoo.lee@samsung.com>
Wed, 7 Aug 2013 04:25:54 +0000 (13:25 +0900)
[Title] Fix the issue that accelerated overflow scrolling become invisible
[Issues] N_SE-47589
[Problem] Accelerated overflow scrolling become invisible.
[Cause] When calculate the tiledBackingStoreVisibleRect of scrolling layer, we have used m_visibleRect of scrolling layer.
        But it causes that child layers of scrolling layer are not displayed properly and consump too many memory.
[Solution] Removed m_visibleRect of scrollingLayer and modified to set position of scrolling layer
           when change offset of scrolling layer.

Conflicts:
Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h

Change-Id: I0eeb5738a55381fb4b2267c4728d9f4eea4d5659

Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h

index ad13b49..d1f3255 100644 (file)
@@ -677,9 +677,9 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
         m_scrollingLayer->setSize(paddingBox.size());
         m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location(), false);
         // Note that we implement the contents offset via the bounds origin on this layer, rather than a position on the sublayer.
-        m_scrollingLayer->setBoundsOrigin(FloatPoint(scrollOffset.width(), scrollOffset.height()));
+        m_scrollingLayer->setBoundsOrigin(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));
 
-        m_scrollingContentsLayer->setPosition(FloatPoint());
+        m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));
 
         IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHeight());
         if (scrollSize != m_scrollingContentsLayer->size())
index 5583da4..118ec26 100755 (executable)
@@ -371,9 +371,9 @@ void WebLayerTreeRenderer::adjustPositionForOverflowLayers()
         const Vector<GraphicsLayer*>& childLayers = contentsLayer->children();
         for (size_t i = 0; i < childLayers.size(); ++i)
             if (childLayers[i]->isScrollbar())
-                toTextureMapperLayer(childLayers[i])->setScrollPositionDeltaIfNeeded(FloatSize(contentsLayer->boundsOrigin().x(), contentsLayer->boundsOrigin().y()));
+                toTextureMapperLayer(childLayers[i])->setScrollPositionDeltaIfNeeded(FloatSize(-contentsLayer->boundsOrigin().x(), -contentsLayer->boundsOrigin().y()));
 #endif
-        textureMapperLayer->setScrollPositionDeltaIfNeeded(FloatSize(-contentsLayer->boundsOrigin().x(), -contentsLayer->boundsOrigin().y()));
+        textureMapperLayer->setScrollPositionDeltaIfNeeded(FloatSize(contentsLayer->boundsOrigin() - contentsLayer->position()));
     }
 }
 
@@ -389,8 +389,12 @@ bool WebLayerTreeRenderer::setOffset(const WebLayerID id, const FloatPoint& offs
         return false;
 
     const IntSize contentLayerSize(contentsLayer->size().width(), contentsLayer->size().height());
-    const IntRect boundaryRect(FloatRect(scrollingLayer->position(), scrollingLayer->size()));
-    const IntRect visibleRect(FloatRect(contentsLayer->boundsOrigin(), scrollingLayer->size()));
+    const IntRect boundaryRect(FloatRect(FloatPoint(0, 0), scrollingLayer->size()));
+    const IntRect visibleRect(FloatRect(-contentsLayer->boundsOrigin().x(),
+                                        -contentsLayer->boundsOrigin().y(),
+                                        scrollingLayer->size().width(),
+                                        scrollingLayer->size().height()));
+
 
     IntRect newVisibleRect = visibleRect;
     newVisibleRect.moveBy(flooredIntPoint(offset));
@@ -407,7 +411,7 @@ bool WebLayerTreeRenderer::setOffset(const WebLayerID id, const FloatPoint& offs
     if (visibleRect == newVisibleRect)
         return false;
 
-    contentsLayer->setBoundsOrigin(newVisibleRect.location());
+    contentsLayer->setBoundsOrigin(FloatPoint(-newVisibleRect.x(), -newVisibleRect.y()));
 
     m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::SetVisibleContentsRectAndTrajectoryVectorForLayer(id, visibleRect, offset), m_drawingAreaProxy->page()->pageID());
 
index 954fd4d..576d024 100644 (file)
@@ -848,7 +848,6 @@ void LayerTreeCoordinator::setVisibleContentsRectAndTrajectoryVectorForLayer(int
     if (!contentsLayer)
         return;
 
-    toWebGraphicsLayer(contentsLayer)->setVisibleRect(visibleRect);
     if (trajectoryVector != FloatPoint::zero()) {
         m_webPage->scrollOverflowWithTrajectoryVector(trajectoryVector);
         toWebGraphicsLayer(contentsLayer)->setVisibleContentRectTrajectoryVector(trajectoryVector);
@@ -882,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());
index c6b6249..e9a62b7 100755 (executable)
@@ -473,12 +473,6 @@ void WebGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
 
 void WebGraphicsLayer::setNeedsDisplay()
 {
-#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
-    if (!m_visibleRect.isEmpty()) {
-        setNeedsDisplayInRect(IntRect(m_visibleRect));
-        return;
-    }
-#endif
     setNeedsDisplayInRect(IntRect(IntPoint::zero(), IntSize(size().width(), size().height())));
 }
 
@@ -785,11 +779,6 @@ IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
         return IntRect();
 #endif
 
-#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
-    if (!m_visibleRect.isEmpty())
-        return m_visibleRect;
-#endif
-
     FloatRect perspectiveRect = m_webGraphicsLayerClient->visibleContentsRect();
 
 #if ENABLE(TIZEN_CSS_OVERFLOW_CLIPPING_BACKING_STORE)
@@ -807,6 +796,19 @@ IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
         return endAnimationRect;
     }
 
+#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_SCROLLBAR)
+    if (isScrollbar()) {
+        WebGraphicsLayer* parentLayer = toWebGraphicsLayer(parent());
+        if (parentLayer && parentLayer->isOverflow()) {
+            GraphicsLayerTransform adjustedTransform = m_layerTransform;
+            adjustedTransform.setPosition(FloatPoint(position().x() - parentLayer->position().x(),
+                    position().y() - parentLayer->position().y()));
+            adjustedTransform.combineTransforms(parent() ? toWebGraphicsLayer(parent())->m_layerTransform.combinedForChildren() : TransformationMatrix());
+            return enclosingIntRect(adjustedTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(perspectiveRect)));
+        }
+    }
+#endif
+
     // Return a projection of the visible rect (surface coordinates) onto the layer's plane (layer coordinates).
     // The resulting quad might be squewed and the visible rect is the bounding box of this quad,
     // so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier).
index 172529b..4c2cc7f 100755 (executable)
@@ -210,7 +210,6 @@ public:
 #endif
 
 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
-    void setVisibleRect(const IntRect& rect) { m_visibleRect = rect; }
     void setIsOverflow(const bool b);
     bool isOverflow() const { return m_isOverflow; }
 #endif
@@ -292,9 +291,6 @@ private:
     float m_fixedAnimationScale;
 #endif
 
-#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
-    IntRect m_visibleRect;
-#endif
     PlatformLayer* m_canvasPlatformLayer;
     Timer<WebGraphicsLayer> m_animationStartedTimer;
     GraphicsLayerAnimations m_animations;