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

Side by Side Diff: Source/core/editing/SelectionController.h

Issue 1113323002: [Reland] Refactor the selection code in EventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SelectionController_h
6 #define SelectionController_h
7 #include "core/CoreExport.h"
8 #include "core/editing/TextGranularity.h"
9 #include "core/page/EventWithHitTestResults.h"
10 #include "platform/heap/Handle.h"
11
12 namespace blink {
13
14 class LocalFrame;
15 class HitTestResult;
16 class VisibleSelection;
17
18 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili ngWhitespace };
19
20 class CORE_EXPORT SelectionController : public NoBaseWillBeGarbageCollectedFinal ized<SelectionController> {
21 WTF_MAKE_NONCOPYABLE(SelectionController);
22 public:
23 explicit SelectionController(LocalFrame*);
24 ~SelectionController();
25 DECLARE_TRACE();
26
27 void clear();
28
29 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleS election&, TextGranularity);
30 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing Whitespace);
31 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT railingWhitespace);
32 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&);
33 void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResul ts&);
34 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResult s&);
35
36 void handleMousePressEvent(const MouseEventWithHitTestResults&);
37 bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
38 bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
39 bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
40 void handleMouseDraggedEvent(const MouseEventWithHitTestResults&, const IntP oint&, const LayoutPoint&, const RefPtr<Node>, const IntPoint&);
41 bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&, const Layo utPoint&);
42 bool handlePasteGlobalSelection(const PlatformMouseEvent&);
43
44 void updateSelectionForMouseDrag(const RefPtr<Node>, const LayoutPoint&, con st IntPoint&);
45 void updateSelectionForMouseDrag(const HitTestResult&, const RefPtr<Node>, c onst LayoutPoint&, const IntPoint&);
46 void selectionForContextMenu(const MouseEventWithHitTestResults&, const Layo utPoint&);
47 void releaseSelection(MouseEventWithHitTestResults&);
48 void notifySelectionChanged();
49
50 void initializeSelectionState() { m_selectionState = HaveNotStartedSelection ; }
51 void setAllowSelection(bool allow) { m_allowSelection = allow; }
52 bool allowSelection() const { return m_allowSelection; }
53 bool singleClickInSelection() { return m_singleClickInSelection; }
54
55 private:
56 LocalFrame* const m_frame;
57
58 bool m_allowSelection;
59 bool m_singleClickInSelection;
60 enum SelectionState { HaveNotStartedSelection, PlacedCaret, ExtendedSelectio n };
61 SelectionState m_selectionState;
62 };
63
64 }
65 #endif // SelectionController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698