| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 } | 748 } |
| 749 | 749 |
| 750 RefPtr<WebCore::PopupContainer> selectPopup; | 750 RefPtr<WebCore::PopupContainer> selectPopup; |
| 751 selectPopup = m_selectPopup; | 751 selectPopup = m_selectPopup; |
| 752 hideSelectPopup(); | 752 hideSelectPopup(); |
| 753 ASSERT(!m_selectPopup); | 753 ASSERT(!m_selectPopup); |
| 754 | 754 |
| 755 // Don't trigger a disambiguation popup on sites designed for mobile dev
ices. | 755 // Don't trigger a disambiguation popup on sites designed for mobile dev
ices. |
| 756 // Instead, assume that the page has been designed with big enough butto
ns and links. | 756 // Instead, assume that the page has been designed with big enough butto
ns and links. |
| 757 if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds()) { | 757 if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds()) { |
| 758 IntRect boundingBox(event.x - event.data.tap.width / 2, event.y - ev
ent.data.tap.height / 2, event.data.tap.width, event.data.tap.height); | 758 // FIXME: didTapMultipleTargets should just take a rect instead of |
| 759 // an event. |
| 760 WebGestureEvent scaledEvent; |
| 761 scaledEvent.x = event.x / pageScaleFactor(); |
| 762 scaledEvent.y = event.y / pageScaleFactor(); |
| 763 scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor(
); |
| 764 scaledEvent.data.tap.height = event.data.tap.height / pageScaleFacto
r(); |
| 765 IntRect boundingBox(scaledEvent.x - scaledEvent.data.tap.width / 2,
scaledEvent.y - scaledEvent.data.tap.height / 2, scaledEvent.data.tap.width, sca
ledEvent.data.tap.height); |
| 759 Vector<IntRect> goodTargets; | 766 Vector<IntRect> goodTargets; |
| 760 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg
ets); | 767 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTarg
ets); |
| 761 // FIXME: replace touch adjustment code when numberOfGoodTargets ==
1? | 768 // FIXME: replace touch adjustment code when numberOfGoodTargets ==
1? |
| 762 // Single candidate case is currently handled by: https://bugs.webki
t.org/show_bug.cgi?id=85101 | 769 // Single candidate case is currently handled by: https://bugs.webki
t.org/show_bug.cgi?id=85101 |
| 763 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT
argets(event, goodTargets)) { | 770 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT
argets(scaledEvent, goodTargets)) { |
| 764 eventSwallowed = true; | 771 eventSwallowed = true; |
| 765 eventCancelled = true; | 772 eventCancelled = true; |
| 766 break; | 773 break; |
| 767 } | 774 } |
| 768 } | 775 } |
| 769 | 776 |
| 770 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(),
event); | 777 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(),
event); |
| 771 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGesture
Event(platformEvent); | 778 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGesture
Event(platformEvent); |
| 772 | 779 |
| 773 if (m_selectPopup && m_selectPopup == selectPopup) { | 780 if (m_selectPopup && m_selectPopup == selectPopup) { |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 } | 1354 } |
| 1348 | 1355 |
| 1349 void WebViewImpl::hasTouchEventHandlers(bool hasTouchHandlers) | 1356 void WebViewImpl::hasTouchEventHandlers(bool hasTouchHandlers) |
| 1350 { | 1357 { |
| 1351 if (m_client) | 1358 if (m_client) |
| 1352 m_client->hasTouchEventHandlers(hasTouchHandlers); | 1359 m_client->hasTouchEventHandlers(hasTouchHandlers); |
| 1353 } | 1360 } |
| 1354 | 1361 |
| 1355 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) | 1362 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) |
| 1356 { | 1363 { |
| 1364 // FIXME: Implement this. Note that the point must be divided by pageScaleFa
ctor. |
| 1357 return true; | 1365 return true; |
| 1358 } | 1366 } |
| 1359 | 1367 |
| 1360 #if !OS(DARWIN) | 1368 #if !OS(DARWIN) |
| 1361 // Mac has no way to open a context menu based on a keyboard event. | 1369 // Mac has no way to open a context menu based on a keyboard event. |
| 1362 bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) | 1370 bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) |
| 1363 { | 1371 { |
| 1364 // The contextMenuController() holds onto the last context menu that was | 1372 // The contextMenuController() holds onto the last context menu that was |
| 1365 // popped up on the page until a new one is created. We need to clear | 1373 // popped up on the page until a new one is created. We need to clear |
| 1366 // this menu before propagating the event through the DOM so that we can | 1374 // this menu before propagating the event through the DOM so that we can |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 default: | 2084 default: |
| 2077 ASSERT_NOT_REACHED(); | 2085 ASSERT_NOT_REACHED(); |
| 2078 } | 2086 } |
| 2079 | 2087 |
| 2080 node->dispatchMouseEvent( | 2088 node->dispatchMouseEvent( |
| 2081 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_ca
st<const WebMouseEvent*>(&inputEvent)), | 2089 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_ca
st<const WebMouseEvent*>(&inputEvent)), |
| 2082 eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCo
unt); | 2090 eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCo
unt); |
| 2083 return true; | 2091 return true; |
| 2084 } | 2092 } |
| 2085 | 2093 |
| 2086 const WebInputEvent* inputEventTransformed = &inputEvent; | 2094 return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, inputEvent)
; |
| 2087 if (m_page->settings()->applyPageScaleFactorInCompositor()) { | |
| 2088 WebMouseEvent mouseEvent; | |
| 2089 WebGestureEvent gestureEvent; | |
| 2090 if (WebInputEvent::isMouseEventType(inputEvent.type)) { | |
| 2091 mouseEvent = *static_cast<const WebMouseEvent*>(&inputEvent); | |
| 2092 mouseEvent.x = mouseEvent.x / pageScaleFactor(); | |
| 2093 mouseEvent.y = mouseEvent.y / pageScaleFactor(); | |
| 2094 inputEventTransformed = static_cast<const WebInputEvent*>(&mouseEven
t); | |
| 2095 } else if (WebInputEvent::isGestureEventType(inputEvent.type)) { | |
| 2096 gestureEvent = *static_cast<const WebGestureEvent*>(&inputEvent); | |
| 2097 gestureEvent.x = gestureEvent.x / pageScaleFactor(); | |
| 2098 gestureEvent.y = gestureEvent.y / pageScaleFactor(); | |
| 2099 gestureEvent.data.tap.width /= pageScaleFactor(); | |
| 2100 gestureEvent.data.tap.height /= pageScaleFactor(); | |
| 2101 inputEventTransformed = static_cast<const WebInputEvent*>(&gestureEv
ent); | |
| 2102 } | |
| 2103 } | |
| 2104 | |
| 2105 return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, *inputEvent
Transformed); | |
| 2106 } | 2095 } |
| 2107 | 2096 |
| 2108 void WebViewImpl::mouseCaptureLost() | 2097 void WebViewImpl::mouseCaptureLost() |
| 2109 { | 2098 { |
| 2110 m_mouseCaptureNode = 0; | 2099 m_mouseCaptureNode = 0; |
| 2111 } | 2100 } |
| 2112 | 2101 |
| 2113 void WebViewImpl::setFocus(bool enable) | 2102 void WebViewImpl::setFocus(bool enable) |
| 2114 { | 2103 { |
| 2115 m_page->focusController()->setFocused(enable); | 2104 m_page->focusController()->setFocused(enable); |
| (...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4399 #endif | 4388 #endif |
| 4400 | 4389 |
| 4401 bool WebViewImpl::shouldDisableDesktopWorkarounds() | 4390 bool WebViewImpl::shouldDisableDesktopWorkarounds() |
| 4402 { | 4391 { |
| 4403 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport
Arguments(); | 4392 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport
Arguments(); |
| 4404 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments.
userZoom | 4393 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments.
userZoom |
| 4405 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp
ortArguments::ValueAuto); | 4394 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp
ortArguments::ValueAuto); |
| 4406 } | 4395 } |
| 4407 | 4396 |
| 4408 } // namespace WebKit | 4397 } // namespace WebKit |
| OLD | NEW |