| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/PaintInvalidationCapableScrollableArea.h" | 5 #include "core/paint/PaintInvalidationCapableScrollableArea.h" |
| 6 | 6 |
| 7 #include "core/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
| 8 #include "core/html/HTMLFrameOwnerElement.h" | 8 #include "core/html/HTMLFrameOwnerElement.h" |
| 9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
| 10 #include "core/layout/LayoutScrollbar.h" | 10 #include "core/layout/LayoutScrollbar.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 static LayoutRect scrollControlPaintInvalidationRect( | 32 static LayoutRect scrollControlPaintInvalidationRect( |
| 33 const IntRect& scrollControlRect, | 33 const IntRect& scrollControlRect, |
| 34 const LayoutBox& box, | 34 const LayoutBox& box, |
| 35 const PaintInvalidatorContext& context) { | 35 const PaintInvalidatorContext& context) { |
| 36 LayoutRect paintInvalidationRect(scrollControlRect); | 36 LayoutRect paintInvalidationRect(scrollControlRect); |
| 37 // No need to apply any paint offset. Scroll controls paint in a different | 37 // No need to apply any paint offset. Scroll controls paint in a different |
| 38 // transform space than their contained box (the scrollbarPaintOffset | 38 // transform space than their contained box (the scrollbarPaintOffset |
| 39 // transform node). | 39 // transform node). |
| 40 if (!paintInvalidationRect.isEmpty() && | 40 if (!paintInvalidationRect.isEmpty() && |
| 41 !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 41 !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 42 context.mapLocalRectToPaintInvalidationBacking(box, paintInvalidationRect); | 42 context.mapLocalRectToPaintInvalidationBacking(box, paintInvalidationRect); |
| 43 |
| 44 IntSize adjustment = box.scrollAdjustmentForPaintInvalidation( |
| 45 *context.paintInvalidationContainer); |
| 46 paintInvalidationRect.move(adjustment); |
| 47 } |
| 43 return paintInvalidationRect; | 48 return paintInvalidationRect; |
| 44 } | 49 } |
| 45 | 50 |
| 46 // Returns true if the scroll control is invalidated. | 51 // Returns true if the scroll control is invalidated. |
| 47 static bool invalidatePaintOfScrollControlIfNeeded( | 52 static bool invalidatePaintOfScrollControlIfNeeded( |
| 48 const LayoutRect& newPaintInvalidationRect, | 53 const LayoutRect& newPaintInvalidationRect, |
| 49 const LayoutRect& previousPaintInvalidationRect, | 54 const LayoutRect& previousPaintInvalidationRect, |
| 50 bool needsPaintInvalidation, | 55 bool needsPaintInvalidation, |
| 51 LayoutBox& box, | 56 LayoutBox& box, |
| 52 const LayoutBoxModelObject& paintInvalidationContainer) { | 57 const LayoutBoxModelObject& paintInvalidationContainer) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 fullBounds.unite(m_scrollCornerAndResizerPreviousPaintInvalidationRect); | 203 fullBounds.unite(m_scrollCornerAndResizerPreviousPaintInvalidationRect); |
| 199 return fullBounds; | 204 return fullBounds; |
| 200 } | 205 } |
| 201 | 206 |
| 202 void PaintInvalidationCapableScrollableArea:: | 207 void PaintInvalidationCapableScrollableArea:: |
| 203 scrollControlWasSetNeedsPaintInvalidation() { | 208 scrollControlWasSetNeedsPaintInvalidation() { |
| 204 layoutBox()->setMayNeedPaintInvalidation(); | 209 layoutBox()->setMayNeedPaintInvalidation(); |
| 205 } | 210 } |
| 206 | 211 |
| 207 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |