Index: Source/core/paint/DeprecatedPaintLayer.cpp |
diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp |
index 29c0f4bca89cbee090098a58324a430b07e04553..cdfacd616dd76567e2cc20a6f0b71eb7f7561c22 100644 |
--- a/Source/core/paint/DeprecatedPaintLayer.cpp |
+++ b/Source/core/paint/DeprecatedPaintLayer.cpp |
@@ -709,6 +709,19 @@ bool DeprecatedPaintLayer::update3DTransformedDescendantStatus() |
return has3DTransform(); |
} |
+LayoutPoint DeprecatedPaintLayer::locationExcludeOverflowScroll() const |
+{ |
+ // Our m_location already has scroll offset baked-in. We have to revert it here. |
+ IntSize scrollOffset; |
+ if (DeprecatedPaintLayer* positionedParent = layoutObject()->isOutOfFlowPositioned() ? enclosingPositionedAncestor() : nullptr) { |
+ if (positionedParent->layoutObject()->hasOverflowClip()) |
+ scrollOffset = positionedParent->layoutBox()->scrolledContentOffset(); |
+ } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { |
+ scrollOffset = parent()->layoutBox()->scrolledContentOffset(); |
+ } |
+ return m_location + LayoutSize(scrollOffset); |
+} |
+ |
bool DeprecatedPaintLayer::updateLayerPosition() |
{ |
LayoutPoint localPoint; |
@@ -1242,7 +1255,7 @@ void DeprecatedPaintLayer::insertOnlyThisLayer() |
} |
// Returns the layer reached on the walk up towards the ancestor. |
-static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location) |
+static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location, DeprecatedPaintLayer::LocationQueryBehavior behavior) |
{ |
ASSERT(ancestorLayer != layer); |
@@ -1267,10 +1280,10 @@ static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const |
// of both relative to the container and subtract. |
LayoutPoint thisCoords; |
- layer->convertToLayerCoords(parentLayer, thisCoords); |
+ layer->convertToLayerCoords(parentLayer, thisCoords, behavior); |
LayoutPoint ancestorCoords; |
- ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); |
+ ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords, behavior); |
location += (thisCoords - ancestorCoords); |
return ancestorLayer; |
@@ -1287,18 +1300,18 @@ static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const |
if (!parentLayer) |
return nullptr; |
- location += layer->location(); |
+ location += layer->location(behavior); |
return parentLayer; |
} |
-void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location) const |
+void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location, LocationQueryBehavior behavior) const |
{ |
if (ancestorLayer == this) |
return; |
const DeprecatedPaintLayer* currLayer = this; |
while (currLayer && currLayer != ancestorLayer) |
- currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, location); |
+ currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, location, behavior); |
} |
void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutRect& rect) const |
@@ -1414,7 +1427,7 @@ void DeprecatedPaintLayer::collectFragments(DeprecatedPaintLayerFragments& fragm |
outlineRectInFlowThread, &offsetWithinPaginatedLayer); |
// Take our bounding box within the flow thread and clip it. |
- LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer); |
+ LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : physicalBoundingBox(nullptr, &offsetWithinPaginatedLayer); |
layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); |
// Make the dirty rect relative to the fragmentation context (multicol container, etc.). |
@@ -2036,6 +2049,7 @@ bool DeprecatedPaintLayer::hasBlockSelectionGapBounds() const |
bool DeprecatedPaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const DeprecatedPaintLayer* rootLayer, const LayoutPoint* offsetFromRoot) const |
{ |
+ ASSERT(!(rootLayer && offsetFromRoot)); |
// Always examine the canvas and the root. |
// FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView |
// paints the root's background. |
@@ -2104,6 +2118,7 @@ static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Layou |
LayoutRect DeprecatedPaintLayer::physicalBoundingBox(const DeprecatedPaintLayer* ancestorLayer, const LayoutPoint* offsetFromRoot) const |
pdr.
2015/09/03 06:16:59
Can we just switch this to two functions?
LayoutR
trchen
2015/09/04 06:10:14
Done.
|
{ |
+ ASSERT(!(ancestorLayer && offsetFromRoot)); |
LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutObject()); |
if (offsetFromRoot) |
result.moveBy(*offsetFromRoot); |
@@ -2153,10 +2168,10 @@ static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLaye |
} |
} |
-LayoutRect DeprecatedPaintLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren(const DeprecatedPaintLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const |
+LayoutRect DeprecatedPaintLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren(const LayoutPoint& offsetFromRoot) const |
{ |
LayoutPoint origin; |
- LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); |
+ LayoutRect result = physicalBoundingBox(nullptr, &origin); |
const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
@@ -2192,7 +2207,7 @@ LayoutRect DeprecatedPaintLayer::boundingBoxForCompositing(const DeprecatedPaint |
// TODO(chrishtr): avoid converting to IntRect and back. |
if (result == LayoutRect(LayoutRect::infiniteIntRect())) { |
LayoutPoint origin; |
- result = physicalBoundingBox(ancestorLayer, &origin); |
+ result = physicalBoundingBox(nullptr, &origin); |
const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
@@ -2335,6 +2350,9 @@ bool DeprecatedPaintLayer::hasCompositedClippingMask() const |
bool DeprecatedPaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const |
{ |
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
+ return hasTransformRelatedProperty(); |
+ |
return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingState() != PaintsIntoOwnBacking); |
} |