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 3885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 | 3896 |
3897 float magnifyDelta = exp(event.deltaY() * 0.002f); | 3897 float magnifyDelta = exp(event.deltaY() * 0.002f); |
3898 float newPageScaleFactor = pageScaleFactor * magnifyDelta; | 3898 float newPageScaleFactor = pageScaleFactor * magnifyDelta; |
3899 | 3899 |
3900 IntPoint anchorAfterCss(anchorBeforeDip); | 3900 IntPoint anchorAfterCss(anchorBeforeDip); |
3901 anchorAfterCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor); | 3901 anchorAfterCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor); |
3902 page->inspectorController().requestPageScaleFactor(newPageScaleFactor, ancho
rBeforeCss - toIntSize(anchorAfterCss)); | 3902 page->inspectorController().requestPageScaleFactor(newPageScaleFactor, ancho
rBeforeCss - toIntSize(anchorAfterCss)); |
3903 return true; | 3903 return true; |
3904 } | 3904 } |
3905 | 3905 |
| 3906 TouchAction EventHandler::intersectTouchAction(TouchAction action1, TouchAction
action2) |
| 3907 { |
| 3908 if (action1 == TouchActionNone || action2 == TouchActionNone) |
| 3909 return TouchActionNone; |
| 3910 if (action1 == TouchActionAuto) |
| 3911 return action2; |
| 3912 if (action2 == TouchActionAuto) |
| 3913 return action1; |
| 3914 if (!(action1 & action2)) |
| 3915 return TouchActionNone; |
| 3916 return action1 & action2; |
| 3917 } |
| 3918 |
3906 TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) | 3919 TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
3907 { | 3920 { |
3908 // Optimization to minimize risk of this new feature (behavior should be ide
ntical | 3921 // Optimization to minimize risk of this new feature (behavior should be ide
ntical |
3909 // since there's no way to get non-default touch-action values). | 3922 // since there's no way to get non-default touch-action values). |
3910 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) | 3923 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) |
3911 return TouchActionAuto; | 3924 return TouchActionAuto; |
3912 | 3925 |
3913 // Start by permitting all actions, then walk the block level elements from | 3926 // Start by permitting all actions, then walk the block level elements from |
3914 // the target node up to the nearest scrollable ancestor and exclude any | 3927 // the target node up to the nearest scrollable ancestor and exclude any |
3915 // prohibited actions. For now this is trivial, but when we add more types | 3928 // prohibited actions. For now this is trivial, but when we add more types |
3916 // of actions it'll get a little more complex. | 3929 // of actions it'll get a little more complex. |
| 3930 TouchAction effectiveTouchAction = TouchActionAuto; |
3917 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal:
:parent(curNode)) { | 3931 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal:
:parent(curNode)) { |
3918 // The spec says only block and SVG elements get touch-action. | 3932 // The spec says only block and SVG elements get touch-action. |
3919 // FIXME(rbyers): Add correct support for SVG, crbug.com/247396. | 3933 // FIXME(rbyers): Add correct support for SVG, crbug.com/247396. |
3920 if (RenderObject* renderer = curNode->renderer()) { | 3934 if (RenderObject* renderer = curNode->renderer()) { |
3921 if (renderer->isRenderBlockFlow()) { | 3935 if (renderer->isRenderBlockFlow()) { |
3922 if (renderer->style()->touchAction() == TouchActionNone) | 3936 TouchAction action = renderer->style()->touchAction(); |
3923 return TouchActionNone; | 3937 effectiveTouchAction = intersectTouchAction(action, effectiveTou
chAction); |
| 3938 if (effectiveTouchAction == TouchActionNone) |
| 3939 break; |
3924 } | 3940 } |
3925 | 3941 |
3926 // If we've reached an ancestor that supports a touch action, search
no further. | 3942 // If we've reached an ancestor that supports a touch action, search
no further. |
3927 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) | 3943 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) |
3928 break; | 3944 break; |
3929 } | 3945 } |
3930 } | 3946 } |
3931 return TouchActionAuto; | 3947 return effectiveTouchAction; |
3932 } | 3948 } |
3933 | 3949 |
3934 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) | 3950 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) |
3935 { | 3951 { |
3936 m_mousePositionIsUnknown = false; | 3952 m_mousePositionIsUnknown = false; |
3937 m_lastKnownMousePosition = event.position(); | 3953 m_lastKnownMousePosition = event.position(); |
3938 m_lastKnownMouseGlobalPosition = event.globalPosition(); | 3954 m_lastKnownMouseGlobalPosition = event.globalPosition(); |
3939 } | 3955 } |
3940 | 3956 |
3941 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
ev, Frame* subframe) | 3957 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
ev, Frame* subframe) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4009 unsigned EventHandler::accessKeyModifiers() | 4025 unsigned EventHandler::accessKeyModifiers() |
4010 { | 4026 { |
4011 #if OS(MACOSX) | 4027 #if OS(MACOSX) |
4012 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4028 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4013 #else | 4029 #else |
4014 return PlatformEvent::AltKey; | 4030 return PlatformEvent::AltKey; |
4015 #endif | 4031 #endif |
4016 } | 4032 } |
4017 | 4033 |
4018 } // namespace WebCore | 4034 } // namespace WebCore |
OLD | NEW |