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