Commit 09eac2ac authored by andersca@apple.com's avatar andersca@apple.com

More work towards making PlatformWheelEvent immutable

https://bugs.webkit.org/show_bug.cgi?id=69348

Reviewed by Sam Weinig.

More work on getting rid of m_isAccepted from PlatformWheelEvent. Add more asserts
that the return value of handleWheelEvent is equal to m_isAccepted.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleWheelEvent):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::handleWheelEvent):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9e803e65
2011-10-04 Anders Carlsson <andersca@apple.com>
More work towards making PlatformWheelEvent immutable
https://bugs.webkit.org/show_bug.cgi?id=69348
Reviewed by Sam Weinig.
More work on getting rid of m_isAccepted from PlatformWheelEvent. Add more asserts
that the return value of handleWheelEvent is equal to m_isAccepted.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleWheelEvent):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::handleWheelEvent):
2011-10-04 Cary Clark <caryclark@google.com>
Inset focus ring (Skia on Mac)
......@@ -2189,16 +2189,19 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
}
}
if (e.isAccepted())
return true;
// isAccepted can't be true here, because then we would already have returned from this function.
ASSERT(!e.isAccepted());
// We do another check on the frame view because the event handler can run JS which results in the frame getting destroyed.
view = m_frame->view();
if (!view)
return false;
view->wheelEvent(e);
return e.isAccepted();
bool handled = view->wheelEvent(e);
ASSERT(handled == e.isAccepted());
return handled;
}
void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEvent)
......
......@@ -91,6 +91,8 @@ bool ScrollAnimator::handleWheelEvent(PlatformWheelEvent& e)
float deltaX = horizontalScrollbar ? e.deltaX() : 0;
float deltaY = verticalScrollbar ? e.deltaY() : 0;
bool handled = false;
IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scrollableArea->minimumScrollPosition();
if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
......@@ -98,6 +100,7 @@ bool ScrollAnimator::handleWheelEvent(PlatformWheelEvent& e)
|| (deltaY < 0 && maxForwardScrollDelta.height() > 0)
|| (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) {
e.accept();
handled = true;
if (e.granularity() == ScrollByPageWheelEvent) {
ASSERT(!e.deltaX());
bool negative = deltaY < 0;
......@@ -112,7 +115,8 @@ bool ScrollAnimator::handleWheelEvent(PlatformWheelEvent& e)
scroll(HorizontalScrollbar, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX);
}
return e.isAccepted();
ASSERT(e.isAccepted() == handled);
return handled;
}
#if ENABLE(GESTURE_EVENTS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment