| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (m_page) { | 428 if (m_page) { |
| 429 toLocalFrame(m_page->mainFrame())->view()->resize(newSizeInViewport); | 429 toLocalFrame(m_page->mainFrame())->view()->resize(newSizeInViewport); |
| 430 m_page->frameHost().visualViewport().setSize(newSizeInViewport); | 430 m_page->frameHost().visualViewport().setSize(newSizeInViewport); |
| 431 } | 431 } |
| 432 | 432 |
| 433 m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.heigh
t)); | 433 m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.heigh
t)); |
| 434 } | 434 } |
| 435 | 435 |
| 436 WebInputEventResult WebPagePopupImpl::handleKeyEvent(const WebKeyboardEvent& eve
nt) | 436 WebInputEventResult WebPagePopupImpl::handleKeyEvent(const WebKeyboardEvent& eve
nt) |
| 437 { | 437 { |
| 438 return handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 438 if (m_closing || !m_page->mainFrame() || !toLocalFrame(m_page->mainFrame())-
>view()) |
| 439 return WebInputEventResult::NotHandled; |
| 440 return toLocalFrame(m_page->mainFrame())->eventHandler().keyEvent(event); |
| 439 } | 441 } |
| 440 | 442 |
| 441 WebInputEventResult WebPagePopupImpl::handleCharEvent(const WebKeyboardEvent& ev
ent) | 443 WebInputEventResult WebPagePopupImpl::handleCharEvent(const WebKeyboardEvent& ev
ent) |
| 442 { | 444 { |
| 443 return handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 445 return handleKeyEvent(event); |
| 444 } | 446 } |
| 445 | 447 |
| 446 WebInputEventResult WebPagePopupImpl::handleGestureEvent(const WebGestureEvent&
event) | 448 WebInputEventResult WebPagePopupImpl::handleGestureEvent(const WebGestureEvent&
event) |
| 447 { | 449 { |
| 448 if (m_closing || !m_page || !m_page->mainFrame() || !toLocalFrame(m_page->ma
inFrame())->view()) | 450 if (m_closing || !m_page || !m_page->mainFrame() || !toLocalFrame(m_page->ma
inFrame())->view()) |
| 449 return WebInputEventResult::NotHandled; | 451 return WebInputEventResult::NotHandled; |
| 450 if (event.type == WebInputEvent::GestureTap && !isViewportPointInWindow(even
t.x, event.y)) { | 452 if (event.type == WebInputEvent::GestureTap && !isViewportPointInWindow(even
t.x, event.y)) { |
| 451 cancel(); | 453 cancel(); |
| 452 return WebInputEventResult::NotHandled; | 454 return WebInputEventResult::NotHandled; |
| 453 } | 455 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 479 return IntRect(0, 0, windowRect.width, windowRect.height).contains(IntPoint(
pointInWindow.x, pointInWindow.y)); | 481 return IntRect(0, 0, windowRect.width, windowRect.height).contains(IntPoint(
pointInWindow.x, pointInWindow.y)); |
| 480 } | 482 } |
| 481 | 483 |
| 482 WebInputEventResult WebPagePopupImpl::handleInputEvent(const WebInputEvent& even
t) | 484 WebInputEventResult WebPagePopupImpl::handleInputEvent(const WebInputEvent& even
t) |
| 483 { | 485 { |
| 484 if (m_closing) | 486 if (m_closing) |
| 485 return WebInputEventResult::NotHandled; | 487 return WebInputEventResult::NotHandled; |
| 486 return PageWidgetDelegate::handleInputEvent(*this, event, m_page->deprecated
LocalMainFrame()); | 488 return PageWidgetDelegate::handleInputEvent(*this, event, m_page->deprecated
LocalMainFrame()); |
| 487 } | 489 } |
| 488 | 490 |
| 489 WebInputEventResult WebPagePopupImpl::handleKeyEvent(const PlatformKeyboardEvent
& event) | |
| 490 { | |
| 491 if (m_closing || !m_page->mainFrame() || !toLocalFrame(m_page->mainFrame())-
>view()) | |
| 492 return WebInputEventResult::NotHandled; | |
| 493 return toLocalFrame(m_page->mainFrame())->eventHandler().keyEvent(event); | |
| 494 } | |
| 495 | |
| 496 void WebPagePopupImpl::setFocus(bool enable) | 491 void WebPagePopupImpl::setFocus(bool enable) |
| 497 { | 492 { |
| 498 if (!m_page) | 493 if (!m_page) |
| 499 return; | 494 return; |
| 500 m_page->focusController().setFocused(enable); | 495 m_page->focusController().setFocused(enable); |
| 501 if (enable) | 496 if (enable) |
| 502 m_page->focusController().setActive(true); | 497 m_page->focusController().setActive(true); |
| 503 } | 498 } |
| 504 | 499 |
| 505 void WebPagePopupImpl::close() | 500 void WebPagePopupImpl::close() |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // A WebPagePopupImpl instance usually has two references. | 576 // A WebPagePopupImpl instance usually has two references. |
| 582 // - One owned by the instance itself. It represents the visible widget. | 577 // - One owned by the instance itself. It represents the visible widget. |
| 583 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 578 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 584 // WebPagePopupImpl to close. | 579 // WebPagePopupImpl to close. |
| 585 // We need them because the closing operation is asynchronous and the widget | 580 // We need them because the closing operation is asynchronous and the widget |
| 586 // can be closed while the WebViewImpl is unaware of it. | 581 // can be closed while the WebViewImpl is unaware of it. |
| 587 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 582 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 588 } | 583 } |
| 589 | 584 |
| 590 } // namespace blink | 585 } // namespace blink |
| OLD | NEW |