| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "core/frame/PageScaleConstraintsSet.h" | 60 #include "core/frame/PageScaleConstraintsSet.h" |
| 61 #include "core/frame/RemoteFrame.h" | 61 #include "core/frame/RemoteFrame.h" |
| 62 #include "core/frame/ResizeViewportAnchor.h" | 62 #include "core/frame/ResizeViewportAnchor.h" |
| 63 #include "core/frame/RotationViewportAnchor.h" | 63 #include "core/frame/RotationViewportAnchor.h" |
| 64 #include "core/frame/Settings.h" | 64 #include "core/frame/Settings.h" |
| 65 #include "core/frame/UseCounter.h" | 65 #include "core/frame/UseCounter.h" |
| 66 #include "core/frame/VisualViewport.h" | 66 #include "core/frame/VisualViewport.h" |
| 67 #include "core/html/HTMLMediaElement.h" | 67 #include "core/html/HTMLMediaElement.h" |
| 68 #include "core/html/HTMLPlugInElement.h" | 68 #include "core/html/HTMLPlugInElement.h" |
| 69 #include "core/html/HTMLTextAreaElement.h" | 69 #include "core/html/HTMLTextAreaElement.h" |
| 70 #include "core/input/ContextMenuAllowedScope.h" |
| 70 #include "core/input/EventHandler.h" | 71 #include "core/input/EventHandler.h" |
| 71 #include "core/input/TouchActionUtil.h" | 72 #include "core/input/TouchActionUtil.h" |
| 72 #include "core/layout/LayoutPart.h" | 73 #include "core/layout/LayoutPart.h" |
| 73 #include "core/layout/TextAutosizer.h" | 74 #include "core/layout/TextAutosizer.h" |
| 74 #include "core/layout/api/LayoutViewItem.h" | 75 #include "core/layout/api/LayoutViewItem.h" |
| 75 #include "core/layout/compositing/PaintLayerCompositor.h" | 76 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 76 #include "core/loader/FrameLoadRequest.h" | 77 #include "core/loader/FrameLoadRequest.h" |
| 77 #include "core/loader/FrameLoader.h" | 78 #include "core/loader/FrameLoader.h" |
| 78 #include "core/loader/FrameLoaderStateMachine.h" | 79 #include "core/loader/FrameLoaderStateMachine.h" |
| 79 #include "core/page/ContextMenuController.h" | 80 #include "core/page/ContextMenuController.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 #include "public/web/WebPlugin.h" | 156 #include "public/web/WebPlugin.h" |
| 156 #include "public/web/WebPluginAction.h" | 157 #include "public/web/WebPluginAction.h" |
| 157 #include "public/web/WebRange.h" | 158 #include "public/web/WebRange.h" |
| 158 #include "public/web/WebScopedUserGesture.h" | 159 #include "public/web/WebScopedUserGesture.h" |
| 159 #include "public/web/WebSelection.h" | 160 #include "public/web/WebSelection.h" |
| 160 #include "public/web/WebViewClient.h" | 161 #include "public/web/WebViewClient.h" |
| 161 #include "public/web/WebWindowFeatures.h" | 162 #include "public/web/WebWindowFeatures.h" |
| 162 #include "web/AnimationWorkletProxyClientImpl.h" | 163 #include "web/AnimationWorkletProxyClientImpl.h" |
| 163 #include "web/CompositorMutatorImpl.h" | 164 #include "web/CompositorMutatorImpl.h" |
| 164 #include "web/CompositorWorkerProxyClientImpl.h" | 165 #include "web/CompositorWorkerProxyClientImpl.h" |
| 165 #include "web/ContextMenuAllowedScope.h" | |
| 166 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h" | 166 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h" |
| 167 #include "web/DevToolsEmulator.h" | 167 #include "web/DevToolsEmulator.h" |
| 168 #include "web/FullscreenController.h" | 168 #include "web/FullscreenController.h" |
| 169 #include "web/LinkHighlightImpl.h" | 169 #include "web/LinkHighlightImpl.h" |
| 170 #include "web/PageOverlay.h" | 170 #include "web/PageOverlay.h" |
| 171 #include "web/PrerendererClientImpl.h" | 171 #include "web/PrerendererClientImpl.h" |
| 172 #include "web/StorageQuotaClientImpl.h" | 172 #include "web/StorageQuotaClientImpl.h" |
| 173 #include "web/WebDevToolsAgentImpl.h" | 173 #include "web/WebDevToolsAgentImpl.h" |
| 174 #include "web/WebInputMethodControllerImpl.h" | 174 #include "web/WebInputMethodControllerImpl.h" |
| 175 #include "web/WebLocalFrameImpl.h" | 175 #include "web/WebLocalFrameImpl.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 EnableTapHighlights(highlight_nodes); | 834 EnableTapHighlights(highlight_nodes); |
| 835 for (size_t i = 0; i < link_highlights_.size(); ++i) | 835 for (size_t i = 0; i < link_highlights_.size(); ++i) |
| 836 link_highlights_[i]->StartHighlightAnimationIfNeeded(); | 836 link_highlights_[i]->StartHighlightAnimationIfNeeded(); |
| 837 event_result = WebInputEventResult::kHandledSystem; | 837 event_result = WebInputEventResult::kHandledSystem; |
| 838 event_cancelled = true; | 838 event_cancelled = true; |
| 839 break; | 839 break; |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 | 843 |
| 844 event_result = | 844 { |
| 845 MainFrameImpl()->GetFrame()->GetEventHandler().HandleGestureEvent( | 845 ContextMenuAllowedScope scope; |
| 846 targeted_event); | 846 event_result = |
| 847 MainFrameImpl()->GetFrame()->GetEventHandler().HandleGestureEvent( |
| 848 targeted_event); |
| 849 } |
| 850 |
| 847 if (page_popup_ && last_hidden_page_popup_ && | 851 if (page_popup_ && last_hidden_page_popup_ && |
| 848 page_popup_->HasSamePopupClient(last_hidden_page_popup_.Get())) { | 852 page_popup_->HasSamePopupClient(last_hidden_page_popup_.Get())) { |
| 849 // The tap triggered a page popup that is the same as the one we just | 853 // The tap triggered a page popup that is the same as the one we just |
| 850 // closed. It needs to be closed. | 854 // closed. It needs to be closed. |
| 851 CancelPagePopup(); | 855 CancelPagePopup(); |
| 852 } | 856 } |
| 853 last_hidden_page_popup_ = nullptr; | 857 last_hidden_page_popup_ = nullptr; |
| 854 break; | 858 break; |
| 855 } | 859 } |
| 856 case WebInputEvent::kGestureTwoFingerTap: | 860 case WebInputEvent::kGestureTwoFingerTap: |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 Frame* focused_frame = GetPage()->GetFocusController().FocusedOrMainFrame(); | 1648 Frame* focused_frame = GetPage()->GetFocusController().FocusedOrMainFrame(); |
| 1645 if (!focused_frame->IsLocalFrame()) | 1649 if (!focused_frame->IsLocalFrame()) |
| 1646 return WebInputEventResult::kNotHandled; | 1650 return WebInputEventResult::kNotHandled; |
| 1647 // Firefox reveal focus based on "keydown" event but not "contextmenu" | 1651 // Firefox reveal focus based on "keydown" event but not "contextmenu" |
| 1648 // event, we match FF. | 1652 // event, we match FF. |
| 1649 if (Element* focused_element = | 1653 if (Element* focused_element = |
| 1650 ToLocalFrame(focused_frame)->GetDocument()->FocusedElement()) | 1654 ToLocalFrame(focused_frame)->GetDocument()->FocusedElement()) |
| 1651 focused_element->scrollIntoViewIfNeeded(); | 1655 focused_element->scrollIntoViewIfNeeded(); |
| 1652 return ToLocalFrame(focused_frame) | 1656 return ToLocalFrame(focused_frame) |
| 1653 ->GetEventHandler() | 1657 ->GetEventHandler() |
| 1654 .SendContextMenuEventForKey(nullptr); | 1658 .ShowNonLocatedContextMenu(nullptr); |
| 1655 } | 1659 } |
| 1656 } | 1660 } |
| 1657 #else | 1661 #else |
| 1658 WebInputEventResult WebViewImpl::SendContextMenuEvent( | 1662 WebInputEventResult WebViewImpl::SendContextMenuEvent( |
| 1659 const WebKeyboardEvent& event) { | 1663 const WebKeyboardEvent& event) { |
| 1660 return WebInputEventResult::kNotHandled; | 1664 return WebInputEventResult::kNotHandled; |
| 1661 } | 1665 } |
| 1662 #endif | 1666 #endif |
| 1663 | 1667 |
| 1664 void WebViewImpl::ShowContextMenuAtPoint(float x, | 1668 void WebViewImpl::ShowContextMenuAtPoint(float x, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1676 | 1680 |
| 1677 void WebViewImpl::ShowContextMenuForElement(WebElement element) { | 1681 void WebViewImpl::ShowContextMenuForElement(WebElement element) { |
| 1678 if (!GetPage()) | 1682 if (!GetPage()) |
| 1679 return; | 1683 return; |
| 1680 | 1684 |
| 1681 GetPage()->GetContextMenuController().ClearContextMenu(); | 1685 GetPage()->GetContextMenuController().ClearContextMenu(); |
| 1682 { | 1686 { |
| 1683 ContextMenuAllowedScope scope; | 1687 ContextMenuAllowedScope scope; |
| 1684 if (LocalFrame* focused_frame = | 1688 if (LocalFrame* focused_frame = |
| 1685 ToLocalFrame(GetPage()->GetFocusController().FocusedOrMainFrame())) | 1689 ToLocalFrame(GetPage()->GetFocusController().FocusedOrMainFrame())) |
| 1686 focused_frame->GetEventHandler().SendContextMenuEventForKey( | 1690 focused_frame->GetEventHandler().ShowNonLocatedContextMenu( |
| 1687 element.Unwrap<Element>()); | 1691 element.Unwrap<Element>()); |
| 1688 } | 1692 } |
| 1689 } | 1693 } |
| 1690 | 1694 |
| 1691 PagePopup* WebViewImpl::OpenPagePopup(PagePopupClient* client) { | 1695 PagePopup* WebViewImpl::OpenPagePopup(PagePopupClient* client) { |
| 1692 DCHECK(client); | 1696 DCHECK(client); |
| 1693 if (HasOpenedPopup()) | 1697 if (HasOpenedPopup()) |
| 1694 HidePopups(); | 1698 HidePopups(); |
| 1695 DCHECK(!page_popup_); | 1699 DCHECK(!page_popup_); |
| 1696 | 1700 |
| (...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3509 | 3513 |
| 3510 void WebViewImpl::ShowContextMenu(WebMenuSourceType source_type) { | 3514 void WebViewImpl::ShowContextMenu(WebMenuSourceType source_type) { |
| 3511 if (!GetPage()) | 3515 if (!GetPage()) |
| 3512 return; | 3516 return; |
| 3513 | 3517 |
| 3514 GetPage()->GetContextMenuController().ClearContextMenu(); | 3518 GetPage()->GetContextMenuController().ClearContextMenu(); |
| 3515 { | 3519 { |
| 3516 ContextMenuAllowedScope scope; | 3520 ContextMenuAllowedScope scope; |
| 3517 if (LocalFrame* focused_frame = ToLocalFrame( | 3521 if (LocalFrame* focused_frame = ToLocalFrame( |
| 3518 GetPage()->GetFocusController().FocusedOrMainFrame())) { | 3522 GetPage()->GetFocusController().FocusedOrMainFrame())) { |
| 3519 focused_frame->GetEventHandler().SendContextMenuEventForKey(nullptr, | 3523 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr, |
| 3520 source_type); | 3524 source_type); |
| 3521 } | 3525 } |
| 3522 } | 3526 } |
| 3523 } | 3527 } |
| 3524 | 3528 |
| 3525 void WebViewImpl::DidCloseContextMenu() { | 3529 void WebViewImpl::DidCloseContextMenu() { |
| 3526 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); | 3530 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); |
| 3527 if (frame) | 3531 if (frame) |
| 3528 frame->Selection().SetCaretBlinkingSuspended(false); | 3532 frame->Selection().SetCaretBlinkingSuspended(false); |
| 3529 } | 3533 } |
| 3530 | 3534 |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4165 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4169 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4166 return nullptr; | 4170 return nullptr; |
| 4167 return focused_frame; | 4171 return focused_frame; |
| 4168 } | 4172 } |
| 4169 | 4173 |
| 4170 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4174 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4171 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4175 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4172 } | 4176 } |
| 4173 | 4177 |
| 4174 } // namespace blink | 4178 } // namespace blink |
| OLD | NEW |