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

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 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) 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/LocalDOMWindow.h" 57 #include "core/frame/LocalDOMWindow.h"
58 #include "core/frame/LocalFrame.h" 58 #include "core/frame/LocalFrame.h"
59 #include "core/frame/LocalFrameView.h" 59 #include "core/frame/LocalFrameView.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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 722 }
722 723
723 // TODO(editing-dev): Should we pass in user_triggered? 724 // TODO(editing-dev): Should we pass in user_triggered?
724 SetSelection(SelectionInDOMTree::Builder() 725 SetSelection(SelectionInDOMTree::Builder()
725 .SelectAllChildren(*root) 726 .SelectAllChildren(*root)
726 .SetIsHandleVisible(IsHandleVisible()) 727 .SetIsHandleVisible(IsHandleVisible())
727 .Build()); 728 .Build());
728 SelectFrameElementInParentIfFullySelected(); 729 SelectFrameElementInParentIfFullySelected();
729 // TODO(editing-dev): Should we pass in user_triggered? 730 // TODO(editing-dev): Should we pass in user_triggered?
730 NotifyTextControlOfSelectionChange(kUserTriggered); 731 NotifyTextControlOfSelectionChange(kUserTriggered);
732 if (IsHandleVisible()) {
733 ContextMenuAllowedScope scope;
734 frame_->GetEventHandler().ShowNonLocatedContextMenu(nullptr,
735 kMenuSourceTouch);
736 }
731 } 737 }
732 738
733 void FrameSelection::NotifyAccessibilityForSelectionChange() { 739 void FrameSelection::NotifyAccessibilityForSelectionChange() {
734 if (GetSelectionInDOMTree().IsNone()) 740 if (GetSelectionInDOMTree().IsNone())
735 return; 741 return;
736 AXObjectCache* cache = GetDocument().ExistingAXObjectCache(); 742 AXObjectCache* cache = GetDocument().ExistingAXObjectCache();
737 if (!cache) 743 if (!cache)
738 return; 744 return;
739 const Position& start = GetSelectionInDOMTree().ComputeStartPosition(); 745 const Position& start = GetSelectionInDOMTree().ComputeStartPosition();
740 cache->SelectionChanged(start.ComputeContainerNode()); 746 cache->SelectionChanged(start.ComputeContainerNode());
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 } 1186 }
1181 1187
1182 void showTree(const blink::FrameSelection* sel) { 1188 void showTree(const blink::FrameSelection* sel) {
1183 if (sel) 1189 if (sel)
1184 sel->ShowTreeForThis(); 1190 sel->ShowTreeForThis();
1185 else 1191 else
1186 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1192 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1187 } 1193 }
1188 1194
1189 #endif 1195 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698