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

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

Issue 318753008: Add tracing output for the name of an input event to Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added comment. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // FIXME: autogenerate this kind of code, and use it throughout Blink rather tha n
1812 // the one-offs for subsets of these values.
1813 static const AtomicString* inputTypeToName(WebInputEvent::Type type)
1814 {
1815 switch (type) {
1816 case WebInputEvent::MouseDown:
1817 return &EventTypeNames::mousedown;
1818 case WebInputEvent::MouseUp:
1819 return &EventTypeNames::mouseup;
1820 case WebInputEvent::MouseMove:
1821 return &EventTypeNames::mousemove;
1822 case WebInputEvent::MouseEnter:
1823 return &EventTypeNames::mouseenter;
1824 case WebInputEvent::MouseLeave:
1825 return &EventTypeNames::mouseleave;
1826 case WebInputEvent::ContextMenu:
1827 return &EventTypeNames::contextmenu;
1828 case WebInputEvent::MouseWheel:
1829 return &EventTypeNames::mousewheel;
1830 case WebInputEvent::KeyDown:
1831 return &EventTypeNames::keydown;
1832 case WebInputEvent::KeyUp:
1833 return &EventTypeNames::keyup;
1834 case WebInputEvent::GestureScrollBegin:
1835 return &EventTypeNames::gesturescrollstart;
1836 case WebInputEvent::GestureScrollEnd:
1837 return &EventTypeNames::gesturescrollend;
1838 case WebInputEvent::GestureScrollUpdate:
1839 return &EventTypeNames::gesturescrollupdate;
1840 case WebInputEvent::TouchStart:
1841 return &EventTypeNames::touchstart;
1842 case WebInputEvent::TouchMove:
1843 return &EventTypeNames::touchmove;
1844 case WebInputEvent::TouchEnd:
1845 return &EventTypeNames::touchend;
1846 case WebInputEvent::TouchCancel:
1847 return &EventTypeNames::touchcancel;
1848 default:
1849 return 0;
1850 }
1851 }
1852
1811 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) 1853 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
1812 { 1854 {
1813 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved); 1855 UserGestureNotifier notifier(m_autofillClient, &m_userGestureObserved);
1814 // On the first input event since page load, |notifier| instructs the 1856 // On the first input event since page load, |notifier| instructs the
1815 // autofill client to unblock values of password input fields of any forms 1857 // 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 1858 // 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 1859 // 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 1860 // case, the form submission happens before the autofill client is told
1819 // to unblock the password values, and so the password values are not 1861 // to unblock the password values, and so the password values are not
1820 // submitted. To avoid that, GestureTap is handled explicitly: 1862 // submitted. To avoid that, GestureTap is handled explicitly:
1821 if (inputEvent.type == WebInputEvent::GestureTap && m_autofillClient) { 1863 if (inputEvent.type == WebInputEvent::GestureTap && m_autofillClient) {
1822 m_userGestureObserved = true; 1864 m_userGestureObserved = true;
1823 m_autofillClient->firstUserGestureObserved(); 1865 m_autofillClient->firstUserGestureObserved();
1824 } 1866 }
1825 1867
1826 TRACE_EVENT0("input", "WebViewImpl::handleInputEvent"); 1868 const AtomicString* inputEventName = inputTypeToName(inputEvent.type);
1869 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 1870 // If we've started a drag and drop operation, ignore input events until
1828 // we're done. 1871 // we're done.
1829 if (m_doingDragAndDrop) 1872 if (m_doingDragAndDrop)
1830 return true; 1873 return true;
1831 1874
1832 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input Event)) 1875 if (m_devToolsAgent && m_devToolsAgent->handleInputEvent(m_page.get(), input Event))
1833 return true; 1876 return true;
1834 1877
1835 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. 1878 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately.
1836 if (m_ignoreInputEvents) 1879 if (m_ignoreInputEvents)
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4106 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4064 4107
4065 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4108 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4066 return false; 4109 return false;
4067 4110
4068 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4111 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4069 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4112 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4070 } 4113 }
4071 4114
4072 } // namespace blink 4115 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698