Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index bf2f39420dadded07e16b9b51166dcd65e77b2a9..2baacbd7361224934fa9648c59352e6b8b64f3eb 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -59,7 +59,6 @@ |
#include "core/frame/Settings.h" |
#include "core/frame/animation/AnimationController.h" |
#include "core/page/scrolling/ScrollingCoordinator.h" |
-#include "core/rendering/ColumnInfo.h" |
#include "core/rendering/CompositedLayerMapping.h" |
#include "core/rendering/FilterEffectRenderer.h" |
#include "core/rendering/HitTestRequest.h" |
@@ -112,7 +111,6 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type) |
, m_visibleDescendantStatusDirty(false) |
, m_hasVisibleDescendant(false) |
, m_hasVisibleNonLayerContent(false) |
- , m_isPaginated(false) |
, m_3DTransformedDescendantStatusDirty(true) |
, m_has3DTransformedDescendant(false) |
, m_containsDirtyOverlayScrollbars(false) |
@@ -271,10 +269,8 @@ void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, UpdateLay |
if (flags & UpdatePagination) |
updatePagination(); |
- else { |
- m_isPaginated = false; |
+ else |
m_enclosingPaginationLayer = 0; |
- } |
repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint); |
@@ -292,9 +288,6 @@ void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, UpdateLay |
flags |= UpdatePagination; |
} |
- if (renderer()->hasColumns()) |
- flags |= UpdatePagination; |
- |
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
child->updateLayerPositions(geometryMap, flags); |
@@ -576,28 +569,6 @@ RenderLayer* RenderLayer::enclosingOverflowClipLayer(IncludeSelfOrNot includeSel |
return 0; |
} |
-static bool checkContainingBlockChainForPagination(RenderLayerModelObject* renderer, RenderBox* ancestorColumnsRenderer) |
-{ |
- RenderView* view = renderer->view(); |
- RenderLayerModelObject* prevBlock = renderer; |
- RenderBlock* containingBlock; |
- for (containingBlock = renderer->containingBlock(); |
- containingBlock && containingBlock != view && containingBlock != ancestorColumnsRenderer; |
- containingBlock = containingBlock->containingBlock()) |
- prevBlock = containingBlock; |
- |
- // If the columns block wasn't in our containing block chain, then we aren't paginated by it. |
- if (containingBlock != ancestorColumnsRenderer) |
- return false; |
- |
- // If the previous block is absolutely positioned, then we can't be paginated by the columns block. |
- if (prevBlock->isOutOfFlowPositioned()) |
- return false; |
- |
- // Otherwise we are paginated by the columns block. |
- return true; |
-} |
- |
bool RenderLayer::useRegionBasedColumns() const |
{ |
const Settings* settings = renderer()->document().settings(); |
@@ -606,20 +577,12 @@ bool RenderLayer::useRegionBasedColumns() const |
void RenderLayer::updatePagination() |
{ |
- m_isPaginated = false; |
m_enclosingPaginationLayer = 0; |
if (hasCompositedLayerMapping() || !parent()) |
return; // FIXME: We will have to deal with paginated compositing layers someday. |
// FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. |
- // The main difference between the paginated booleans for the old column code and the new column code |
- // is that each paginated layer has to paint on its own with the new code. There is no |
- // recurring into child layers. This means that the m_isPaginated bits for the new column code can't just be set on |
- // "roots" that get split and paint all their descendants. Instead each layer has to be checked individually and |
- // genuinely know if it is going to have to split itself up when painting only its contents (and not any other descendant |
- // layers). We track an enclosingPaginationLayer instead of using a simple bit, since we want to be able to get back |
- // to that layer easily. |
bool regionBasedColumnsUsed = useRegionBasedColumns(); |
if (regionBasedColumnsUsed && renderer()->isInFlowRenderFlowThread()) { |
m_enclosingPaginationLayer = this; |
@@ -634,8 +597,7 @@ void RenderLayer::updatePagination() |
m_enclosingPaginationLayer = parent()->enclosingPaginationLayer(); |
if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTransform()) |
m_enclosingPaginationLayer = 0; |
- } else |
- m_isPaginated = parent()->renderer()->hasColumns(); |
+ } |
return; |
} |
@@ -663,10 +625,6 @@ void RenderLayer::updatePagination() |
// If we're not normal flow, then we need to look for a multi-column object between us and our stacking container. |
RenderLayerStackingNode* ancestorStackingContainerNode = m_stackingNode->ancestorStackingContainerNode(); |
for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { |
- if (curr->renderer()->hasColumns()) { |
- m_isPaginated = checkContainingBlockChainForPagination(renderer(), curr->renderBox()); |
- return; |
- } |
if (curr->stackingNode() == ancestorStackingContainerNode) |
return; |
} |
@@ -937,18 +895,6 @@ bool RenderLayer::updateLayerPosition() |
localPoint += offset; |
} |
} else if (parent()) { |
- if (hasCompositedLayerMapping()) { |
- // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. |
- // They won't split across columns properly. |
- LayoutSize columnOffset; |
- if (!parent()->renderer()->hasColumns() && parent()->renderer()->isRoot() && renderer()->view()->hasColumns()) |
- renderer()->view()->adjustForColumns(columnOffset, localPoint); |
- else |
- parent()->renderer()->adjustForColumns(columnOffset, localPoint); |
- |
- localPoint += columnOffset; |
- } |
- |
if (parent()->renderer()->hasOverflowClip()) { |
IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset(); |
localPoint -= scrollOffset; |
@@ -2149,10 +2095,7 @@ void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte |
if (childLayer->compositingState() == PaintsIntoGroupedBacking) |
continue; |
- if (!childLayer->isPaginated()) |
- childLayer->paintLayer(context, paintingInfo, paintFlags); |
- else |
- paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFlags); |
+ childLayer->paintLayer(context, paintingInfo, paintFlags); |
} |
} |
@@ -2441,123 +2384,6 @@ void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF |
} |
} |
-void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
-{ |
- // We need to do multiple passes, breaking up our child layer into strips. |
- Vector<RenderLayer*> columnLayers; |
- RenderLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContainerNode(); |
- for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) { |
- if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagination(childLayer->renderer(), curr->renderBox())) |
- columnLayers.append(curr); |
- if (curr->stackingNode() == ancestorNode) |
- break; |
- } |
- |
- // It is possible for paintLayer() to be called after the child layer ceases to be paginated but before |
- // updateLayerPositions() is called and resets the isPaginated() flag, see <rdar://problem/10098679>. |
- // If this is the case, just bail out, since the upcoming call to updateLayerPositions() will repaint the layer. |
- if (!columnLayers.size()) |
- return; |
- |
- paintChildLayerIntoColumns(childLayer, context, paintingInfo, paintFlags, columnLayers, columnLayers.size() - 1); |
-} |
- |
-void RenderLayer::paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsContext* context, const LayerPaintingInfo& paintingInfo, |
- PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t colIndex) |
-{ |
- RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer()); |
- |
- ASSERT(columnBlock && columnBlock->hasColumns()); |
- if (!columnBlock || !columnBlock->hasColumns()) |
- return; |
- |
- LayoutPoint layerOffset; |
- // FIXME: It looks suspicious to call convertToLayerCoords here |
- // as canUseConvertToLayerCoords is true for this layer. |
- columnBlock->layer()->convertToLayerCoords(paintingInfo.rootLayer, layerOffset); |
- |
- bool isHorizontal = columnBlock->style()->isHorizontalWritingMode(); |
- |
- ColumnInfo* colInfo = columnBlock->columnInfo(); |
- unsigned colCount = columnBlock->columnCount(colInfo); |
- LayoutUnit currLogicalTopOffset = 0; |
- for (unsigned i = 0; i < colCount; i++) { |
- // For each rect, we clip to the rect, and then we adjust our coords. |
- LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); |
- columnBlock->flipForWritingMode(colRect); |
- LayoutUnit logicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - columnBlock->logicalLeftOffsetForContent(); |
- LayoutSize offset; |
- if (isHorizontal) { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- offset = LayoutSize(logicalLeftOffset, currLogicalTopOffset); |
- else |
- offset = LayoutSize(0, colRect.y() + currLogicalTopOffset - columnBlock->borderTop() - columnBlock->paddingTop()); |
- } else { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- offset = LayoutSize(currLogicalTopOffset, logicalLeftOffset); |
- else |
- offset = LayoutSize(colRect.x() + currLogicalTopOffset - columnBlock->borderLeft() - columnBlock->paddingLeft(), 0); |
- } |
- |
- colRect.moveBy(layerOffset); |
- |
- LayoutRect localDirtyRect(paintingInfo.paintDirtyRect); |
- localDirtyRect.intersect(colRect); |
- |
- if (!localDirtyRect.isEmpty()) { |
- GraphicsContextStateSaver stateSaver(*context); |
- |
- // Each strip pushes a clip, since column boxes are specified as being |
- // like overflow:hidden. |
- context->clip(pixelSnappedIntRect(colRect)); |
- |
- if (!colIndex) { |
- // Apply a translation transform to change where the layer paints. |
- TransformationMatrix oldTransform; |
- bool oldHasTransform = childLayer->transform(); |
- if (oldHasTransform) |
- oldTransform = *childLayer->transform(); |
- TransformationMatrix newTransform(oldTransform); |
- newTransform.translateRight(roundToInt(offset.width()), roundToInt(offset.height())); |
- |
- childLayer->m_transform = adoptPtr(new TransformationMatrix(newTransform)); |
- |
- LayerPaintingInfo localPaintingInfo(paintingInfo); |
- localPaintingInfo.paintDirtyRect = localDirtyRect; |
- childLayer->paintLayer(context, localPaintingInfo, paintFlags); |
- |
- if (oldHasTransform) |
- childLayer->m_transform = adoptPtr(new TransformationMatrix(oldTransform)); |
- else |
- childLayer->m_transform.clear(); |
- } else { |
- // Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space. |
- // This involves subtracting out the position of the layer in our current coordinate space. |
- LayoutPoint childOffset; |
- columnLayers[colIndex - 1]->convertToLayerCoords(paintingInfo.rootLayer, childOffset); |
- TransformationMatrix transform; |
- transform.translateRight(roundToInt(childOffset.x() + offset.width()), roundToInt(childOffset.y() + offset.height())); |
- |
- // Apply the transform. |
- context->concatCTM(transform.toAffineTransform()); |
- |
- // Now do a paint with the root layer shifted to be the next multicol block. |
- LayerPaintingInfo columnPaintingInfo(paintingInfo); |
- columnPaintingInfo.rootLayer = columnLayers[colIndex - 1]; |
- columnPaintingInfo.paintDirtyRect = transform.inverse().mapRect(localDirtyRect); |
- paintChildLayerIntoColumns(childLayer, context, columnPaintingInfo, paintFlags, columnLayers, colIndex - 1); |
- } |
- } |
- |
- // Move to the next position. |
- LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width(); |
- if (columnBlock->style()->isFlippedBlocksWritingMode()) |
- currLogicalTopOffset += blockDelta; |
- else |
- currLogicalTopOffset -= blockDelta; |
- } |
-} |
- |
static inline LayoutRect frameVisibleRect(RenderObject* renderer) |
{ |
FrameView* frameView = renderer->document().view(); |
@@ -2999,12 +2825,8 @@ RenderLayer* RenderLayer::hitTestChildren(ChildrenIteration childrentoVisit, Ren |
RenderLayerStackingNodeReverseIterator iterator(*m_stackingNode, childrentoVisit); |
while (RenderLayerStackingNode* child = iterator.next()) { |
RenderLayer* childLayer = child->layer(); |
- RenderLayer* hitLayer = 0; |
HitTestResult tempResult(result.hitTestLocation()); |
- if (childLayer->isPaginated()) |
- hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestLocation, transformState, zOffsetForDescendants); |
- else |
- hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants); |
+ RenderLayer* hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants); |
// If it a rect-based test, we can safely append the temporary result since it might had hit |
// nodes but not necesserily had hitLayer set. |
@@ -3023,126 +2845,6 @@ RenderLayer* RenderLayer::hitTestChildren(ChildrenIteration childrentoVisit, Ren |
return resultLayer; |
} |
-RenderLayer* RenderLayer::hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, |
- const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) |
-{ |
- Vector<RenderLayer*> columnLayers; |
- RenderLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContainerNode(); |
- for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) { |
- if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagination(childLayer->renderer(), curr->renderBox())) |
- columnLayers.append(curr); |
- if (curr->stackingNode() == ancestorNode) |
- break; |
- } |
- |
- ASSERT(columnLayers.size()); |
- return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitTestRect, hitTestLocation, transformState, zOffset, |
- columnLayers, columnLayers.size() - 1); |
-} |
- |
-RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, |
- const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset, |
- const Vector<RenderLayer*>& columnLayers, size_t columnIndex) |
-{ |
- RenderBlock* columnBlock = toRenderBlock(columnLayers[columnIndex]->renderer()); |
- |
- ASSERT(columnBlock && columnBlock->hasColumns()); |
- if (!columnBlock || !columnBlock->hasColumns()) |
- return 0; |
- |
- LayoutPoint layerOffset; |
- columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset); |
- |
- ColumnInfo* colInfo = columnBlock->columnInfo(); |
- int colCount = columnBlock->columnCount(colInfo); |
- |
- // We have to go backwards from the last column to the first. |
- bool isHorizontal = columnBlock->style()->isHorizontalWritingMode(); |
- LayoutUnit logicalLeft = columnBlock->logicalLeftOffsetForContent(); |
- LayoutUnit currLogicalTopOffset = 0; |
- int i; |
- for (i = 0; i < colCount; i++) { |
- LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); |
- LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.width()); |
- if (columnBlock->style()->isFlippedBlocksWritingMode()) |
- currLogicalTopOffset += blockDelta; |
- else |
- currLogicalTopOffset -= blockDelta; |
- } |
- for (i = colCount - 1; i >= 0; i--) { |
- // For each rect, we clip to the rect, and then we adjust our coords. |
- LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); |
- columnBlock->flipForWritingMode(colRect); |
- LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft; |
- LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.width()); |
- if (columnBlock->style()->isFlippedBlocksWritingMode()) |
- currLogicalTopOffset -= blockDelta; |
- else |
- currLogicalTopOffset += blockDelta; |
- |
- LayoutSize offset; |
- if (isHorizontal) { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- offset = LayoutSize(currLogicalLeftOffset, currLogicalTopOffset); |
- else |
- offset = LayoutSize(0, colRect.y() + currLogicalTopOffset - columnBlock->borderTop() - columnBlock->paddingTop()); |
- } else { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- offset = LayoutSize(currLogicalTopOffset, currLogicalLeftOffset); |
- else |
- offset = LayoutSize(colRect.x() + currLogicalTopOffset - columnBlock->borderLeft() - columnBlock->paddingLeft(), 0); |
- } |
- |
- colRect.moveBy(layerOffset); |
- |
- LayoutRect localClipRect(hitTestRect); |
- localClipRect.intersect(colRect); |
- |
- if (!localClipRect.isEmpty() && hitTestLocation.intersects(localClipRect)) { |
- RenderLayer* hitLayer = 0; |
- if (!columnIndex) { |
- // Apply a translation transform to change where the layer paints. |
- TransformationMatrix oldTransform; |
- bool oldHasTransform = childLayer->transform(); |
- if (oldHasTransform) |
- oldTransform = *childLayer->transform(); |
- TransformationMatrix newTransform(oldTransform); |
- newTransform.translateRight(offset.width(), offset.height()); |
- |
- childLayer->m_transform = adoptPtr(new TransformationMatrix(newTransform)); |
- hitLayer = childLayer->hitTestLayer(rootLayer, columnLayers[0], request, result, localClipRect, hitTestLocation, false, transformState, zOffset); |
- if (oldHasTransform) |
- childLayer->m_transform = adoptPtr(new TransformationMatrix(oldTransform)); |
- else |
- childLayer->m_transform.clear(); |
- } else { |
- // Adjust the transform such that the renderer's upper left corner will be at (0,0) in user space. |
- // This involves subtracting out the position of the layer in our current coordinate space. |
- RenderLayer* nextLayer = columnLayers[columnIndex - 1]; |
- RefPtr<HitTestingTransformState> newTransformState = nextLayer->createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestLocation, transformState); |
- newTransformState->translate(offset.width(), offset.height(), HitTestingTransformState::AccumulateTransform); |
- FloatPoint localPoint = newTransformState->mappedPoint(); |
- FloatQuad localPointQuad = newTransformState->mappedQuad(); |
- LayoutRect localHitTestRect = newTransformState->mappedArea().enclosingBoundingBox(); |
- HitTestLocation newHitTestLocation; |
- if (hitTestLocation.isRectBasedTest()) |
- newHitTestLocation = HitTestLocation(localPoint, localPointQuad); |
- else |
- newHitTestLocation = HitTestLocation(localPoint); |
- newTransformState->flatten(); |
- |
- hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[columnIndex - 1], request, result, localHitTestRect, newHitTestLocation, |
- newTransformState.get(), zOffset, columnLayers, columnIndex - 1); |
- } |
- |
- if (hitLayer) |
- return hitLayer; |
- } |
- } |
- |
- return 0; |
-} |
- |
void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) |
{ |
m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); |