| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintInvalidator.h" | 5 #include "core/paint/PaintInvalidator.h" |
| 6 | 6 |
| 7 #include "core/editing/FrameSelection.h" | 7 #include "core/editing/FrameSelection.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 // TODO(wangxianzhu): Combine this into PaintInvalidator::mapLocalRectToPaintInv
alidationBacking() when removing PaintInvalidationState. | 39 // TODO(wangxianzhu): Combine this into PaintInvalidator::mapLocalRectToPaintInv
alidationBacking() when removing PaintInvalidationState. |
| 40 static LayoutRect mapLocalRectToPaintInvalidationBacking(GeometryMapper& geometr
yMapper, const LayoutObject& object, const FloatRect& localRect, const PaintInva
lidatorContext& context) | 40 static LayoutRect mapLocalRectToPaintInvalidationBacking(GeometryMapper& geometr
yMapper, const LayoutObject& object, const FloatRect& localRect, const PaintInva
lidatorContext& context) |
| 41 { | 41 { |
| 42 // TODO(wkorman): The flip below is required because visual rects are | 42 // TODO(wkorman): The flip below is required because visual rects are |
| 43 // currently in "physical coordinates with flipped block-flow direction" | 43 // currently in "physical coordinates with flipped block-flow direction" |
| 44 // (see LayoutBoxModelObject.h) but we need them to be in physical | 44 // (see LayoutBoxModelObject.h) but we need them to be in physical |
| 45 // coordinates. | 45 // coordinates. |
| 46 FloatRect rect = localRect; | 46 FloatRect rect = localRect; |
| 47 if (object.isBox()) | 47 if (object.isBox()) { |
| 48 toLayoutBox(object).flipForWritingMode(rect); | 48 toLayoutBox(object).flipForWritingMode(rect); |
| 49 } else if (!(context.forcedSubtreeInvalidationFlags & PaintInvalidatorContex
t::ForcedSubtreeSlowPathRect)) { |
| 50 // For SPv2 and the GeometryMapper path, we also need to convert the rec
t |
| 51 // for non-boxes into physical coordinates before applying paint offset. |
| 52 // (Otherwise we'll call mapToVisualrectInAncestorSpace() which requires |
| 53 // physical coordinates for boxes, but "physical coordinates with flippe
d |
| 54 // block-flow direction" for non-boxes for which we don't need to flip.) |
| 55 // TODO(wangxianzhu): Avoid containingBlock(). |
| 56 object.containingBlock()->flipForWritingMode(rect); |
| 57 } |
| 49 | 58 |
| 50 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 59 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 51 // In SPv2, visual rects are in the space of their local transform node. | 60 // In SPv2, visual rects are in the space of their local transform node. |
| 52 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 61 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 53 return LayoutRect(rect); | 62 return LayoutRect(rect); |
| 54 } | 63 } |
| 55 | 64 |
| 56 LayoutRect result; | 65 LayoutRect result; |
| 57 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced
SubtreeSlowPathRect) { | 66 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced
SubtreeSlowPathRect) { |
| 58 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali
dationContainer, rect); | 67 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali
dationContainer, rect); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 192 } |
| 184 | 193 |
| 185 DCHECK(context.paintInvalidationContainer == object.containerForPaintInvalid
ation()); | 194 DCHECK(context.paintInvalidationContainer == object.containerForPaintInvalid
ation()); |
| 186 DCHECK(context.paintingLayer == object.paintingLayer()); | 195 DCHECK(context.paintingLayer == object.paintingLayer()); |
| 187 | 196 |
| 188 if (object.mayNeedPaintInvalidationSubtree()) | 197 if (object.mayNeedPaintInvalidationSubtree()) |
| 189 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force
dSubtreeInvalidationChecking; | 198 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force
dSubtreeInvalidationChecking; |
| 190 | 199 |
| 191 // TODO(crbug.com/637313): This is temporary before we support filters in pa
int property tree. | 200 // TODO(crbug.com/637313): This is temporary before we support filters in pa
int property tree. |
| 192 // TODO(crbug.com/648274): This is a workaround for multi-column contents. | 201 // TODO(crbug.com/648274): This is a workaround for multi-column contents. |
| 193 // TODO(crbug.com/648409): This is a workaround for inline contents in verti
cal-rl container. | 202 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread()) |
| 194 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread() || obj
ect.hasFlippedBlocksWritingMode()) | |
| 195 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force
dSubtreeSlowPathRect; | 203 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force
dSubtreeSlowPathRect; |
| 196 | 204 |
| 197 context.oldBounds = object.previousPaintInvalidationRect(); | 205 context.oldBounds = object.previousPaintInvalidationRect(); |
| 198 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); | 206 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); |
| 199 context.newBounds = computePaintInvalidationRectInBacking(object, context); | 207 context.newBounds = computePaintInvalidationRectInBacking(object, context); |
| 200 context.newLocation = computeLocationFromPaintInvalidationBacking(object, co
ntext); | 208 context.newLocation = computeLocationFromPaintInvalidationBacking(object, co
ntext); |
| 201 | 209 |
| 202 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(*context.pa
intInvalidationContainer); | 210 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(*context.pa
intInvalidationContainer); |
| 203 context.newLocation.move(adjustment); | 211 context.newLocation.move(adjustment); |
| 204 context.newBounds.move(adjustment); | 212 context.newBounds.move(adjustment); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 object.getMutableForPainting().clearPaintInvalidationFlags(); | 313 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 306 } | 314 } |
| 307 | 315 |
| 308 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 316 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 309 { | 317 { |
| 310 for (auto target : m_pendingDelayedPaintInvalidations) | 318 for (auto target : m_pendingDelayedPaintInvalidations) |
| 311 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); | 319 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); |
| 312 } | 320 } |
| 313 | 321 |
| 314 } // namespace blink | 322 } // namespace blink |
| OLD | NEW |