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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 mouseContextMenu(event); | 550 mouseContextMenu(event); |
551 #endif | 551 #endif |
552 } | 552 } |
553 | 553 |
554 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) | 554 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) |
555 { | 555 { |
556 hidePopups(); | 556 hidePopups(); |
557 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 557 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
558 } | 558 } |
559 | 559 |
560 void WebViewImpl::scrollBy(const WebFloatSize& delta) | 560 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) |
561 { | 561 { |
562 if (m_flingSourceDevice == WebGestureEvent::Touchpad) { | 562 if (m_flingSourceDevice == WebGestureEvent::Touchpad) { |
563 WebMouseWheelEvent syntheticWheel; | 563 WebMouseWheelEvent syntheticWheel; |
564 const float tickDivisor = WebCore::WheelEvent::TickMultiplier; | 564 const float tickDivisor = WebCore::WheelEvent::TickMultiplier; |
565 | 565 |
566 syntheticWheel.deltaX = delta.width; | 566 syntheticWheel.deltaX = delta.width; |
567 syntheticWheel.deltaY = delta.height; | 567 syntheticWheel.deltaY = delta.height; |
568 syntheticWheel.wheelTicksX = delta.width / tickDivisor; | 568 syntheticWheel.wheelTicksX = delta.width / tickDivisor; |
569 syntheticWheel.wheelTicksY = delta.height / tickDivisor; | 569 syntheticWheel.wheelTicksY = delta.height / tickDivisor; |
570 syntheticWheel.hasPreciseScrollingDeltas = true; | 570 syntheticWheel.hasPreciseScrollingDeltas = true; |
571 syntheticWheel.x = m_positionOnFlingStart.x; | 571 syntheticWheel.x = m_positionOnFlingStart.x; |
572 syntheticWheel.y = m_positionOnFlingStart.y; | 572 syntheticWheel.y = m_positionOnFlingStart.y; |
573 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 573 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; |
574 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 574 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; |
575 syntheticWheel.modifiers = m_flingModifier; | 575 syntheticWheel.modifiers = m_flingModifier; |
576 | 576 |
577 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) | 577 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) |
578 handleMouseWheel(*m_page->mainFrame(), syntheticWheel); | 578 return handleMouseWheel(*m_page->mainFrame(), syntheticWheel); |
579 } else { | 579 } else { |
580 WebGestureEvent syntheticGestureEvent; | 580 WebGestureEvent syntheticGestureEvent; |
581 | 581 |
582 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr
opagation; | 582 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr
opagation; |
583 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; | 583 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; |
584 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; | 584 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; |
585 syntheticGestureEvent.x = m_positionOnFlingStart.x; | 585 syntheticGestureEvent.x = m_positionOnFlingStart.x; |
586 syntheticGestureEvent.y = m_positionOnFlingStart.y; | 586 syntheticGestureEvent.y = m_positionOnFlingStart.y; |
587 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; | 587 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; |
588 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; | 588 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; |
589 syntheticGestureEvent.modifiers = m_flingModifier; | 589 syntheticGestureEvent.modifiers = m_flingModifier; |
590 syntheticGestureEvent.sourceDevice = WebGestureEvent::Touchscreen; | 590 syntheticGestureEvent.sourceDevice = WebGestureEvent::Touchscreen; |
591 | 591 |
592 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) | 592 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) |
593 handleGestureEvent(syntheticGestureEvent); | 593 return handleGestureEvent(syntheticGestureEvent); |
594 } | 594 } |
| 595 return false; |
| 596 } |
| 597 |
| 598 void WebViewImpl::scrollBy(const WebFloatSize& delta) |
| 599 { |
| 600 scrollBy(delta, WebFloatSize()); |
595 } | 601 } |
596 | 602 |
597 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) | 603 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
598 { | 604 { |
599 bool eventSwallowed = false; | 605 bool eventSwallowed = false; |
600 bool eventCancelled = false; // for disambiguation | 606 bool eventCancelled = false; // for disambiguation |
601 | 607 |
602 // Special handling for slow-path fling gestures. | 608 // Special handling for slow-path fling gestures. |
603 switch (event.type) { | 609 switch (event.type) { |
604 case WebInputEvent::GestureFlingStart: { | 610 case WebInputEvent::GestureFlingStart: { |
(...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4003 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4009 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4004 | 4010 |
4005 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4011 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4006 return false; | 4012 return false; |
4007 | 4013 |
4008 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4014 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4009 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4015 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4010 } | 4016 } |
4011 | 4017 |
4012 } // namespace blink | 4018 } // namespace blink |
OLD | NEW |