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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.h

Issue 2201853002: Blink handle selection handle visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing clear handles Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 enum class CursorAlignOnScroll { IfNeeded, Always }; 60 enum class CursorAlignOnScroll { IfNeeded, Always };
61 61
62 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 }; 62 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 };
63 63
64 enum RevealExtentOption { RevealExtent, DoNotRevealExtent }; 64 enum RevealExtentOption { RevealExtent, DoNotRevealExtent };
65 65
66 enum class SelectionDirectionalMode { NonDirectional, Directional }; 66 enum class SelectionDirectionalMode { NonDirectional, Directional };
67 67
68 enum class CaretVisibility; 68 enum class CaretVisibility;
69 69
70 enum class HandleVisibility { NotVisible, Visible };
71
70 class CORE_EXPORT FrameSelection final 72 class CORE_EXPORT FrameSelection final
71 : public GarbageCollectedFinalized<FrameSelection> { 73 : public GarbageCollectedFinalized<FrameSelection> {
72 WTF_MAKE_NONCOPYABLE(FrameSelection); 74 WTF_MAKE_NONCOPYABLE(FrameSelection);
73 75
74 public: 76 public:
75 static FrameSelection* create(LocalFrame* frame) { 77 static FrameSelection* create(LocalFrame* frame) {
76 return new FrameSelection(frame); 78 return new FrameSelection(frame);
77 } 79 }
78 ~FrameSelection(); 80 ~FrameSelection();
79 81
80 enum EAlteration { AlterationMove, AlterationExtend }; 82 enum EAlteration { AlterationMove, AlterationExtend };
81 enum SetSelectionOption { 83 enum SetSelectionOption {
82 // 1 << 0 is reserved for EUserTriggered 84 // 1 << 0 is reserved for EUserTriggered
83 CloseTyping = 1 << 1, 85 CloseTyping = 1 << 1,
84 ClearTypingStyle = 1 << 2, 86 ClearTypingStyle = 1 << 2,
85 DoNotSetFocus = 1 << 3, 87 DoNotSetFocus = 1 << 3,
86 DoNotUpdateAppearance = 1 << 4, 88 DoNotUpdateAppearance = 1 << 4,
87 DoNotClearStrategy = 1 << 5, 89 DoNotClearStrategy = 1 << 5,
88 DoNotAdjustInFlatTree = 1 << 6, 90 DoNotAdjustInFlatTree = 1 << 6,
91 HandleVisible = 1 << 7,
89 }; 92 };
90 // Union of values in SetSelectionOption and EUserTriggered 93 // Union of values in SetSelectionOption and EUserTriggered
91 typedef unsigned SetSelectionOptions; 94 typedef unsigned SetSelectionOptions;
92 static inline EUserTriggered selectionOptionsToUserTriggered( 95 static inline EUserTriggered selectionOptionsToUserTriggered(
93 SetSelectionOptions options) { 96 SetSelectionOptions options) {
94 return static_cast<EUserTriggered>(options & UserTriggered); 97 return static_cast<EUserTriggered>(options & UserTriggered);
95 } 98 }
96 99
97 bool isAvailable() const { return m_document; } 100 bool isAvailable() const { return m_document; }
98 // You should not call |document()| when |!isAvailable()|. 101 // You should not call |document()| when |!isAvailable()|.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 SetSelectionOptions = CloseTyping | ClearTypingStyle, 144 SetSelectionOptions = CloseTyping | ClearTypingStyle,
142 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, 145 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded,
143 TextGranularity = CharacterGranularity); 146 TextGranularity = CharacterGranularity);
144 bool setSelectedRange( 147 bool setSelectedRange(
145 const EphemeralRange&, 148 const EphemeralRange&,
146 TextAffinity, 149 TextAffinity,
147 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, 150 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional,
148 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); 151 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle);
149 void selectAll(); 152 void selectAll();
150 void clear(); 153 void clear();
154 void clearHandles();
151 155
152 // Call this after doing user-triggered selections to make it easy to delete 156 // Call this after doing user-triggered selections to make it easy to delete
153 // the frame you entirely selected. 157 // the frame you entirely selected.
154 void selectFrameElementInParentIfFullySelected(); 158 void selectFrameElementInParentIfFullySelected();
155 159
160 bool contains(const HitTestResult&);
156 bool contains(const LayoutPoint&); 161 bool contains(const LayoutPoint&);
157 162
158 SelectionType getSelectionType() const { 163 SelectionType getSelectionType() const {
159 return selection().getSelectionType(); 164 return selection().getSelectionType();
160 } 165 }
161 166
162 TextAffinity affinity() const { return selection().affinity(); } 167 TextAffinity affinity() const { return selection().affinity(); }
163 168
164 bool modify(EAlteration, 169 bool modify(EAlteration,
165 SelectionDirection, 170 SelectionDirection,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Used to suspend caret blinking while the mouse is down. 238 // Used to suspend caret blinking while the mouse is down.
234 void setCaretBlinkingSuspended(bool); 239 void setCaretBlinkingSuspended(bool);
235 bool isCaretBlinkingSuspended() const; 240 bool isCaretBlinkingSuspended() const;
236 241
237 // Focus 242 // Focus
238 void setFocused(bool); 243 void setFocused(bool);
239 bool isFocused() const { return m_focused; } 244 bool isFocused() const { return m_focused; }
240 bool isFocusedAndActive() const; 245 bool isFocusedAndActive() const;
241 void pageActivationChanged(); 246 void pageActivationChanged();
242 247
248 bool isHandleVisible() const {
249 return m_handleVisibility == HandleVisibility::Visible;
250 }
251
243 void updateSecureKeyboardEntryIfActive(); 252 void updateSecureKeyboardEntryIfActive();
244 253
245 // Returns true if a word is selected. 254 // Returns true if a word is selected.
246 bool selectWordAroundPosition(const VisiblePosition&); 255 bool selectWordAroundPosition(const VisiblePosition&);
247 256
248 #ifndef NDEBUG 257 #ifndef NDEBUG
249 void showTreeForThis() const; 258 void showTreeForThis() const;
250 #endif 259 #endif
251 260
252 void setFocusedNodeIfNeeded(); 261 void setFocusedNodeIfNeeded();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 const Member<PendingSelection> m_pendingSelection; 342 const Member<PendingSelection> m_pendingSelection;
334 const Member<SelectionEditor> m_selectionEditor; 343 const Member<SelectionEditor> m_selectionEditor;
335 344
336 TextGranularity m_granularity; 345 TextGranularity m_granularity;
337 LayoutUnit m_xPosForVerticalArrowNavigation; 346 LayoutUnit m_xPosForVerticalArrowNavigation;
338 347
339 Member<EditingStyle> m_typingStyle; 348 Member<EditingStyle> m_typingStyle;
340 349
341 bool m_focused : 1; 350 bool m_focused : 1;
342 351
352 HandleVisibility m_handleVisibility = HandleVisibility::NotVisible;
353
343 // Controls text granularity used to adjust the selection's extent in 354 // Controls text granularity used to adjust the selection's extent in
344 // moveRangeSelectionExtent. 355 // moveRangeSelectionExtent.
345 std::unique_ptr<GranularityStrategy> m_granularityStrategy; 356 std::unique_ptr<GranularityStrategy> m_granularityStrategy;
346 357
347 const Member<FrameCaret> m_frameCaret; 358 const Member<FrameCaret> m_frameCaret;
348 }; 359 };
349 360
350 inline EditingStyle* FrameSelection::typingStyle() const { 361 inline EditingStyle* FrameSelection::typingStyle() const {
351 return m_typingStyle.get(); 362 return m_typingStyle.get();
352 } 363 }
353 364
354 inline void FrameSelection::clearTypingStyle() { 365 inline void FrameSelection::clearTypingStyle() {
355 m_typingStyle.clear(); 366 m_typingStyle.clear();
356 } 367 }
357 368
358 inline void FrameSelection::setTypingStyle(EditingStyle* style) { 369 inline void FrameSelection::setTypingStyle(EditingStyle* style) {
359 m_typingStyle = style; 370 m_typingStyle = style;
360 } 371 }
361 } // namespace blink 372 } // namespace blink
362 373
363 #ifndef NDEBUG 374 #ifndef NDEBUG
364 // Outside the WebCore namespace for ease of invocation from gdb. 375 // Outside the WebCore namespace for ease of invocation from gdb.
365 void showTree(const blink::FrameSelection&); 376 void showTree(const blink::FrameSelection&);
366 void showTree(const blink::FrameSelection*); 377 void showTree(const blink::FrameSelection*);
367 #endif 378 #endif
368 379
369 #endif // FrameSelection_h 380 #endif // FrameSelection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698