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 29 matching lines...) Expand all Loading... |
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 | 49 |
| 50 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 51 // In SPv2, visual rects are in the space of their local transform node. |
| 52 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 53 return LayoutRect(rect); |
| 54 } |
| 55 |
50 LayoutRect result; | 56 LayoutRect result; |
51 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced
SubtreeSlowPathRect) { | 57 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced
SubtreeSlowPathRect) { |
52 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali
dationContainer, rect); | 58 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali
dationContainer, rect); |
53 } else if (object == context.paintInvalidationContainer) { | 59 } else if (object == context.paintInvalidationContainer) { |
54 result = LayoutRect(rect); | 60 result = LayoutRect(rect); |
55 } else { | 61 } else { |
| 62 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 63 |
56 GeometryPropertyTreeState currentTreeState(context.treeBuilderContext.cu
rrent.transform, context.treeBuilderContext.current.clip, context.treeBuilderCon
text.currentEffect); | 64 GeometryPropertyTreeState currentTreeState(context.treeBuilderContext.cu
rrent.transform, context.treeBuilderContext.current.clip, context.treeBuilderCon
text.currentEffect); |
57 GeometryPropertyTreeState containerTreeState; | 65 GeometryPropertyTreeState containerTreeState; |
58 const ObjectPaintProperties* containerPaintProperties = context.paintInv
alidationContainer->objectPaintProperties(); | 66 const ObjectPaintProperties* containerPaintProperties = context.paintInv
alidationContainer->objectPaintProperties(); |
59 containerPaintProperties->getContentsProperties(containerTreeState); | 67 containerPaintProperties->getContentsProperties(containerTreeState); |
60 | 68 |
61 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | |
62 bool success = false; | 69 bool success = false; |
63 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace(rec
t, currentTreeState, containerTreeState, success)); | 70 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace(rec
t, currentTreeState, containerTreeState, success)); |
64 DCHECK(success); | 71 DCHECK(success); |
65 result.moveBy(-containerPaintProperties->localBorderBoxProperties()->pai
ntOffset); | 72 result.moveBy(-containerPaintProperties->localBorderBoxProperties()->pai
ntOffset); |
66 } | 73 } |
67 | 74 |
68 if (context.paintInvalidationContainer->layer()->groupedMapping()) | 75 if (context.paintInvalidationContainer->layer()->groupedMapping()) |
69 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*context.paintI
nvalidationContainer, result); | 76 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*context.paintI
nvalidationContainer, result); |
70 return result; | 77 return result; |
71 } | 78 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 object.getMutableForPainting().clearPaintInvalidationFlags(); | 305 object.getMutableForPainting().clearPaintInvalidationFlags(); |
299 } | 306 } |
300 | 307 |
301 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 308 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
302 { | 309 { |
303 for (auto target : m_pendingDelayedPaintInvalidations) | 310 for (auto target : m_pendingDelayedPaintInvalidations) |
304 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); | 311 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); |
305 } | 312 } |
306 | 313 |
307 } // namespace blink | 314 } // namespace blink |
OLD | NEW |