--- a/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp Thu Aug 19 10:58:56 2010 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp Tue Aug 31 16:17:46 2010 +0300
@@ -17,7 +17,7 @@
// INCLUDE FILES
-#include <browser_platform_variant.hrh>
+#include <Browser_platform_variant.hrh>
#include <../bidi.h>
#include "WebPageScrollHandler.h"
#include "BrCtl.h"
@@ -34,21 +34,17 @@
#include "WebScrollbarDrawer.h"
#include "RenderObject.h"
#include "WebScrollingDeceleratorGH.h"
-#include "pluginskin.h"
+
#include "WebKitLogger.h"
using namespace WebCore;
+using namespace RT_GestureHelper;
// constants
const int KPageOverviewScrollPeriodic = 20 * 1000; // Update frequently for faster, smoother scrolling
const int KMicroInterval = 300000;
const int KPageOverviewScrollStart = 1000;
const int KCancelDecelerationTimeout = 200000; //Decelerate only if flicked KCancelDecelerationTimeout microsec after last drag event.
-#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF
-const int KScrollIntervalTimeout = 30000; // scroll timer interval in microseconds
-#else
const int KScrollIntervalTimeout = 40000; // scroll timer interval in microseconds
-#endif
-
const int KAngularDeviationThreshold = 160; // % deviation ignored from minor axis of motion(120 means 20 %)
const int KScrollThresholdPixels = 10; // scrolls only if delta is above this threshold
const int KScrollDirectionBoundary = 30; // Bound around focal point within which scrolling locks in X or Y states
@@ -91,13 +87,7 @@
WebFrameView* ScrollableView::activeFrameView()
{
if (m_scrollingElement) {
- Frame* frame = m_scrollingElement->document()->frame();
- if(frame) {
- return kit(frame)->frameView();
- }
- else {
- return NULL;
- }
+ return kit(m_scrollingElement->document()->frame())->frameView();
}
else {
return m_frameView;
@@ -137,8 +127,8 @@
//
void WebPageScrollHandler::constructL()
{
- m_scrollTimer = CPeriodic::NewL(CActive::EPriorityUserInput);
- m_pageOverviewScrollPeriodic = CPeriodic::NewL(CActive::EPriorityUserInput);
+ m_scrollTimer = CPeriodic::NewL(CActive::EPriorityUserInput - 1);
+ m_pageOverviewScrollPeriodic = CPeriodic::NewL(CActive::EPriorityUserInput - 1);
m_lastPosition = TPoint(0, 0);
m_scrollbarDrawer = WebScrollbarDrawer::NewL();
if(AknLayoutUtils::PenEnabled()) {
@@ -382,14 +372,12 @@
bool shouldScrollHorizontally = false;
WebFrame* frame = kit(m_scrollableView.m_scrollingElement->document()->frame());
RenderObject* render = m_scrollableView.m_scrollingElement->renderer();
- if(render) //check if render exits before using it
- {
- __ASSERT_DEBUG(render->isScrollable(), User::Panic(_L(""), KErrGeneral));
- if (aScrollDelta.iY)
- shouldScrollVertically = !render->scroll(ScrollDown, ScrollByPixel, frame->frameView()->toDocCoords(aScrollDelta).iY / 100);
- if (aScrollDelta.iX)
- shouldScrollHorizontally = !render->scroll(ScrollRight, ScrollByPixel, frame->frameView()->toDocCoords(aScrollDelta).iX / 100);
- }
+ __ASSERT_DEBUG(render->isScrollable(), User::Panic(_L(""), KErrGeneral));
+ if (aScrollDelta.iY)
+ shouldScrollVertically = !render->scroll(ScrollDown, ScrollByPixel, frame->frameView()->toDocCoords(aScrollDelta).iY / 100);
+ if (aScrollDelta.iX)
+ shouldScrollHorizontally = !render->scroll(ScrollRight, ScrollByPixel, frame->frameView()->toDocCoords(aScrollDelta).iX / 100);
+
TPoint scrollPos = frame->frameView()->contentPos();
TPoint newscrollDelta = frame->frameView()->toDocCoords(aScrollDelta);
m_currentNormalizedPosition += newscrollDelta;
@@ -404,7 +392,7 @@
if (shouldScrollVertically || shouldScrollHorizontally){
if (m_scrollableView.m_frameView->needScroll(scrollPos)) {
- frame->frameView()->scrollTo(scrollPos, ETrue);
+ frame->frameView()->scrollTo(scrollPos);
updateScrollbars(scrollPos, newscrollDelta);
core(frame)->sendScrollEvent();
}
@@ -431,8 +419,8 @@
m_currentNormalizedPosition.iY = m_scrollableView.contentPos().iY * 100;
}
else {
-
- m_scrollableView.m_frameView->scrollTo(scrollPos, ETrue);
+
+ m_scrollableView.m_frameView->scrollTo(scrollPos);
m_lastPosition = m_currentPosition;
#ifndef BRDO_USE_GESTURE_HELPER
m_decel->updatePos();
@@ -571,32 +559,25 @@
Element* currElement = NULL;
if(!e) return NULL;
RenderObject* render = e->renderer();
- if(render) {
+ if (render && render->isScrollable()) {
RenderLayer* layer = render->enclosingLayer();
Element* parent = e;
-
- if (e->isControl()) {
- if (render->isScrollable()) {
- currElement = e;
- }
- }
- else {
- while (parent && parent->renderer()) {
- if (parent->renderer()->isScrollable()) {
- currElement = parent;
- break;
- }
- parent = static_cast<Element*>(parent->parent());
- }
+ currElement = e;
+ while (!currElement->isControl() && parent && parent->renderer() && parent->renderer()->enclosingLayer() == layer) {
+ currElement = parent;
+ Node* pn = parent;
+ do {
+ pn = pn->parent();
+ } while (pn && !pn->isElementNode());
+ parent = static_cast<Element*>(pn);
}
if (currElement) {
- //check for current element which is scrollable
currElement->ref();
- m_scrollableView.m_scrollingElement = currElement;
+ m_scrollableView.m_scrollingElement = currElement;
m_scrollableView.m_frameView = NULL;
return true;
- }
}
+ }
return false;
}
@@ -615,9 +596,9 @@
}
-void WebPageScrollHandler::handleScrollingGH(const TStmGestureEvent& aGesture)
+void WebPageScrollHandler::handleScrollingGH(const TGestureEvent& aEvent)
{
- TPoint newPos = aGesture.CurrentPos();
+ TPoint newPos = aEvent.CurrentPos();
m_currentPosition = newPos;
if (m_webView->inPageViewMode()) {
if (!m_pageOverviewScrollPeriodic->IsActive()){
@@ -633,9 +614,9 @@
}
-void WebPageScrollHandler::handleTouchDownGH(const TStmGestureEvent& aGesture)
+void WebPageScrollHandler::handleTouchDownGH(const TGestureEvent& aEvent)
{
- TPoint newPos = aGesture.CurrentPos();
+ TPoint newPos = aEvent.CurrentPos();
m_lastMoveEventTime = 0;
m_lastPosition = newPos;
m_currentPosition = newPos;
@@ -650,19 +631,16 @@
}
-void WebPageScrollHandler::handleTouchUpGH(const TStmGestureEvent& aGesture)
+void WebPageScrollHandler::handleTouchUpGH(const TGestureEvent& aEvent)
{
bool decelDoesScrollbars = false;
- TPoint newPos = aGesture.CurrentPos();
+ TPoint newPos = aEvent.CurrentPos();
if (m_webView->inPageViewMode()) {
if (m_pageOverviewScrollPeriodic->IsActive()){
m_pageOverviewScrollPeriodic->Cancel();
}
m_webView->closePageView();
- PluginSkin* plugin = m_webView->mainFrame()->focusedPlugin();
- if(plugin)
- plugin->setPluginWinClipedRect();
scrollPageOverviewGH();
m_webView->setViewIsScrolling(false);
m_webView->toggleRepaintTimer(true);
@@ -670,7 +648,7 @@
else {
m_scrollTimer->Cancel();
m_lastPosition = TPoint(0, 0);
- decelDoesScrollbars = startDeceleration(aGesture);
+ decelDoesScrollbars = startDeceleration(aEvent);
if (m_webView->viewIsScrolling()) {
Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
@@ -688,10 +666,10 @@
}
-bool WebPageScrollHandler::startDeceleration(const TStmGestureEvent& aGesture)
+bool WebPageScrollHandler::startDeceleration(const TGestureEvent& aEvent)
{
bool started = false;
- TRealPoint gstSpeed = aGesture.Speed();
+ TRealPoint gstSpeed = aEvent.Speed();
if (Abs(gstSpeed.iX / gstSpeed.iY) <= KTanOfThresholdAngle) {
gstSpeed.iX = 0;
}
@@ -701,19 +679,12 @@
}
if ((Abs(gstSpeed.iX) > 0) || (Abs(gstSpeed.iY) > 0)) {
- started = m_decelGH->startDecel(gstSpeed, m_scrollbarDrawer);
+ m_decelGH->startDecel(gstSpeed, m_scrollbarDrawer);
+ started = true;
}
+
+
return started;
}
-void WebPageScrollHandler::stopScrolling()
-{
- if (m_scrollTimer && m_scrollTimer->IsActive()) {
- m_scrollTimer->Cancel();
- }
- if (m_scrollbarDrawer) {
- m_scrollbarDrawer->fadeScrollbar();
- }
- m_webView->setViewIsScrolling(false);
-}
// End of File