[WK2] calculate tiledBackingStoreVisibleRect including animation trajectory.
authorJungJik Lee <jungjik.lee@samsung.com>
Thu, 28 Mar 2013 03:38:13 +0000 (12:38 +0900)
committerJungJik Lee <jungjik.lee@samsung.com>
Fri, 5 Apr 2013 10:36:35 +0000 (19:36 +0900)
[Title] [WK2] calculate tiledBackingStoreVisibleRect including animation trajectory.
[Issue#] N_SE-25602
[Problem] TBS can not create tiles which is outside of keepRect while animation is running.
[Cause] during the animation, WebGraphicsLayer did not update itself's backing store by animation keyframes.
[Solution] unite the regions that the animation trajectory starts and ends.

Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h

index ae0f935..9839d7b 100755 (executable)
@@ -997,18 +997,27 @@ IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
         return m_visibleRect;
 #endif
 
+    FloatRect perspectiveRect = m_webGraphicsLayerClient->visibleContentsRect();
+
 #if ENABLE(TIZEN_CSS_OVERFLOW_CLIPPING_BACKING_STORE)
     if (GraphicsLayer::overflowClipping() && m_mainBackingStore) {
         WebGraphicsLayer* parentLayer = toWebGraphicsLayer(parent());
         if (parentLayer)
-            return enclosingIntRect(m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(parentLayer->clippingBounds())));
+            perspectiveRect = parentLayer->clippingBounds();
     }
 #endif
 
+    if (m_movingVisibleRect) {
+        IntRect startAnimationRect = enclosingIntRect(m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(perspectiveRect)));
+        IntRect endAnimationRect = enclosingIntRect(m_layerSettledTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(perspectiveRect)));
+        endAnimationRect.unite(startAnimationRect);
+        return endAnimationRect;
+    }
+
     // 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).
-    return enclosingIntRect(m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_webGraphicsLayerClient->visibleContentsRect()))));
+    return enclosingIntRect(m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(perspectiveRect)));
 }
 
 Color WebGraphicsLayer::tiledBackingStoreBackgroundColor() const
@@ -1195,14 +1204,23 @@ bool WebGraphicsLayer::hasPendingVisibleChanges()
 void WebGraphicsLayer::computeTransformedVisibleRect()
 {
     // When we have a transform animation, we need to update visible rect every frame to adjust the visible rect of a backing store.
-    bool hasActiveTransformAnimation = selfOrAncestorHasActiveTransformAnimation();
     if (!m_shouldUpdateVisibleRect && !m_movingVisibleRect)
         return;
 
     m_shouldUpdateVisibleRect = false;
     TransformationMatrix currentTransform = transform();
-    if (m_movingVisibleRect)
+    if (m_movingVisibleRect) {
+        m_layerSettledTransform.setLocalTransform(currentTransform);
+        m_layerSettledTransform.setPosition(position());
+        m_layerSettledTransform.setAnchorPoint(anchorPoint());
+        m_layerSettledTransform.setSize(size());
+        m_layerSettledTransform.setFlattening(!preserves3D());
+        m_layerSettledTransform.setChildrenTransform(childrenTransform());
+        m_layerSettledTransform.combineTransforms(parent() ? toWebGraphicsLayer(parent())->m_layerTransform.combinedForChildren() : TransformationMatrix());
+
         client()->getCurrentTransform(this, currentTransform);
+    }
+
     m_layerTransform.setLocalTransform(currentTransform);
     m_layerTransform.setPosition(position());
     m_layerTransform.setAnchorPoint(anchorPoint());
index 2c676f9..d21d812 100755 (executable)
@@ -255,6 +255,7 @@ private:
     GraphicsLayer* m_maskTarget;
     FloatRect m_needsDisplayRect;
     GraphicsLayerTransform m_layerTransform;
+    GraphicsLayerTransform m_layerSettledTransform;
     bool m_inUpdateMode : 1;
     bool m_shouldUpdateVisibleRect: 1;
     bool m_shouldSyncLayerState: 1;