Title: [124178] trunk/Source
Revision
124178
Author
[email protected]
Date
2012-07-30 23:55:55 -0700 (Mon, 30 Jul 2012)

Log Message

[Texmap] Remove the backing store after 'style.visibility' for an element sets 'hidden'.
https://bugs.webkit.org/show_bug.cgi?id=92492

Patch by Huang Dongsung <[email protected]> on 2012-07-30
Reviewed by Noam Rosenthal.

Source/WebCore:

This patch's purpose is to save vram memory.
When visibility of the element sets hidden, we do not need to draw the element,
so we do not need to keep a texture of the backing store.
Currently, Texmap does not draw the element with visibility:hidden because
RenderLayerBacking::paintIntoLayer does not draw anything.
This patch just removes unused textures.

No new tests - no new testable functionality.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::setContentsVisible):
(WebCore):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
(GraphicsLayerTextureMapper):
* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::updateBackingStore):
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::isVisible):
(WebCore::TextureMapperLayer::syncCompositingStateSelf):
* platform/graphics/texmap/TextureMapperLayer.h:
(State):
(WebCore::TextureMapperLayer::State::State):

Source/WebKit2:

Texmap handles visibility:hidden in this patch, so WebGraphicsLayer
sends the LayerTreeCoordinatorProxyMessages with additional infomation
to UIProcess.

* Shared/WebLayerTreeInfo.h:
* UIProcess/WebLayerTreeRenderer.cpp:
(WebKit::WebLayerTreeRenderer::setLayerState):
* WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::setContentsVisible):
(WebCore):
(WebCore::WebGraphicsLayer::syncLayerState):
* WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h:
(WebGraphicsLayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124177 => 124178)


--- trunk/Source/WebCore/ChangeLog	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebCore/ChangeLog	2012-07-31 06:55:55 UTC (rev 124178)
@@ -1,3 +1,33 @@
+2012-07-30  Huang Dongsung  <[email protected]>
+
+        [Texmap] Remove the backing store after 'style.visibility' for an element sets 'hidden'.
+        https://bugs.webkit.org/show_bug.cgi?id=92492
+
+        Reviewed by Noam Rosenthal.
+
+        This patch's purpose is to save vram memory.
+        When visibility of the element sets hidden, we do not need to draw the element,
+        so we do not need to keep a texture of the backing store.
+        Currently, Texmap does not draw the element with visibility:hidden because
+        RenderLayerBacking::paintIntoLayer does not draw anything.
+        This patch just removes unused textures.
+
+        No new tests - no new testable functionality.
+
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::setContentsVisible):
+        (WebCore):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        (GraphicsLayerTextureMapper):
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::updateBackingStore):
+        (WebCore::TextureMapperLayer::paintSelf):
+        (WebCore::TextureMapperLayer::isVisible):
+        (WebCore::TextureMapperLayer::syncCompositingStateSelf):
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        (State):
+        (WebCore::TextureMapperLayer::State::State):
+
 2012-07-30  Keishi Hattori  <[email protected]>
 
         Implement datalist UI for input type color for Chromium

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (124177 => 124178)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-07-31 06:55:55 UTC (rev 124178)
@@ -273,6 +273,16 @@
 
 /* \reimp (GraphicsLayer.h)
 */
+void GraphicsLayerTextureMapper::setContentsVisible(bool value)
+{
+    if (value == contentsAreVisible())
+        return;
+    notifyChange(TextureMapperLayer::ContentsVisibleChange);
+    GraphicsLayer::setContentsVisible(value);
+}
+
+/* \reimp (GraphicsLayer.h)
+*/
 void GraphicsLayerTextureMapper::setContentsOpaque(bool value)
 {
     if (value == contentsOpaque())

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (124177 => 124178)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2012-07-31 06:55:55 UTC (rev 124178)
@@ -60,6 +60,7 @@
     virtual void setPreserves3D(bool b);
     virtual void setMasksToBounds(bool b);
     virtual void setDrawsContent(bool b);
+    virtual void setContentsVisible(bool);
     virtual void setContentsOpaque(bool b);
     virtual void setBackfaceVisibility(bool b);
     virtual void setOpacity(float opacity);

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (124177 => 124178)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-07-31 06:55:55 UTC (rev 124178)
@@ -103,7 +103,7 @@
     if (!m_shouldUpdateBackingStoreFromLayer)
         return;
 
-    if (!m_state.drawsContent || m_size.isEmpty()) {
+    if (!m_state.drawsContent || !m_state.contentsVisible || m_size.isEmpty()) {
         m_backingStore.clear();
         return;
     }
@@ -157,7 +157,7 @@
 
 void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
 {
-    if (!m_state.visible)
+    if (!m_state.visible || !m_state.contentsVisible)
         return;
 
     // We apply the following transform to compensate for painting into a surface, and then apply the offset so that the painting fits in the target rect.
@@ -294,6 +294,8 @@
         return false;
     if (!m_state.visible && m_children.isEmpty())
         return false;
+    if (!m_state.contentsVisible && m_children.isEmpty())
+        return false;
     if (m_opacity < 0.01)
         return false;
     return true;
@@ -472,6 +474,7 @@
     m_state.preserves3D = graphicsLayer->preserves3D();
     m_state.masksToBounds = graphicsLayer->masksToBounds();
     m_state.drawsContent = graphicsLayer->drawsContent();
+    m_state.contentsVisible = graphicsLayer->contentsAreVisible();
     m_state.contentsOpaque = graphicsLayer->contentsOpaque();
     m_state.backfaceVisibility = graphicsLayer->backfaceVisibility();
     m_state.childrenTransform = graphicsLayer->childrenTransform();

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (124177 => 124178)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-07-31 06:55:55 UTC (rev 124178)
@@ -83,16 +83,17 @@
         Preserves3DChange =         (1L << 12),
         MasksToBoundsChange =       (1L << 13),
         DrawsContentChange =        (1L << 14),
-        ContentsOpaqueChange =      (1L << 15),
+        ContentsVisibleChange =     (1L << 15),
+        ContentsOpaqueChange =      (1L << 16),
 
-        BackfaceVisibilityChange =  (1L << 16),
-        ChildrenTransformChange =   (1L << 17),
-        DisplayChange =             (1L << 18),
-        BackgroundColorChange =     (1L << 19),
+        BackfaceVisibilityChange =  (1L << 17),
+        ChildrenTransformChange =   (1L << 18),
+        DisplayChange =             (1L << 19),
+        BackgroundColorChange =     (1L << 20),
 
-        ReplicaLayerChange =        (1L << 20),
-        AnimationChange =           (1L << 21),
-        FilterChange =              (1L << 22)
+        ReplicaLayerChange =        (1L << 21),
+        AnimationChange =           (1L << 22),
+        FilterChange =              (1L << 23)
     };
 
     enum SyncOptions {
@@ -212,6 +213,7 @@
         bool preserves3D : 1;
         bool masksToBounds : 1;
         bool drawsContent : 1;
+        bool contentsVisible : 1;
         bool contentsOpaque : 1;
         bool backfaceVisibility : 1;
         bool visible : 1;
@@ -225,6 +227,7 @@
             , preserves3D(false)
             , masksToBounds(false)
             , drawsContent(false)
+            , contentsVisible(true)
             , contentsOpaque(false)
             , backfaceVisibility(false)
             , visible(true)

Modified: trunk/Source/WebKit2/ChangeLog (124177 => 124178)


--- trunk/Source/WebKit2/ChangeLog	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-31 06:55:55 UTC (rev 124178)
@@ -1,3 +1,24 @@
+2012-07-30  Huang Dongsung  <[email protected]>
+
+        [Texmap] Remove the backing store after 'style.visibility' for an element sets 'hidden'.
+        https://bugs.webkit.org/show_bug.cgi?id=92492
+
+        Reviewed by Noam Rosenthal.
+
+        Texmap handles visibility:hidden in this patch, so WebGraphicsLayer
+        sends the LayerTreeCoordinatorProxyMessages with additional infomation
+        to UIProcess.
+
+        * Shared/WebLayerTreeInfo.h:
+        * UIProcess/WebLayerTreeRenderer.cpp:
+        (WebKit::WebLayerTreeRenderer::setLayerState):
+        * WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::setContentsVisible):
+        (WebCore):
+        (WebCore::WebGraphicsLayer::syncLayerState):
+        * WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h:
+        (WebGraphicsLayer):
+
 2012-07-30  Sam Weinig  <[email protected]>
 
         Add a proper umbrella header for the public WebKit2 API headers

Modified: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h (124177 => 124178)


--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2012-07-31 06:55:55 UTC (rev 124178)
@@ -61,6 +61,7 @@
         struct {
             bool contentsOpaque : 1;
             bool drawsContent : 1;
+            bool contentsVisible : 1;
             bool backfaceVisible : 1;
             bool masksToBounds : 1;
             bool preserves3D : 1;

Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp (124177 => 124178)


--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp	2012-07-31 06:55:55 UTC (rev 124178)
@@ -264,6 +264,7 @@
     layer->setContentsOpaque(layerInfo.contentsOpaque);
     layer->setContentsRect(layerInfo.contentsRect);
     layer->setDrawsContent(layerInfo.drawsContent);
+    layer->setContentsVisible(layerInfo.contentsVisible);
     toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport);
 
     if (layerInfo.fixedToViewport)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp (124177 => 124178)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp	2012-07-31 06:55:55 UTC (rev 124178)
@@ -277,6 +277,15 @@
     didChangeLayerState();
 }
 
+void WebGraphicsLayer::setContentsVisible(bool b)
+{
+    if (contentsAreVisible() == b)
+        return;
+    GraphicsLayer::setContentsVisible(b);
+
+    didChangeLayerState();
+}
+
 void WebGraphicsLayer::setContentsOpaque(bool b)
 {
     if (contentsOpaque() == b)
@@ -470,6 +479,7 @@
     m_layerInfo.contentsOpaque = contentsOpaque();
     m_layerInfo.contentsRect = contentsRect();
     m_layerInfo.drawsContent = drawsContent();
+    m_layerInfo.contentsVisible = contentsAreVisible();
     m_layerInfo.mask = toWebLayerID(maskLayer());
     m_layerInfo.masksToBounds = masksToBounds();
     m_layerInfo.opacity = opacity();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h (124177 => 124178)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h	2012-07-31 06:52:49 UTC (rev 124177)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h	2012-07-31 06:55:55 UTC (rev 124178)
@@ -95,6 +95,7 @@
     void setPreserves3D(bool);
     void setMasksToBounds(bool);
     void setDrawsContent(bool);
+    void setContentsVisible(bool);
     void setContentsOpaque(bool);
     void setBackfaceVisibility(bool);
     void setOpacity(float);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to