Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.h

Issue 1456953003: Revert of Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.h
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
index bc261b77f4d9b0381eccf2bf36d5478dd6b6bae6..26b8fb97111dd14c8030be7744b14c9a21c29066 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
@@ -147,10 +147,10 @@
virtual bool isActive() const = 0;
virtual int scrollSize(ScrollbarOrientation) const = 0;
- void setScrollbarNeedsPaintInvalidation(Scrollbar*);
+ virtual void invalidateScrollbar(Scrollbar*, const IntRect&);
virtual bool isScrollCornerVisible() const = 0;
virtual IntRect scrollCornerRect() const = 0;
- void setScrollCornerNeedsPaintInvalidation();
+ virtual void invalidateScrollCorner(const IntRect&);
virtual void getTickmarks(Vector<IntRect>&) const { }
// Convert points and rects between the scrollbar and its containing view.
@@ -235,6 +235,25 @@
int maximumScrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPosition().y(); }
int clampScrollPosition(ScrollbarOrientation orientation, int pos) { return std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPosition(orientation)); }
+ bool hasVerticalBarDamage() const { return !m_verticalBarDamage.isEmpty(); }
+ bool hasHorizontalBarDamage() const { return !m_horizontalBarDamage.isEmpty(); }
+ const IntRect& verticalBarDamage() const { return m_verticalBarDamage; }
+ const IntRect& horizontalBarDamage() const { return m_horizontalBarDamage; }
+
+ void addScrollbarDamage(Scrollbar* scrollbar, const IntRect& rect)
+ {
+ if (scrollbar == horizontalScrollbar())
+ m_horizontalBarDamage.unite(rect);
+ else
+ m_verticalBarDamage.unite(rect);
+ }
+
+ void resetScrollbarDamage()
+ {
+ m_verticalBarDamage = IntRect();
+ m_horizontalBarDamage = IntRect();
+ }
+
virtual GraphicsLayer* layerForContainer() const;
virtual GraphicsLayer* layerForScrolling() const { return 0; }
virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; }
@@ -251,8 +270,8 @@
virtual ~ScrollableArea();
- // Called when any of horizontal scrollbar, vertical scrollbar and scroll corner is setNeedsPaintInvalidation.
- virtual void scrollControlWasSetNeedsPaintInvalidation() = 0;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
+ virtual void invalidateScrollCornerRect(const IntRect&) = 0;
// Returns the default scroll style this area should scroll with when not
// explicitly specified. E.g. The scrolling behavior of an element can be
@@ -292,16 +311,6 @@
void scrollPositionChanged(const DoublePoint&, ScrollType);
void clearScrollAnimators();
-
- bool horizontalScrollbarNeedsPaintInvalidation() const { return m_horizontalScrollbarNeedsPaintInvalidation; }
- bool verticalScrollbarNeedsPaintInvalidation() const { return m_verticalScrollbarNeedsPaintInvalidation; }
- bool scrollCornerNeedsPaintInvalidation() const { return m_scrollCornerNeedsPaintInvalidation; }
- void clearNeedsPaintInvalidationForScrollControls()
- {
- m_horizontalScrollbarNeedsPaintInvalidation = false;
- m_verticalScrollbarNeedsPaintInvalidation = false;
- m_scrollCornerNeedsPaintInvalidation = false;
- }
private:
void programmaticScrollHelper(const DoublePoint&, ScrollBehavior);
@@ -325,6 +334,10 @@
virtual int documentStep(ScrollbarOrientation) const;
virtual float pixelStep(ScrollbarOrientation) const;
+ // Stores the paint invalidations for the scrollbars during layout.
+ IntRect m_horizontalBarDamage;
+ IntRect m_verticalBarDamage;
+
struct ScrollableAreaAnimators {
OwnPtr<ScrollAnimatorBase> scrollAnimator;
OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator;
@@ -337,10 +350,6 @@
unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle
unsigned m_scrollOriginChanged : 1;
-
- unsigned m_horizontalScrollbarNeedsPaintInvalidation : 1;
- unsigned m_verticalScrollbarNeedsPaintInvalidation : 1;
- unsigned m_scrollCornerNeedsPaintInvalidation : 1;
// There are 8 possible combinations of writing mode and direction. Scroll origin will be non-zero in the x or y axis
// if there is any reversed direction or writing-mode. The combinations are:

Powered by Google App Engine
This is Rietveld 408576698