| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return mapLocalRectToPaintInvalidationBacking<FloatRect, FloatPoint>( | 162 return mapLocalRectToPaintInvalidationBacking<FloatRect, FloatPoint>( |
| 163 object, localRect, context, m_geometryMapper); | 163 object, localRect, context, m_geometryMapper); |
| 164 } | 164 } |
| 165 return mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( | 165 return mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( |
| 166 object, object.localVisualRect(), context, m_geometryMapper); | 166 object, object.localVisualRect(), context, m_geometryMapper); |
| 167 } | 167 } |
| 168 | 168 |
| 169 LayoutPoint PaintInvalidator::computeLocationInBacking( | 169 LayoutPoint PaintInvalidator::computeLocationInBacking( |
| 170 const LayoutObject& object, | 170 const LayoutObject& object, |
| 171 const PaintInvalidatorContext& context) { | 171 const PaintInvalidatorContext& context) { |
| 172 // In SPv2, locationInBacking is in the space of their local transform node. |
| 173 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 174 return object.paintOffset(); |
| 175 |
| 172 LayoutPoint point; | 176 LayoutPoint point; |
| 173 if (object != context.paintInvalidationContainer) { | 177 if (object != context.paintInvalidationContainer) { |
| 174 point.moveBy(object.paintOffset()); | 178 point.moveBy(object.paintOffset()); |
| 175 | 179 |
| 176 const auto* containerTransform = | 180 const auto* containerTransform = |
| 177 context.paintInvalidationContainer->paintProperties() | 181 context.paintInvalidationContainer->paintProperties() |
| 178 ->contentsProperties() | 182 ->contentsProperties() |
| 179 ->transform(); | 183 ->transform(); |
| 180 if (context.treeBuilderContext.current.transform != containerTransform) { | 184 if (context.treeBuilderContext.current.transform != containerTransform) { |
| 181 point = LayoutPoint(m_geometryMapper | 185 point = LayoutPoint(m_geometryMapper |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 if (object.document().printing() && | 422 if (object.document().printing() && |
| 419 !RuntimeEnabledFeatures::printBrowserEnabled()) | 423 !RuntimeEnabledFeatures::printBrowserEnabled()) |
| 420 return; // Don't invalidate paints if we're printing. | 424 return; // Don't invalidate paints if we're printing. |
| 421 | 425 |
| 422 updatePaintInvalidationContainer(object, context); | 426 updatePaintInvalidationContainer(object, context); |
| 423 | 427 |
| 424 bool objectShouldCheckForPaintInvalidation = | 428 bool objectShouldCheckForPaintInvalidation = |
| 425 object | 429 object |
| 426 .shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); | 430 .shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); |
| 427 if (!context.forcedSubtreeInvalidationFlags && | 431 if (!context.forcedSubtreeInvalidationFlags && |
| 428 !objectShouldCheckForPaintInvalidation) | 432 !objectShouldCheckForPaintInvalidation) { |
| 433 #if CHECK_VISUAL_RECT_UPDATE |
| 434 updateVisualRect(object, context); |
| 435 DCHECK( |
| 436 (context.oldVisualRect.isEmpty() && context.newVisualRect.isEmpty()) || |
| 437 enclosingIntRect(context.oldVisualRect) == |
| 438 enclosingIntRect(context.newVisualRect)) |
| 439 << "Visual rect changed without needing paint invalidation:" |
| 440 << " object=" << object.debugName() |
| 441 << " old=" << context.oldVisualRect.toString() |
| 442 << " new=" << context.newVisualRect.toString(); |
| 443 DCHECK(object.isText() || context.oldLocation == context.newLocation) |
| 444 << "Location changed without needing paint invalidation:" |
| 445 << " old=" << context.oldLocation.toString() |
| 446 << " new=" << context.newLocation.toString(); |
| 447 #endif |
| 429 return; | 448 return; |
| 449 } |
| 430 | 450 |
| 431 updateVisualRect(object, context); | 451 updateVisualRect(object, context); |
| 432 | 452 |
| 433 if (!objectShouldCheckForPaintInvalidation && | 453 if (!objectShouldCheckForPaintInvalidation && |
| 434 context.forcedSubtreeInvalidationFlags == | 454 context.forcedSubtreeInvalidationFlags == |
| 435 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate) { | 455 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate) { |
| 436 // We are done updating the visual rect. No other paint invalidation work to | 456 // We are done updating the visual rect. No other paint invalidation work to |
| 437 // do for this object. | 457 // do for this object. |
| 438 return; | 458 return; |
| 439 } | 459 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 468 } | 488 } |
| 469 } | 489 } |
| 470 | 490 |
| 471 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 491 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
| 472 for (auto target : m_pendingDelayedPaintInvalidations) | 492 for (auto target : m_pendingDelayedPaintInvalidations) |
| 473 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 493 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 474 PaintInvalidationDelayedFull); | 494 PaintInvalidationDelayedFull); |
| 475 } | 495 } |
| 476 | 496 |
| 477 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |