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

Unified Diff: Source/core/page/EventHandler.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, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/page/EventHandler.h
diff --git a/Source/core/page/EventHandler.h b/Source/core/page/EventHandler.h
index eeb7df8c47208340f4bf9b8bb84a63aad03ad6f6..ffc0c412e3ebb2a7688774e5cea92ed1775d2856 100644
--- a/Source/core/page/EventHandler.h
+++ b/Source/core/page/EventHandler.h
@@ -27,7 +27,7 @@
#define EventHandler_h
#include "core/CoreExport.h"
-#include "core/editing/TextGranularity.h"
+#include "core/editing/SelectionController.h"
yosin_UTC9 2015/05/18 08:53:47 Let's use |OwnPtr<ScrollController| to avoid inclu
Miyoung Shin(g) 2015/05/19 09:01:43 Done.
#include "core/events/TextEventInputType.h"
#include "core/layout/HitTestRequest.h"
#include "core/style/ComputedStyleConstants.h"
@@ -77,11 +77,9 @@ class ScrollableArea;
class Scrollbar;
class ScrollState;
class TextEvent;
-class VisibleSelection;
class WheelEvent;
class Widget;
-enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
enum class DragInitiator;
class CORE_EXPORT EventHandler : public NoBaseWillBeGarbageCollectedFinalized<EventHandler> {
@@ -94,8 +92,6 @@ public:
void clear();
void nodeWillBeRemoved(Node&);
- void updateSelectionForMouseDrag();
-
#if OS(WIN)
void startPanScrolling(LayoutObject*);
#endif
@@ -196,31 +192,21 @@ public:
PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_lastMouseDownUserGestureToken.release(); }
int clickCount() { return m_clickCount; }
- bool mouseDownWasSingleClickInSelection() { return m_mouseDownWasSingleClickInSelection; }
+
+ void updateSelectionForMouseDrag();
yosin_UTC9 2015/05/18 08:53:47 nit: Please move this to original position, e.g. L
Miyoung Shin(g) 2015/05/19 09:01:43 Done.
+ SelectionController& selectionController() { return m_selectionController; }
private:
static DragState& dragState();
DataTransfer* createDraggingDataTransfer() const;
- 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&);
-
bool handleMouseMoveOrLeaveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = nullptr, bool onlyUpdateScrollbars = false, bool forceLeave = false);
bool handleMousePressEvent(const MouseEventWithHitTestResults&);
- bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
- bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
- bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
bool handleMouseFocus(const MouseEventWithHitTestResults&);
bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
- bool handlePasteGlobalSelection(const PlatformMouseEvent&);
-
HitTestRequest::HitTestRequestType getHitTypeForGestureType(PlatformEvent::Type);
void applyTouchAdjustment(PlatformGestureEvent*, HitTestResult*);
bool handleGestureTap(const GestureEventWithHitTestResults&);
@@ -239,8 +225,6 @@ private:
void cursorUpdateTimerFired(Timer<EventHandler>*);
void activeIntervalTimerFired(Timer<EventHandler>*);
- bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
-
void fakeMouseMoveEventTimerFired(Timer<EventHandler>*);
void cancelFakeMouseMoveEvent();
bool isCursorVisible() const;
@@ -303,8 +287,6 @@ private:
void defaultEscapeEventHandler(KeyboardEvent*);
void defaultArrowEventHandler(WebFocusType, KeyboardEvent*);
- void updateSelectionForMouseDrag(const HitTestResult&);
-
void updateLastScrollbarUnderMouse(Scrollbar*, bool);
void setFrameWasScrolledByUser();
@@ -336,11 +318,8 @@ private:
bool m_capturesDragging;
RefPtrWillBeMember<Node> m_mousePressNode;
- bool m_mouseDownMayStartSelect;
bool m_mouseDownMayStartDrag;
- bool m_mouseDownWasSingleClickInSelection;
- enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
- SelectionInitiationState m_selectionInitiationState;
+ SelectionController m_selectionController;
yosin_UTC9 2015/05/18 08:53:47 Let's use |const OwnPtr<SelectionController>|.
Miyoung Shin(g) 2015/05/19 09:01:43 Done.
LayoutPoint m_dragStartPos;

Powered by Google App Engine
This is Rietveld 408576698