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 // For non-root SVG, localRect is already in physical coordinates. |
| 48 toLayoutBox(object).flipForWritingMode(rect); | 48 if (!object.isSVG() || object.isSVGRoot()) { |
|
chrishtr
2016/09/29 16:41:59
Can you point me to the equivalent SPv1 code?
Xianzhu
2016/09/29 17:00:55
https://cs.chromium.org/chromium/src/third_party/W
| |
| 49 } else if (!(context.forcedSubtreeInvalidationFlags & PaintInvalidatorContex t::ForcedSubtreeSlowPathRect)) { | 49 if (object.isBox()) { |
| 50 // For SPv2 and the GeometryMapper path, we also need to convert the rec t | 50 toLayoutBox(object).flipForWritingMode(rect); |
| 51 // for non-boxes into physical coordinates before applying paint offset. | 51 } else if (!(context.forcedSubtreeInvalidationFlags & PaintInvalidatorCo ntext::ForcedSubtreeSlowPathRect)) { |
| 52 // (Otherwise we'll call mapToVisualrectInAncestorSpace() which requires | 52 // For SPv2 and the GeometryMapper path, we also need to convert the rect |
| 53 // physical coordinates for boxes, but "physical coordinates with flippe d | 53 // for non-boxes into physical coordinates before applying paint off set. |
| 54 // block-flow direction" for non-boxes for which we don't need to flip.) | 54 // (Otherwise we'll call mapToVisualrectInAncestorSpace() which requ ires |
| 55 // TODO(wangxianzhu): Avoid containingBlock(). | 55 // physical coordinates for boxes, but "physical coordinates with fl ipped |
| 56 object.containingBlock()->flipForWritingMode(rect); | 56 // block-flow direction" for non-boxes for which we don't need to fl ip.) |
| 57 // TODO(wangxianzhu): Avoid containingBlock(). | |
| 58 object.containingBlock()->flipForWritingMode(rect); | |
| 59 } | |
| 57 } | 60 } |
| 58 | 61 |
| 59 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 62 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 60 // In SPv2, visual rects are in the space of their local transform node. | 63 // In SPv2, visual rects are in the space of their local transform node. |
| 61 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 64 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 62 return LayoutRect(rect); | 65 return LayoutRect(rect); |
| 63 } | 66 } |
| 64 | 67 |
| 65 LayoutRect result; | 68 LayoutRect result; |
| 66 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced SubtreeSlowPathRect) { | 69 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced SubtreeSlowPathRect) { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 object.getMutableForPainting().clearPaintInvalidationFlags(); | 316 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 314 } | 317 } |
| 315 | 318 |
| 316 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 319 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 317 { | 320 { |
| 318 for (auto target : m_pendingDelayedPaintInvalidations) | 321 for (auto target : m_pendingDelayedPaintInvalidations) |
| 319 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn validationDelayedFull); | 322 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn validationDelayedFull); |
| 320 } | 323 } |
| 321 | 324 |
| 322 } // namespace blink | 325 } // namespace blink |
| OLD | NEW |