| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking( | 136 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking( |
| 137 const LayoutObject& object, | 137 const LayoutObject& object, |
| 138 LayoutRect& rect) const { | 138 LayoutRect& rect) const { |
| 139 GeometryMapper geometryMapper; | 139 GeometryMapper geometryMapper; |
| 140 rect = blink::mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( | 140 rect = blink::mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( |
| 141 geometryMapper, object, rect, *this); | 141 geometryMapper, object, rect, *this); |
| 142 } | 142 } |
| 143 | 143 |
| 144 LayoutRect PaintInvalidator::computeVisualRectInBacking( | 144 inline LayoutRect PaintInvalidator::computeVisualRectInBacking( |
| 145 const LayoutObject& object, | 145 const LayoutObject& object, |
| 146 const PaintInvalidatorContext& context) { | 146 const PaintInvalidatorContext& context) { |
| 147 if (object.isSVGChild()) { | 147 if (object.isSVGChild()) { |
| 148 FloatRect localRect = SVGLayoutSupport::localVisualRect(object); | 148 FloatRect localRect = SVGLayoutSupport::localVisualRect(object); |
| 149 return mapLocalRectToPaintInvalidationBacking<FloatRect, FloatPoint>( | 149 return mapLocalRectToPaintInvalidationBacking<FloatRect, FloatPoint>( |
| 150 m_geometryMapper, object, localRect, context); | 150 m_geometryMapper, object, localRect, context); |
| 151 } | 151 } |
| 152 return mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( | 152 return mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( |
| 153 m_geometryMapper, object, object.localVisualRect(), context); | 153 m_geometryMapper, object, object.localVisualRect(), context); |
| 154 } | 154 } |
| 155 | 155 |
| 156 LayoutPoint PaintInvalidator::computeLocationInBacking( | 156 inline LayoutPoint PaintInvalidator::computeLocationInBacking( |
| 157 const LayoutObject& object, | 157 const LayoutObject& object, |
| 158 const PaintInvalidatorContext& context) { | 158 const PaintInvalidatorContext& context) { |
| 159 // Use visual rect location for LayoutTexts because it suffices to check | 159 // Use visual rect location for LayoutTexts because it suffices to check |
| 160 // visual rect change for layout caused invalidation. | 160 // visual rect change for layout caused invalidation. |
| 161 if (object.isText()) | 161 if (object.isText()) |
| 162 return context.newVisualRect.location(); | 162 return context.newVisualRect.location(); |
| 163 | 163 |
| 164 LayoutPoint point; | 164 LayoutPoint point; |
| 165 if (object != context.paintInvalidationContainer) { | 165 if (object != context.paintInvalidationContainer) { |
| 166 point.moveBy(object.paintOffset()); | 166 point.moveBy(object.paintOffset()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 185 if (context.paintInvalidationContainer->layer()->groupedMapping()) { | 185 if (context.paintInvalidationContainer->layer()->groupedMapping()) { |
| 186 FloatPoint floatPoint(point); | 186 FloatPoint floatPoint(point); |
| 187 PaintLayer::mapPointInPaintInvalidationContainerToBacking( | 187 PaintLayer::mapPointInPaintInvalidationContainerToBacking( |
| 188 *context.paintInvalidationContainer, floatPoint); | 188 *context.paintInvalidationContainer, floatPoint); |
| 189 point = LayoutPoint(floatPoint); | 189 point = LayoutPoint(floatPoint); |
| 190 } | 190 } |
| 191 | 191 |
| 192 return point; | 192 return point; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, | 195 inline void PaintInvalidator::updatePaintingLayer( |
| 196 PaintInvalidatorContext& context) { | 196 const LayoutObject& object, |
| 197 PaintInvalidatorContext& context) { |
| 197 if (object.hasLayer() && | 198 if (object.hasLayer() && |
| 198 toLayoutBoxModelObject(object).hasSelfPaintingLayer()) { | 199 toLayoutBoxModelObject(object).hasSelfPaintingLayer()) { |
| 199 context.paintingLayer = toLayoutBoxModelObject(object).layer(); | 200 context.paintingLayer = toLayoutBoxModelObject(object).layer(); |
| 200 } else if (object.isColumnSpanAll() || | 201 } else if (object.isColumnSpanAll() || |
| 201 (object.isFloating() && !object.parent()->isLayoutBlock())) { | 202 (object.isFloating() && !object.parent()->isLayoutBlock())) { |
| 202 // See LayoutObject::paintingLayer() for the special-cases of floating under | 203 // See LayoutObject::paintingLayer() for the special-cases of floating under |
| 203 // inline and multicolumn. | 204 // inline and multicolumn. |
| 204 context.paintingLayer = object.paintingLayer(); | 205 context.paintingLayer = object.paintingLayer(); |
| 205 } | 206 } |
| 206 | 207 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 m_treeBuilderContext.current = m_savedContext; | 257 m_treeBuilderContext.current = m_savedContext; |
| 257 } | 258 } |
| 258 | 259 |
| 259 private: | 260 private: |
| 260 PaintPropertyTreeBuilderContext& m_treeBuilderContext; | 261 PaintPropertyTreeBuilderContext& m_treeBuilderContext; |
| 261 PaintPropertyTreeBuilderContext::ContainingBlockContext m_savedContext; | 262 PaintPropertyTreeBuilderContext::ContainingBlockContext m_savedContext; |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 } // namespace | 265 } // namespace |
| 265 | 266 |
| 266 void PaintInvalidator::updateContext(const LayoutObject& object, | 267 inline void PaintInvalidator::updateContext(const LayoutObject& object, |
| 267 PaintInvalidatorContext& context) { | 268 PaintInvalidatorContext& context) { |
| 268 Optional<ScopedUndoFrameViewContentClipAndScroll> | 269 Optional<ScopedUndoFrameViewContentClipAndScroll> |
| 269 undoFrameViewContentClipAndScroll; | 270 undoFrameViewContentClipAndScroll; |
| 270 | 271 |
| 271 if (object.isPaintInvalidationContainer()) { | 272 if (object.isPaintInvalidationContainer()) { |
| 272 context.paintInvalidationContainer = toLayoutBoxModelObject(&object); | 273 context.paintInvalidationContainer = toLayoutBoxModelObject(&object); |
| 273 if (object.styleRef().isStackingContext()) | 274 if (object.styleRef().isStackingContext()) |
| 274 context.paintInvalidationContainerForStackedContents = | 275 context.paintInvalidationContainerForStackedContents = |
| 275 toLayoutBoxModelObject(&object); | 276 toLayoutBoxModelObject(&object); |
| 276 } else if (object.isLayoutView()) { | 277 } else if (object.isLayoutView()) { |
| 277 // paintInvalidationContainerForStackedContents is only for stacked | 278 // paintInvalidationContainerForStackedContents is only for stacked |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; | 449 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; |
| 449 } | 450 } |
| 450 | 451 |
| 451 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 452 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
| 452 for (auto target : m_pendingDelayedPaintInvalidations) | 453 for (auto target : m_pendingDelayedPaintInvalidations) |
| 453 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 454 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 454 PaintInvalidationDelayedFull); | 455 PaintInvalidationDelayedFull); |
| 455 } | 456 } |
| 456 | 457 |
| 457 } // namespace blink | 458 } // namespace blink |
| OLD | NEW |