Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 2905783002: Rename SendContextMenuEventForKey to ShowNonLocatedContextMenu (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 } 1803 }
1804 1804
1805 static bool ShouldShowContextMenuAtSelection(const FrameSelection& selection) { 1805 static bool ShouldShowContextMenuAtSelection(const FrameSelection& selection) {
1806 const VisibleSelection& visible_selection = 1806 const VisibleSelection& visible_selection =
1807 selection.ComputeVisibleSelectionInDOMTreeDeprecated(); 1807 selection.ComputeVisibleSelectionInDOMTreeDeprecated();
1808 if (!visible_selection.IsRange() && !visible_selection.RootEditableElement()) 1808 if (!visible_selection.IsRange() && !visible_selection.RootEditableElement())
1809 return false; 1809 return false;
1810 return selection.SelectionHasFocus(); 1810 return selection.SelectionHasFocus();
1811 } 1811 }
1812 1812
1813 WebInputEventResult EventHandler::SendContextMenuEventForKey( 1813 WebInputEventResult EventHandler::ShowNonLocatedContextMenu(
1814 Element* override_target_element) { 1814 Element* override_target_element) {
1815 FrameView* view = frame_->View(); 1815 FrameView* view = frame_->View();
1816 if (!view) 1816 if (!view)
1817 return WebInputEventResult::kNotHandled; 1817 return WebInputEventResult::kNotHandled;
1818 1818
1819 Document* doc = frame_->GetDocument(); 1819 Document* doc = frame_->GetDocument();
1820 if (!doc) 1820 if (!doc)
1821 return WebInputEventResult::kNotHandled; 1821 return WebInputEventResult::kNotHandled;
1822 1822
1823 static const int kContextMenuMargin = 1; 1823 static const int kContextMenuMargin = 1;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 if (!target_node) 1874 if (!target_node)
1875 target_node = doc; 1875 target_node = doc;
1876 1876
1877 // Use the focused node as the target for hover and active. 1877 // Use the focused node as the target for hover and active.
1878 HitTestRequest request(HitTestRequest::kActive); 1878 HitTestRequest request(HitTestRequest::kActive);
1879 HitTestResult result(request, location_in_root_frame); 1879 HitTestResult result(request, location_in_root_frame);
1880 result.SetInnerNode(target_node); 1880 result.SetInnerNode(target_node);
1881 doc->UpdateHoverActiveState(request, result.InnerElement()); 1881 doc->UpdateHoverActiveState(request, result.InnerElement());
1882 1882
1883 // The contextmenu event is a mouse event even when invoked using the 1883 // The contextmenu event is a mouse event even when invoked using the
1884 // keyboard. This is required for web compatibility. 1884 // keyboard or other methods. This is required for web compatibility.
1885 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; 1885 WebInputEvent::Type event_type = WebInputEvent::kMouseDown;
1886 if (frame_->GetSettings() && 1886 if (frame_->GetSettings() &&
1887 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) 1887 frame_->GetSettings()->GetShowContextMenuOnMouseUp())
1888 event_type = WebInputEvent::kMouseUp; 1888 event_type = WebInputEvent::kMouseUp;
1889 1889
1890 WebMouseEvent mouse_event( 1890 WebMouseEvent mouse_event(
1891 event_type, 1891 event_type,
1892 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), 1892 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()),
1893 WebFloatPoint(global_position.X(), global_position.Y()), 1893 WebFloatPoint(global_position.X(), global_position.Y()),
1894 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, 1894 WebPointerProperties::Button::kNoButton, /* clickCount */ 0,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 MouseEventWithHitTestResults& mev, 2122 MouseEventWithHitTestResults& mev,
2123 LocalFrame* subframe) { 2123 LocalFrame* subframe) {
2124 WebInputEventResult result = 2124 WebInputEventResult result =
2125 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); 2125 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event());
2126 if (result != WebInputEventResult::kNotHandled) 2126 if (result != WebInputEventResult::kNotHandled)
2127 return result; 2127 return result;
2128 return WebInputEventResult::kHandledSystem; 2128 return WebInputEventResult::kHandledSystem;
2129 } 2129 }
2130 2130
2131 } // namespace blink 2131 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698