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

Side by Side Diff: sky/engine/web/WebViewImpl.cpp

Issue 868933003: Remove user gesture tracking (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "sky/engine/core/rendering/RenderView.h" 63 #include "sky/engine/core/rendering/RenderView.h"
64 #include "sky/engine/platform/Cursor.h" 64 #include "sky/engine/platform/Cursor.h"
65 #include "sky/engine/platform/KeyboardCodes.h" 65 #include "sky/engine/platform/KeyboardCodes.h"
66 #include "sky/engine/platform/Logging.h" 66 #include "sky/engine/platform/Logging.h"
67 #include "sky/engine/platform/NotImplemented.h" 67 #include "sky/engine/platform/NotImplemented.h"
68 #include "sky/engine/platform/PlatformGestureEvent.h" 68 #include "sky/engine/platform/PlatformGestureEvent.h"
69 #include "sky/engine/platform/PlatformKeyboardEvent.h" 69 #include "sky/engine/platform/PlatformKeyboardEvent.h"
70 #include "sky/engine/platform/PlatformMouseEvent.h" 70 #include "sky/engine/platform/PlatformMouseEvent.h"
71 #include "sky/engine/platform/PlatformWheelEvent.h" 71 #include "sky/engine/platform/PlatformWheelEvent.h"
72 #include "sky/engine/platform/TraceEvent.h" 72 #include "sky/engine/platform/TraceEvent.h"
73 #include "sky/engine/platform/UserGestureIndicator.h"
74 #include "sky/engine/platform/fonts/FontCache.h" 73 #include "sky/engine/platform/fonts/FontCache.h"
75 #include "sky/engine/platform/graphics/Color.h" 74 #include "sky/engine/platform/graphics/Color.h"
76 #include "sky/engine/platform/graphics/GraphicsContext.h" 75 #include "sky/engine/platform/graphics/GraphicsContext.h"
77 #include "sky/engine/platform/graphics/Image.h" 76 #include "sky/engine/platform/graphics/Image.h"
78 #include "sky/engine/platform/graphics/ImageBuffer.h" 77 #include "sky/engine/platform/graphics/ImageBuffer.h"
79 #include "sky/engine/platform/scroll/Scrollbar.h" 78 #include "sky/engine/platform/scroll/Scrollbar.h"
80 #include "sky/engine/public/platform/Platform.h" 79 #include "sky/engine/public/platform/Platform.h"
81 #include "sky/engine/public/platform/WebFloatPoint.h" 80 #include "sky/engine/public/platform/WebFloatPoint.h"
82 #include "sky/engine/public/platform/WebImage.h" 81 #include "sky/engine/public/platform/WebImage.h"
83 #include "sky/engine/public/platform/WebLayerTreeView.h" 82 #include "sky/engine/public/platform/WebLayerTreeView.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 , m_rootLayer(0) 142 , m_rootLayer(0)
144 , m_matchesHeuristicsForGpuRasterization(false) 143 , m_matchesHeuristicsForGpuRasterization(false)
145 , m_recreatingGraphicsContext(false) 144 , m_recreatingGraphicsContext(false)
146 , m_flingModifier(0) 145 , m_flingModifier(0)
147 , m_flingSourceDevice(false) 146 , m_flingSourceDevice(false)
148 , m_showPaintRects(false) 147 , m_showPaintRects(false)
149 , m_showDebugBorders(false) 148 , m_showDebugBorders(false)
150 , m_showScrollBottleneckRects(false) 149 , m_showScrollBottleneckRects(false)
151 , m_baseBackgroundColor(Color::white) 150 , m_baseBackgroundColor(Color::white)
152 , m_backgroundColorOverride(Color::transparent) 151 , m_backgroundColorOverride(Color::transparent)
153 , m_userGestureObserved(false)
154 { 152 {
155 Page::PageClients pageClients; 153 Page::PageClients pageClients;
156 pageClients.chromeClient = &m_chromeClientImpl; 154 pageClients.chromeClient = &m_chromeClientImpl;
157 pageClients.editorClient = &m_editorClientImpl; 155 pageClients.editorClient = &m_editorClientImpl;
158 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; 156 pageClients.spellCheckerClient = &m_spellCheckerClientImpl;
159 157
160 m_page = adoptPtr(new Page(pageClients, m_client->services())); 158 m_page = adoptPtr(new Page(pageClients, m_client->services()));
161 159
162 setDeviceScaleFactor(m_client->screenInfo().deviceScaleFactor); 160 setDeviceScaleFactor(m_client->screenInfo().deviceScaleFactor);
163 setVisibilityState(m_client->visibilityState(), true); 161 setVisibilityState(m_client->visibilityState(), true);
(...skipping 13 matching lines...) Expand all
177 175
178 void WebViewImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseEvent& e vent) 176 void WebViewImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseEvent& e vent)
179 { 177 {
180 m_client->setMouseOverURL(WebURL()); 178 m_client->setMouseOverURL(WebURL());
181 mainFrame.eventHandler().handleMouseLeaveEvent(PlatformMouseEventBuilder(mai nFrame.view(), event)); 179 mainFrame.eventHandler().handleMouseLeaveEvent(PlatformMouseEventBuilder(mai nFrame.view(), event));
182 } 180 }
183 181
184 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev ent) 182 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev ent)
185 { 183 {
186 mainFrame.eventHandler().handleMousePressEvent(PlatformMouseEventBuilder(mai nFrame.view(), event)); 184 mainFrame.eventHandler().handleMousePressEvent(PlatformMouseEventBuilder(mai nFrame.view(), event));
187
188 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode)
189 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG estureToken();
190 } 185 }
191 186
192 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even t) 187 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even t)
193 { 188 {
194 mainFrame.eventHandler().handleMouseReleaseEvent(PlatformMouseEventBuilder(m ainFrame.view(), event)); 189 mainFrame.eventHandler().handleMouseReleaseEvent(PlatformMouseEventBuilder(m ainFrame.view(), event));
195 } 190 }
196 191
197 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event) 192 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event)
198 { 193 {
199 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event)); 194 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event));
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 611
617 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { 612 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) {
618 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); 613 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type);
619 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. 614 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it.
620 RefPtr<Node> node = m_mouseCaptureNode; 615 RefPtr<Node> node = m_mouseCaptureNode;
621 616
622 // Not all platforms call mouseCaptureLost() directly. 617 // Not all platforms call mouseCaptureLost() directly.
623 if (inputEvent.type == WebInputEvent::MouseUp) 618 if (inputEvent.type == WebInputEvent::MouseUp)
624 mouseCaptureLost(); 619 mouseCaptureLost();
625 620
626 OwnPtr<UserGestureIndicator> gestureIndicator;
627
628 AtomicString eventType; 621 AtomicString eventType;
629 switch (inputEvent.type) { 622 switch (inputEvent.type) {
630 case WebInputEvent::MouseMove: 623 case WebInputEvent::MouseMove:
631 eventType = EventTypeNames::mousemove; 624 eventType = EventTypeNames::mousemove;
632 break; 625 break;
633 case WebInputEvent::MouseLeave: 626 case WebInputEvent::MouseLeave:
634 eventType = EventTypeNames::mouseout; 627 eventType = EventTypeNames::mouseout;
635 break; 628 break;
636 case WebInputEvent::MouseDown: 629 case WebInputEvent::MouseDown:
637 eventType = EventTypeNames::mousedown; 630 eventType = EventTypeNames::mousedown;
638 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture));
639 m_mouseCaptureGestureToken = gestureIndicator->currentToken();
640 break; 631 break;
641 case WebInputEvent::MouseUp: 632 case WebInputEvent::MouseUp:
642 eventType = EventTypeNames::mouseup; 633 eventType = EventTypeNames::mouseup;
643 gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureG estureToken.release()));
644 break; 634 break;
645 default: 635 default:
646 ASSERT_NOT_REACHED(); 636 ASSERT_NOT_REACHED();
647 } 637 }
648 638
649 node->dispatchMouseEvent( 639 node->dispatchMouseEvent(
650 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), static_cast< const WebMouseEvent&>(inputEvent)), 640 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), static_cast< const WebMouseEvent&>(inputEvent)),
651 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount) ; 641 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount) ;
652 return true; 642 return true;
653 } 643 }
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 page()->focusController().setActive(active); 1230 page()->focusController().setActive(active);
1241 } 1231 }
1242 1232
1243 bool WebViewImpl::isActive() const 1233 bool WebViewImpl::isActive() const
1244 { 1234 {
1245 return page() ? page()->focusController().isActive() : false; 1235 return page() ? page()->focusController().isActive() : false;
1246 } 1236 }
1247 1237
1248 void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag e) 1238 void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag e)
1249 { 1239 {
1250 m_userGestureObserved = false;
1251 if (!isNavigationWithinPage)
1252 UserGestureIndicator::clearProcessedUserGestureSinceLoad();
1253 } 1240 }
1254 1241
1255 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) 1242 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe)
1256 { 1243 {
1257 if (!m_client) 1244 if (!m_client)
1258 return; 1245 return;
1259 m_client->didUpdateLayout(); 1246 m_client->didUpdateLayout();
1260 } 1247 }
1261 1248
1262 void WebViewImpl::setBackgroundColorOverride(WebColor color) 1249 void WebViewImpl::setBackgroundColorOverride(WebColor color)
(...skipping 29 matching lines...) Expand all
1292 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, 1279 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
1293 bool isInitialState) { 1280 bool isInitialState) {
1294 if (!page()) 1281 if (!page())
1295 return; 1282 return;
1296 1283
1297 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden); 1284 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden);
1298 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int> (visibilityState)), isInitialState); 1285 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int> (visibilityState)), isInitialState);
1299 } 1286 }
1300 1287
1301 } // namespace blink 1288 } // namespace blink
OLDNEW
« sky/engine/core/dom/Element.cpp ('K') | « sky/engine/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698