Chromium Code Reviews| Index: Source/core/editing/SelectionController.h |
| diff --git a/Source/core/editing/SelectionController.h b/Source/core/editing/SelectionController.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7052833130a59d61d45df47ad9f54c1775ae155a |
| --- /dev/null |
| +++ b/Source/core/editing/SelectionController.h |
| @@ -0,0 +1,63 @@ |
| +// 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.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SelectionController_h |
| +#define SelectionController_h |
| +#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.
|
| +#include "core/editing/TextGranularity.h" |
| +#include "core/page/EventWithHitTestResults.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class LocalFrame; |
|
yosin_UTC9
2015/05/18 08:53:46
Please in alphabetical order.
Miyoung Shin(g)
2015/05/19 09:01:42
Done.
|
| +class HitTestResult; |
| +class VisibleSelection; |
| + |
| +enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace }; |
| + |
| +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.
|
| + 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.
|
| +public: |
| + explicit SelectionController(LocalFrame*); |
| + ~SelectionController(); |
| + |
| + void clear(); |
| + |
| + bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity); |
| + void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace); |
| + void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace); |
| + void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); |
| + void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResults&); |
| + void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&); |
| + |
| + void handleMousePressEvent(const MouseEventWithHitTestResults&); |
| + bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&); |
| + bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); |
| + bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); |
| + void handleMouseDraggedEvent(const MouseEventWithHitTestResults&, const IntPoint&, const LayoutPoint&, const RefPtr<Node>, const IntPoint&); |
| + bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&, const LayoutPoint&); |
| + bool handlePasteGlobalSelection(const PlatformMouseEvent&); |
| + |
| + void updateSelectionForMouseDrag(const RefPtr<Node>, const LayoutPoint&, const IntPoint&); |
| + void updateSelectionForMouseDrag(const HitTestResult&, const RefPtr<Node>, const LayoutPoint&, const IntPoint&); |
| + void selectionForContextMenu(const MouseEventWithHitTestResults&, const LayoutPoint&); |
| + void releaseSelection(MouseEventWithHitTestResults&); |
| + |
| + 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-
|
| + void setAllowSelection(bool allow) { m_allowSelection = allow; } |
| + bool allowSelection() const { return m_allowSelection; } |
| + 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.
|
| + |
| +private: |
| + LocalFrame* const m_frame; |
| + |
| + bool m_allowSelection; |
| + bool m_singleClickInSelection; |
| + enum SelectionState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection }; |
|
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.
|
| + SelectionState m_selectionState; |
| +}; |
| + |
| +} |
| +#endif // SelectionController_h |