Chromium Code Reviews| 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 need to convert the rect int o physical coordinates | |
| 51 // before applying paint offset. TODO(wangxianzhu): Avoid containingBloc k(). | |
|
chrishtr
2016/09/27 21:12:44
Add a sentence explicitly saying that mapToVisualR
Xianzhu
2016/09/27 21:30:40
Done.
| |
| 52 object.containingBlock()->flipForWritingMode(rect); | |
| 53 } | |
| 49 | 54 |
| 50 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 55 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 51 // In SPv2, visual rects are in the space of their local transform node. | 56 // In SPv2, visual rects are in the space of their local transform node. |
| 52 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 57 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 53 return LayoutRect(rect); | 58 return LayoutRect(rect); |
| 54 } | 59 } |
| 55 | 60 |
| 56 LayoutRect result; | 61 LayoutRect result; |
| 57 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced SubtreeSlowPathRect) { | 62 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced SubtreeSlowPathRect) { |
| 58 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali dationContainer, rect); | 63 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali dationContainer, rect); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 } | 188 } |
| 184 | 189 |
| 185 DCHECK(context.paintInvalidationContainer == object.containerForPaintInvalid ation()); | 190 DCHECK(context.paintInvalidationContainer == object.containerForPaintInvalid ation()); |
| 186 DCHECK(context.paintingLayer == object.paintingLayer()); | 191 DCHECK(context.paintingLayer == object.paintingLayer()); |
| 187 | 192 |
| 188 if (object.mayNeedPaintInvalidationSubtree()) | 193 if (object.mayNeedPaintInvalidationSubtree()) |
| 189 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeInvalidationChecking; | 194 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeInvalidationChecking; |
| 190 | 195 |
| 191 // TODO(crbug.com/637313): This is temporary before we support filters in pa int property tree. | 196 // 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. | 197 // 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. | 198 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread()) |
| 194 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread() || obj ect.hasFlippedBlocksWritingMode()) | |
| 195 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeSlowPathRect; | 199 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeSlowPathRect; |
| 196 | 200 |
| 197 context.oldBounds = object.previousPaintInvalidationRect(); | 201 context.oldBounds = object.previousPaintInvalidationRect(); |
| 198 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); | 202 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); |
| 199 context.newBounds = computePaintInvalidationRectInBacking(object, context); | 203 context.newBounds = computePaintInvalidationRectInBacking(object, context); |
| 200 context.newLocation = computeLocationFromPaintInvalidationBacking(object, co ntext); | 204 context.newLocation = computeLocationFromPaintInvalidationBacking(object, co ntext); |
| 201 | 205 |
| 202 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(*context.pa intInvalidationContainer); | 206 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(*context.pa intInvalidationContainer); |
| 203 context.newLocation.move(adjustment); | 207 context.newLocation.move(adjustment); |
| 204 context.newBounds.move(adjustment); | 208 context.newBounds.move(adjustment); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 object.getMutableForPainting().clearPaintInvalidationFlags(); | 309 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 306 } | 310 } |
| 307 | 311 |
| 308 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 312 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 309 { | 313 { |
| 310 for (auto target : m_pendingDelayedPaintInvalidations) | 314 for (auto target : m_pendingDelayedPaintInvalidations) |
| 311 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn validationDelayedFull); | 315 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn validationDelayedFull); |
| 312 } | 316 } |
| 313 | 317 |
| 314 } // namespace blink | 318 } // namespace blink |
| OLD | NEW |