| 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 10 matching lines...) Expand all Loading... |
| 21 if (!scrollbar.isCustomScrollbar() | 21 if (!scrollbar.isCustomScrollbar() |
| 22 && !(orientation == HorizontalScrollbar ? layerForHorizontalScrollbar()
: layerForVerticalScrollbar())) | 22 && !(orientation == HorizontalScrollbar ? layerForHorizontalScrollbar()
: layerForVerticalScrollbar())) |
| 23 ObjectPaintInvalidator(*layoutBox()).slowSetPaintingLayerNeedsRepaintAnd
InvalidateDisplayItemClient(scrollbar, PaintInvalidationScroll); | 23 ObjectPaintInvalidator(*layoutBox()).slowSetPaintingLayerNeedsRepaintAnd
InvalidateDisplayItemClient(scrollbar, PaintInvalidationScroll); |
| 24 | 24 |
| 25 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 25 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 26 } | 26 } |
| 27 | 27 |
| 28 static LayoutRect scrollControlPaintInvalidationRect(const IntRect& scrollContro
lRect, const LayoutBox& box, const PaintInvalidatorContext& context) | 28 static LayoutRect scrollControlPaintInvalidationRect(const IntRect& scrollContro
lRect, const LayoutBox& box, const PaintInvalidatorContext& context) |
| 29 { | 29 { |
| 30 LayoutRect paintInvalidationRect(scrollControlRect); | 30 LayoutRect paintInvalidationRect(scrollControlRect); |
| 31 if (!paintInvalidationRect.isEmpty()) | 31 // No need to apply any paint offset. Scroll controls paint in a different t
ransform space than their contained box |
| 32 // (the scrollbarPaintOffset transform node). |
| 33 if (!paintInvalidationRect.isEmpty() && !RuntimeEnabledFeatures::slimmingPai
ntV2Enabled()) |
| 32 context.mapLocalRectToPaintInvalidationBacking(box, paintInvalidationRec
t); | 34 context.mapLocalRectToPaintInvalidationBacking(box, paintInvalidationRec
t); |
| 33 return paintInvalidationRect; | 35 return paintInvalidationRect; |
| 34 } | 36 } |
| 35 | 37 |
| 36 // Returns true if the scroll control is invalidated. | 38 // Returns true if the scroll control is invalidated. |
| 37 static bool invalidatePaintOfScrollControlIfNeeded(const LayoutRect& newPaintInv
alidationRect, const LayoutRect& previousPaintInvalidationRect, bool needsPaintI
nvalidation, LayoutBox& box, const LayoutBoxModelObject& paintInvalidationContai
ner) | 39 static bool invalidatePaintOfScrollControlIfNeeded(const LayoutRect& newPaintInv
alidationRect, const LayoutRect& previousPaintInvalidationRect, bool needsPaintI
nvalidation, LayoutBox& box, const LayoutBoxModelObject& paintInvalidationContai
ner) |
| 38 { | 40 { |
| 39 bool shouldInvalidateNewRect = needsPaintInvalidation; | 41 bool shouldInvalidateNewRect = needsPaintInvalidation; |
| 40 if (newPaintInvalidationRect != previousPaintInvalidationRect) { | 42 if (newPaintInvalidationRect != previousPaintInvalidationRect) { |
| 41 ObjectPaintInvalidator(box).invalidatePaintUsingContainer(paintInvalidat
ionContainer, previousPaintInvalidationRect, PaintInvalidationScroll); | 43 ObjectPaintInvalidator(box).invalidatePaintUsingContainer(paintInvalidat
ionContainer, previousPaintInvalidationRect, PaintInvalidationScroll); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 fullBounds.unite(m_scrollCornerAndResizerPreviousPaintInvalidationRect); | 140 fullBounds.unite(m_scrollCornerAndResizerPreviousPaintInvalidationRect); |
| 139 return fullBounds; | 141 return fullBounds; |
| 140 } | 142 } |
| 141 | 143 |
| 142 void PaintInvalidationCapableScrollableArea::scrollControlWasSetNeedsPaintInvali
dation() | 144 void PaintInvalidationCapableScrollableArea::scrollControlWasSetNeedsPaintInvali
dation() |
| 143 { | 145 { |
| 144 layoutBox()->setMayNeedPaintInvalidation(); | 146 layoutBox()->setMayNeedPaintInvalidation(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |