- Revision
- 106554
- Author
- [email protected]
- Date
- 2012-02-02 07:09:48 -0800 (Thu, 02 Feb 2012)
Log Message
Source/WebCore: Update active and hover state on touch release.
https://bugs.webkit.org/show_bug.cgi?id=77620
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-02-02
Reviewed by Kenneth Rohde Christiansen.
* rendering/HitTestRequest.h:
(WebCore::HitTestRequest::move):
(WebCore::HitTestRequest::release):
(WebCore::HitTestRequest::touchEvent):
(WebCore::HitTestRequest::mouseEvent):
(WebCore::HitTestRequest::touchMove):
(WebCore::HitTestRequest::touchRelease):
Rename the enum values in HitTestRequest to be mouse/touch
agnostic, and add value for recognizing touch events.
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::nodeAtPoint): Update for HitTestRequest rename.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTest): ditto
(WebCore::RenderLayer::updateHoverActiveState): Reset hoverstate on touch release.
* page/EventHandler.cpp:
(WebCore::EventHandler::updateSelectionForMouseDrag): Update for HitTestRequest rename.
(WebCore::EventHandler::handleMouseMoveEvent): ditto
(WebCore::EventHandler::handleMouseReleaseEvent): ditto
(WebCore::EventHandler::hoverTimerFired): ditto
(WebCore::EventHandler::dragSourceEndedAt): ditto
(WebCore::EventHandler::handleTouchEvent): Hittest touch release to reset
active and hover states and add touch enum to all touch hittests.
Source/WebKit/chromium: Update enum name for HitTestRequest::RequestType
https://bugs.webkit.org/show_bug.cgi?id=77620
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-02-02
Reviewed by Kenneth Rohde Christiansen.
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::visiblePositionForWindowPoint):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (106553 => 106554)
--- trunk/Source/WebCore/ChangeLog 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebCore/ChangeLog 2012-02-02 15:09:48 UTC (rev 106554)
@@ -1,3 +1,33 @@
+2012-02-02 Allan Sandfeld Jensen <[email protected]>
+
+ Update active and hover state on touch release.
+ https://bugs.webkit.org/show_bug.cgi?id=77620
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * rendering/HitTestRequest.h:
+ (WebCore::HitTestRequest::move):
+ (WebCore::HitTestRequest::release):
+ (WebCore::HitTestRequest::touchEvent):
+ (WebCore::HitTestRequest::mouseEvent):
+ (WebCore::HitTestRequest::touchMove):
+ (WebCore::HitTestRequest::touchRelease):
+ Rename the enum values in HitTestRequest to be mouse/touch
+ agnostic, and add value for recognizing touch events.
+ * rendering/RenderFrameSet.cpp:
+ (WebCore::RenderFrameSet::nodeAtPoint): Update for HitTestRequest rename.
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::hitTest): ditto
+ (WebCore::RenderLayer::updateHoverActiveState): Reset hoverstate on touch release.
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::updateSelectionForMouseDrag): Update for HitTestRequest rename.
+ (WebCore::EventHandler::handleMouseMoveEvent): ditto
+ (WebCore::EventHandler::handleMouseReleaseEvent): ditto
+ (WebCore::EventHandler::hoverTimerFired): ditto
+ (WebCore::EventHandler::dragSourceEndedAt): ditto
+ (WebCore::EventHandler::handleTouchEvent): Hittest touch release to reset
+ active and hover states and add touch enum to all touch hittests.
+
2012-02-02 Pavel Feldman <[email protected]>
Web Inspector: enable editing of selected rows on single click in elements panel.
Modified: trunk/Source/WebCore/page/EventHandler.cpp (106553 => 106554)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-02-02 15:09:48 UTC (rev 106554)
@@ -646,7 +646,7 @@
HitTestRequest request(HitTestRequest::ReadOnly |
HitTestRequest::Active |
- HitTestRequest::MouseMove);
+ HitTestRequest::Move);
HitTestResult result(view->windowToContents(m_currentMousePosition));
layer->hitTest(request, result);
updateSelectionForMouseDrag(result);
@@ -1620,7 +1620,7 @@
if (m_lastScrollbarUnderMouse && m_mousePressed)
return m_lastScrollbarUnderMouse->mouseMoved(mouseEvent);
- HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove;
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move;
if (m_mousePressed)
hitType |= HitTestRequest::Active;
@@ -1727,7 +1727,7 @@
return m_lastScrollbarUnderMouse->mouseUp(mouseEvent);
}
- HitTestRequest request(HitTestRequest::MouseUp);
+ HitTestRequest request(HitTestRequest::Release);
MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
Frame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev);
if (m_eventHandlerWillResetCapturingMouseEventsNode)
@@ -2456,7 +2456,7 @@
if (RenderView* renderer = m_frame->contentRenderer()) {
if (FrameView* view = m_frame->view()) {
- HitTestRequest request(HitTestRequest::MouseMove);
+ HitTestRequest request(HitTestRequest::Move);
HitTestResult result(view->windowToContents(m_currentMousePosition));
renderer->layer()->hitTest(request, result);
m_frame->document()->updateStyleIfNeeded();
@@ -2773,7 +2773,7 @@
void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperation operation)
{
// Send a hit test request so that RenderLayer gets a chance to update the :hover and :active pseudoclasses.
- HitTestRequest request(HitTestRequest::MouseUp);
+ HitTestRequest request(HitTestRequest::Release);
prepareMouseEvent(request, event);
if (dragState().m_dragSrc && dragState().shouldDispatchEvents()) {
@@ -3232,7 +3232,7 @@
PlatformTouchPoint::State pointState = point.state();
LayoutPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos());
- HitTestRequest::HitTestRequestType hitType = HitTestRequest::Active | HitTestRequest::ReadOnly;
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
// The HitTestRequest types used for mouse events map quite adequately
// to touch events. Note that in addition to meaning that the hit test
// should affect the active state of the current node if necessary,
@@ -3240,16 +3240,17 @@
// with the mouse (or finger in this case) being pressed.
switch (pointState) {
case PlatformTouchPoint::TouchPressed:
- hitType = HitTestRequest::Active;
+ hitType |= HitTestRequest::Active;
break;
case PlatformTouchPoint::TouchMoved:
- hitType = HitTestRequest::Active | HitTestRequest::MouseMove | HitTestRequest::ReadOnly;
+ hitType |= HitTestRequest::Active | HitTestRequest::Move | HitTestRequest::ReadOnly;
break;
case PlatformTouchPoint::TouchReleased:
case PlatformTouchPoint::TouchCancelled:
- hitType = HitTestRequest::MouseUp;
+ hitType |= HitTestRequest::Release;
break;
default:
+ ASSERT_NOT_REACHED();
break;
}
@@ -3274,10 +3275,13 @@
m_originatingTouchPointTargets.set(touchPointTargetKey, node);
touchTarget = node;
} else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) {
+ // We only perform a hittest on release or cancel to unset :active or :hover state.
+ hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false, false, DontHitTestScrollbars, hitType);
// The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel
// we also remove it from the map.
touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey);
} else
+ // No hittest is performed on move, since the target is not allowed to change anyway.
touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey);
if (!touchTarget.get())
Modified: trunk/Source/WebCore/rendering/HitTestRequest.h (106553 => 106554)
--- trunk/Source/WebCore/rendering/HitTestRequest.h 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebCore/rendering/HitTestRequest.h 2012-02-02 15:09:48 UTC (rev 106554)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -29,10 +30,11 @@
enum RequestType {
ReadOnly = 1 << 1,
Active = 1 << 2,
- MouseMove = 1 << 3,
- MouseUp = 1 << 4,
+ Move = 1 << 3,
+ Release = 1 << 4,
IgnoreClipping = 1 << 5,
- SVGClipContent = 1 << 6
+ SVGClipContent = 1 << 6,
+ TouchEvent = 1 << 7
};
typedef unsigned HitTestRequestType;
@@ -44,11 +46,17 @@
bool readOnly() const { return m_requestType & ReadOnly; }
bool active() const { return m_requestType & Active; }
- bool mouseMove() const { return m_requestType & MouseMove; }
- bool mouseUp() const { return m_requestType & MouseUp; }
+ bool move() const { return m_requestType & Move; }
+ bool release() const { return m_requestType & Release; }
bool ignoreClipping() const { return m_requestType & IgnoreClipping; }
bool svgClipContent() const { return m_requestType & SVGClipContent; }
+ bool touchEvent() const { return m_requestType & TouchEvent; }
+ bool mouseEvent() const { return !touchEvent(); }
+ // Convenience functions
+ bool touchMove() const { return move() && touchEvent(); }
+ bool touchRelease() const { return release() && touchEvent(); }
+
HitTestRequestType type() const { return m_requestType; }
private:
Modified: trunk/Source/WebCore/rendering/RenderFrameSet.cpp (106553 => 106554)
--- trunk/Source/WebCore/rendering/RenderFrameSet.cpp 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebCore/rendering/RenderFrameSet.cpp 2012-02-02 15:09:48 UTC (rev 106554)
@@ -167,7 +167,7 @@
|| m_isResizing;
if (inside && frameSet()->noResize()
- && !request.readOnly() && !result.innerNode()) {
+ && !request.readOnly() && !result.innerNode() && !request.touchMove()) {
result.setInnerNode(node());
result.setInnerNonSharedNode(node());
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (106553 => 106554)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-02-02 15:09:48 UTC (rev 106554)
@@ -3104,7 +3104,7 @@
// We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down,
// return ourselves. We do this so mouse events continue getting delivered after a drag has
// exited the WebView, and so hit testing over a scrollbar hits the content document.
- if ((request.active() || request.mouseUp()) && renderer()->isRenderView()) {
+ if ((request.active() || request.release()) && renderer()->isRenderView()) {
renderer()->updateHitTestResult(result, result.point());
insideLayer = this;
}
@@ -4013,13 +4013,12 @@
doc->setActiveNode(0);
} else {
Node* newActiveNode = result.innerNode();
- if (!activeNode && newActiveNode && request.active()) {
+ if (!activeNode && newActiveNode && request.active() && !request.touchMove()) {
// We are setting the :active chain and freezing it. If future moves happen, they
// will need to reference this chain.
for (RenderObject* curr = newActiveNode->renderer(); curr; curr = curr->parent()) {
- if (curr->node() && !curr->isText()) {
+ if (curr->node() && !curr->isText())
curr->node()->setInActiveChain();
- }
}
doc->setActiveNode(newActiveNode);
}
@@ -4031,11 +4030,24 @@
// If the mouse is down and if this is a mouse move event, we want to restrict changes in
// :hover/:active to only apply to elements that are in the :active chain that we froze
// at the time the mouse went down.
- bool mustBeInActiveChain = request.active() && request.mouseMove();
+ bool mustBeInActiveChain = request.active() && request.move();
- // Check to see if the hovered node has changed. If not, then we don't need to
- // do anything.
RefPtr<Node> oldHoverNode = doc->hoverNode();
+ // Clear the :hover chain when the touch gesture is over.
+ if (request.touchRelease()) {
+ if (oldHoverNode) {
+ for (RenderObject* curr = oldHoverNode->renderer(); curr; curr = curr->parent()) {
+ if (curr->node() && !curr->isText())
+ curr->node()->setHovered(false);
+ }
+ doc->setHoverNode(0);
+ }
+ // A touch release can not set new hover or active target.
+ return;
+ }
+
+ // Check to see if the hovered node has changed.
+ // If it hasn't, we do not need to do anything.
Node* newHoverNode = result.innerNode();
if (newHoverNode && !newHoverNode->renderer())
newHoverNode = result.innerNonSharedNode();
Modified: trunk/Source/WebKit/chromium/ChangeLog (106553 => 106554)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-02-02 15:09:48 UTC (rev 106554)
@@ -1,3 +1,13 @@
+2012-02-02 Allan Sandfeld Jensen <[email protected]>
+
+ Update enum name for HitTestRequest::RequestType
+ https://bugs.webkit.org/show_bug.cgi?id=77620
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::visiblePositionForWindowPoint):
+
2012-02-02 Kinuko Yasuda <[email protected]>
Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API) under chromium directory (re-landing r105395)
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (106553 => 106554)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-02-02 14:47:21 UTC (rev 106553)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-02-02 15:09:48 UTC (rev 106554)
@@ -1384,7 +1384,7 @@
VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
{
- HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove;
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move;
hitType |= HitTestRequest::ReadOnly;
hitType |= HitTestRequest::Active;
HitTestRequest request(hitType);