| 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 #ifndef PaintInvalidationCapableScrollableArea_h | 5 #ifndef PaintInvalidationCapableScrollableArea_h |
| 6 #define PaintInvalidationCapableScrollableArea_h | 6 #define PaintInvalidationCapableScrollableArea_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
| 10 #include "platform/scroll/ScrollableArea.h" | 10 #include "platform/scroll/ScrollableArea.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class LayoutBox; | 14 class LayoutBox; |
| 15 class LayoutBoxModelObject; | 15 class LayoutBoxModelObject; |
| 16 class LayoutScrollbarPart; | 16 class LayoutScrollbarPart; |
| 17 class PaintInvalidationContainer; | 17 class PaintInvalidationContainer; |
| 18 class PaintInvalidationState; | 18 class PaintInvalidationState; |
| 19 struct PaintInvalidatorContext; | 19 struct PaintInvalidatorContext; |
| 20 | 20 |
| 21 // Base class of FrameView and PaintLayerScrollableArea to share paint invalidat
ion code. | 21 // Base class of FrameView and PaintLayerScrollableArea to share paint |
| 22 // TODO(wangxianzhu): Combine this into PaintLayerScrollableArea when root-layer
-scrolls launches. | 22 // invalidation code. |
| 23 // TODO(wangxianzhu): Combine this into PaintLayerScrollableArea when |
| 24 // root-layer-scrolls launches. |
| 23 class CORE_EXPORT PaintInvalidationCapableScrollableArea | 25 class CORE_EXPORT PaintInvalidationCapableScrollableArea |
| 24 : public ScrollableArea { | 26 : public ScrollableArea { |
| 25 public: | 27 public: |
| 26 PaintInvalidationCapableScrollableArea() | 28 PaintInvalidationCapableScrollableArea() |
| 27 : m_horizontalScrollbarPreviouslyWasOverlay(false), | 29 : m_horizontalScrollbarPreviouslyWasOverlay(false), |
| 28 m_verticalScrollbarPreviouslyWasOverlay(false) {} | 30 m_verticalScrollbarPreviouslyWasOverlay(false) {} |
| 29 | 31 |
| 30 void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation) override; | 32 void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation) override; |
| 31 | 33 |
| 32 void invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidationState&); | 34 void invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidationState&); |
| 33 void invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidatorContext&); | 35 void invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidatorContext&); |
| 34 | 36 |
| 35 // Should be called when the previous paint invalidation rects are no longer v
alid. | 37 // Should be called when the previous paint invalidation rects are no longer |
| 38 // valid. |
| 36 void clearPreviousPaintInvalidationRects(); | 39 void clearPreviousPaintInvalidationRects(); |
| 37 | 40 |
| 38 virtual IntRect scrollCornerAndResizerRect() const { | 41 virtual IntRect scrollCornerAndResizerRect() const { |
| 39 return scrollCornerRect(); | 42 return scrollCornerRect(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 LayoutRect visualRectForScrollbarParts() const override; | 45 LayoutRect visualRectForScrollbarParts() const override; |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 virtual LayoutScrollbarPart* scrollCorner() const = 0; | 48 virtual LayoutScrollbarPart* scrollCorner() const = 0; |
| 46 virtual LayoutScrollbarPart* resizer() const = 0; | 49 virtual LayoutScrollbarPart* resizer() const = 0; |
| 47 | 50 |
| 48 void scrollControlWasSetNeedsPaintInvalidation() override; | 51 void scrollControlWasSetNeedsPaintInvalidation() override; |
| 49 | 52 |
| 50 bool m_horizontalScrollbarPreviouslyWasOverlay; | 53 bool m_horizontalScrollbarPreviouslyWasOverlay; |
| 51 bool m_verticalScrollbarPreviouslyWasOverlay; | 54 bool m_verticalScrollbarPreviouslyWasOverlay; |
| 52 LayoutRect m_horizontalScrollbarPreviousPaintInvalidationRect; | 55 LayoutRect m_horizontalScrollbarPreviousPaintInvalidationRect; |
| 53 LayoutRect m_verticalScrollbarPreviousPaintInvalidationRect; | 56 LayoutRect m_verticalScrollbarPreviousPaintInvalidationRect; |
| 54 LayoutRect m_scrollCornerAndResizerPreviousPaintInvalidationRect; | 57 LayoutRect m_scrollCornerAndResizerPreviousPaintInvalidationRect; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace blink | 60 } // namespace blink |
| 58 | 61 |
| 59 #endif // PaintInvalidationCapableScrollableArea_h | 62 #endif // PaintInvalidationCapableScrollableArea_h |
| OLD | NEW |