[CSS Regions] layerOwner in RenderNamedFlowFragment cannot return null

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

Patch by Mihai Maerean <mmaerean@adobe.com> on 2014-01-22
Reviewed by Sam Weinig.

RenderNamedFlowFragment::layerOwner cannot return null because regions create stacking
contexts which create layers.

No new tests, no functional change.

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::hasCompositingRegionDescendant):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeRegionCompositingRequirements):
* rendering/RenderNamedFlowFragment.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 155ba0f7
2014-01-22 Mihai Maerean <mmaerean@adobe.com>
[CSS Regions] layerOwner in RenderNamedFlowFragment cannot return null
https://bugs.webkit.org/show_bug.cgi?id=127343
Reviewed by Sam Weinig.
RenderNamedFlowFragment::layerOwner cannot return null because regions create stacking
contexts which create layers.
No new tests, no functional change.
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::hasCompositingRegionDescendant):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeRegionCompositingRequirements):
* rendering/RenderNamedFlowFragment.h:
2014-01-22 Antti Koivisto <antti@apple.com>
Avoid unthrottled layer flushes triggered by RenderLayerCompositor::ensureRootLayer
......@@ -251,10 +251,9 @@ void RenderFlowThread::layout()
#if USE(ACCELERATED_COMPOSITING)
bool RenderFlowThread::hasCompositingRegionDescendant() const
{
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter)
if (RenderLayerModelObject* layerOwner = toRenderNamedFlowFragment(*iter)->layerOwner())
if (layerOwner->hasLayer() && layerOwner->layer()->hasCompositingDescendant())
return true;
for (auto& region : m_regionList)
if (toRenderNamedFlowFragment(region)->layerOwner().layer()->hasCompositingDescendant())
return true;
return false;
}
......
......@@ -6937,7 +6937,7 @@ void RenderLayer::filterNeedsRepaint()
void RenderLayer::paintNamedFlowThreadInsideRegion(GraphicsContext* context, RenderNamedFlowFragment* region, LayoutRect paintDirtyRect, LayoutPoint paintOffset, PaintBehavior paintBehavior, PaintLayerFlags paintFlags)
{
LayoutRect regionContentBox = toRenderBox(region->layerOwner())->contentBoxRect();
LayoutRect regionContentBox = toRenderBox(region->layerOwner()).contentBoxRect();
LayoutSize moveOffset = region->flowThreadPortionLocation() - (paintOffset + regionContentBox.location());
IntPoint adjustedPaintOffset = roundedIntPoint(-moveOffset);
paintDirtyRect.move(moveOffset);
......
......@@ -1001,14 +1001,14 @@ void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(IntRect& a
IntPoint flowDelta;
m_owningLayer.convertToPixelSnappedLayerCoords(flowThreadLayer, flowDelta);
parentRegion->adjustRegionBoundsFromFlowThreadPortionRect(flowDelta, ancestorCompositingBounds);
RenderBoxModelObject* layerOwner = toRenderBoxModelObject(parentRegion->layerOwner());
if (layerOwner->hasLayer() && layerOwner->layer()->backing()) {
RenderBoxModelObject& layerOwner = toRenderBoxModelObject(parentRegion->layerOwner());
if (layerOwner.layer()->backing()) {
// Make sure that the region propagates its borders, paddings, outlines or box-shadows to layers inside it.
// Note that the composited bounds of the RenderRegion are already calculated
// because RenderLayerCompositor::rebuildCompositingLayerTree will only
// iterate on the content of the region after the region itself is computed.
ancestorCompositingBounds.moveBy(roundedIntPoint(layerOwner->layer()->backing()->compositedBounds().location()));
ancestorCompositingBounds.move(-layerOwner->borderAndPaddingStart(), -layerOwner->borderAndPaddingBefore());
ancestorCompositingBounds.moveBy(roundedIntPoint(layerOwner.layer()->backing()->compositedBounds().location()));
ancestorCompositingBounds.move(-layerOwner.borderAndPaddingStart(), -layerOwner.borderAndPaddingBefore());
}
}
}
......
......@@ -1288,7 +1288,7 @@ void RenderLayerCompositor::computeRegionCompositingRequirements(RenderNamedFlow
}
if (overlapMap)
overlapMap->geometryMap().popMappingsToAncestor(region->layerOwner());
overlapMap->geometryMap().popMappingsToAncestor(&region->layerOwner());
}
void RenderLayerCompositor::setCompositingParent(RenderLayer& childLayer, RenderLayer* parentLayer)
......
......@@ -65,9 +65,8 @@ public:
// 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.
RenderLayerModelObject* layerOwner() const { return parent() && parent()->isRenderLayerModelObject() ? toRenderLayerModelObject(parent())
: nullptr; }
// The return value cannot be null because CSS Regions create Stacking Contexts (which means they create layers).
RenderLayerModelObject& layerOwner() const { return *toRenderLayerModelObject(parent()); }
bool hasCustomRegionStyle() const { return m_hasCustomRegionStyle; }
void setHasCustomRegionStyle(bool hasCustomRegionStyle) { m_hasCustomRegionStyle = hasCustomRegionStyle; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment