OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 m_widgetClient->setWindowRect(m_windowRectInScreen); | 384 m_widgetClient->setWindowRect(m_windowRectInScreen); |
385 | 385 |
386 if (m_page) { | 386 if (m_page) { |
387 toLocalFrame(m_page->mainFrame())->view()->resize(newSize); | 387 toLocalFrame(m_page->mainFrame())->view()->resize(newSize); |
388 m_page->frameHost().visualViewport().setSize(newSize); | 388 m_page->frameHost().visualViewport().setSize(newSize); |
389 } | 389 } |
390 | 390 |
391 m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.heigh
t)); | 391 m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.heigh
t)); |
392 } | 392 } |
393 | 393 |
394 bool WebPagePopupImpl::handleKeyEvent(const WebKeyboardEvent& event) | 394 WebInputEventResult WebPagePopupImpl::handleKeyEvent(const WebKeyboardEvent& eve
nt) |
395 { | 395 { |
396 return handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 396 return handleKeyEvent(PlatformKeyboardEventBuilder(event)); |
397 } | 397 } |
398 | 398 |
399 bool WebPagePopupImpl::handleCharEvent(const WebKeyboardEvent& event) | 399 WebInputEventResult WebPagePopupImpl::handleCharEvent(const WebKeyboardEvent& ev
ent) |
400 { | 400 { |
401 return handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 401 return handleKeyEvent(PlatformKeyboardEventBuilder(event)); |
402 } | 402 } |
403 | 403 |
404 bool WebPagePopupImpl::handleGestureEvent(const WebGestureEvent& event) | 404 WebInputEventResult WebPagePopupImpl::handleGestureEvent(const WebGestureEvent&
event) |
405 { | 405 { |
406 if (m_closing || !m_page || !m_page->mainFrame() || !toLocalFrame(m_page->ma
inFrame())->view()) | 406 if (m_closing || !m_page || !m_page->mainFrame() || !toLocalFrame(m_page->ma
inFrame())->view()) |
407 return false; | 407 return WebInputEventResult::NotHandled; |
408 if (event.type == WebInputEvent::GestureTap && !isGestureEventInWindow(event
)) { | 408 if (event.type == WebInputEvent::GestureTap && !isGestureEventInWindow(event
)) { |
409 cancel(); | 409 cancel(); |
410 return false; | 410 return WebInputEventResult::NotHandled; |
411 } | 411 } |
412 LocalFrame& frame = *toLocalFrame(m_page->mainFrame()); | 412 LocalFrame& frame = *toLocalFrame(m_page->mainFrame()); |
413 return frame.eventHandler().handleGestureEvent(PlatformGestureEventBuilder(f
rame.view(), event)); | 413 return frame.eventHandler().handleGestureEvent(PlatformGestureEventBuilder(f
rame.view(), event)); |
414 } | 414 } |
415 | 415 |
416 void WebPagePopupImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEven
t& event) | 416 void WebPagePopupImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEven
t& event) |
417 { | 417 { |
418 if (isMouseEventInWindow(event)) | 418 if (isMouseEventInWindow(event)) |
419 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 419 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
420 else | 420 else |
421 cancel(); | 421 cancel(); |
422 } | 422 } |
423 | 423 |
424 bool WebPagePopupImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWhe
elEvent& event) | 424 WebInputEventResult WebPagePopupImpl::handleMouseWheel(LocalFrame& mainFrame, co
nst WebMouseWheelEvent& event) |
425 { | 425 { |
426 if (isMouseEventInWindow(event)) | 426 if (isMouseEventInWindow(event)) |
427 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 427 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
428 cancel(); | 428 cancel(); |
429 return false; | 429 return WebInputEventResult::NotHandled; |
430 } | 430 } |
431 | 431 |
432 bool WebPagePopupImpl::isMouseEventInWindow(const WebMouseEvent& event) | 432 bool WebPagePopupImpl::isMouseEventInWindow(const WebMouseEvent& event) |
433 { | 433 { |
434 return IntRect(0, 0, m_windowRectInScreen.width, m_windowRectInScreen.height
).contains(IntPoint(event.x, event.y)); | 434 return IntRect(0, 0, m_windowRectInScreen.width, m_windowRectInScreen.height
).contains(IntPoint(event.x, event.y)); |
435 } | 435 } |
436 | 436 |
437 bool WebPagePopupImpl::isGestureEventInWindow(const WebGestureEvent& event) | 437 bool WebPagePopupImpl::isGestureEventInWindow(const WebGestureEvent& event) |
438 { | 438 { |
439 return IntRect(0, 0, m_windowRectInScreen.width, m_windowRectInScreen.height
).contains(IntPoint(event.x, event.y)); | 439 return IntRect(0, 0, m_windowRectInScreen.width, m_windowRectInScreen.height
).contains(IntPoint(event.x, event.y)); |
440 } | 440 } |
441 | 441 |
442 bool WebPagePopupImpl::handleInputEvent(const WebInputEvent& event) | 442 WebInputEventResult WebPagePopupImpl::handleInputEvent(const WebInputEvent& even
t) |
443 { | 443 { |
444 if (m_closing) | 444 if (m_closing) |
445 return false; | 445 return WebInputEventResult::NotHandled; |
446 return PageWidgetDelegate::handleInputEvent(*this, event, m_page->deprecated
LocalMainFrame()); | 446 return PageWidgetDelegate::handleInputEvent(*this, event, m_page->deprecated
LocalMainFrame()); |
447 } | 447 } |
448 | 448 |
449 bool WebPagePopupImpl::handleKeyEvent(const PlatformKeyboardEvent& event) | 449 WebInputEventResult WebPagePopupImpl::handleKeyEvent(const PlatformKeyboardEvent
& event) |
450 { | 450 { |
451 if (m_closing || !m_page->mainFrame() || !toLocalFrame(m_page->mainFrame())-
>view()) | 451 if (m_closing || !m_page->mainFrame() || !toLocalFrame(m_page->mainFrame())-
>view()) |
452 return false; | 452 return WebInputEventResult::NotHandled; |
453 return toLocalFrame(m_page->mainFrame())->eventHandler().keyEvent(event); | 453 return toLocalFrame(m_page->mainFrame())->eventHandler().keyEvent(event); |
454 } | 454 } |
455 | 455 |
456 void WebPagePopupImpl::setFocus(bool enable) | 456 void WebPagePopupImpl::setFocus(bool enable) |
457 { | 457 { |
458 if (!m_page) | 458 if (!m_page) |
459 return; | 459 return; |
460 m_page->focusController().setFocused(enable); | 460 m_page->focusController().setFocused(enable); |
461 if (enable) | 461 if (enable) |
462 m_page->focusController().setActive(true); | 462 m_page->focusController().setActive(true); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // A WebPagePopupImpl instance usually has two references. | 532 // A WebPagePopupImpl instance usually has two references. |
533 // - One owned by the instance itself. It represents the visible widget. | 533 // - One owned by the instance itself. It represents the visible widget. |
534 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 534 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
535 // WebPagePopupImpl to close. | 535 // WebPagePopupImpl to close. |
536 // We need them because the closing operation is asynchronous and the widget | 536 // We need them because the closing operation is asynchronous and the widget |
537 // can be closed while the WebViewImpl is unaware of it. | 537 // can be closed while the WebViewImpl is unaware of it. |
538 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 538 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
539 } | 539 } |
540 | 540 |
541 } // namespace blink | 541 } // namespace blink |
OLD | NEW |