| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ~MaximumDurationTracker() | 168 ~MaximumDurationTracker() |
| 169 { | 169 { |
| 170 *m_maxDuration = max(*m_maxDuration, monotonicallyIncreasingTime() - m_s
tart); | 170 *m_maxDuration = max(*m_maxDuration, monotonicallyIncreasingTime() - m_s
tart); |
| 171 } | 171 } |
| 172 | 172 |
| 173 private: | 173 private: |
| 174 double* m_maxDuration; | 174 double* m_maxDuration; |
| 175 double m_start; | 175 double m_start; |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 class SyntheticTouchPoint : public PlatformTouchPoint { | |
| 179 public: | |
| 180 | |
| 181 // The default values are based on http://dvcs.w3.org/hg/webevents/raw-file/
tip/touchevents.html | |
| 182 explicit SyntheticTouchPoint(const PlatformMouseEvent& event) | |
| 183 { | |
| 184 const static int idDefaultValue = 0; | |
| 185 const static int radiusYDefaultValue = 1; | |
| 186 const static int radiusXDefaultValue = 1; | |
| 187 const static float rotationAngleDefaultValue = 0.0f; | |
| 188 const static float forceDefaultValue = 1.0f; | |
| 189 | |
| 190 m_id = idDefaultValue; // There is only one active TouchPoint. | |
| 191 m_screenPos = event.globalPosition(); | |
| 192 m_pos = event.position(); | |
| 193 m_radiusY = radiusYDefaultValue; | |
| 194 m_radiusX = radiusXDefaultValue; | |
| 195 m_rotationAngle = rotationAngleDefaultValue; | |
| 196 m_force = forceDefaultValue; | |
| 197 | |
| 198 PlatformEvent::Type type = event.type(); | |
| 199 ASSERT(type == PlatformEvent::MouseMoved || type == PlatformEvent::Mouse
Pressed || type == PlatformEvent::MouseReleased); | |
| 200 | |
| 201 switch (type) { | |
| 202 case PlatformEvent::MouseMoved: | |
| 203 m_state = TouchMoved; | |
| 204 break; | |
| 205 case PlatformEvent::MousePressed: | |
| 206 m_state = TouchPressed; | |
| 207 break; | |
| 208 case PlatformEvent::MouseReleased: | |
| 209 m_state = TouchReleased; | |
| 210 break; | |
| 211 default: | |
| 212 ASSERT_NOT_REACHED(); | |
| 213 break; | |
| 214 } | |
| 215 } | |
| 216 }; | |
| 217 | |
| 218 class SyntheticSingleTouchEvent : public PlatformTouchEvent { | |
| 219 public: | |
| 220 explicit SyntheticSingleTouchEvent(const PlatformMouseEvent& event) | |
| 221 { | |
| 222 switch (event.type()) { | |
| 223 case PlatformEvent::MouseMoved: | |
| 224 m_type = TouchMove; | |
| 225 break; | |
| 226 case PlatformEvent::MousePressed: | |
| 227 m_type = TouchStart; | |
| 228 break; | |
| 229 case PlatformEvent::MouseReleased: | |
| 230 m_type = TouchEnd; | |
| 231 break; | |
| 232 default: | |
| 233 ASSERT_NOT_REACHED(); | |
| 234 m_type = NoType; | |
| 235 break; | |
| 236 } | |
| 237 m_timestamp = event.timestamp(); | |
| 238 m_modifiers = event.modifiers(); | |
| 239 m_touchPoints.append(SyntheticTouchPoint(event)); | |
| 240 } | |
| 241 }; | |
| 242 | |
| 243 static inline ScrollGranularity wheelGranularityToScrollGranularity(unsigned del
taMode) | 178 static inline ScrollGranularity wheelGranularityToScrollGranularity(unsigned del
taMode) |
| 244 { | 179 { |
| 245 switch (deltaMode) { | 180 switch (deltaMode) { |
| 246 case WheelEvent::DOM_DELTA_PAGE: | 181 case WheelEvent::DOM_DELTA_PAGE: |
| 247 return ScrollByPage; | 182 return ScrollByPage; |
| 248 case WheelEvent::DOM_DELTA_LINE: | 183 case WheelEvent::DOM_DELTA_LINE: |
| 249 return ScrollByLine; | 184 return ScrollByLine; |
| 250 case WheelEvent::DOM_DELTA_PIXEL: | 185 case WheelEvent::DOM_DELTA_PIXEL: |
| 251 return ScrollByPixel; | 186 return ScrollByPixel; |
| 252 default: | 187 default: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 , m_mouseDownTimestamp(0) | 223 , m_mouseDownTimestamp(0) |
| 289 , m_widgetIsLatched(false) | 224 , m_widgetIsLatched(false) |
| 290 , m_originatingTouchPointTargetKey(0) | 225 , m_originatingTouchPointTargetKey(0) |
| 291 , m_touchPressed(false) | 226 , m_touchPressed(false) |
| 292 , m_scrollGestureHandlingNode(nullptr) | 227 , m_scrollGestureHandlingNode(nullptr) |
| 293 , m_lastHitTestResultOverWidget(false) | 228 , m_lastHitTestResultOverWidget(false) |
| 294 , m_maxMouseMovedDuration(0) | 229 , m_maxMouseMovedDuration(0) |
| 295 , m_baseEventType(PlatformEvent::NoType) | 230 , m_baseEventType(PlatformEvent::NoType) |
| 296 , m_didStartDrag(false) | 231 , m_didStartDrag(false) |
| 297 , m_longTapShouldInvokeContextMenu(false) | 232 , m_longTapShouldInvokeContextMenu(false) |
| 298 , m_syntheticPageScaleFactor(0) | |
| 299 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) | 233 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) |
| 300 , m_lastShowPressTimestamp(0) | 234 , m_lastShowPressTimestamp(0) |
| 301 { | 235 { |
| 302 } | 236 } |
| 303 | 237 |
| 304 EventHandler::~EventHandler() | 238 EventHandler::~EventHandler() |
| 305 { | 239 { |
| 306 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); | 240 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); |
| 307 } | 241 } |
| 308 | 242 |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 // Historically the code would just crash; this is clearly no worse than tha
t. | 1226 // Historically the code would just crash; this is clearly no worse than tha
t. |
| 1293 return view ? view->windowToContents(windowPoint) : windowPoint; | 1227 return view ? view->windowToContents(windowPoint) : windowPoint; |
| 1294 } | 1228 } |
| 1295 | 1229 |
| 1296 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) | 1230 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) |
| 1297 { | 1231 { |
| 1298 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEvent"); | 1232 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEvent"); |
| 1299 | 1233 |
| 1300 RefPtr<FrameView> protector(m_frame->view()); | 1234 RefPtr<FrameView> protector(m_frame->view()); |
| 1301 | 1235 |
| 1302 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); | |
| 1303 if (defaultPrevented) | |
| 1304 return true; | |
| 1305 | |
| 1306 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 1236 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 1307 m_frame->tree().top()->eventHandler().m_lastMouseDownUserGestureToken = gest
ureIndicator.currentToken(); | 1237 m_frame->tree().top()->eventHandler().m_lastMouseDownUserGestureToken = gest
ureIndicator.currentToken(); |
| 1308 | 1238 |
| 1309 cancelFakeMouseMoveEvent(); | 1239 cancelFakeMouseMoveEvent(); |
| 1310 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1240 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 1311 m_capturingMouseEventsNode = nullptr; | 1241 m_capturingMouseEventsNode = nullptr; |
| 1312 m_mousePressed = true; | 1242 m_mousePressed = true; |
| 1313 m_capturesDragging = true; | 1243 m_capturesDragging = true; |
| 1314 setLastKnownMousePosition(mouseEvent); | 1244 setLastKnownMousePosition(mouseEvent); |
| 1315 m_mouseDownTimestamp = mouseEvent.timestamp(); | 1245 m_mouseDownTimestamp = mouseEvent.timestamp(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 } | 1416 } |
| 1487 | 1417 |
| 1488 void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event) | 1418 void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event) |
| 1489 { | 1419 { |
| 1490 TRACE_EVENT0("webkit", "EventHandler::handleMouseLeaveEvent"); | 1420 TRACE_EVENT0("webkit", "EventHandler::handleMouseLeaveEvent"); |
| 1491 | 1421 |
| 1492 RefPtr<FrameView> protector(m_frame->view()); | 1422 RefPtr<FrameView> protector(m_frame->view()); |
| 1493 handleMouseMoveOrLeaveEvent(event); | 1423 handleMouseMoveOrLeaveEvent(event); |
| 1494 } | 1424 } |
| 1495 | 1425 |
| 1496 static Cursor& syntheticTouchCursor() | |
| 1497 { | |
| 1498 DEFINE_STATIC_LOCAL(Cursor, c, (Image::loadPlatformResource("syntheticTouchC
ursor").get(), IntPoint(10, 10))); | |
| 1499 return c; | |
| 1500 } | |
| 1501 | |
| 1502 bool EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMouseEvent& mouseEv
ent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars) | 1426 bool EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMouseEvent& mouseEv
ent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars) |
| 1503 { | 1427 { |
| 1504 ASSERT(m_frame); | 1428 ASSERT(m_frame); |
| 1505 ASSERT(m_frame->view()); | 1429 ASSERT(m_frame->view()); |
| 1506 | 1430 |
| 1507 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); | |
| 1508 if (defaultPrevented) { | |
| 1509 m_frame->view()->setCursor(syntheticTouchCursor()); | |
| 1510 return true; | |
| 1511 } | |
| 1512 | |
| 1513 setLastKnownMousePosition(mouseEvent); | 1431 setLastKnownMousePosition(mouseEvent); |
| 1514 | 1432 |
| 1515 if (m_hoverTimer.isActive()) | 1433 if (m_hoverTimer.isActive()) |
| 1516 m_hoverTimer.stop(); | 1434 m_hoverTimer.stop(); |
| 1517 | 1435 |
| 1518 m_cursorUpdateTimer.stop(); | 1436 m_cursorUpdateTimer.stop(); |
| 1519 | 1437 |
| 1520 cancelFakeMouseMoveEvent(); | 1438 cancelFakeMouseMoveEvent(); |
| 1521 | 1439 |
| 1522 if (m_svgPan) { | 1440 if (m_svgPan) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 } | 1544 } |
| 1627 | 1545 |
| 1628 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) | 1546 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) |
| 1629 { | 1547 { |
| 1630 TRACE_EVENT0("webkit", "EventHandler::handleMouseReleaseEvent"); | 1548 TRACE_EVENT0("webkit", "EventHandler::handleMouseReleaseEvent"); |
| 1631 | 1549 |
| 1632 RefPtr<FrameView> protector(m_frame->view()); | 1550 RefPtr<FrameView> protector(m_frame->view()); |
| 1633 | 1551 |
| 1634 m_frame->selection().setCaretBlinkingSuspended(false); | 1552 m_frame->selection().setCaretBlinkingSuspended(false); |
| 1635 | 1553 |
| 1636 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); | |
| 1637 if (defaultPrevented) | |
| 1638 return true; | |
| 1639 | |
| 1640 OwnPtr<UserGestureIndicator> gestureIndicator; | 1554 OwnPtr<UserGestureIndicator> gestureIndicator; |
| 1641 | 1555 |
| 1642 if (m_frame->tree().top()->eventHandler().m_lastMouseDownUserGestureToken) | 1556 if (m_frame->tree().top()->eventHandler().m_lastMouseDownUserGestureToken) |
| 1643 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->tree().top
()->eventHandler().m_lastMouseDownUserGestureToken.release())); | 1557 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->tree().top
()->eventHandler().m_lastMouseDownUserGestureToken.release())); |
| 1644 else | 1558 else |
| 1645 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin
gUserGesture)); | 1559 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin
gUserGesture)); |
| 1646 | 1560 |
| 1647 #if OS(WIN) | 1561 #if OS(WIN) |
| 1648 if (Page* page = m_frame->page()) | 1562 if (Page* page = m_frame->page()) |
| 1649 page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame,
mouseEvent); | 1563 page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame,
mouseEvent); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 | 2059 |
| 2146 if (!doc->renderer()) | 2060 if (!doc->renderer()) |
| 2147 return false; | 2061 return false; |
| 2148 | 2062 |
| 2149 RefPtr<FrameView> protector(m_frame->view()); | 2063 RefPtr<FrameView> protector(m_frame->view()); |
| 2150 | 2064 |
| 2151 FrameView* view = m_frame->view(); | 2065 FrameView* view = m_frame->view(); |
| 2152 if (!view) | 2066 if (!view) |
| 2153 return false; | 2067 return false; |
| 2154 | 2068 |
| 2155 if (handleWheelEventAsEmulatedGesture(e)) | |
| 2156 return true; | |
| 2157 | |
| 2158 LayoutPoint vPoint = view->windowToContents(e.position()); | 2069 LayoutPoint vPoint = view->windowToContents(e.position()); |
| 2159 | 2070 |
| 2160 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::ConfusingA
ndOftenMisusedDisallowShadowContent); | 2071 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::ConfusingA
ndOftenMisusedDisallowShadowContent); |
| 2161 HitTestResult result(vPoint); | 2072 HitTestResult result(vPoint); |
| 2162 doc->renderView()->hitTest(request, result); | 2073 doc->renderView()->hitTest(request, result); |
| 2163 | 2074 |
| 2164 Node* node = result.innerNode(); | 2075 Node* node = result.innerNode(); |
| 2165 // Wheel events should not dispatch to text nodes. | 2076 // Wheel events should not dispatch to text nodes. |
| 2166 if (node && node->isTextNode()) | 2077 if (node && node->isTextNode()) |
| 2167 node = NodeRenderingTraversal::parent(node); | 2078 node = NodeRenderingTraversal::parent(node); |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3789 stateName, touchEventTarget->toNode()->document().domWindow(
), | 3700 stateName, touchEventTarget->toNode()->document().domWindow(
), |
| 3790 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(
), event.metaKey()); | 3701 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(
), event.metaKey()); |
| 3791 touchEventTarget->toNode()->dispatchTouchEvent(touchEvent.get()); | 3702 touchEventTarget->toNode()->dispatchTouchEvent(touchEvent.get()); |
| 3792 swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() ||
touchEvent->defaultHandled(); | 3703 swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() ||
touchEvent->defaultHandled(); |
| 3793 } | 3704 } |
| 3794 } | 3705 } |
| 3795 | 3706 |
| 3796 return swallowedEvent; | 3707 return swallowedEvent; |
| 3797 } | 3708 } |
| 3798 | 3709 |
| 3799 bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent
& event) | |
| 3800 { | |
| 3801 if (!m_frame || !m_frame->settings() || !m_frame->settings()->touchEventEmul
ationEnabled()) | |
| 3802 return false; | |
| 3803 | |
| 3804 PlatformEvent::Type eventType = event.type(); | |
| 3805 if (eventType != PlatformEvent::MouseMoved && eventType != PlatformEvent::Mo
usePressed && eventType != PlatformEvent::MouseReleased) | |
| 3806 return false; | |
| 3807 | |
| 3808 HitTestRequest request(HitTestRequest::Active | HitTestRequest::ConfusingAnd
OftenMisusedDisallowShadowContent); | |
| 3809 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); | |
| 3810 if (mev.scrollbar() || subframeForHitTestResult(mev)) | |
| 3811 return false; | |
| 3812 | |
| 3813 // The order is important. This check should follow the subframe test: http:
//webkit.org/b/111292. | |
| 3814 if (eventType == PlatformEvent::MouseMoved && event.button() == NoButton) | |
| 3815 return true; | |
| 3816 | |
| 3817 SyntheticSingleTouchEvent touchEvent(event); | |
| 3818 if (handleTouchEvent(touchEvent)) | |
| 3819 return true; | |
| 3820 | |
| 3821 return handleMouseEventAsEmulatedGesture(event); | |
| 3822 } | |
| 3823 | |
| 3824 bool EventHandler::handleMouseEventAsEmulatedGesture(const PlatformMouseEvent& e
vent) | |
| 3825 { | |
| 3826 PlatformEvent::Type eventType = event.type(); | |
| 3827 if (event.button() != LeftButton || !m_frame->isMainFrame()) | |
| 3828 return false; | |
| 3829 | |
| 3830 // Simulate pinch / scroll gesture. | |
| 3831 const IntPoint& position = event.position(); | |
| 3832 bool swallowEvent = false; | |
| 3833 | |
| 3834 FrameView* view = m_frame->view(); | |
| 3835 if (event.shiftKey()) { | |
| 3836 // Shift pressed - consider it gesture. | |
| 3837 swallowEvent = true; | |
| 3838 Page* page = m_frame->page(); | |
| 3839 float pageScaleFactor = page->pageScaleFactor(); | |
| 3840 switch (eventType) { | |
| 3841 case PlatformEvent::MousePressed: | |
| 3842 m_lastSyntheticPinchAnchorCss = adoptPtr(new IntPoint(view->scrollPo
sition() + position)); | |
| 3843 m_lastSyntheticPinchAnchorDip = adoptPtr(new IntPoint(position)); | |
| 3844 m_lastSyntheticPinchAnchorDip->scale(pageScaleFactor, pageScaleFacto
r); | |
| 3845 m_syntheticPageScaleFactor = pageScaleFactor; | |
| 3846 break; | |
| 3847 case PlatformEvent::MouseMoved: | |
| 3848 { | |
| 3849 if (!m_lastSyntheticPinchAnchorCss) | |
| 3850 break; | |
| 3851 | |
| 3852 float dy = m_lastSyntheticPinchAnchorDip->y() - position.y() * p
ageScaleFactor; | |
| 3853 float magnifyDelta = exp(dy * 0.002f); | |
| 3854 float newPageScaleFactor = m_syntheticPageScaleFactor * magnifyD
elta; | |
| 3855 | |
| 3856 IntPoint anchorCss(*m_lastSyntheticPinchAnchorDip.get()); | |
| 3857 anchorCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFact
or); | |
| 3858 page->inspectorController().requestPageScaleFactor(newPageScaleF
actor, *m_lastSyntheticPinchAnchorCss.get() - toIntSize(anchorCss)); | |
| 3859 break; | |
| 3860 } | |
| 3861 case PlatformEvent::MouseReleased: | |
| 3862 m_lastSyntheticPinchAnchorCss.clear(); | |
| 3863 m_lastSyntheticPinchAnchorDip.clear(); | |
| 3864 default: | |
| 3865 break; | |
| 3866 } | |
| 3867 } else { | |
| 3868 switch (eventType) { | |
| 3869 case PlatformEvent::MouseMoved: | |
| 3870 { | |
| 3871 // Always consume move events. | |
| 3872 swallowEvent = true; | |
| 3873 int dx = m_lastSyntheticPanLocation ? position.x() - m_lastSynth
eticPanLocation->x() : 0; | |
| 3874 int dy = m_lastSyntheticPanLocation ? position.y() - m_lastSynth
eticPanLocation->y() : 0; | |
| 3875 if (dx || dy) | |
| 3876 view->scrollBy(IntSize(-dx, -dy)); | |
| 3877 // Mouse dragged - consider it gesture. | |
| 3878 m_lastSyntheticPanLocation = adoptPtr(new IntPoint(position)); | |
| 3879 break; | |
| 3880 } | |
| 3881 case PlatformEvent::MouseReleased: | |
| 3882 // There was a drag -> gesture. | |
| 3883 swallowEvent = !!m_lastSyntheticPanLocation; | |
| 3884 m_lastSyntheticPanLocation.clear(); | |
| 3885 default: | |
| 3886 break; | |
| 3887 } | |
| 3888 } | |
| 3889 | |
| 3890 return swallowEvent; | |
| 3891 } | |
| 3892 | |
| 3893 bool EventHandler::handleWheelEventAsEmulatedGesture(const PlatformWheelEvent& e
vent) | |
| 3894 { | |
| 3895 if (!m_frame || !m_frame->settings() || !m_frame->settings()->touchEventEmul
ationEnabled()) | |
| 3896 return false; | |
| 3897 | |
| 3898 // Only convert vertical wheel w/ shift into pinch for touch-enabled device
convenience. | |
| 3899 if (!event.shiftKey() || !event.deltaY()) | |
| 3900 return false; | |
| 3901 | |
| 3902 Page* page = m_frame->page(); | |
| 3903 FrameView* view = m_frame->view(); | |
| 3904 float pageScaleFactor = page->pageScaleFactor(); | |
| 3905 IntPoint anchorBeforeCss(view->scrollPosition() + event.position()); | |
| 3906 IntPoint anchorBeforeDip(event.position()); | |
| 3907 anchorBeforeDip.scale(pageScaleFactor, pageScaleFactor); | |
| 3908 | |
| 3909 float magnifyDelta = exp(event.deltaY() * 0.002f); | |
| 3910 float newPageScaleFactor = pageScaleFactor * magnifyDelta; | |
| 3911 | |
| 3912 IntPoint anchorAfterCss(anchorBeforeDip); | |
| 3913 anchorAfterCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor); | |
| 3914 page->inspectorController().requestPageScaleFactor(newPageScaleFactor, ancho
rBeforeCss - toIntSize(anchorAfterCss)); | |
| 3915 return true; | |
| 3916 } | |
| 3917 | |
| 3918 TouchAction EventHandler::intersectTouchAction(TouchAction action1, TouchAction
action2) | 3710 TouchAction EventHandler::intersectTouchAction(TouchAction action1, TouchAction
action2) |
| 3919 { | 3711 { |
| 3920 if (action1 == TouchActionNone || action2 == TouchActionNone) | 3712 if (action1 == TouchActionNone || action2 == TouchActionNone) |
| 3921 return TouchActionNone; | 3713 return TouchActionNone; |
| 3922 if (action1 == TouchActionAuto) | 3714 if (action1 == TouchActionAuto) |
| 3923 return action2; | 3715 return action2; |
| 3924 if (action2 == TouchActionAuto) | 3716 if (action2 == TouchActionAuto) |
| 3925 return action1; | 3717 return action1; |
| 3926 if (!(action1 & action2)) | 3718 if (!(action1 & action2)) |
| 3927 return TouchActionNone; | 3719 return TouchActionNone; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4042 unsigned EventHandler::accessKeyModifiers() | 3834 unsigned EventHandler::accessKeyModifiers() |
| 4043 { | 3835 { |
| 4044 #if OS(MACOSX) | 3836 #if OS(MACOSX) |
| 4045 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3837 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 4046 #else | 3838 #else |
| 4047 return PlatformEvent::AltKey; | 3839 return PlatformEvent::AltKey; |
| 4048 #endif | 3840 #endif |
| 4049 } | 3841 } |
| 4050 | 3842 |
| 4051 } // namespace WebCore | 3843 } // namespace WebCore |
| OLD | NEW |