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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: fix rebase problems Created 3 years, 7 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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "core/editing/spellcheck/SpellChecker.h" 55 #include "core/editing/spellcheck/SpellChecker.h"
56 #include "core/events/Event.h" 56 #include "core/events/Event.h"
57 #include "core/frame/FrameView.h" 57 #include "core/frame/FrameView.h"
58 #include "core/frame/LocalDOMWindow.h" 58 #include "core/frame/LocalDOMWindow.h"
59 #include "core/frame/LocalFrame.h" 59 #include "core/frame/LocalFrame.h"
60 #include "core/frame/Settings.h" 60 #include "core/frame/Settings.h"
61 #include "core/html/HTMLBodyElement.h" 61 #include "core/html/HTMLBodyElement.h"
62 #include "core/html/HTMLFrameElementBase.h" 62 #include "core/html/HTMLFrameElementBase.h"
63 #include "core/html/HTMLInputElement.h" 63 #include "core/html/HTMLInputElement.h"
64 #include "core/html/HTMLSelectElement.h" 64 #include "core/html/HTMLSelectElement.h"
65 #include "core/input/ContextMenuAllowedScope.h"
65 #include "core/input/EventHandler.h" 66 #include "core/input/EventHandler.h"
66 #include "core/layout/HitTestRequest.h" 67 #include "core/layout/HitTestRequest.h"
67 #include "core/layout/HitTestResult.h" 68 #include "core/layout/HitTestResult.h"
68 #include "core/layout/LayoutPart.h" 69 #include "core/layout/LayoutPart.h"
69 #include "core/layout/api/LayoutViewItem.h" 70 #include "core/layout/api/LayoutViewItem.h"
70 #include "core/loader/DocumentLoader.h" 71 #include "core/loader/DocumentLoader.h"
71 #include "core/page/EditorClient.h" 72 #include "core/page/EditorClient.h"
72 #include "core/page/FocusController.h" 73 #include "core/page/FocusController.h"
73 #include "core/page/FrameTree.h" 74 #include "core/page/FrameTree.h"
74 #include "core/page/Page.h" 75 #include "core/page/Page.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 } 716 }
716 717
717 // TODO(editing-dev): Should we pass in user_triggered? 718 // TODO(editing-dev): Should we pass in user_triggered?
718 SetSelection(SelectionInDOMTree::Builder() 719 SetSelection(SelectionInDOMTree::Builder()
719 .SelectAllChildren(*root) 720 .SelectAllChildren(*root)
720 .SetIsHandleVisible(IsHandleVisible()) 721 .SetIsHandleVisible(IsHandleVisible())
721 .Build()); 722 .Build());
722 SelectFrameElementInParentIfFullySelected(); 723 SelectFrameElementInParentIfFullySelected();
723 // TODO(editing-dev): Should we pass in user_triggered? 724 // TODO(editing-dev): Should we pass in user_triggered?
724 NotifyTextControlOfSelectionChange(kUserTriggered); 725 NotifyTextControlOfSelectionChange(kUserTriggered);
726 if (IsHandleVisible()) {
yosin_UTC9 2017/05/24 04:51:23 It is OK to show context menu when JS calls |docum
amaralp1 2017/05/24 08:30:34 I think it is OK in this case. The selectAll will
727 ContextMenuAllowedScope scope;
728 frame_->GetEventHandler().SendContextMenuEventForTouchSelection(
729 kMenuSourceTouch);
730 }
725 } 731 }
726 732
727 bool FrameSelection::SetSelectedRange(const EphemeralRange& range, 733 bool FrameSelection::SetSelectedRange(const EphemeralRange& range,
728 TextAffinity affinity, 734 TextAffinity affinity,
729 SelectionDirectionalMode directional, 735 SelectionDirectionalMode directional,
730 SetSelectionOptions options) { 736 SetSelectionOptions options) {
731 if (range.IsNull()) 737 if (range.IsNull())
732 return false; 738 return false;
733 SetSelection(SelectionInDOMTree::Builder() 739 SetSelection(SelectionInDOMTree::Builder()
734 .SetBaseAndExtent(range) 740 .SetBaseAndExtent(range)
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 } 1196 }
1191 1197
1192 void showTree(const blink::FrameSelection* sel) { 1198 void showTree(const blink::FrameSelection* sel) {
1193 if (sel) 1199 if (sel)
1194 sel->ShowTreeForThis(); 1200 sel->ShowTreeForThis();
1195 else 1201 else
1196 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1202 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1197 } 1203 }
1198 1204
1199 #endif 1205 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698