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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 // (Otherwise we'll call mapToVisualrectInAncestorSpace() which requires | 64 // (Otherwise we'll call mapToVisualrectInAncestorSpace() which requires |
| 65 // physical coordinates for boxes, but "physical coordinates with flipped | 65 // physical coordinates for boxes, but "physical coordinates with flipped |
| 66 // block-flow direction" for non-boxes for which we don't need to flip.) | 66 // block-flow direction" for non-boxes for which we don't need to flip.) |
| 67 // TODO(wangxianzhu): Avoid containingBlock(). | 67 // TODO(wangxianzhu): Avoid containingBlock(). |
| 68 object.containingBlock()->flipForWritingMode(rect); | 68 object.containingBlock()->flipForWritingMode(rect); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 72 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 73 // In SPv2, visual rects are in the space of their local transform node. | 73 // In SPv2, visual rects are in the space of their local transform node. |
| 74 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 74 // For SVG, the input rect is in local SVG coordinates in which paint |
| 75 // offset doesn't apply. | |
| 76 if (object.isSVG() && !object.isSVGRoot()) | |
| 77 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | |
| 75 // Use enclosingIntRect to ensure the final visual rect will cover the | 78 // Use enclosingIntRect to ensure the final visual rect will cover the |
| 76 // rect in source coordinates no matter if the painting will use pixel | 79 // rect in source coordinates no matter if the painting will use pixel |
| 77 // snapping. | 80 // snapping. |
| 78 return LayoutRect(enclosingIntRect(rect)); | 81 return LayoutRect(enclosingIntRect(rect)); |
| 79 } | 82 } |
| 80 | 83 |
| 81 LayoutRect result; | 84 LayoutRect result; |
| 82 if (context.forcedSubtreeInvalidationFlags & | 85 if (context.forcedSubtreeInvalidationFlags & |
| 83 PaintInvalidatorContext::ForcedSubtreeSlowPathRect) { | 86 PaintInvalidatorContext::ForcedSubtreeSlowPathRect) { |
| 84 result = slowMapToVisualRectInAncestorSpace( | 87 result = slowMapToVisualRectInAncestorSpace( |
| 85 object, *context.paintInvalidationContainer, rect); | 88 object, *context.paintInvalidationContainer, rect); |
| 86 } else if (object == context.paintInvalidationContainer) { | 89 } else if (object == context.paintInvalidationContainer) { |
| 87 result = LayoutRect(rect); | 90 result = LayoutRect(rect); |
| 88 } else { | 91 } else { |
| 89 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 92 // For non-root SVG, the input rect is in local SVG coordinates in which |
| 90 if ((!object.isSVG() || object.isSVGRoot()) && !rect.isEmpty()) { | 93 // paint offset doesn't apply. |
|
Xianzhu
2016/12/06 18:35:26
!rect.isEmpty() is removed to be consistent with t
| |
| 94 if (!object.isSVG() || object.isSVGRoot()) { | |
| 95 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | |
| 91 // Use enclosingIntRect to ensure the final visual rect will cover the | 96 // Use enclosingIntRect to ensure the final visual rect will cover the |
| 92 // rect in source coordinates no matter if the painting will use pixel | 97 // rect in source coordinates no matter if the painting will use pixel |
| 93 // snapping. | 98 // snapping. |
| 94 rect = enclosingIntRect(rect); | 99 rect = enclosingIntRect(rect); |
| 95 } | 100 } |
| 96 | 101 |
| 97 PropertyTreeState currentTreeState( | 102 PropertyTreeState currentTreeState( |
| 98 context.treeBuilderContext.current.transform, | 103 context.treeBuilderContext.current.transform, |
| 99 context.treeBuilderContext.current.clip, | 104 context.treeBuilderContext.current.clip, |
| 100 context.treeBuilderContext.currentEffect, | 105 context.treeBuilderContext.currentEffect, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; | 438 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; |
| 434 } | 439 } |
| 435 | 440 |
| 436 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 441 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
| 437 for (auto target : m_pendingDelayedPaintInvalidations) | 442 for (auto target : m_pendingDelayedPaintInvalidations) |
| 438 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 443 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 439 PaintInvalidationDelayedFull); | 444 PaintInvalidationDelayedFull); |
| 440 } | 445 } |
| 441 | 446 |
| 442 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |