| OLD | NEW |
| 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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 Frame* focused_frame = GetPage()->GetFocusController().FocusedOrMainFrame(); | 1642 Frame* focused_frame = GetPage()->GetFocusController().FocusedOrMainFrame(); |
| 1643 if (!focused_frame->IsLocalFrame()) | 1643 if (!focused_frame->IsLocalFrame()) |
| 1644 return WebInputEventResult::kNotHandled; | 1644 return WebInputEventResult::kNotHandled; |
| 1645 // Firefox reveal focus based on "keydown" event but not "contextmenu" | 1645 // Firefox reveal focus based on "keydown" event but not "contextmenu" |
| 1646 // event, we match FF. | 1646 // event, we match FF. |
| 1647 if (Element* focused_element = | 1647 if (Element* focused_element = |
| 1648 ToLocalFrame(focused_frame)->GetDocument()->FocusedElement()) | 1648 ToLocalFrame(focused_frame)->GetDocument()->FocusedElement()) |
| 1649 focused_element->scrollIntoViewIfNeeded(); | 1649 focused_element->scrollIntoViewIfNeeded(); |
| 1650 return ToLocalFrame(focused_frame) | 1650 return ToLocalFrame(focused_frame) |
| 1651 ->GetEventHandler() | 1651 ->GetEventHandler() |
| 1652 .SendContextMenuEventForKey(nullptr); | 1652 .ShowNonLocatedContextMenu(nullptr); |
| 1653 } | 1653 } |
| 1654 } | 1654 } |
| 1655 #else | 1655 #else |
| 1656 WebInputEventResult WebViewImpl::SendContextMenuEvent( | 1656 WebInputEventResult WebViewImpl::SendContextMenuEvent( |
| 1657 const WebKeyboardEvent& event) { | 1657 const WebKeyboardEvent& event) { |
| 1658 return WebInputEventResult::kNotHandled; | 1658 return WebInputEventResult::kNotHandled; |
| 1659 } | 1659 } |
| 1660 #endif | 1660 #endif |
| 1661 | 1661 |
| 1662 void WebViewImpl::ShowContextMenuAtPoint(float x, | 1662 void WebViewImpl::ShowContextMenuAtPoint(float x, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1674 | 1674 |
| 1675 void WebViewImpl::ShowContextMenuForElement(WebElement element) { | 1675 void WebViewImpl::ShowContextMenuForElement(WebElement element) { |
| 1676 if (!GetPage()) | 1676 if (!GetPage()) |
| 1677 return; | 1677 return; |
| 1678 | 1678 |
| 1679 GetPage()->GetContextMenuController().ClearContextMenu(); | 1679 GetPage()->GetContextMenuController().ClearContextMenu(); |
| 1680 { | 1680 { |
| 1681 ContextMenuAllowedScope scope; | 1681 ContextMenuAllowedScope scope; |
| 1682 if (LocalFrame* focused_frame = | 1682 if (LocalFrame* focused_frame = |
| 1683 ToLocalFrame(GetPage()->GetFocusController().FocusedOrMainFrame())) | 1683 ToLocalFrame(GetPage()->GetFocusController().FocusedOrMainFrame())) |
| 1684 focused_frame->GetEventHandler().SendContextMenuEventForKey( | 1684 focused_frame->GetEventHandler().ShowNonLocatedContextMenu( |
| 1685 element.Unwrap<Element>()); | 1685 element.Unwrap<Element>()); |
| 1686 } | 1686 } |
| 1687 } | 1687 } |
| 1688 | 1688 |
| 1689 PagePopup* WebViewImpl::OpenPagePopup(PagePopupClient* client) { | 1689 PagePopup* WebViewImpl::OpenPagePopup(PagePopupClient* client) { |
| 1690 DCHECK(client); | 1690 DCHECK(client); |
| 1691 if (HasOpenedPopup()) | 1691 if (HasOpenedPopup()) |
| 1692 HidePopups(); | 1692 HidePopups(); |
| 1693 DCHECK(!page_popup_); | 1693 DCHECK(!page_popup_); |
| 1694 | 1694 |
| (...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3497 | 3497 |
| 3498 void WebViewImpl::ShowContextMenu() { | 3498 void WebViewImpl::ShowContextMenu() { |
| 3499 if (!GetPage()) | 3499 if (!GetPage()) |
| 3500 return; | 3500 return; |
| 3501 | 3501 |
| 3502 GetPage()->GetContextMenuController().ClearContextMenu(); | 3502 GetPage()->GetContextMenuController().ClearContextMenu(); |
| 3503 { | 3503 { |
| 3504 ContextMenuAllowedScope scope; | 3504 ContextMenuAllowedScope scope; |
| 3505 if (LocalFrame* focused_frame = | 3505 if (LocalFrame* focused_frame = |
| 3506 ToLocalFrame(GetPage()->GetFocusController().FocusedOrMainFrame())) | 3506 ToLocalFrame(GetPage()->GetFocusController().FocusedOrMainFrame())) |
| 3507 focused_frame->GetEventHandler().SendContextMenuEventForKey(nullptr); | 3507 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr); |
| 3508 } | 3508 } |
| 3509 } | 3509 } |
| 3510 | 3510 |
| 3511 void WebViewImpl::DidCloseContextMenu() { | 3511 void WebViewImpl::DidCloseContextMenu() { |
| 3512 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); | 3512 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); |
| 3513 if (frame) | 3513 if (frame) |
| 3514 frame->Selection().SetCaretBlinkingSuspended(false); | 3514 frame->Selection().SetCaretBlinkingSuspended(false); |
| 3515 } | 3515 } |
| 3516 | 3516 |
| 3517 void WebViewImpl::HidePopups() { | 3517 void WebViewImpl::HidePopups() { |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4152 return nullptr; | 4152 return nullptr; |
| 4153 return focused_frame; | 4153 return focused_frame; |
| 4154 } | 4154 } |
| 4155 | 4155 |
| 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4158 } | 4158 } |
| 4159 | 4159 |
| 4160 } // namespace blink | 4160 } // namespace blink |
| OLD | NEW |