OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 3430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3441 } | 3441 } |
3442 | 3442 |
3443 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id()) | 3443 // Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id()) |
3444 // since we shouldn't get a touchstart for a touch that's already | 3444 // since we shouldn't get a touchstart for a touch that's already |
3445 // down. However EventSender allows this to be violated and there's | 3445 // down. However EventSender allows this to be violated and there's |
3446 // some tests that take advantage of it. There may also be edge | 3446 // some tests that take advantage of it. There may also be edge |
3447 // cases in the browser where this happens. | 3447 // cases in the browser where this happens. |
3448 // See http://crbug.com/345372. | 3448 // See http://crbug.com/345372. |
3449 m_targetForTouchID.set(point.id(), node); | 3449 m_targetForTouchID.set(point.id(), node); |
3450 | 3450 |
3451 TouchAction effectiveTouchAction = computeEffectiveTouchAction(pageP
oint); | 3451 TouchAction effectiveTouchAction = computeEffectiveTouchAction(*node
); |
3452 if (effectiveTouchAction != TouchActionAuto) | 3452 if (effectiveTouchAction != TouchActionAuto) |
3453 m_frame->page()->chrome().client().setTouchAction(effectiveTouch
Action); | 3453 m_frame->page()->chrome().client().setTouchAction(effectiveTouch
Action); |
3454 } | 3454 } |
3455 } | 3455 } |
3456 | 3456 |
3457 m_touchPressed = !allTouchReleased; | 3457 m_touchPressed = !allTouchReleased; |
3458 | 3458 |
3459 // If there's no document receiving touch events, or no handlers on the | 3459 // If there's no document receiving touch events, or no handlers on the |
3460 // document set to receive the events, then we can skip all the rest of | 3460 // document set to receive the events, then we can skip all the rest of |
3461 // this work. | 3461 // this work. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3615 return TouchActionNone; | 3615 return TouchActionNone; |
3616 if (action1 == TouchActionAuto) | 3616 if (action1 == TouchActionAuto) |
3617 return action2; | 3617 return action2; |
3618 if (action2 == TouchActionAuto) | 3618 if (action2 == TouchActionAuto) |
3619 return action1; | 3619 return action1; |
3620 if (!(action1 & action2)) | 3620 if (!(action1 & action2)) |
3621 return TouchActionNone; | 3621 return TouchActionNone; |
3622 return action1 & action2; | 3622 return action1 & action2; |
3623 } | 3623 } |
3624 | 3624 |
3625 TouchAction EventHandler::computeEffectiveTouchAction(const LayoutPoint& point) | 3625 TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
3626 { | 3626 { |
3627 // Optimization to minimize risk of this new feature (behavior should be ide
ntical | 3627 // Optimization to minimize risk of this new feature (behavior should be ide
ntical |
3628 // since there's no way to get non-default touch-action values). | 3628 // since there's no way to get non-default touch-action values). |
3629 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) | 3629 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) |
3630 return TouchActionAuto; | 3630 return TouchActionAuto; |
3631 | 3631 |
3632 HitTestResult taResult = hitTestResultAtPoint(point, HitTestRequest::TouchEv
ent | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::TouchA
ction); | |
3633 Node* node = taResult.innerNode(); | |
3634 if (!node) | |
3635 return TouchActionAuto; | |
3636 | |
3637 // Start by permitting all actions, then walk the elements supporting | 3632 // Start by permitting all actions, then walk the elements supporting |
3638 // touch-action from the target node up to the nearest scrollable ancestor | 3633 // touch-action from the target node up to the nearest scrollable ancestor |
3639 // and exclude any prohibited actions. | 3634 // and exclude any prohibited actions. |
3640 TouchAction effectiveTouchAction = TouchActionAuto; | 3635 TouchAction effectiveTouchAction = TouchActionAuto; |
3641 for (const Node* curNode = node; curNode; curNode = NodeRenderingTraversal::
parent(curNode)) { | 3636 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal:
:parent(curNode)) { |
3642 if (RenderObject* renderer = curNode->renderer()) { | 3637 if (RenderObject* renderer = curNode->renderer()) { |
3643 if (renderer->visibleForTouchAction()) { | 3638 if (renderer->supportsTouchAction()) { |
3644 TouchAction action = renderer->style()->touchAction(); | 3639 TouchAction action = renderer->style()->touchAction(); |
3645 effectiveTouchAction = intersectTouchAction(action, effectiveTou
chAction); | 3640 effectiveTouchAction = intersectTouchAction(action, effectiveTou
chAction); |
3646 if (effectiveTouchAction == TouchActionNone) | 3641 if (effectiveTouchAction == TouchActionNone) |
3647 break; | 3642 break; |
3648 } | 3643 } |
3649 | 3644 |
3650 // If we've reached an ancestor that supports a touch action, search
no further. | 3645 // If we've reached an ancestor that supports a touch action, search
no further. |
3651 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) | 3646 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) |
3652 break; | 3647 break; |
3653 } | 3648 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3733 unsigned EventHandler::accessKeyModifiers() | 3728 unsigned EventHandler::accessKeyModifiers() |
3734 { | 3729 { |
3735 #if OS(MACOSX) | 3730 #if OS(MACOSX) |
3736 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3731 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3737 #else | 3732 #else |
3738 return PlatformEvent::AltKey; | 3733 return PlatformEvent::AltKey; |
3739 #endif | 3734 #endif |
3740 } | 3735 } |
3741 | 3736 |
3742 } // namespace WebCore | 3737 } // namespace WebCore |
OLD | NEW |