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

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

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.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
index 85016be74b5a15c2f326a65e4254a439ceac12f6..f23801b9243c29badaf4540425180ae39d106b05 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -51,6 +51,7 @@
struct SameSizeAsScrollableArea {
virtual ~SameSizeAsScrollableArea();
+ IntRect scrollbarDamage[2];
#if ENABLE(ASSERT) && ENABLE(OILPAN)
VerifyEagerFinalization verifyEager;
#endif
@@ -81,9 +82,6 @@
: m_inLiveResize(false)
, m_scrollbarOverlayStyle(ScrollbarOverlayStyleDefault)
, m_scrollOriginChanged(false)
- , m_horizontalScrollbarNeedsPaintInvalidation(false)
- , m_verticalScrollbarNeedsPaintInvalidation(false)
- , m_scrollCornerNeedsPaintInvalidation(false)
{
}
@@ -248,13 +246,22 @@
// Tell the scrollbars to update their thumb postions.
if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
horizontalScrollbar->offsetDidChange();
- if (horizontalScrollbar->isOverlayScrollbar() && !hasLayerForHorizontalScrollbar())
- setScrollbarNeedsPaintInvalidation(horizontalScrollbar);
+ if (horizontalScrollbar->isOverlayScrollbar() && !hasLayerForHorizontalScrollbar()) {
+ if (!verticalScrollbar)
+ horizontalScrollbar->invalidate();
+ else {
+ // If there is both a horizontalScrollbar and a verticalScrollbar,
+ // then we must also invalidate the corner between them.
+ IntRect boundsAndCorner = horizontalScrollbar->boundsRect();
+ boundsAndCorner.setWidth(boundsAndCorner.width() + verticalScrollbar->width());
+ horizontalScrollbar->invalidateRect(boundsAndCorner);
+ }
+ }
}
if (verticalScrollbar) {
verticalScrollbar->offsetDidChange();
if (verticalScrollbar->isOverlayScrollbar() && !hasLayerForVerticalScrollbar())
- setScrollbarNeedsPaintInvalidation(verticalScrollbar);
+ verticalScrollbar->invalidate();
}
if (scrollPositionDouble() != oldPosition) {
@@ -395,16 +402,16 @@
if (Scrollbar* scrollbar = horizontalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(scrollbar);
- setScrollbarNeedsPaintInvalidation(scrollbar);
+ scrollbar->invalidate();
}
if (Scrollbar* scrollbar = verticalScrollbar()) {
ScrollbarTheme::theme()->updateScrollbarOverlayStyle(scrollbar);
- setScrollbarNeedsPaintInvalidation(scrollbar);
- }
-}
-
-void ScrollableArea::setScrollbarNeedsPaintInvalidation(Scrollbar* scrollbar)
+ scrollbar->invalidate();
+ }
+}
+
+void ScrollableArea::invalidateScrollbar(Scrollbar* scrollbar, const IntRect& rect)
{
if (scrollbar == horizontalScrollbar()) {
if (GraphicsLayer* graphicsLayer = layerForHorizontalScrollbar()) {
@@ -412,8 +419,7 @@
graphicsLayer->setContentsNeedsDisplay();
return;
}
- m_horizontalScrollbarNeedsPaintInvalidation = true;
- scrollControlWasSetNeedsPaintInvalidation();
+ invalidateScrollbarRect(scrollbar, rect);
return;
}
if (scrollbar == verticalScrollbar()) {
@@ -422,22 +428,20 @@
graphicsLayer->setContentsNeedsDisplay();
return;
}
- m_verticalScrollbarNeedsPaintInvalidation = true;
- scrollControlWasSetNeedsPaintInvalidation();
+ invalidateScrollbarRect(scrollbar, rect);
return;
}
// Otherwise the scrollbar is just created and has not been set as either
// horizontalScrollbar() or verticalScrollbar().
}
-void ScrollableArea::setScrollCornerNeedsPaintInvalidation()
+void ScrollableArea::invalidateScrollCorner(const IntRect& rect)
{
if (GraphicsLayer* graphicsLayer = layerForScrollCorner()) {
graphicsLayer->setNeedsDisplay();
return;
}
- m_scrollCornerNeedsPaintInvalidation = true;
- scrollControlWasSetNeedsPaintInvalidation();
+ invalidateScrollCornerRect(rect);
}
bool ScrollableArea::hasLayerForHorizontalScrollbar() const

Powered by Google App Engine
This is Rietveld 408576698