diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -139,16 +139,18 @@ #include "nsServiceManagerUtils.h" #include "nsITimer.h" #ifdef XP_MACOSX #include #endif +#define NS_PANNING + #if defined(DEBUG_rods) || defined(DEBUG_bryner) //#define DEBUG_DOCSHELL_FOCUS #endif #define NS_USER_INTERACTION_INTERVAL 5000 // ms static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID); @@ -365,16 +367,17 @@ nsMouseWheelTransaction::OnEvent(nsEvent OutOfTime(sMouseMoved, GetIgnoreMoveDelayTime())) { // Terminate the current mousewheel transaction if the mouse moved more // than ignoremovedelay milliseconds ago EndTransaction(); } return; case NS_MOUSE_MOVE: case NS_DRAGDROP_OVER: + printf("NS_MOUSE_MOVE\n"); if (((nsMouseEvent*)aEvent)->reason == nsMouseEvent::eReal) { // If the cursor is moving to be outside the frame, // terminate the scrollwheel transaction. nsPoint pt = GetScreenPoint((nsGUIEvent*)aEvent); nsIntRect r = sTargetFrame->GetScreenRectExternal(); if (!r.Contains(pt)) { EndTransaction(); return; @@ -435,16 +438,19 @@ nsMouseWheelTransaction::GetIgnoreMoveDe nsEventStateManager::nsEventStateManager() : mLockCursor(0), mCurrentTarget(nsnull), mLastMouseOverFrame(nsnull), mLastDragOverFrame(nsnull), // init d&d gesture state machine variables mGestureDownPoint(0,0), + mLastScrollPoint(0,0), + mScrollView(nsnull), + mKineticTrackerPtr(0), mCurrentFocusFrame(nsnull), mCurrentTabIndex(0), mLastFocusedWith(eEventFocusedByUnknown), mPresContext(nsnull), mLClickCount(0), mMClickCount(0), mRClickCount(0), mNormalLMouseEventInProcess(PR_FALSE), @@ -460,16 +466,17 @@ nsEventStateManager::nsEventStateManager if (gUserInteractionTimer) { gUserInteractionTimer->InitWithCallback(gUserInteractionTimerCallback, NS_USER_INTERACTION_INTERVAL, nsITimer::TYPE_REPEATING_SLACK); } } } ++sESMInstanceCount; + memset(mKineticTracker, 0, sizeof(PointTracker) * KINETIC_MOVEMENTS_TO_TRACK); } NS_IMETHODIMP nsEventStateManager::Init() { nsresult rv; nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1", &rv); @@ -831,16 +838,17 @@ nsEventStateManager::PreHandleEvent(nsPr } else { GenerateMouseEnterExit((nsGUIEvent*)aEvent); //This is a window level mouse exit event and should stop here aEvent->message = 0; break; } } case NS_MOUSE_MOVE: + //printf("NS_MOUSE_MOVE prehandle\n"); // on the Mac, GenerateDragGesture() may not return until the drag // has completed and so |aTargetFrame| may have been deleted (moving // a bookmark, for example). If this is the case, however, we know // that ClearFrameRefs() has been called and it cleared out // |mCurrentTarget|. As a result, we should pass |mCurrentTarget| // into UpdateCursor(). GenerateDragGesture(aPresContext, (nsMouseEvent*)aEvent); UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus); @@ -1854,45 +1862,65 @@ nsEventStateManager::BeginTrackingDragGe { printf("Begin Tracking Drag\n"); // Note that |inDownEvent| could be either a mouse down event or a // synthesized mouse move event. nsRect screenPt; inDownEvent->widget->WidgetToScreen(nsRect(inDownEvent->refPoint, nsSize(1, 1)), screenPt); mGestureDownPoint = screenPt.TopLeft(); - + mLastScrollPoint = mGestureDownPoint; inDownFrame->GetContentForEvent(aPresContext, inDownEvent, getter_AddRefs(mGestureDownContent)); mGestureDownFrameOwner = inDownFrame->GetContent(); mGestureDownShift = inDownEvent->isShift; mGestureDownControl = inDownEvent->isControl; mGestureDownAlt = inDownEvent->isAlt; mGestureDownMeta = inDownEvent->isMeta; #ifdef CLICK_HOLD_CONTEXT_MENUS // fire off a timer to track click-hold if (nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_TRUE)) CreateClickHoldTimer ( aPresContext, inDownFrame, inDownEvent ); #endif +#ifdef NS_PANNING + memset(mKineticTracker, 0, KINETIC_MOVEMENTS_TO_TRACK * sizeof(PointTracker)); + mScrollView = nsnull; +#endif } // // StopTrackingDragGesture // // Record that the mouse has gone back up so that we should leave the TRACKING // state of d&d gesture tracker and return to the START state. // void nsEventStateManager::StopTrackingDragGesture() { + printf("stop tracking\n"); mGestureDownContent = nsnull; mGestureDownFrameOwner = nsnull; +#ifdef NS_PANNING + if(mScrollView){ + PRInt32 x1 = mKineticTracker[mKineticTrackerPtr].x; + PRInt32 x2 = mKineticTracker[(mKineticTrackerPtr+1)%KINETIC_MOVEMENTS_TO_TRACK].x; + PRInt32 y1 = mKineticTracker[mKineticTrackerPtr].y; + PRInt32 y2 = mKineticTracker[(mKineticTrackerPtr+1)%KINETIC_MOVEMENTS_TO_TRACK].y; + PRInt64 t1 = mKineticTracker[mKineticTrackerPtr].t; + PRInt64 t2 = mKineticTracker[(mKineticTrackerPtr+1)%KINETIC_MOVEMENTS_TO_TRACK].t; + if(t1 && t2 && t1 > t2) + mScrollView->StartKineticScroll(((x2-x1)*1000)/(t1-t2), ((y2-y1)*1000)/(t1-t2)); + } else + printf("mScrollView is null\n"); + mScrollView = nsnull; + +#endif } void nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent) { NS_ASSERTION(aEvent->widget == mCurrentTarget->GetWindow(), "Incorrect widget in event"); @@ -1903,16 +1931,28 @@ nsEventStateManager::FillInEventFromGest aEvent->widget->WidgetToScreen(tmpRect, tmpRect); aEvent->refPoint = mGestureDownPoint - tmpRect.TopLeft(); aEvent->isShift = mGestureDownShift; aEvent->isControl = mGestureDownControl; aEvent->isAlt = mGestureDownAlt; aEvent->isMeta = mGestureDownMeta; } +static nsIFrame* +GetParentFrameToScroll(nsPresContext* aPresContext, nsIFrame* aFrame) +{ + if (!aPresContext || !aFrame) + return nsnull; + + if (aFrame->GetStyleDisplay()->mPosition == NS_STYLE_POSITION_FIXED) + return aPresContext->GetPresShell()->GetRootScrollFrame(); + + return aFrame->GetParent(); +} + // // GenerateDragGesture // // If we're in the TRACKING state of the d&d gesture tracker, check the current position // of the mouse in relation to the old one. If we've moved a sufficient amount from // the mouse down, then fire off a drag gesture event. // // Note that when the mouse enters a new child window with its own view, the event's @@ -1926,31 +1966,33 @@ nsEventStateManager::GenerateDragGesture nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext, nsMouseEvent *aEvent) { NS_ASSERTION(aPresContext, "This shouldn't happen."); if ( IsTrackingDragGesture() ) { mCurrentTarget = aPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner); if (!mCurrentTarget) { + printf("!mCurrentTarget\n"); StopTrackingDragGesture(); return; } - +#ifndef NS_PANNING // Check if selection is tracking drag gestures, if so // don't interfere! if (mCurrentTarget) { nsCOMPtr frameSel = mCurrentTarget->GetFrameSelection(); if (frameSel && frameSel->GetMouseDownState()) { + printf("tracking drag gesture\n"); StopTrackingDragGesture(); return; } } - +#endif static PRInt32 pixelThresholdX = 0; static PRInt32 pixelThresholdY = 0; if (!pixelThresholdX) { nsILookAndFeel *lf = aPresContext->LookAndFeel(); lf->GetMetric(nsILookAndFeel::eMetric_DragThresholdX, pixelThresholdX); lf->GetMetric(nsILookAndFeel::eMetric_DragThresholdY, pixelThresholdY); if (!pixelThresholdX) @@ -1959,24 +2001,64 @@ nsEventStateManager::GenerateDragGesture pixelThresholdY = 5; } // fire drag gesture if mouse has moved enough nsRect tmpRect; aEvent->widget->WidgetToScreen(nsRect(aEvent->refPoint, nsSize(1, 1)), tmpRect); nsPoint pt = tmpRect.TopLeft(); + //printf("dragged %d, %d\n",(pt.x - mGestureDownPoint.x), (pt.y - mGestureDownPoint.y)); if (PR_ABS(pt.x - mGestureDownPoint.x) > pixelThresholdX || PR_ABS(pt.y - mGestureDownPoint.y) > pixelThresholdY) { #ifdef CLICK_HOLD_CONTEXT_MENUS // stop the click-hold before we fire off the drag gesture, in case // it takes a long time KillClickHoldTimer(); #endif - +#ifdef NS_PANNING + aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH; + aEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT; + + mKineticTrackerPtr = (mKineticTrackerPtr +1)%KINETIC_MOVEMENTS_TO_TRACK; + mKineticTracker[mKineticTrackerPtr].x = pt.x; + mKineticTracker[mKineticTrackerPtr].y = pt.y; + mKineticTracker[mKineticTrackerPtr].t = aEvent->time; + + if (!mScrollView) { + nsIScrollableView* scrollView = nsnull; + nsIFrame* scrollFrame = mCurrentTarget; + + + //PRBool passToParent = lastScrollFrame ? PR_FALSE : PR_TRUE; + + for (; !scrollView && scrollFrame ; + scrollFrame = GetParentFrameToScroll(aPresContext, scrollFrame)) { + // Check whether the frame wants to provide us with a scrollable view. + nsIScrollableViewProvider* svp; + CallQueryInterface(scrollFrame, &svp); + if (svp) { + scrollView = svp->GetScrollableView(); + } + + } + mScrollView = scrollView; + } + int dx = mLastScrollPoint.x - pt.x; + int dy = mLastScrollPoint.y - pt.y; + if (mScrollView) { + mLastScrollPoint = pt; + mScrollView->ScrollByPixels(dx,dy); + //printf("scrolled by %d, %d\n", dx, dy); + } else { + //mCurrentTarget->GetWindow()->ScrollBy(dx,dy); + //mLastScrollPoint = pt; + //printf("couldn't get scrolling view\n"); + } +#else nsCOMPtr targetContent = mGestureDownContent; // Stop tracking the drag gesture now. This should stop us from // reentering GenerateDragGesture inside DOM event processing. StopTrackingDragGesture(); nsCOMPtr widget = mCurrentTarget->GetWindow(); // get the widget from the target frame @@ -2005,16 +2087,17 @@ nsEventStateManager::GenerateDragGesture &status); // Note that frame event handling doesn't care about NS_DRAGDROP_GESTURE, // which is just as well since we don't really know which frame to // send it to // Reset mCurretTargetContent to what it was mCurrentTargetContent = targetBeforeEvent; +#endif } // Now flush all pending notifications, for better responsiveness // while dragging. FlushPendingEvents(aPresContext); } } // GenerateDragGesture @@ -2128,28 +2211,16 @@ nsEventStateManager::DoScrollZoom(nsIFra // positive adjustment to decrease zoom, negative to increase PRInt32 change = (adjustment > 0) ? -1 : 1; if (nsContentUtils::GetBoolPref("browser.zoom.full")) ChangeFullZoom(change); else ChangeTextSize(change); } -} - -static nsIFrame* -GetParentFrameToScroll(nsPresContext* aPresContext, nsIFrame* aFrame) -{ - if (!aPresContext || !aFrame) - return nsnull; - - if (aFrame->GetStyleDisplay()->mPosition == NS_STYLE_POSITION_FIXED) - return aPresContext->GetPresShell()->GetRootScrollFrame(); - - return aFrame->GetParent(); } nsresult nsEventStateManager::DoScrollText(nsPresContext* aPresContext, nsIFrame* aTargetFrame, nsInputEvent* aEvent, PRInt32 aNumLines, PRBool aScrollHorizontal, @@ -2971,16 +3042,17 @@ nsEventStateManager::DispatchMouseEvent( event.nativeMsg = ((nsMouseEvent*)aEvent)->nativeMsg; event.relatedTarget = aRelatedContent; mCurrentTargetContent = aTargetContent; nsIFrame* targetFrame = nsnull; if (aTargetContent) { nsESMEventCB callback(aTargetContent); + //printf("dispatching mouse move\n"); nsEventDispatcher::Dispatch(aTargetContent, mPresContext, &event, nsnull, &status, &callback); nsIPresShell *shell = mPresContext ? mPresContext->GetPresShell() : nsnull; if (shell) { // Although the primary frame was checked in event callback, // it may not be the same object after event dispatching and handling. // So we need to refetch it. @@ -3115,16 +3187,17 @@ nsEventStateManager::GenerateMouseEnterE return; // Hold onto old target content through the event and reset after. nsCOMPtr targetBeforeEvent = mCurrentTargetContent; switch(aEvent->message) { case NS_MOUSE_MOVE: { + //printf("NS_MOUSE_MOVE gmee\n"); // Get the target content target (mousemove target == mouseover target) nsCOMPtr targetElement; GetEventTargetContent(aEvent, getter_AddRefs(targetElement)); if (!targetElement) { // We're always over the document root, even if we're only // over dead space in a page (whose frame is not associated with // any content) or in print preview dead space targetElement = mDocument->GetRootContent(); diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -57,20 +57,30 @@ class nsIPresShell; class nsIPresShell; class nsIDocShell; class nsIDocShellTreeNode; class nsIDocShellTreeItem; class nsIFocusController; class imgIContainer; // mac uses click-hold context menus, a holdover from 4.x -#ifdef XP_MACOSX +// touch screens could also use this, perhaps we should +// move to NS_TOUCHSCREEN +#if defined(XP_MACOSX) || defined(NS_HILDON) #define CLICK_HOLD_CONTEXT_MENUS 1 #endif + +#define KINETIC_MOVEMENTS_TO_TRACK 3 + +struct PointTracker{ + PRInt32 x; + PRInt32 y; + PRUint32 t; +}; /* * Event listener manager */ class nsEventStateManager : public nsSupportsWeakReference, public nsIEventStateManager, public nsIObserver @@ -342,16 +352,20 @@ protected: nsWeakFrame mCurrentTarget; nsCOMPtr mCurrentTargetContent; nsWeakFrame mLastMouseOverFrame; nsCOMPtr mLastMouseOverElement; nsWeakFrame mLastDragOverFrame; // member variables for the d&d gesture state machine nsPoint mGestureDownPoint; // screen coordinates + nsPoint mLastScrollPoint; + nsIScrollableView* mScrollView; + PointTracker mKineticTracker[KINETIC_MOVEMENTS_TO_TRACK]; + PRInt32 mKineticTrackerPtr; // The content to use as target if we start a d&d (what we drag). nsCOMPtr mGestureDownContent; // The content of the frame where the mouse-down event occurred. It's the same // as the target in most cases but not always - for example when dragging // an of an image map this is the image. (bug 289667) nsCOMPtr mGestureDownFrameOwner; // State of keys when the original gesture-down happened PRPackedBool mGestureDownShift; diff --git a/view/public/nsIScrollableView.h b/view/public/nsIScrollableView.h --- a/view/public/nsIScrollableView.h +++ b/view/public/nsIScrollableView.h @@ -200,16 +200,18 @@ public: * Adds a scroll position listener. */ NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener) = 0; /** * Removes a scroll position listener. */ NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener) = 0; + + NS_IMETHOD StartKineticScroll(PRInt32 aVelocityX, PRInt32 aVelocityY) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollableView, NS_ISCROLLABLEVIEW_IID) //regardless of the transparency or opacity settings //for this view, it can always be scrolled via a blit #define NS_SCROLL_PROPERTY_ALWAYS_BLIT 0x0001 diff --git a/view/src/nsScrollPortView.cpp b/view/src/nsScrollPortView.cpp --- a/view/src/nsScrollPortView.cpp +++ b/view/src/nsScrollPortView.cpp @@ -55,30 +55,71 @@ #include static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); #define SMOOTH_SCROLL_MSECS_PER_FRAME 10 #define SMOOTH_SCROLL_FRAMES 10 +#define KINETIC_SCROLL_MSECS_PER_FRAME 40 + #define SMOOTH_SCROLL_PREF_NAME "general.smoothScroll" class SmoothScroll { public: SmoothScroll() {} ~SmoothScroll() { if (mScrollAnimationTimer) mScrollAnimationTimer->Cancel(); } nsCOMPtr mScrollAnimationTimer; PRInt32 mVelocities[SMOOTH_SCROLL_FRAMES*2]; PRInt32 mFrameIndex; nscoord mDestinationX; nscoord mDestinationY; +}; + +class KineticScroll { +public: + KineticScroll() {} + ~KineticScroll() { + if (mScrollAnimationTimer) mScrollAnimationTimer->Cancel(); + } + + nsCOMPtr mScrollAnimationTimer; + PRInt32 mVelocityX; + PRInt32 mVelocityY; + PRInt32 mFrameIndex; + nscoord mDestinationX; + nscoord mDestinationY; + PRInt32 mOriginX; + PRInt32 mOriginY; + PRInt32 mOriginalVelocityX; + PRInt32 mOriginalVelocityY; + + void Decay(PRInt32 aOffsetX, PRInt32 aOffsetY) { + if (this->mOriginX == this->mDestinationX) + this->mVelocityX = 0; + else { + this->mVelocityX = + this->mOriginalVelocityX * (aOffsetX - this->mDestinationX)/(this->mOriginX - this->mDestinationX); + if (PR_ABS(this->mVelocityX) <10) + this->mVelocityX = 0; + } + if (this->mOriginY == this->mDestinationY) + this->mVelocityY = 0; + else { + this->mVelocityY = + this->mOriginalVelocityY * (aOffsetY - this->mDestinationY)/(this->mOriginY - this->mDestinationY); + if (PR_ABS(this->mVelocityY) <10) + this->mVelocityY = 0; + } + + } }; nsScrollPortView::nsScrollPortView(nsViewManager* aViewManager) : nsView(aViewManager) { mOffsetX = mOffsetY = 0; nsCOMPtr dev; mViewManager->GetDeviceContext(*getter_AddRefs(dev)); @@ -719,8 +760,91 @@ nsScrollPortView::IncrementalScroll() mOffsetY + mSmoothScroll->mVelocities[mSmoothScroll->mFrameIndex*2 + 1], 0); mSmoothScroll->mFrameIndex++; } else { delete mSmoothScroll; mSmoothScroll = nsnull; } } + +/* + * Callback function from timer used in nsScrollPortView::DoSmoothScroll + * this cleans up the target coordinates and incrementally calls + * nsScrollPortView::ScrollTo + */ +void +nsScrollPortView::KineticScrollAnimationCallback (nsITimer *aTimer, void* anInstance) +{ + nsScrollPortView* self = static_cast(anInstance); + if (self) { + self->KineticIncrementalScroll(); + } +} + +/* + * manages data members and calls to ScrollTo from the (static) SmoothScrollAnimationCallback method + */ +void +nsScrollPortView::KineticIncrementalScroll() +{ + // printf("dest: %d, %d\nvel; %d,%d\n", mKineticScroll->mDestinationX, mKineticScroll->mDestinationY, mKineticScroll->mVelocityX, mKineticScroll->mVelocityY); + + // printf("%d, %d -> ", mOffsetX, mOffsetY); + // printf("%d, %d -> ", mOffsetX + (mKineticScroll->mVelocityX * KINETIC_SCROLL_MSECS_PER_FRAME) / 1000, + // mOffsetY + (mKineticScroll->mVelocityY * KINETIC_SCROLL_MSECS_PER_FRAME) / 1000); + + PRInt32 oldOffX = mOffsetX; + PRInt32 oldOffY = mOffsetY; + + if (!mKineticScroll) { + return; + } + + if (mKineticScroll->mVelocityX != 0 || mKineticScroll->mVelocityY !=0) { + ScrollByPixels ((mKineticScroll->mVelocityX * KINETIC_SCROLL_MSECS_PER_FRAME) / 1000, + (mKineticScroll->mVelocityY * KINETIC_SCROLL_MSECS_PER_FRAME) / 1000); + mKineticScroll->Decay(mOffsetX, mOffsetY); + } else { + // printf(" done\n"); + mKineticScroll->mScrollAnimationTimer->Cancel(); + delete mKineticScroll; + mKineticScroll = nsnull; + } + if ( oldOffX == mOffsetX && oldOffY == mOffsetY){ + // printf("didn't move\n"); + mKineticScroll->mScrollAnimationTimer->Cancel(); + delete mKineticScroll; + mKineticScroll = nsnull; + } +// printf("%d, %d\n", mOffsetX, mOffsetY); +} + +NS_IMETHODIMP +nsScrollPortView::StartKineticScroll(PRInt32 aVelocityX, PRInt32 aVelocityY) +{ + printf("starting kinetic scroll\n"); + mKineticScroll = new KineticScroll; + if (mKineticScroll) { + mKineticScroll->mScrollAnimationTimer = do_CreateInstance("@mozilla.org/timer;1"); + if (!mKineticScroll->mScrollAnimationTimer) { + delete mKineticScroll; + mKineticScroll = nsnull; + } + } + mKineticScroll->mScrollAnimationTimer-> + InitWithFuncCallback( + KineticScrollAnimationCallback, this, KINETIC_SCROLL_MSECS_PER_FRAME, + nsITimer::TYPE_REPEATING_PRECISE); + + mKineticScroll->mOriginX = mOffsetX; + mKineticScroll->mOriginY = mOffsetY; + mKineticScroll->mDestinationX = mOffsetX + aVelocityX * 10; + mKineticScroll->mDestinationY = mOffsetY + aVelocityY * 10; + + mKineticScroll->mVelocityX = aVelocityX; + mKineticScroll->mVelocityY = aVelocityY; + printf("dest: %d, %d\nvel; %d,%d\n", mKineticScroll->mDestinationX, mKineticScroll->mDestinationY, mKineticScroll->mVelocityX, mKineticScroll->mVelocityY); + + mKineticScroll->mOriginalVelocityX = aVelocityX; + mKineticScroll->mOriginalVelocityY = aVelocityY; + return NS_OK; +} diff --git a/view/src/nsScrollPortView.h b/view/src/nsScrollPortView.h --- a/view/src/nsScrollPortView.h +++ b/view/src/nsScrollPortView.h @@ -39,18 +39,19 @@ #define nsScrollPortView_h___ #include "nsView.h" #include "nsIScrollableView.h" #include "nsCOMPtr.h" #include "nsITimer.h" class nsISupportsArray; +class KineticScroll; class SmoothScroll; - + //this is a class that acts as a container for other views and provides //automatic management of scrolling of the views it contains. class nsScrollPortView : public nsView, public nsIScrollableView { public: nsScrollPortView(nsViewManager* aViewManager = nsnull); @@ -81,27 +82,30 @@ public: NS_IMETHOD_(nsIView*) View(); NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener); NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener); // local to the view module nsView* GetScrolledView() const { return GetFirstChild(); } - + + NS_IMETHOD StartKineticScroll(PRInt32 aVelocityX, PRInt32 aVelocityY); private: NS_IMETHOD ScrollToImpl(nscoord aX, nscoord aY, PRUint32 aUpdateFlags); // data members + KineticScroll* mKineticScroll; SmoothScroll* mSmoothScroll; - // methods void IncrementalScroll(); + void KineticIncrementalScroll(); PRBool IsSmoothScrollingEnabled(); static void SmoothScrollAnimationCallback(nsITimer *aTimer, void* aESM); + static void KineticScrollAnimationCallback(nsITimer *aTimer, void* aESM); protected: virtual ~nsScrollPortView(); //private void Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsPoint aPixDelta, PRInt32 p2a); PRBool CannotBitBlt(nsView* aScrolledView); diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -909,19 +909,20 @@ NS_IMETHODIMP nsViewManager::UpdateView( RootViewManager()->IncrementUpdateCount(); if (!IsRefreshEnabled()) { return NS_OK; } // See if we should do an immediate refresh or wait if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) { + printf("refresh imediately\n"); Composite(); } - + return NS_OK; } NS_IMETHODIMP nsViewManager::UpdateAllViews(PRUint32 aUpdateFlags) { if (RootViewManager() != this) { return RootViewManager()->UpdateAllViews(aUpdateFlags); } diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -1235,17 +1235,17 @@ nsWindow::Scroll(PRInt32 aDx, nsRect bounds; kid->GetBounds(bounds); bounds.x += aDx; bounds.y += aDy; static_cast(kid)->SetBounds(bounds); } // Process all updates so that everything is drawn. - gdk_window_process_all_updates(); + //gdk_window_process_all_updates(); return NS_OK; } NS_IMETHODIMP nsWindow::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) { if (!mDrawingarea)