Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 197213011: Selectively disable rubber banding on mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 PageWidgetEventHandler::handleMouseUp(mainFrame, event); 540 PageWidgetEventHandler::handleMouseUp(mainFrame, event);
541 541
542 #if OS(WIN) 542 #if OS(WIN)
543 // Dispatch the contextmenu event regardless of if the click was swallowed. 543 // Dispatch the contextmenu event regardless of if the click was swallowed.
544 // On Mac/Linux, we handle it on mouse down, not up. 544 // On Mac/Linux, we handle it on mouse down, not up.
545 if (event.button == WebMouseEvent::ButtonRight) 545 if (event.button == WebMouseEvent::ButtonRight)
546 mouseContextMenu(event); 546 mouseContextMenu(event);
547 #endif 547 #endif
548 } 548 }
549 549
550 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event) 550 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event, bool canRubberbandLeft, bool canRubberbandRight)
551 { 551 {
552 hidePopups(); 552 hidePopups();
553 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); 553 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event, canRubberb andLeft, canRubberbandRight);
554 } 554 }
555 555
556 void WebViewImpl::scrollBy(const WebFloatSize& delta) 556 void WebViewImpl::scrollBy(const WebFloatSize& delta)
557 { 557 {
558 if (m_flingSourceDevice == WebGestureEvent::Touchpad) { 558 if (m_flingSourceDevice == WebGestureEvent::Touchpad) {
559 WebMouseWheelEvent syntheticWheel; 559 WebMouseWheelEvent syntheticWheel;
560 const float tickDivisor = WebCore::WheelEvent::TickMultiplier; 560 const float tickDivisor = WebCore::WheelEvent::TickMultiplier;
561 561
562 syntheticWheel.deltaX = delta.width; 562 syntheticWheel.deltaX = delta.width;
563 syntheticWheel.deltaY = delta.height; 563 syntheticWheel.deltaY = delta.height;
564 syntheticWheel.wheelTicksX = delta.width / tickDivisor; 564 syntheticWheel.wheelTicksX = delta.width / tickDivisor;
565 syntheticWheel.wheelTicksY = delta.height / tickDivisor; 565 syntheticWheel.wheelTicksY = delta.height / tickDivisor;
566 syntheticWheel.hasPreciseScrollingDeltas = true; 566 syntheticWheel.hasPreciseScrollingDeltas = true;
567 syntheticWheel.x = m_positionOnFlingStart.x; 567 syntheticWheel.x = m_positionOnFlingStart.x;
568 syntheticWheel.y = m_positionOnFlingStart.y; 568 syntheticWheel.y = m_positionOnFlingStart.y;
569 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; 569 syntheticWheel.globalX = m_globalPositionOnFlingStart.x;
570 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; 570 syntheticWheel.globalY = m_globalPositionOnFlingStart.y;
571 syntheticWheel.modifiers = m_flingModifier; 571 syntheticWheel.modifiers = m_flingModifier;
572 572
573 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) 573 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view())
574 handleMouseWheel(*m_page->mainFrame(), syntheticWheel); 574 handleMouseWheel(*m_page->mainFrame(), syntheticWheel, false, false) ;
575 } else { 575 } else {
576 WebGestureEvent syntheticGestureEvent; 576 WebGestureEvent syntheticGestureEvent;
577 577
578 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr opagation; 578 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr opagation;
579 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; 579 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width;
580 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; 580 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height;
581 syntheticGestureEvent.x = m_positionOnFlingStart.x; 581 syntheticGestureEvent.x = m_positionOnFlingStart.x;
582 syntheticGestureEvent.y = m_positionOnFlingStart.y; 582 syntheticGestureEvent.y = m_positionOnFlingStart.y;
583 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; 583 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x;
584 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; 584 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y;
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 1745
1746 bool WebViewImpl::hasVerticalScrollbar() 1746 bool WebViewImpl::hasVerticalScrollbar()
1747 { 1747 {
1748 return mainFrameImpl()->frameView()->verticalScrollbar(); 1748 return mainFrameImpl()->frameView()->verticalScrollbar();
1749 } 1749 }
1750 1750
1751 const WebInputEvent* WebViewImpl::m_currentInputEvent = 0; 1751 const WebInputEvent* WebViewImpl::m_currentInputEvent = 0;
1752 1752
1753 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) 1753 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
1754 { 1754 {
1755 return handleInputEvent(inputEvent, true, true);
1756 }
1757 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent, bool canRubb erbandLeft, bool canRubberbandRight)
1758 {
1755 TRACE_EVENT0("input", "WebViewImpl::handleInputEvent"); 1759 TRACE_EVENT0("input", "WebViewImpl::handleInputEvent");
1756 // If we've started a drag and drop operation, ignore input events until 1760 // If we've started a drag and drop operation, ignore input events until
1757 // we're done. 1761 // we're done.
1758 if (m_doingDragAndDrop) 1762 if (m_doingDragAndDrop)
1759 return true; 1763 return true;
1760 1764
1761 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input Event)) 1765 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input Event))
1762 return true; 1766 return true;
1763 1767
1764 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. 1768 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 default: 1802 default:
1799 ASSERT_NOT_REACHED(); 1803 ASSERT_NOT_REACHED();
1800 } 1804 }
1801 1805
1802 node->dispatchMouseEvent( 1806 node->dispatchMouseEvent(
1803 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_ca st<const WebMouseEvent*>(&inputEvent)), 1807 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_ca st<const WebMouseEvent*>(&inputEvent)),
1804 eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCo unt); 1808 eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCo unt);
1805 return true; 1809 return true;
1806 } 1810 }
1807 1811
1808 return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, inputEvent) ; 1812 return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, inputEvent, canRubberbandLeft, canRubberbandRight);
1809 } 1813 }
1810 1814
1811 void WebViewImpl::setCursorVisibilityState(bool isVisible) 1815 void WebViewImpl::setCursorVisibilityState(bool isVisible)
1812 { 1816 {
1813 if (m_page) 1817 if (m_page)
1814 m_page->setIsCursorVisible(isVisible); 1818 m_page->setIsCursorVisible(isVisible);
1815 } 1819 }
1816 1820
1817 void WebViewImpl::mouseCaptureLost() 1821 void WebViewImpl::mouseCaptureLost()
1818 { 1822 {
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after
3968 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 3972 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
3969 3973
3970 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 3974 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
3971 return false; 3975 return false;
3972 3976
3973 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 3977 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
3974 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 3978 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
3975 } 3979 }
3976 3980
3977 } // namespace blink 3981 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698