Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
|
yosin_UTC9
2015/05/18 08:53:46
nit: Please use copyright comments in "EventHandle
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 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" | |
|
yosin_UTC9
2015/05/18 08:53:46
nit: Please have a blank line between guard macro
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 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; | |
|
yosin_UTC9
2015/05/18 08:53:46
Please in alphabetical order.
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 15 class HitTestResult; | |
| 16 class VisibleSelection; | |
| 17 | |
| 18 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili ngWhitespace }; | |
| 19 | |
| 20 class CORE_EXPORT SelectionController { | |
|
yosin_UTC9
2015/05/18 08:53:46
nit: Please put |final|.
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 21 DISALLOW_ALLOCATION(); | |
|
yosin_UTC9
2015/05/18 08:53:46
Let's make |SelectionControler| allocatable to avo
yosin_UTC9
2015/05/18 08:53:46
nit: Please add |WTF_MAKE_NONCOPYABLE(SelectionCon
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 22 public: | |
| 23 explicit SelectionController(LocalFrame*); | |
| 24 ~SelectionController(); | |
| 25 | |
| 26 void clear(); | |
| 27 | |
| 28 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleS election&, TextGranularity); | |
| 29 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing Whitespace); | |
| 30 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT railingWhitespace); | |
| 31 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); | |
| 32 void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResul ts&); | |
| 33 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResult s&); | |
| 34 | |
| 35 void handleMousePressEvent(const MouseEventWithHitTestResults&); | |
| 36 bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&); | |
| 37 bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); | |
| 38 bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); | |
| 39 void handleMouseDraggedEvent(const MouseEventWithHitTestResults&, const IntP oint&, const LayoutPoint&, const RefPtr<Node>, const IntPoint&); | |
| 40 bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&, const Layo utPoint&); | |
| 41 bool handlePasteGlobalSelection(const PlatformMouseEvent&); | |
| 42 | |
| 43 void updateSelectionForMouseDrag(const RefPtr<Node>, const LayoutPoint&, con st IntPoint&); | |
| 44 void updateSelectionForMouseDrag(const HitTestResult&, const RefPtr<Node>, c onst LayoutPoint&, const IntPoint&); | |
| 45 void selectionForContextMenu(const MouseEventWithHitTestResults&, const Layo utPoint&); | |
| 46 void releaseSelection(MouseEventWithHitTestResults&); | |
| 47 | |
| 48 void initializeSelectionState() { m_selectionState = HaveNotStartedSelection ; } | |
|
yosin_UTC9
2015/05/18 08:53:46
Let's do this in CPP file.
See:
http://dev.chromi
Miyoung Shin(g)
2015/05/19 09:01:42
Oh, I thought that it's ok to refer to the legacy-
| |
| 49 void setAllowSelection(bool allow) { m_allowSelection = allow; } | |
| 50 bool allowSelection() const { return m_allowSelection; } | |
| 51 bool singleClickInSelection() { return m_singleClickInSelection; } | |
|
yosin_UTC9
2015/05/18 08:53:46
nit: |const|.
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 52 | |
| 53 private: | |
| 54 LocalFrame* const m_frame; | |
| 55 | |
| 56 bool m_allowSelection; | |
| 57 bool m_singleClickInSelection; | |
| 58 enum SelectionState { HaveNotStartedSelection, PlacedCaret, ExtendedSelectio n }; | |
|
yosin_UTC9
2015/05/18 08:53:46
Let't use |enum class| for better static check.
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
| |
| 59 SelectionState m_selectionState; | |
| 60 }; | |
| 61 | |
| 62 } | |
| 63 #endif // SelectionController_h | |
| OLD | NEW |