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

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

Issue 868133003: Remove touch events from Sky (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
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | sky/examples/touch-demo.sky » ('j') | 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 WebViewImpl::~WebViewImpl() 162 WebViewImpl::~WebViewImpl()
163 { 163 {
164 ASSERT(!m_page); 164 ASSERT(!m_page);
165 } 165 }
166 166
167 WebLocalFrameImpl* WebViewImpl::mainFrameImpl() 167 WebLocalFrameImpl* WebViewImpl::mainFrameImpl()
168 { 168 {
169 return m_page ? WebLocalFrameImpl::fromFrame(m_page->mainFrame()) : 0; 169 return m_page ? WebLocalFrameImpl::fromFrame(m_page->mainFrame()) : 0;
170 } 170 }
171 171
172 bool WebViewImpl::handleTouchEvent(LocalFrame& mainFrame, const WebTouchEvent& e vent)
173 {
174 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event));
175 }
176
177 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) 172 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
178 { 173 {
179 bool eventSwallowed = false; 174 bool eventSwallowed = false;
180 bool eventCancelled = false; // for disambiguation 175 bool eventCancelled = false; // for disambiguation
181 176
182 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), even t); 177 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), even t);
183 178
184 // FIXME: Remove redundant hit tests by pushing the call to EventHandler::ta rgetGestureEvent 179 // FIXME: Remove redundant hit tests by pushing the call to EventHandler::ta rgetGestureEvent
185 // up to this point and pass GestureEventWithHitTestResults around. 180 // up to this point and pass GestureEventWithHitTestResults around.
186 181
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 case WebInputEvent::GestureScrollUpdate: 531 case WebInputEvent::GestureScrollUpdate:
537 return EventTypeNames::gesturescrollupdate; 532 return EventTypeNames::gesturescrollupdate;
538 case WebInputEvent::GestureTapDown: 533 case WebInputEvent::GestureTapDown:
539 return EventTypeNames::gesturetapdown; 534 return EventTypeNames::gesturetapdown;
540 case WebInputEvent::GestureShowPress: 535 case WebInputEvent::GestureShowPress:
541 return EventTypeNames::gestureshowpress; 536 return EventTypeNames::gestureshowpress;
542 case WebInputEvent::GestureTap: 537 case WebInputEvent::GestureTap:
543 return EventTypeNames::gesturetap; 538 return EventTypeNames::gesturetap;
544 case WebInputEvent::GestureTapUnconfirmed: 539 case WebInputEvent::GestureTapUnconfirmed:
545 return EventTypeNames::gesturetapunconfirmed; 540 return EventTypeNames::gesturetapunconfirmed;
546 case WebInputEvent::TouchStart:
547 return EventTypeNames::touchstart;
548 case WebInputEvent::TouchMove:
549 return EventTypeNames::touchmove;
550 case WebInputEvent::TouchEnd:
551 return EventTypeNames::touchend;
552 case WebInputEvent::TouchCancel:
553 return EventTypeNames::touchcancel;
554 default: 541 default:
555 return String("unknown"); 542 return String("unknown");
556 } 543 }
557 } 544 }
558 545
559 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) 546 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
560 { 547 {
561 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToNa me(inputEvent.type).ascii().data()); 548 TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToNa me(inputEvent.type).ascii().data());
562 549
563 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent , &inputEvent); 550 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent , &inputEvent);
564 551
565 if (WebInputEvent::isPointerEventType(inputEvent.type)) { 552 if (WebInputEvent::isPointerEventType(inputEvent.type)) {
566 const WebPointerEvent& event = static_cast<const WebPointerEvent&>(input Event); 553 const WebPointerEvent& event = static_cast<const WebPointerEvent&>(input Event);
567 return m_page->mainFrame()->newEventHandler().handlePointerEvent(event); 554 return m_page->mainFrame()->newEventHandler().handlePointerEvent(event);
568 } 555 }
569 556
570 LocalFrame* frame = m_page ? m_page->mainFrame() : nullptr;
571 switch (inputEvent.type) { 557 switch (inputEvent.type) {
572 case WebInputEvent::RawKeyDown: 558 case WebInputEvent::RawKeyDown:
573 case WebInputEvent::KeyDown: 559 case WebInputEvent::KeyDown:
574 case WebInputEvent::KeyUp: 560 case WebInputEvent::KeyUp:
575 return handleKeyEvent(static_cast<const WebKeyboardEvent&>(inputEvent)); 561 return handleKeyEvent(static_cast<const WebKeyboardEvent&>(inputEvent));
576 562
577 case WebInputEvent::Char: 563 case WebInputEvent::Char:
578 return handleCharEvent(static_cast<const WebKeyboardEvent&>(inputEvent)) ; 564 return handleCharEvent(static_cast<const WebKeyboardEvent&>(inputEvent)) ;
579 case WebInputEvent::GestureScrollBegin: 565 case WebInputEvent::GestureScrollBegin:
580 case WebInputEvent::GestureScrollEnd: 566 case WebInputEvent::GestureScrollEnd:
581 case WebInputEvent::GestureScrollUpdate: 567 case WebInputEvent::GestureScrollUpdate:
582 case WebInputEvent::GestureScrollUpdateWithoutPropagation: 568 case WebInputEvent::GestureScrollUpdateWithoutPropagation:
583 case WebInputEvent::GestureFlingStart: 569 case WebInputEvent::GestureFlingStart:
584 case WebInputEvent::GestureFlingCancel: 570 case WebInputEvent::GestureFlingCancel:
585 case WebInputEvent::GestureTap: 571 case WebInputEvent::GestureTap:
586 case WebInputEvent::GestureTapUnconfirmed: 572 case WebInputEvent::GestureTapUnconfirmed:
587 case WebInputEvent::GestureTapDown: 573 case WebInputEvent::GestureTapDown:
588 case WebInputEvent::GestureShowPress: 574 case WebInputEvent::GestureShowPress:
589 case WebInputEvent::GestureTapCancel: 575 case WebInputEvent::GestureTapCancel:
590 case WebInputEvent::GestureDoubleTap: 576 case WebInputEvent::GestureDoubleTap:
591 case WebInputEvent::GestureTwoFingerTap: 577 case WebInputEvent::GestureTwoFingerTap:
592 case WebInputEvent::GestureLongPress: 578 case WebInputEvent::GestureLongPress:
593 case WebInputEvent::GestureLongTap: 579 case WebInputEvent::GestureLongTap:
594 return handleGestureEvent(static_cast<const WebGestureEvent&>(inputEvent )); 580 return handleGestureEvent(static_cast<const WebGestureEvent&>(inputEvent ));
595 581
596 case WebInputEvent::TouchStart:
597 case WebInputEvent::TouchMove:
598 case WebInputEvent::TouchEnd:
599 case WebInputEvent::TouchCancel:
600 if (!frame || !frame->view())
601 return false;
602 return handleTouchEvent(*frame, static_cast<const WebTouchEvent&>(inputE vent));
603
604 case WebInputEvent::GesturePinchBegin: 582 case WebInputEvent::GesturePinchBegin:
605 case WebInputEvent::GesturePinchEnd: 583 case WebInputEvent::GesturePinchEnd:
606 case WebInputEvent::GesturePinchUpdate: 584 case WebInputEvent::GesturePinchUpdate:
607 // FIXME: Once PlatformGestureEvent is updated to support pinch, this 585 // FIXME: Once PlatformGestureEvent is updated to support pinch, this
608 // should call handleGestureEvent, just like it currently does for 586 // should call handleGestureEvent, just like it currently does for
609 // gesture scroll. 587 // gesture scroll.
610 return false; 588 return false;
611 589
612 default: 590 default:
613 return false; 591 return false;
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, 1152 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
1175 bool isInitialState) { 1153 bool isInitialState) {
1176 if (!page()) 1154 if (!page())
1177 return; 1155 return;
1178 1156
1179 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden); 1157 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden);
1180 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int> (visibilityState)), isInitialState); 1158 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int> (visibilityState)), isInitialState);
1181 } 1159 }
1182 1160
1183 } // namespace blink 1161 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | sky/examples/touch-demo.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698