| Index: Source/core/editing/SelectionController.h
|
| diff --git a/Source/core/frame/DOMTimer.h b/Source/core/editing/SelectionController.h
|
| similarity index 35%
|
| copy from Source/core/frame/DOMTimer.h
|
| copy to Source/core/editing/SelectionController.h
|
| index 508a1841884529871b964b78685b9a1f6be0da7d..9af726f18e07affd2074fe82f22e3badd61f64e4 100644
|
| --- a/Source/core/frame/DOMTimer.h
|
| +++ b/Source/core/editing/SelectionController.h
|
| @@ -1,5 +1,6 @@
|
| /*
|
| - * Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
| + * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
|
| + * Copyright (C) 2015 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions
|
| @@ -21,70 +22,66 @@
|
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| - *
|
| */
|
|
|
| -#ifndef DOMTimer_h
|
| -#define DOMTimer_h
|
| +#ifndef SelectionController_h
|
| +#define SelectionController_h
|
|
|
| -#include "bindings/core/v8/ScheduledAction.h"
|
| #include "core/CoreExport.h"
|
| -#include "core/frame/SuspendableTimer.h"
|
| -#include "platform/UserGestureIndicator.h"
|
| +#include "core/editing/TextGranularity.h"
|
| +#include "core/page/EventWithHitTestResults.h"
|
| #include "platform/heap/Handle.h"
|
| -#include "wtf/OwnPtr.h"
|
| -#include "wtf/PassOwnPtr.h"
|
| -#include "wtf/RefPtr.h"
|
|
|
| namespace blink {
|
|
|
| -class ExecutionContext;
|
| +class FrameSelection;
|
| +class HitTestResult;
|
| +class LocalFrame;
|
| +class VisibleSelection;
|
|
|
| -class CORE_EXPORT DOMTimer final : public RefCountedWillBeGarbageCollectedFinalized<DOMTimer>, public SuspendableTimer {
|
| - WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMTimer);
|
| +class SelectionController final : public NoBaseWillBeGarbageCollected<SelectionController> {
|
| + WTF_MAKE_NONCOPYABLE(SelectionController);
|
| public:
|
| - // Creates a new timer owned by the ExecutionContext, starts it and returns its ID.
|
| - static int install(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction>, int timeout, bool singleShot);
|
| - static void removeByID(ExecutionContext*, int timeoutID);
|
| -
|
| - virtual ~DOMTimer();
|
| -
|
| - // ActiveDOMObject
|
| - virtual void stop() override;
|
| -
|
| - // The following are essentially constants. All intervals are in seconds.
|
| - static double hiddenPageAlignmentInterval();
|
| - static double visiblePageAlignmentInterval();
|
| -
|
| - // Eager finalization is needed to promptly stop this Timer object.
|
| - // Otherwise timer events might fire at an object that's slated for destruction
|
| - // (when lazily swept), but some of its members (m_action) may already have
|
| - // been finalized & must not be accessed.
|
| - EAGERLY_FINALIZE();
|
| - DECLARE_VIRTUAL_TRACE();
|
| -
|
| - void disposeTimer();
|
| + static PassOwnPtrWillBeRawPtr<SelectionController> create(LocalFrame&);
|
| + DECLARE_TRACE();
|
| +
|
| + bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity);
|
| + void handleMousePressEvent(const MouseEventWithHitTestResults&);
|
| + bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
|
| + bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
|
| + bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
|
| + void handleMouseDraggedEvent(const MouseEventWithHitTestResults&, const IntPoint&, const LayoutPoint&, Node*, const IntPoint&);
|
| + bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&, const LayoutPoint&);
|
| + bool handlePasteGlobalSelection(const PlatformMouseEvent&);
|
| + bool handleGestureLongPress(const PlatformGestureEvent&, const HitTestResult&);
|
| +
|
| + void updateSelectionForMouseDrag(Node*, const LayoutPoint&, const IntPoint&);
|
| + void updateSelectionForMouseDrag(const HitTestResult&, Node*, const LayoutPoint&, const IntPoint&);
|
| + void sendContextMenuEvent(const MouseEventWithHitTestResults&, const LayoutPoint&);
|
| + void passMousePressEventToSubframe(const MouseEventWithHitTestResults&);
|
| +
|
| + void initializeSelectionState();
|
| + void setMouseDownMayStartSelect(bool);
|
| + bool mouseDownMayStartSelect() const;
|
| + bool mouseDownWasSingleClickInSelection() const;
|
|
|
| private:
|
| - friend class DOMTimerCoordinator; // For create().
|
| + explicit SelectionController(LocalFrame&);
|
|
|
| - static PassRefPtrWillBeRawPtr<DOMTimer> create(ExecutionContext* context, PassOwnPtrWillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot, int timeoutID)
|
| - {
|
| - return adoptRefWillBeNoop(new DOMTimer(context, action, timeout, singleShot, timeoutID));
|
| - }
|
| + enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
|
| + void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace);
|
| + void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace);
|
| + void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&);
|
| + void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResults&);
|
| + void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&);
|
|
|
| - DOMTimer(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction>, int interval, bool singleShot, int timeoutID);
|
| - virtual void fired() override;
|
|
|
| - // Retuns timer fire time rounded to the next multiple of timer alignment interval.
|
| - virtual double alignedFireTime(double) const override;
|
| -
|
| - int m_timeoutID;
|
| - int m_nestingLevel;
|
| - OwnPtrWillBeMember<ScheduledAction> m_action;
|
| - RefPtr<UserGestureToken> m_userGestureToken;
|
| + RawPtrWillBeMember<LocalFrame> const m_frame;
|
| + bool m_mouseDownMayStartSelect;
|
| + bool m_mouseDownWasSingleClickInSelection;
|
| + enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
|
| + SelectionInitiationState m_selectionInitiationState;
|
| };
|
|
|
| } // namespace blink
|
| -
|
| -#endif // DOMTimer_h
|
| +#endif // SelectionController_h
|
|
|