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

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

Issue 246293006: Blink Support for Overlay Scrollbar Animation Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix try server compile error Created 6 years, 6 months 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: Source/platform/scroll/ScrollableArea.cpp
diff --git a/Source/platform/scroll/ScrollableArea.cpp b/Source/platform/scroll/ScrollableArea.cpp
index 39ad11ff0d74438e7263719b0dc0e2d76f09fd69..d08622bac6f3295c78a1596227c85045a64f67db 100644
--- a/Source/platform/scroll/ScrollableArea.cpp
+++ b/Source/platform/scroll/ScrollableArea.cpp
@@ -32,12 +32,13 @@
#include "config.h"
#include "platform/scroll/ScrollableArea.h"
+#include "platform/TraceEvent.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/geometry/FloatPoint.h"
+#include "platform/scroll/ScrollbarStateTransitionAnimator.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "wtf/PassOwnPtr.h"
-#include "platform/TraceEvent.h"
static const int kPixelsPerLineStep = 40;
static const float kMinFractionToStepWhenPaging = 0.875f;
@@ -49,6 +50,7 @@ struct SameSizeAsScrollableArea {
unsigned damageBits : 2;
IntRect scrollbarDamage[2];
void* pointer;
+ void* stateTranstionAnimatorPointer;
abarth-chromium 2014/06/16 22:47:04 The point of having this struct here is to keep th
unsigned bitfields : 16;
IntPoint origin;
};
@@ -95,6 +97,36 @@ ScrollAnimator* ScrollableArea::scrollAnimator() const
return m_scrollAnimator.get();
}
+ScrollbarStateTransitionAnimator* ScrollableArea::scrollbarStateTransitionAnimator() const
+{
+ if (hasOverlayScrollbars() && !m_scrollbarStateTransitionAnimator)
+ m_scrollbarStateTransitionAnimator = ScrollbarStateTransitionAnimator::create(const_cast<ScrollableArea*>(this));
+
+ return m_scrollbarStateTransitionAnimator.get();
+}
+
+bool ScrollableArea::isDuringStateTransitionAnimation() const
+{
+ return hasOverlayScrollbars() && existingScrollbarStateTransitionAnimator() && existingScrollbarStateTransitionAnimator()->isDuringStateTransitionAnimation();
+}
+
+void ScrollableArea::stateTransitionInProgress()
+{
+ if (isDuringStateTransitionAnimation()) {
+ double progress = existingScrollbarStateTransitionAnimator()->stateTransitionProgress();
+ blink::WebThemeEngine::State startState = existingScrollbarStateTransitionAnimator()->stateTransitionStartState();
+ blink::WebThemeEngine::State endState = existingScrollbarStateTransitionAnimator()->stateTransitionEndState();
+
+ if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
+ verticalScrollbar->updateStateTransitionData(startState, endState, progress);
+ }
+
+ if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
+ horizontalScrollbar->updateStateTransitionData(startState, endState, progress);
+ }
+ }
+}
+
void ScrollableArea::setScrollOrigin(const IntPoint& origin)
{
if (m_scrollOrigin != origin) {
@@ -276,11 +308,15 @@ void ScrollableArea::mouseMovedInContentArea() const
void ScrollableArea::mouseEnteredScrollbar(Scrollbar* scrollbar) const
{
scrollAnimator()->mouseEnteredScrollbar(scrollbar);
+ if (ScrollbarStateTransitionAnimator* animator = scrollbarStateTransitionAnimator())
+ animator->mouseEnteredScrollbar(scrollbar);
}
void ScrollableArea::mouseExitedScrollbar(Scrollbar* scrollbar) const
{
scrollAnimator()->mouseExitedScrollbar(scrollbar);
+ if (ScrollbarStateTransitionAnimator* animator = scrollbarStateTransitionAnimator())
+ animator->mouseExitedScrollbar(scrollbar);
}
void ScrollableArea::contentAreaDidShow() const
@@ -392,10 +428,12 @@ bool ScrollableArea::hasLayerForScrollCorner() const
return layerForScrollCorner();
}
-void ScrollableArea::serviceScrollAnimations()
+void ScrollableArea::serviceScrollbarAnimations()
{
if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
scrollAnimator->serviceScrollAnimations();
+ if (ScrollbarStateTransitionAnimator* animator = existingScrollbarStateTransitionAnimator())
+ animator->serviceAnimations();
}
IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const

Powered by Google App Engine
This is Rietveld 408576698