Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
| index f7fefe576aff17d0c7013f36525d5b7ed36552cc..8a811d86a8beb6b95221eb7f13bd1567ea5ce816 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
| @@ -1192,12 +1192,6 @@ static PassOwnPtr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRe |
| return value.release(); |
| } |
| -LayoutRect LayoutObject::computePaintInvalidationRect(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const |
| -{ |
| - return clippedOverflowRectForPaintInvalidation(&paintInvalidationContainer, paintInvalidationState); |
| -} |
| - |
| - |
| static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintInvalidationContainer, const IntRect& dirtyRect) |
| { |
| FrameView* frameView = paintInvalidationContainer.frameView(); |
| @@ -1295,11 +1289,6 @@ void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const |
| invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason); |
| } |
| -LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const |
| -{ |
| - return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationContainer.layer(), paintInvalidationState); |
| -} |
| - |
| const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const |
| { |
| RELEASE_ASSERT(isRooted()); |
| @@ -1312,7 +1301,7 @@ const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const |
| const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidation(); |
| LayoutRect dirtyRectOnBacking = dirtyRect; |
| - PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRectOnBacking); |
| + PaintLayer::mapRectToPaintInvalidationBacking(*this, paintInvalidationContainer, dirtyRectOnBacking); |
| invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking, PaintInvalidationRectangle); |
| return &paintInvalidationContainer; |
| } |
| @@ -1340,12 +1329,14 @@ void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv |
| if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
| return; |
| - PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationState); |
| - clearPaintInvalidationFlags(paintInvalidationState); |
| + PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *this); |
| + PaintInvalidationReason reason = invalidatePaintIfNeeded(newPaintInvalidationState); |
| + clearPaintInvalidationFlags(newPaintInvalidationState); |
| if (reason == PaintInvalidationDelayedFull) |
| - paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); |
| + newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this); |
| + newPaintInvalidationState.updateForChildren(); |
| invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); |
| } |
| @@ -1369,7 +1360,10 @@ static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old |
| LayoutRect LayoutObject::selectionRectInViewCoordinates() const |
| { |
| - return selectionRectForPaintInvalidation(view()); |
|
chrishtr
2016/03/24 00:53:52
Delete the selectionRectForPaintInvalidation() fun
Xianzhu
2016/03/25 16:35:54
Already deleted. (Actually, renamed to localSelect
|
| + LayoutRect selectionRect = localSelectionRect(); |
| + if (!selectionRect.isEmpty()) |
| + mapToVisibleRectInAncestorSpace(view(), selectionRect); |
| + return selectionRect; |
| } |
| LayoutRect LayoutObject::previousSelectionRectForPaintInvalidation() const |
| @@ -1404,13 +1398,16 @@ inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject |
| return; |
| LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); |
| - LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvalidationContainer); |
| - |
| - // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller |
| - // does not move on scroll. |
| - if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidationContainer != this) { |
| - LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset()); |
| - newSelectionRect.move(inverseOffset); |
| + LayoutRect newSelectionRect = localSelectionRect(); |
| + if (!newSelectionRect.isEmpty()) { |
|
chrishtr
2016/03/24 00:53:52
Make mapLocalRectToPaintInvalidationBacking() earl
Xianzhu
2016/03/25 16:35:54
I tried that but it broke some cases because somet
|
| + paintInvalidationState.mapLocalRectToPaintInvalidationBacking(newSelectionRect); |
| + |
| + // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller |
| + // does not move on scroll. |
| + if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidationContainer != this) { |
| + LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset()); |
| + newSelectionRect.move(inverseOffset); |
| + } |
| } |
| setPreviousSelectionRectForPaintInvalidation(newSelectionRect); |
| @@ -1426,6 +1423,8 @@ inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject |
| PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState) |
| { |
| + ASSERT(&paintInvalidationState.currentObject() == this); |
| + |
| if (styleRef().hasOutline()) { |
| PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*this); |
| if (layer.layoutObject() != this) |
| @@ -1442,8 +1441,8 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid |
| const LayoutRect oldBounds = previousPaintInvalidationRect(); |
| const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); |
| - LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationContainer, &paintInvalidationState); |
| - LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(this, &paintInvalidationContainer, &paintInvalidationState); |
| + LayoutRect newBounds = paintInvalidationState.computePaintInvalidationRectInBacking(); |
| + LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() ? LayoutPoint() : paintInvalidationState.computePositionFromPaintInvalidationBacking(); |
| // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller |
| // does not move on scroll. |
| @@ -1629,25 +1628,22 @@ void LayoutObject::invalidatePaintForOverflowIfNeeded() |
| LayoutRect LayoutObject::absoluteClippedOverflowRect() const |
| { |
| - return clippedOverflowRectForPaintInvalidation(view()); |
| + LayoutRect rect = localOverflowRectForPaintInvalidation(); |
| + mapToVisibleRectInAncestorSpace(view(), rect); |
| + return rect; |
| } |
| -LayoutRect LayoutObject::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject*, const PaintInvalidationState*) const |
| +LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const |
| { |
| ASSERT_NOT_REACHED(); |
| return LayoutRect(); |
| } |
| -void LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) const |
| +void LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect) const |
| { |
| if (ancestor == this) |
| return; |
| - if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ancestor)) { |
| - paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect); |
| - return; |
| - } |
| - |
| if (LayoutObject* parent = this->parent()) { |
| if (parent->hasOverflowClip()) { |
| LayoutBox* parentBox = toLayoutBox(parent); |
| @@ -1658,7 +1654,7 @@ void LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a |
| return; |
| } |
| - parent->mapToVisibleRectInAncestorSpace(ancestor, rect, nullptr); |
| + parent->mapToVisibleRectInAncestorSpace(ancestor, rect); |
| } |
| } |
| @@ -2243,21 +2239,11 @@ FloatQuad LayoutObject::ancestorToLocalQuad(LayoutBoxModelObject* ancestor, cons |
| return transformState.lastPlanarQuad(); |
| } |
| -void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const |
| +void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
| { |
| if (ancestor == this) |
| return; |
| - if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ancestor)) { |
| - LayoutSize offset = paintInvalidationState->paintOffset(); |
| - if (const LayoutBox* layoutBox = isBox() ? toLayoutBox(this) : nullptr) |
| - offset += layoutBox->locationOffset(); |
| - if (const PaintLayer* layer = style()->hasInFlowPosition() && hasLayer() ? toLayoutBoxModelObject(this)->layer() : nullptr) |
| - offset += layer->offsetForInFlowPosition(); |
| - transformState.move(offset); |
| - return; |
| - } |
| - |
| if (wasFixed) |
| *wasFixed = mode & IsFixed; |
| @@ -2304,7 +2290,7 @@ void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran |
| return; |
| } |
| - o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed, paintInvalidationState); |
| + o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed); |
| } |
| const LayoutObject* LayoutObject::pushMappingToContainer(const LayoutBoxModelObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
| @@ -2403,10 +2389,10 @@ FloatQuad LayoutObject::localToAncestorQuad(const FloatQuad& localQuad, const La |
| return transformState.lastPlanarQuad(); |
| } |
| -FloatPoint LayoutObject::localToAncestorPoint(const FloatPoint& localPoint, const LayoutBoxModelObject* ancestor, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const |
| +FloatPoint LayoutObject::localToAncestorPoint(const FloatPoint& localPoint, const LayoutBoxModelObject* ancestor, MapCoordinatesFlags mode, bool* wasFixed) const |
| { |
| TransformState transformState(TransformState::ApplyTransformDirection, localPoint); |
| - mapLocalToAncestor(ancestor, transformState, mode | ApplyContainerFlip | UseTransforms, wasFixed, paintInvalidationState); |
| + mapLocalToAncestor(ancestor, transformState, mode | ApplyContainerFlip | UseTransforms, wasFixed); |
| transformState.flatten(); |
| return transformState.lastPlanarPoint(); |
| @@ -2449,7 +2435,7 @@ FloatPoint LayoutObject::localToInvalidationBackingPoint(const LayoutPoint& loca |
| if (paintInvalidationContainer.layer()->compositingState() == NotComposited) |
| return containerPoint; |
| - PaintLayer::mapPointToPaintBackingCoordinates(&paintInvalidationContainer, containerPoint); |
| + PaintLayer::mapPointInPaintInvalidationContainerToBacking(paintInvalidationContainer, containerPoint); |
| return containerPoint; |
| } |