Title: [115347] trunk/Source/WebCore
- Revision
- 115347
- Author
- [email protected]
- Date
- 2012-04-26 13:15:07 -0700 (Thu, 26 Apr 2012)
Log Message
Add ScrollAnimatorBlackBerry as an extension to ScrollAnimatorNone
https://bugs.webkit.org/show_bug.cgi?id=84625
Reviewed by Anders Carlsson.
Patch by Antonio Gomes <[email protected]>
Patch adds ScrollAnimatorBlackBerry class as an extension to of
ScrollAnimatorNone. The main goal here is extending the later to allow
overscrolling while the animation runs.
Once the animation finishes, the flag gets reseted and
ScrollableArea::constrainsScrollingtoContentEdge is set back to the value
it had before, so this method has to be explicitly called anytime it is wanted.
* CMakeLists.txt:
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::animationWillStart):
(WebCore::ScrollAnimator::animationDidFinish):
(ScrollAnimator):
* platform/ScrollAnimatorNone.cpp:
(WebCore):
(WebCore::ScrollAnimatorNone::scroll):
(WebCore::ScrollAnimatorNone::animationTimerFired):
* platform/blackberry/ScrollAnimatorBlackBerry.cpp: Added.
(WebCore):
(WebCore::ScrollAnimator::create):
(WebCore::ScrollAnimatorBlackBerry::ScrollAnimatorBlackBerry):
(WebCore::ScrollAnimatorBlackBerry::animationWillStart):
(WebCore::ScrollAnimatorBlackBerry::animationDidFinish):
(WebCore::ScrollAnimatorBlackBerry::setDisableConstrainsScrollingToContentEdgeWhileAnimating):
* platform/blackberry/ScrollAnimatorBlackBerry.h: Added.
(WebCore):
(ScrollAnimatorBlackBerry):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (115346 => 115347)
--- trunk/Source/WebCore/ChangeLog 2012-04-26 20:14:54 UTC (rev 115346)
+++ trunk/Source/WebCore/ChangeLog 2012-04-26 20:15:07 UTC (rev 115347)
@@ -1,3 +1,38 @@
+2012-04-25 Antonio Gomes <[email protected]>
+
+ Add ScrollAnimatorBlackBerry as an extension to ScrollAnimatorNone
+ https://bugs.webkit.org/show_bug.cgi?id=84625
+
+ Reviewed by Anders Carlsson.
+
+ Patch adds ScrollAnimatorBlackBerry class as an extension to of
+ ScrollAnimatorNone. The main goal here is extending the later to allow
+ overscrolling while the animation runs.
+
+ Once the animation finishes, the flag gets reseted and
+ ScrollableArea::constrainsScrollingtoContentEdge is set back to the value
+ it had before, so this method has to be explicitly called anytime it is wanted.
+
+ * CMakeLists.txt:
+ * platform/ScrollAnimator.h:
+ (WebCore::ScrollAnimator::animationWillStart):
+ (WebCore::ScrollAnimator::animationDidFinish):
+ (ScrollAnimator):
+ * platform/ScrollAnimatorNone.cpp:
+ (WebCore):
+ (WebCore::ScrollAnimatorNone::scroll):
+ (WebCore::ScrollAnimatorNone::animationTimerFired):
+ * platform/blackberry/ScrollAnimatorBlackBerry.cpp: Added.
+ (WebCore):
+ (WebCore::ScrollAnimator::create):
+ (WebCore::ScrollAnimatorBlackBerry::ScrollAnimatorBlackBerry):
+ (WebCore::ScrollAnimatorBlackBerry::animationWillStart):
+ (WebCore::ScrollAnimatorBlackBerry::animationDidFinish):
+ (WebCore::ScrollAnimatorBlackBerry::setDisableConstrainsScrollingToContentEdgeWhileAnimating):
+ * platform/blackberry/ScrollAnimatorBlackBerry.h: Added.
+ (WebCore):
+ (ScrollAnimatorBlackBerry):
+
2012-04-26 Antonio Gomes <[email protected]>
[BlackBerry] Add smooth_scrolling options to CMAKE and enable it for Blackberry
Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (115346 => 115347)
--- trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-04-26 20:14:54 UTC (rev 115346)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-04-26 20:15:07 UTC (rev 115347)
@@ -196,6 +196,12 @@
dom/TouchList.cpp
)
+IF (ENABLE_SMOOTH_SCROLLING)
+ LIST(APPEND WebCore_SOURCES
+ platform/blackberry/ScrollAnimatorBlackBerry.cpp
+ )
+ENDIF ()
+
LIST(APPEND WEBDOM_IDL_HEADERS
bindings/cpp/WebDOMCString.h
bindings/cpp/WebDOMEventTarget.h
Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp (115346 => 115347)
--- trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp 2012-04-26 20:14:54 UTC (rev 115346)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp 2012-04-26 20:15:07 UTC (rev 115347)
@@ -59,12 +59,14 @@
const double kMinimumTimerInterval = .001;
const double kZoomTicks = 11;
+#if !(PLATFORM(BLACKBERRY))
PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
{
if (scrollableArea && scrollableArea->scrollAnimatorEnabled())
return adoptPtr(new ScrollAnimatorNone(scrollableArea));
return adoptPtr(new ScrollAnimator(scrollableArea));
}
+#endif
ScrollAnimatorNone::Parameters::Parameters()
: m_isEnabled(false)
@@ -467,6 +469,7 @@
bool needToScroll = data.updateDataFromParameters(step, multiplier, scrollableSize, WTF::monotonicallyIncreasingTime(), ¶meters);
if (needToScroll && !animationTimerActive()) {
m_startTime = data.m_startTime;
+ animationWillStart();
animationTimerFired();
}
return needToScroll;
@@ -565,6 +568,9 @@
TRACE_EVENT("ScrollAnimatorNone::notifyPositionChanged", this, 0);
#endif
notifyPositionChanged();
+
+ if (!continueAnimation)
+ animationDidFinish();
}
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.h (115346 => 115347)
--- trunk/Source/WebCore/platform/ScrollAnimatorNone.h 2012-04-26 20:14:54 UTC (rev 115346)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.h 2012-04-26 20:15:07 UTC (rev 115347)
@@ -101,6 +101,9 @@
virtual void scrollBy(const IntPoint&);
protected:
+ virtual void animationWillStart() { }
+ virtual void animationDidFinish() { }
+
friend class ::ScrollAnimatorNoneTest;
struct PerAxisData {
Added: trunk/Source/WebCore/platform/blackberry/ScrollAnimatorBlackBerry.cpp (0 => 115347)
--- trunk/Source/WebCore/platform/blackberry/ScrollAnimatorBlackBerry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/blackberry/ScrollAnimatorBlackBerry.cpp 2012-04-26 20:15:07 UTC (rev 115347)
@@ -0,0 +1,50 @@
+
+#include "config.h"
+
+#if ENABLE(SMOOTH_SCROLLING)
+
+#include "ScrollAnimatorBlackBerry.h"
+
+#include "ScrollableArea.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
+{
+ if (scrollableArea && scrollableArea->scrollAnimatorEnabled())
+ return adoptPtr(new ScrollAnimatorBlackBerry(scrollableArea));
+ return adoptPtr(new ScrollAnimator(scrollableArea));
+}
+
+ScrollAnimatorBlackBerry::ScrollAnimatorBlackBerry(ScrollableArea* scrollableArea)
+ : ScrollAnimatorNone(scrollableArea)
+ , m_disableConstrainsScrollingToContentEdgeWhileAnimating(false)
+ , m_originalConstransScrollingToContentEdge(true)
+{
+}
+
+void ScrollAnimatorBlackBerry::animationWillStart()
+{
+ if (m_disableConstrainsScrollingToContentEdgeWhileAnimating) {
+ m_originalConstransScrollingToContentEdge = scrollableArea()->constrainsScrollingToContentEdge();
+ scrollableArea()->setConstrainsScrollingToContentEdge(false);
+ }
+}
+
+void ScrollAnimatorBlackBerry::animationDidFinish()
+{
+ if (m_disableConstrainsScrollingToContentEdgeWhileAnimating) {
+ scrollableArea()->setConstrainsScrollingToContentEdge(m_originalConstransScrollingToContentEdge);
+ m_disableConstrainsScrollingToContentEdgeWhileAnimating = false;
+ }
+}
+
+void ScrollAnimatorBlackBerry::setDisableConstrainsScrollingToContentEdgeWhileAnimating(bool value)
+{
+ m_disableConstrainsScrollingToContentEdgeWhileAnimating = value;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SMOOTH_SCROLLING)
Added: trunk/Source/WebCore/platform/blackberry/ScrollAnimatorBlackBerry.h (0 => 115347)
--- trunk/Source/WebCore/platform/blackberry/ScrollAnimatorBlackBerry.h (rev 0)
+++ trunk/Source/WebCore/platform/blackberry/ScrollAnimatorBlackBerry.h 2012-04-26 20:15:07 UTC (rev 115347)
@@ -0,0 +1,33 @@
+
+#ifndef ScrollAnimatorBlackBerry_h
+#define ScrollAnimatorBlackberry_h
+
+#if ENABLE(SMOOTH_SCROLLING)
+
+#include "ScrollAnimator.h"
+#include "ScrollAnimatorNone.h"
+
+namespace WebCore {
+
+class ScrollableArea;
+
+class ScrollAnimatorBlackBerry : public ScrollAnimatorNone {
+public:
+ ScrollAnimatorBlackBerry(ScrollableArea*);
+
+ void setDisableConstrainsScrollingToContentEdgeWhileAnimating(bool);
+
+protected:
+ virtual void animationWillStart();
+ virtual void animationDidFinish();
+
+private:
+ bool m_disableConstrainsScrollingToContentEdgeWhileAnimating;
+ bool m_originalConstransScrollingToContentEdge;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SMOOTH_SCROLLING)
+
+#endif // ScrollAnimatorBlackBerry_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes