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

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

Issue 1550983002: Revert of Make ScrollbarThemeAura selectively invalidate scrollbar parts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/Scrollbar.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
index 4b6a34163d9ce2b2565215fe0efc98e8dd0c64f7..a86da068c7f3476ad441ca7d09b13d5428fbc8d4 100644
--- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
+++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
@@ -126,27 +126,19 @@
return false;
}
-bool Scrollbar::offsetDidChange()
+void Scrollbar::offsetDidChange()
{
ASSERT(m_scrollableArea);
float position = scrollableAreaCurrentPos();
if (position == m_currentPos)
- return false;
-
- float oldPosition = m_currentPos;
+ return;
+
int oldThumbPosition = theme().thumbPosition(*this);
m_currentPos = position;
-
- ScrollbarPart invalidParts = theme().invalidateOnThumbPositionChange(
- *this, oldPosition, position);
- if (invalidParts != NoPart)
- setNeedsPaintInvalidation(invalidParts);
-
+ updateThumbPosition();
if (m_pressedPart == ThumbPart)
setPressedPos(m_pressedPos + theme().thumbPosition(*this) - oldThumbPosition);
-
- return true;
}
void Scrollbar::disconnectFromScrollableArea()
@@ -162,7 +154,22 @@
m_visibleSize = visibleSize;
m_totalSize = totalSize;
+ updateThumbProportion();
+}
+
+void Scrollbar::updateThumb()
+{
setNeedsPaintInvalidation();
+}
+
+void Scrollbar::updateThumbPosition()
+{
+ updateThumb();
+}
+
+void Scrollbar::updateThumbProportion()
+{
+ updateThumb();
}
void Scrollbar::paint(GraphicsContext& context, const CullRect& cullRect) const
@@ -310,7 +317,7 @@
if (((m_hoveredPart == NoPart || part == NoPart) && theme().invalidateOnMouseEnterExit())
// When there's a pressed part, we don't draw a hovered state, so there's no reason to invalidate.
|| m_pressedPart == NoPart)
- setNeedsPaintInvalidation(static_cast<ScrollbarPart>(m_hoveredPart | part));
+ setNeedsPaintInvalidation();
m_hoveredPart = part;
}
@@ -320,7 +327,7 @@
if (m_pressedPart != NoPart
// When we no longer have a pressed part, we can start drawing a hovered state on the hovered part.
|| m_hoveredPart != NoPart)
- setNeedsPaintInvalidation(static_cast<ScrollbarPart>(m_pressedPart | m_hoveredPart | part));
+ setNeedsPaintInvalidation();
m_pressedPart = part;
}
@@ -555,14 +562,12 @@
return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScrollPosition().y();
}
-void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart parts)
-{
- if (m_theme.shouldRepaintAllPartsOnInvalidation())
- parts = AllParts;
- if (parts & ~ThumbPart)
+void Scrollbar::setNeedsPaintInvalidation()
+{
+ if (m_theme.shouldRepaintAllPartsOnInvalidation()) {
m_trackNeedsRepaint = true;
- if (parts & ThumbPart)
m_thumbNeedsRepaint = true;
+ }
if (m_scrollableArea)
m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation());
}
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698