https://bugs.webkit.org/show_bug.cgi?id=78936
Reviewed by James Robinson.
No change in behavior, the code moved around already covered by existing tests.
In calculateDrawTransformsAndVisibility(), there are two separate
if-else statements where setTargetRenderSurface logic is
performed, and this makes the code less readable and more error
prone. This patch merges the logic, removing the redundant if-else
statements.
This code also merges one other set of if-statements that are
equivalent, if (layer->parent()) and if (layer!=rootLayer).
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::createRenderSurface):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::createRenderSurface):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsAndVisibilityInternal):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108426
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-21 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Refactor CCLayerTreeHostCommon: merge scattered setTargetRenderSurface logic
+ https://bugs.webkit.org/show_bug.cgi?id=78936
+
+ Reviewed by James Robinson.
+
+ No change in behavior, the code moved around already covered by existing tests.
+
+ In calculateDrawTransformsAndVisibility(), there are two separate
+ if-else statements where setTargetRenderSurface logic is
+ performed, and this makes the code less readable and more error
+ prone. This patch merges the logic, removing the redundant if-else
+ statements.
+
+ This code also merges one other set of if-statements that are
+ equivalent, if (layer->parent()) and if (layer!=rootLayer).
+
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::createRenderSurface):
+ * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+ (WebCore::CCLayerImpl::createRenderSurface):
+ * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+ (WebCore::calculateDrawTransformsAndVisibilityInternal):
+
2012-02-21 Kentaro Hara <haraken@chromium.org>
Remove FIXME from resolve-supplemental.pl
{
ASSERT(!m_renderSurface);
m_renderSurface = adoptPtr(new RenderSurfaceChromium(this));
+ setTargetRenderSurface(m_renderSurface.get());
}
bool LayerChromium::descendantDrawsContent()
{
ASSERT(!m_renderSurface);
m_renderSurface = adoptPtr(new CCRenderSurface(this));
+ setTargetRenderSurface(m_renderSurface.get());
}
bool CCLayerImpl::descendantDrawsContent()
layer->setDrawOpacity(drawOpacity);
- if (layer->parent()) {
+ if (layer != rootLayer) {
+ ASSERT(layer->parent());
+ layer->clearRenderSurface();
+
// Layers inherit the clip rect from their parent.
layer->setClipRect(layer->parent()->clipRect());
if (layer->parent()->usesLayerClipping())
layer->setUsesLayerClipping(true);
+ // Layers without their own renderSurface will render into the nearest ancestor surface.
layer->setTargetRenderSurface(layer->parent()->targetRenderSurface());
}
- if (layer != rootLayer)
- layer->clearRenderSurface();
-
if (layer->masksToBounds()) {
IntRect clipRect = transformedLayerRect;
clipRect.intersect(layer->clipRect());
layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0);
layer->setScreenSpaceTransform(layerScreenSpaceTransform);
- if (layer->renderSurface())
- layer->setTargetRenderSurface(layer->renderSurface());
- else {
- ASSERT(layer->parent());
- layer->setTargetRenderSurface(layer->parent()->targetRenderSurface());
- }
-
// drawableContentRect() is always stored in the coordinate system of the
// RenderSurface the layer draws into.
if (layer->drawsContent()) {