Title: [110601] trunk/Source/WebCore
- Revision
- 110601
- Author
- [email protected]
- Date
- 2012-03-13 13:59:59 -0700 (Tue, 13 Mar 2012)
Log Message
Refactor some code that is used to check whether a layer needs backing store
https://bugs.webkit.org/show_bug.cgi?id=80917
Reviewed by Dean Jackson.
Move some code out of isSimpleContainerCompositingLayer() in two new
methods to make the code more self-descriptive.
No behavior change, so no tests.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintsBoxDecorations):
(WebCore::RenderLayerBacking::paintsChildren):
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
* rendering/RenderLayerBacking.h:
(RenderLayerBacking):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (110600 => 110601)
--- trunk/Source/WebCore/ChangeLog 2012-03-13 20:47:58 UTC (rev 110600)
+++ trunk/Source/WebCore/ChangeLog 2012-03-13 20:59:59 UTC (rev 110601)
@@ -1,3 +1,22 @@
+2012-03-12 Simon Fraser <[email protected]>
+
+ Refactor some code that is used to check whether a layer needs backing store
+ https://bugs.webkit.org/show_bug.cgi?id=80917
+
+ Reviewed by Dean Jackson.
+
+ Move some code out of isSimpleContainerCompositingLayer() in two new
+ methods to make the code more self-descriptive.
+
+ No behavior change, so no tests.
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::paintsBoxDecorations):
+ (WebCore::RenderLayerBacking::paintsChildren):
+ (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
+ * rendering/RenderLayerBacking.h:
+ (RenderLayerBacking):
+
2012-03-13 Daniel Bates <[email protected]>
REGRESSION(r99369): File input button doesn't highlight when pressed
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (110600 => 110601)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-03-13 20:47:58 UTC (rev 110600)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-03-13 20:59:59 UTC (rev 110601)
@@ -786,6 +786,31 @@
m_graphicsLayer->setContentsToBackgroundColor(rendererBackgroundColor());
}
+bool RenderLayerBacking::paintsBoxDecorations() const
+{
+ if (!m_owningLayer->hasVisibleContent())
+ return false;
+
+ if (hasBoxDecorationsOrBackground(renderer()))
+ return true;
+
+ if (m_owningLayer->hasOverflowControls())
+ return true;
+
+ return false;
+}
+
+bool RenderLayerBacking::paintsChildren() const
+{
+ if (m_owningLayer->hasVisibleContent() && containsNonEmptyRenderers())
+ return true;
+
+ if (hasVisibleNonCompositingDescendantLayers())
+ return true;
+
+ return false;
+}
+
// A "simple container layer" is a RenderLayer which has no visible content to render.
// It may have no children, or all its children may be themselves composited.
// This is a useful optimization, because it allows us to avoid allocating backing store.
@@ -796,21 +821,8 @@
renderObject->hasMask()) // masks require special treatment
return false;
- RenderStyle* style = renderObject->style();
- bool isVisible = m_owningLayer->hasVisibleContent();
-
- // Reject anything that has a border, a border-radius or outline,
- // or any background (color or image).
- // FIXME: we could optimize layers for simple backgrounds.
- if (isVisible && hasBoxDecorationsOrBackground(renderObject))
+ if (paintsBoxDecorations() || paintsChildren())
return false;
-
- if (isVisible && m_owningLayer->hasOverflowControls())
- return false;
-
- // If we have got this far and the renderer has no children, then we're ok.
- if (!renderObject->firstChild())
- return true;
if (renderObject->node() && renderObject->node()->isDocumentNode()) {
// Look to see if the root object has a non-simple background
@@ -818,7 +830,7 @@
if (!rootObject)
return false;
- style = rootObject->style();
+ RenderStyle* style = rootObject->style();
// Reject anything that has a border, a border-radius or outline,
// or is not a simple background (no background, or solid color).
@@ -837,13 +849,6 @@
return false;
}
- // Check to see if all the renderer's children are compositing layers.
- if (isVisible && containsNonEmptyRenderers())
- return false;
-
- if (hasVisibleNonCompositingDescendantLayers())
- return false;
-
return true;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (110600 => 110601)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2012-03-13 20:47:58 UTC (rev 110600)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2012-03-13 20:59:59 UTC (rev 110601)
@@ -186,6 +186,9 @@
bool isMainFrameRenderViewLayer() const;
+ bool paintsBoxDecorations() const;
+ bool paintsChildren() const;
+
// Returns true if this compositing layer has no visible content.
bool isSimpleContainerCompositingLayer() const;
// Returns true if this layer has content that needs to be rendered by painting into the backing store.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes