| 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..972ada5868a8541afb7386beab6b5e3c168c0cf0
|
| --- /dev/null
|
| +++ b/Source/core/editing/SelectionController.h
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// 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"
|
| +#include "core/editing/TextGranularity.h"
|
| +#include "core/page/EventWithHitTestResults.h"
|
| +#include "platform/heap/Handle.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class LocalFrame;
|
| +class HitTestResult;
|
| +class VisibleSelection;
|
| +
|
| +enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
|
| +
|
| +class CORE_EXPORT SelectionController : public NoBaseWillBeGarbageCollectedFinalized<SelectionController> {
|
| + WTF_MAKE_NONCOPYABLE(SelectionController);
|
| +public:
|
| + explicit SelectionController(LocalFrame*);
|
| + ~SelectionController();
|
| + DECLARE_TRACE();
|
| +
|
| + 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 notifySelectionChanged();
|
| +
|
| + void initializeSelectionState() { m_selectionState = HaveNotStartedSelection; }
|
| + void setAllowSelection(bool allow) { m_allowSelection = allow; }
|
| + bool allowSelection() const { return m_allowSelection; }
|
| + bool singleClickInSelection() { return m_singleClickInSelection; }
|
| +
|
| +private:
|
| + LocalFrame* const m_frame;
|
| +
|
| + bool m_allowSelection;
|
| + bool m_singleClickInSelection;
|
| + enum SelectionState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
|
| + SelectionState m_selectionState;
|
| +};
|
| +
|
| +}
|
| +#endif // SelectionController_h
|
|
|