[CSS Regions] The layers from the flow thread should be collected under the regions...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2013 19:38:30 +0000 (19:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2013 19:38:30 +0000 (19:38 +0000)
commit3d799c758787aca6059693e4ab381a7a96e32f31
treed7742164bfebdb8e0c04d4d1938e9b5cd7058c6f
parentc1df25ad085a66cf02ec3a7b6bf4a3cf35c44491
[CSS Regions] The layers from the flow thread should be collected under the regions' layers.
https://bugs.webkit.org/show_bug.cgi?id=120457

Patch by Mihai Maerean <mmaerean@adobe.com> on 2013-10-21
Reviewed by David Hyatt.

Source/WebCore:

This patch is based on the work of Alexandru Chiculita at https://bugs.webkit.org/attachment.cgi?id=203872&action=review

The composited layers inside the named flow threads are collected as part of the regions (as children of the
GraphicsLayer of the layer that corresponds to the region (which is attached to the parent renderer of
RenderNameFlowFragment)).
When a region displays a layer that needs accelerated compositing we activate the accelerated compositing for
that region too (inside RenderLayerCompositor::computeRegionCompositingRequirements).

This patch has landed before (as http://trac.webkit.org/changeset/156451), but was reverted because
fast/multicol/mixed-positioning-stacking-order.html failed. The fix is inside RenderLayerCompositor::canBeComposited
that only enables compositing for layers inside flow threads that collect the graphics layers under the regions.

Another change from changeset #156451 is that now the region renderers are created as anonymous renderers under
the element that has the flow-from property. When a composited layer is needed for the region, it sits in it's
parent renderer, not in the region renderer (RenderNamedFlowFragment).

Tests: compositing/regions/crash-transform-inside-region.html
       compositing/regions/floated-region-with-transformed-child.html
       compositing/regions/move-layer-from-one-region-to-another.html
       compositing/regions/propagate-region-box-shadow-border-padding-for-video.html
       compositing/regions/propagate-region-box-shadow-border-padding.html
       compositing/regions/region-as-layer-in-another-flowthread.html
       compositing/regions/transform-transparent-positioned-video-inside-region.html
       compositing/regions/transformed-layer-inside-transformed-layer.html
       compositing/regions/z-index-update.html
       compositing/regions/z-index.html

* rendering/FlowThreadController.cpp:
(WebCore::FlowThreadController::updateRenderFlowThreadLayersIfNeeded):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::propagateStyleToAnonymousChildren): Not for RenderFlowThreads, as they are updated
through the RenderView::styleDidChange function.
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::layout): When the layout of the flow thread is over (including the 2 phase layout),
we update all the mappings between the layers inside the flow thread and the regions where those layers will be
painted.
(WebCore::RenderFlowThread::hasCompositingRegionDescendant): Whether any of the regions has a compositing descendant.
(WebCore::RenderFlowThread::getLayerListForRegion):
(WebCore::RenderFlowThread::regionForCompositedLayer):
(WebCore::RenderFlowThread::cachedRegionForCompositedLayer):
(WebCore::RenderFlowThread::collectsGraphicsLayersUnderRegions):
(WebCore::RenderFlowThread::updateLayerToRegionMappings): Triggers an update of the layers if a layer has moved
from a region to another since the last update.
(WebCore::RenderFlowThread::updateAllLayerToRegionMappings):
* rendering/RenderFlowThread.h:
* rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::pushRenderFlowThread):
* rendering/RenderGeometryMap.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintList):
(WebCore::RenderLayer::enclosingFlowThreadAncestor):
(WebCore::RenderLayer::isFlowThreadCollectingGraphicsLayersUnderRegions):
(WebCore::RenderLayer::hitTestList):
(WebCore::RenderLayer::calculateLayerBounds): When we calculate the bounds of the RenderView, we ignore those
flow threads that collect the graphics layers under the regions.
(WebCore::RenderLayer::dirtyZOrderLists):
(WebCore::RenderLayer::dirtyNormalFlowList):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldClipCompositedBounds): Not if it's a flow thread that collects the graphics
layers under the regions
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Now adjusts the ancestorCompositingBounds for the FlowThread.
(WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread): Make sure that the region propagates
its borders, paddings, outlines or box-shadows to layers inside it.
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements): Now calls computeRegionCompositingRequirements.
(WebCore::RenderLayerCompositor::computeRegionCompositingRequirements):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Do not iterate the RenderFlowThread directly if
we are going to collect the composited layers as part of regions.
(WebCore::RenderLayerCompositor::rebuildRegionCompositingLayerTree):
(WebCore::RenderLayerCompositor::canBeComposited): CSS Regions flow threads do not need to be composited as we
use composited RenderRegions to render the background of the RenderFlowThread.
(WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason): If it's a container of a css region.
* rendering/RenderLayerCompositor.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::adjustRegionBoundsFromFlowThreadPortionRect):
* rendering/RenderMultiColumnSet.h:
* rendering/RenderNamedFlowFragment.h:
(WebCore::RenderNamedFlowFragment::layerOwner): When the content inside the region requires the region to have a
layer, the layer will be created on the region's parent renderer instead. This method returns that renderer
holding the layer. The return value may be null.
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
(WebCore::RenderNamedFlowThread::nextRendererForNode):
(WebCore::RenderNamedFlowThread::previousRendererForNode):
(WebCore::RenderNamedFlowThread::addFlowChild):
(WebCore::RenderNamedFlowThread::removeFlowChild):
(WebCore::RenderNamedFlowThread::collectsGraphicsLayersUnderRegions):
* rendering/RenderNamedFlowThread.h: m_flowThreadChildList is now allocated through an OwnPtr to keep the render
arena under the size limit.
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect):
* rendering/RenderRegion.h:
(WebCore::toRenderRegion):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeLayers):
* WebCore.exp.in: WebCore::RenderLayer::isFlowThreadCollectingGraphicsLayersUnderRegions

LayoutTests:

* compositing/regions/crash-transform-inside-region-expected.html: Added.
* compositing/regions/crash-transform-inside-region.html: Added.
* compositing/regions/floated-region-with-transformed-child-expected.html: Added.
* compositing/regions/floated-region-with-transformed-child.html: Added.
* compositing/regions/move-layer-from-one-region-to-another-expected.html: Added.
* compositing/regions/move-layer-from-one-region-to-another.html: Added.
* compositing/regions/propagate-region-box-shadow-border-padding-expected.html: Added.
* compositing/regions/propagate-region-box-shadow-border-padding-for-video-expected.html: Added.
* compositing/regions/propagate-region-box-shadow-border-padding-for-video.html: Added.
* compositing/regions/propagate-region-box-shadow-border-padding.html: Added.
* compositing/regions/region-as-layer-in-another-flowthread-expected.html: Added.
* compositing/regions/region-as-layer-in-another-flowthread.html: Added.
* compositing/regions/transform-transparent-positioned-video-inside-region-expected.html: Added.
* compositing/regions/transform-transparent-positioned-video-inside-region.html: Added.
* compositing/regions/transformed-layer-inside-transformed-layer-expected.html: Added.
* compositing/regions/transformed-layer-inside-transformed-layer.html: Added.
* compositing/regions/webkit-flow-renderer-layer-compositing-expected.html:
* compositing/regions/webkit-flow-renderer-layer-compositing.html:
* compositing/regions/z-index-expected.html: Added.
* compositing/regions/z-index-update-expected.html: Added.
* compositing/regions/z-index-update.html: Added.
* compositing/regions/z-index.html: Added.
* fast/multicol/mixed-positioning-stacking-order-expected.html:
* fast/multicol/mixed-positioning-stacking-order.html:
* fast/repaint/region-painting-composited-element-expected.html:
* fast/repaint/region-painting-composited-element.html:
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
49 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/regions/crash-transform-inside-region-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/crash-transform-inside-region.html [new file with mode: 0644]
LayoutTests/compositing/regions/floated-region-with-transformed-child-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/floated-region-with-transformed-child.html [new file with mode: 0644]
LayoutTests/compositing/regions/move-layer-from-one-region-to-another-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/move-layer-from-one-region-to-another.html [new file with mode: 0644]
LayoutTests/compositing/regions/propagate-region-box-shadow-border-padding-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/propagate-region-box-shadow-border-padding-for-video-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/propagate-region-box-shadow-border-padding-for-video.html [new file with mode: 0644]
LayoutTests/compositing/regions/propagate-region-box-shadow-border-padding.html [new file with mode: 0644]
LayoutTests/compositing/regions/region-as-layer-in-another-flowthread-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/region-as-layer-in-another-flowthread.html [new file with mode: 0644]
LayoutTests/compositing/regions/transform-transparent-positioned-video-inside-region-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/transform-transparent-positioned-video-inside-region.html [new file with mode: 0644]
LayoutTests/compositing/regions/transformed-layer-inside-transformed-layer-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/transformed-layer-inside-transformed-layer.html [new file with mode: 0644]
LayoutTests/compositing/regions/webkit-flow-renderer-layer-compositing-expected.html
LayoutTests/compositing/regions/webkit-flow-renderer-layer-compositing.html
LayoutTests/compositing/regions/z-index-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/z-index-update-expected.html [new file with mode: 0644]
LayoutTests/compositing/regions/z-index-update.html [new file with mode: 0644]
LayoutTests/compositing/regions/z-index.html [new file with mode: 0644]
LayoutTests/fast/multicol/mixed-positioning-stacking-order-expected.html
LayoutTests/fast/multicol/mixed-positioning-stacking-order.html
LayoutTests/fast/repaint/region-painting-composited-element-expected.html
LayoutTests/fast/repaint/region-painting-composited-element.html
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/FlowThreadController.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderFlowThread.cpp
Source/WebCore/rendering/RenderFlowThread.h
Source/WebCore/rendering/RenderGeometryMap.cpp
Source/WebCore/rendering/RenderGeometryMap.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h
Source/WebCore/rendering/RenderMultiColumnSet.cpp
Source/WebCore/rendering/RenderMultiColumnSet.h
Source/WebCore/rendering/RenderNamedFlowFragment.h
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/rendering/RenderNamedFlowThread.h
Source/WebCore/rendering/RenderRegion.cpp
Source/WebCore/rendering/RenderRegion.h
Source/WebCore/rendering/RenderTreeAsText.cpp