Title: [113608] trunk/Source/WebKit2
Revision
113608
Author
noam.rosent...@nokia.com
Date
2012-04-09 13:01:26 -0700 (Mon, 09 Apr 2012)

Log Message

[Qt][WK2] Disable the content-scaling and visible contents rect when the layer's transform is not affine
https://bugs.webkit.org/show_bug.cgi?id=82523

Reviewed by Kenneth Rohde Christiansen.

Always use contentsScale of 1 and a full visibleContentsRect when
the layer's transform is not affine. That's because layer's with
complex transform would not gain from the benefit of contents scaling,
and might also create unexpected layer content sizes.

* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::createBackingStore):
(WebCore):
(WebCore::WebGraphicsLayer::tiledBackingStorePaint):
(WebCore::WebGraphicsLayer::tiledBackingStorePaintEnd):
(WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
(WebCore::WebGraphicsLayer::updateTile):
(WebCore::WebGraphicsLayer::removeTile):
(WebCore::WebGraphicsLayer::updateContentBuffers):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayer):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (113607 => 113608)


--- trunk/Source/WebKit2/ChangeLog	2012-04-09 19:46:56 UTC (rev 113607)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-09 20:01:26 UTC (rev 113608)
@@ -1,3 +1,27 @@
+2012-04-09  No'am Rosenthal  <noam.rosent...@nokia.com>
+
+        [Qt][WK2] Disable the content-scaling and visible contents rect when the layer's transform is not affine
+        https://bugs.webkit.org/show_bug.cgi?id=82523
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Always use contentsScale of 1 and a full visibleContentsRect when
+        the layer's transform is not affine. That's because layer's with
+        complex transform would not gain from the benefit of contents scaling,
+        and might also create unexpected layer content sizes.
+
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::createBackingStore):
+        (WebCore):
+        (WebCore::WebGraphicsLayer::tiledBackingStorePaint):
+        (WebCore::WebGraphicsLayer::tiledBackingStorePaintEnd):
+        (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
+        (WebCore::WebGraphicsLayer::updateTile):
+        (WebCore::WebGraphicsLayer::removeTile):
+        (WebCore::WebGraphicsLayer::updateContentBuffers):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+        (WebGraphicsLayer):
+
 2012-04-09  Zalan Bujtas  <zbuj...@gmail.com>
 
         [Qt][WK2] Fail to activate links after double tap gesture.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (113607 => 113608)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-04-09 19:46:56 UTC (rev 113607)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-04-09 20:01:26 UTC (rev 113608)
@@ -496,10 +496,22 @@
 void WebGraphicsLayer::setContentsScale(float scale)
 {
     m_contentsScale = scale;
+    adjustContentsScale();
+}
 
-    if (!m_mainBackingStore || m_mainBackingStore->contentsScale() == scale)
+float WebGraphicsLayer::effectiveContentsScale()
+{
+    return shouldUseTiledBackingStore() ? m_contentsScale : 1;
+}
+
+void WebGraphicsLayer::adjustContentsScale()
+{
+    if (!drawsContent())
         return;
 
+    if (!m_mainBackingStore || m_mainBackingStore->contentsScale() == effectiveContentsScale())
+        return;
+
     // Between creating the new backing store and painting the content,
     // we do not want to drop the previous one as that might result in
     // briefly seeing flickering as the old tiles may be dropped before
@@ -516,7 +528,7 @@
 {
     m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
     m_mainBackingStore->setSupportsAlpha(!contentsOpaque());
-    m_mainBackingStore->setContentsScale(m_contentsScale);
+    m_mainBackingStore->setContentsScale(effectiveContentsScale());
 }
 
 void WebGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect)
@@ -542,11 +554,16 @@
     return IntRect(0, 0, size().width(), size().height());
 }
 
+bool WebGraphicsLayer::shouldUseTiledBackingStore()
+{
+    return !selfOrAncestorHaveNonAffineTransforms();
+}
+
 IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
 {
     // If this layer is part of an active transform animation, the visible rect might change,
     // so we rather render the whole layer until some better optimization is available.
-    if (selfOrAncestorHasActiveTransformAnimations())
+    if (!shouldUseTiledBackingStore())
         return tiledBackingStoreContentsRect();
 
     // Non-invertible layers are not visible.
@@ -562,8 +579,8 @@
 Color WebGraphicsLayer::tiledBackingStoreBackgroundColor() const
 {
     return contentsOpaque() ? Color::white : Color::transparent;
+}
 
-}
 void WebGraphicsLayer::createTile(int tileID, const UpdateInfo& updateInfo)
 {
     m_webGraphicsLayerClient->createTile(id(), tileID, updateInfo);
@@ -656,6 +673,7 @@
 
     // The combined transform will be used in tiledBackingStoreVisibleRect.
     adjustVisibleRect();
+    adjustContentsScale();
 }
 #endif
 
@@ -669,13 +687,13 @@
     GraphicsLayer::setGraphicsLayerFactory(createWebGraphicsLayer);
 }
 
-bool WebGraphicsLayer::selfOrAncestorHasActiveTransformAnimations() const
+bool WebGraphicsLayer::selfOrAncestorHaveNonAffineTransforms()
 {
     if (!m_transformAnimations.isEmpty())
         return true;
 
-    if (parent())
-        return toWebGraphicsLayer(parent())->selfOrAncestorHasActiveTransformAnimations();
+    if (!m_layerTransform.combined().isAffine())
+        return true;
 
     return false;
 }

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (113607 => 113608)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-04-09 19:46:56 UTC (rev 113607)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-04-09 20:01:26 UTC (rev 113608)
@@ -159,10 +159,12 @@
     void createBackingStore();
     HashSet<String> m_transformAnimations;
 
-    bool selfOrAncestorHasActiveTransformAnimations() const;
-
 #if USE(TILED_BACKING_STORE)
+    bool selfOrAncestorHaveNonAffineTransforms();
+    bool shouldUseTiledBackingStore();
+    void adjustContentsScale();
     void computeTransformedVisibleRect();
+    float effectiveContentsScale();
 
     WebKit::WebGraphicsLayerClient* m_webGraphicsLayerClient;
     OwnPtr<WebCore::TiledBackingStore> m_mainBackingStore;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to