| 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 } | 576 } |
| 577 | 577 |
| 578 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) | 578 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) |
| 579 { | 579 { |
| 580 hidePopups(); | 580 hidePopups(); |
| 581 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 581 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
| 582 } | 582 } |
| 583 | 583 |
| 584 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) | 584 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) |
| 585 { | 585 { |
| 586 if (m_flingSourceDevice == WebGestureEvent::Touchpad) { | 586 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { |
| 587 WebMouseWheelEvent syntheticWheel; | 587 WebMouseWheelEvent syntheticWheel; |
| 588 const float tickDivisor = WebCore::WheelEvent::TickMultiplier; | 588 const float tickDivisor = WebCore::WheelEvent::TickMultiplier; |
| 589 | 589 |
| 590 syntheticWheel.deltaX = delta.width; | 590 syntheticWheel.deltaX = delta.width; |
| 591 syntheticWheel.deltaY = delta.height; | 591 syntheticWheel.deltaY = delta.height; |
| 592 syntheticWheel.wheelTicksX = delta.width / tickDivisor; | 592 syntheticWheel.wheelTicksX = delta.width / tickDivisor; |
| 593 syntheticWheel.wheelTicksY = delta.height / tickDivisor; | 593 syntheticWheel.wheelTicksY = delta.height / tickDivisor; |
| 594 syntheticWheel.hasPreciseScrollingDeltas = true; | 594 syntheticWheel.hasPreciseScrollingDeltas = true; |
| 595 syntheticWheel.x = m_positionOnFlingStart.x; | 595 syntheticWheel.x = m_positionOnFlingStart.x; |
| 596 syntheticWheel.y = m_positionOnFlingStart.y; | 596 syntheticWheel.y = m_positionOnFlingStart.y; |
| 597 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 597 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; |
| 598 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 598 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; |
| 599 syntheticWheel.modifiers = m_flingModifier; | 599 syntheticWheel.modifiers = m_flingModifier; |
| 600 | 600 |
| 601 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) | 601 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) |
| 602 return handleMouseWheel(*m_page->mainFrame(), syntheticWheel); | 602 return handleMouseWheel(*m_page->mainFrame(), syntheticWheel); |
| 603 } else { | 603 } else { |
| 604 WebGestureEvent syntheticGestureEvent; | 604 WebGestureEvent syntheticGestureEvent; |
| 605 | 605 |
| 606 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr
opagation; | 606 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr
opagation; |
| 607 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; | 607 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; |
| 608 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; | 608 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; |
| 609 syntheticGestureEvent.x = m_positionOnFlingStart.x; | 609 syntheticGestureEvent.x = m_positionOnFlingStart.x; |
| 610 syntheticGestureEvent.y = m_positionOnFlingStart.y; | 610 syntheticGestureEvent.y = m_positionOnFlingStart.y; |
| 611 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; | 611 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; |
| 612 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; | 612 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; |
| 613 syntheticGestureEvent.modifiers = m_flingModifier; | 613 syntheticGestureEvent.modifiers = m_flingModifier; |
| 614 syntheticGestureEvent.sourceDevice = WebGestureEvent::Touchscreen; | 614 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 615 | 615 |
| 616 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) | 616 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) |
| 617 return handleGestureEvent(syntheticGestureEvent); | 617 return handleGestureEvent(syntheticGestureEvent); |
| 618 } | 618 } |
| 619 return false; | 619 return false; |
| 620 } | 620 } |
| 621 | 621 |
| 622 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) | 622 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
| 623 { | 623 { |
| 624 bool eventSwallowed = false; | 624 bool eventSwallowed = false; |
| (...skipping 3449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4074 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4074 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4075 | 4075 |
| 4076 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4076 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4077 return false; | 4077 return false; |
| 4078 | 4078 |
| 4079 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4079 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4080 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4080 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4081 } | 4081 } |
| 4082 | 4082 |
| 4083 } // namespace blink | 4083 } // namespace blink |
| OLD | NEW |