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 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1801 return mainFrameImpl()->frameView()->horizontalScrollbar(); | 1801 return mainFrameImpl()->frameView()->horizontalScrollbar(); |
1802 } | 1802 } |
1803 | 1803 |
1804 bool WebViewImpl::hasVerticalScrollbar() | 1804 bool WebViewImpl::hasVerticalScrollbar() |
1805 { | 1805 { |
1806 return mainFrameImpl()->frameView()->verticalScrollbar(); | 1806 return mainFrameImpl()->frameView()->verticalScrollbar(); |
1807 } | 1807 } |
1808 | 1808 |
1809 const WebInputEvent* WebViewImpl::m_currentInputEvent = 0; | 1809 const WebInputEvent* WebViewImpl::m_currentInputEvent = 0; |
1810 | 1810 |
1811 static const AtomicString* inputTypeToName(WebInputEvent::Type type) | |
ojan
2014/06/05 21:14:15
Add a FIXME to autogenerate this in EventTypeNames
chrishtr
2014/06/05 21:32:37
Done.
chrishtr
2014/06/05 21:32:37
Done.
| |
1812 { | |
1813 switch (type) { | |
1814 case WebInputEvent::MouseDown: | |
1815 return &EventTypeNames::mousedown; | |
1816 case WebInputEvent::MouseUp: | |
1817 return &EventTypeNames::mouseup; | |
1818 case WebInputEvent::MouseMove: | |
1819 return &EventTypeNames::mousemove; | |
1820 case WebInputEvent::MouseEnter: | |
1821 return &EventTypeNames::mouseenter; | |
1822 case WebInputEvent::MouseLeave: | |
1823 return &EventTypeNames::mouseleave; | |
1824 case WebInputEvent::ContextMenu: | |
1825 return &EventTypeNames::contextmenu; | |
1826 case WebInputEvent::MouseWheel: | |
1827 return &EventTypeNames::mousewheel; | |
1828 case WebInputEvent::KeyDown: | |
1829 return &EventTypeNames::keydown; | |
1830 case WebInputEvent::KeyUp: | |
1831 return &EventTypeNames::keyup; | |
1832 case WebInputEvent::GestureScrollBegin: | |
1833 return &EventTypeNames::gesturescrollstart; | |
1834 case WebInputEvent::GestureScrollEnd: | |
1835 return &EventTypeNames::gesturescrollend; | |
1836 case WebInputEvent::GestureScrollUpdate: | |
1837 return &EventTypeNames::gesturescrollupdate; | |
1838 case WebInputEvent::TouchStart: | |
1839 return &EventTypeNames::touchstart; | |
1840 case WebInputEvent::TouchMove: | |
1841 return &EventTypeNames::touchmove; | |
1842 case WebInputEvent::TouchEnd: | |
1843 return &EventTypeNames::touchend; | |
1844 case WebInputEvent::TouchCancel: | |
1845 return &EventTypeNames::touchcancel; | |
1846 default: | |
1847 return 0; | |
1848 } | |
1849 } | |
1850 | |
1811 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) | 1851 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) |
1812 { | 1852 { |
1813 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); | 1853 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); |
1814 // On the first input event since page load, |notifier| instructs the | 1854 // On the first input event since page load, |notifier| instructs the |
1815 // autofill client to unblock values of password input fields of any forms | 1855 // autofill client to unblock values of password input fields of any forms |
1816 // on the page. There is a single input event, GestureTap, which can both | 1856 // on the page. There is a single input event, GestureTap, which can both |
1817 // be the first event after page load, and cause a form submission. In that | 1857 // be the first event after page load, and cause a form submission. In that |
1818 // case, the form submission happens before the autofill client is told | 1858 // case, the form submission happens before the autofill client is told |
1819 // to unblock the password values, and so the password values are not | 1859 // to unblock the password values, and so the password values are not |
1820 // submitted. To avoid that, GestureTap is handled explicitly: | 1860 // submitted. To avoid that, GestureTap is handled explicitly: |
1821 if (inputEvent.type == WebInputEvent::GestureTap && m_autofillClient) { | 1861 if (inputEvent.type == WebInputEvent::GestureTap && m_autofillClient) { |
1822 m_userGestureObserved = true; | 1862 m_userGestureObserved = true; |
1823 m_autofillClient->firstUserGestureObserved(); | 1863 m_autofillClient->firstUserGestureObserved(); |
1824 } | 1864 } |
1825 | 1865 |
1826 TRACE_EVENT0("input", "WebViewImpl::handleInputEvent"); | 1866 const AtomicString* inputEventName = inputTypeToName(inputEvent.type); |
1867 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputEventNam e ? TRACE_STR_COPY(inputEventName->ascii().data()) : "unknown"); | |
1827 // If we've started a drag and drop operation, ignore input events until | 1868 // If we've started a drag and drop operation, ignore input events until |
1828 // we're done. | 1869 // we're done. |
1829 if (m_doingDragAndDrop) | 1870 if (m_doingDragAndDrop) |
1830 return true; | 1871 return true; |
1831 | 1872 |
1832 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input Event)) | 1873 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input Event)) |
1833 return true; | 1874 return true; |
1834 | 1875 |
1835 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. | 1876 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. |
1836 if (m_ignoreInputEvents) | 1877 if (m_ignoreInputEvents) |
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4063 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4104 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
4064 | 4105 |
4065 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4106 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4066 return false; | 4107 return false; |
4067 | 4108 |
4068 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4109 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4069 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4110 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
4070 } | 4111 } |
4071 | 4112 |
4072 } // namespace blink | 4113 } // namespace blink |
OLD | NEW |