Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Texmap] Remove the backing store after 'style.visibility' for an ele…
…ment sets 'hidden'.

https://bugs.webkit.org/show_bug.cgi?id=92492

Patch by Huang Dongsung <luxtella@company100.net> 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):

Canonical link: https://commits.webkit.org/110553@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Dongseong Hwang authored and webkit-commit-queue committed Jul 31, 2012
1 parent 0fc202c commit 75adb37
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 10 deletions.
30 changes: 30 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,33 @@
2012-07-30 Huang Dongsung <luxtella@company100.net>

[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 <keishi@webkit.org>

Implement datalist UI for input type color for Chromium
Expand Down
Expand Up @@ -271,6 +271,16 @@ void GraphicsLayerTextureMapper::setDrawsContent(bool value)
GraphicsLayer::setDrawsContent(value);
}

/* \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)
Expand Down
Expand Up @@ -60,6 +60,7 @@ class GraphicsLayerTextureMapper : public GraphicsLayer {
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);
Expand Down
Expand Up @@ -103,7 +103,7 @@ void TextureMapperLayer::updateBackingStore(TextureMapper* textureMapper, Graphi
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;
}
Expand Down Expand Up @@ -157,7 +157,7 @@ void TextureMapperLayer::paint()

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.
Expand Down Expand Up @@ -294,6 +294,8 @@ bool TextureMapperLayer::isVisible() const
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;
Expand Down Expand Up @@ -472,6 +474,7 @@ void TextureMapperLayer::syncCompositingStateSelf(GraphicsLayerTextureMapper* gr
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();
Expand Down
19 changes: 11 additions & 8 deletions Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
Expand Up @@ -83,16 +83,17 @@ class TextureMapperLayer : public GraphicsLayerAnimation::Client {
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 {
Expand Down Expand Up @@ -212,6 +213,7 @@ class TextureMapperLayer : public GraphicsLayerAnimation::Client {
bool preserves3D : 1;
bool masksToBounds : 1;
bool drawsContent : 1;
bool contentsVisible : 1;
bool contentsOpaque : 1;
bool backfaceVisibility : 1;
bool visible : 1;
Expand All @@ -225,6 +227,7 @@ class TextureMapperLayer : public GraphicsLayerAnimation::Client {
, preserves3D(false)
, masksToBounds(false)
, drawsContent(false)
, contentsVisible(true)
, contentsOpaque(false)
, backfaceVisibility(false)
, visible(true)
Expand Down
21 changes: 21 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
2012-07-30 Huang Dongsung <luxtella@company100.net>

[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 <sam@webkit.org>

Add a proper umbrella header for the public WebKit2 API headers
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/Shared/WebLayerTreeInfo.h
Expand Up @@ -61,6 +61,7 @@ struct WebLayerInfo {
struct {
bool contentsOpaque : 1;
bool drawsContent : 1;
bool contentsVisible : 1;
bool backfaceVisible : 1;
bool masksToBounds : 1;
bool preserves3D : 1;
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
Expand Up @@ -264,6 +264,7 @@ void WebLayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& laye
layer->setContentsOpaque(layerInfo.contentsOpaque);
layer->setContentsRect(layerInfo.contentsRect);
layer->setDrawsContent(layerInfo.drawsContent);
layer->setContentsVisible(layerInfo.contentsVisible);
toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport);

if (layerInfo.fixedToViewport)
Expand Down
Expand Up @@ -277,6 +277,15 @@ void WebGraphicsLayer::setDrawsContent(bool b)
didChangeLayerState();
}

void WebGraphicsLayer::setContentsVisible(bool b)
{
if (contentsAreVisible() == b)
return;
GraphicsLayer::setContentsVisible(b);

didChangeLayerState();
}

void WebGraphicsLayer::setContentsOpaque(bool b)
{
if (contentsOpaque() == b)
Expand Down Expand Up @@ -470,6 +479,7 @@ void WebGraphicsLayer::syncLayerState()
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();
Expand Down
Expand Up @@ -95,6 +95,7 @@ class WebGraphicsLayer : public WebCore::GraphicsLayer
void setPreserves3D(bool);
void setMasksToBounds(bool);
void setDrawsContent(bool);
void setContentsVisible(bool);
void setContentsOpaque(bool);
void setBackfaceVisibility(bool);
void setOpacity(float);
Expand Down

0 comments on commit 75adb37

Please sign in to comment.