OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 enum class CursorAlignOnScroll { IfNeeded, Always }; | 58 enum class CursorAlignOnScroll { IfNeeded, Always }; |
59 | 59 |
60 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 }; | 60 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 }; |
61 | 61 |
62 enum RevealExtentOption { RevealExtent, DoNotRevealExtent }; | 62 enum RevealExtentOption { RevealExtent, DoNotRevealExtent }; |
63 | 63 |
64 enum class SelectionDirectionalMode { NonDirectional, Directional }; | 64 enum class SelectionDirectionalMode { NonDirectional, Directional }; |
65 | 65 |
66 enum class CaretVisibility; | 66 enum class CaretVisibility; |
67 | 67 |
| 68 enum class HandleVisibility { NotVisible, Visible }; |
| 69 |
68 class CORE_EXPORT FrameSelection final | 70 class CORE_EXPORT FrameSelection final |
69 : public GarbageCollectedFinalized<FrameSelection> { | 71 : public GarbageCollectedFinalized<FrameSelection> { |
70 WTF_MAKE_NONCOPYABLE(FrameSelection); | 72 WTF_MAKE_NONCOPYABLE(FrameSelection); |
71 | 73 |
72 public: | 74 public: |
73 static FrameSelection* create(LocalFrame& frame) { | 75 static FrameSelection* create(LocalFrame& frame) { |
74 return new FrameSelection(frame); | 76 return new FrameSelection(frame); |
75 } | 77 } |
76 ~FrameSelection(); | 78 ~FrameSelection(); |
77 | 79 |
78 enum EAlteration { AlterationMove, AlterationExtend }; | 80 enum EAlteration { AlterationMove, AlterationExtend }; |
79 enum SetSelectionOption { | 81 enum SetSelectionOption { |
80 // 1 << 0 is reserved for EUserTriggered | 82 // 1 << 0 is reserved for EUserTriggered |
81 CloseTyping = 1 << 1, | 83 CloseTyping = 1 << 1, |
82 ClearTypingStyle = 1 << 2, | 84 ClearTypingStyle = 1 << 2, |
83 DoNotSetFocus = 1 << 3, | 85 DoNotSetFocus = 1 << 3, |
84 DoNotUpdateAppearance = 1 << 4, | 86 DoNotUpdateAppearance = 1 << 4, |
85 DoNotClearStrategy = 1 << 5, | 87 DoNotClearStrategy = 1 << 5, |
86 DoNotAdjustInFlatTree = 1 << 6, | 88 DoNotAdjustInFlatTree = 1 << 6, |
| 89 HandleVisible = 1 << 7, |
87 }; | 90 }; |
88 // Union of values in SetSelectionOption and EUserTriggered | 91 // Union of values in SetSelectionOption and EUserTriggered |
89 typedef unsigned SetSelectionOptions; | 92 typedef unsigned SetSelectionOptions; |
90 static inline EUserTriggered selectionOptionsToUserTriggered( | 93 static inline EUserTriggered selectionOptionsToUserTriggered( |
91 SetSelectionOptions options) { | 94 SetSelectionOptions options) { |
92 return static_cast<EUserTriggered>(options & UserTriggered); | 95 return static_cast<EUserTriggered>(options & UserTriggered); |
93 } | 96 } |
94 | 97 |
95 bool isAvailable() const { return m_document; } | 98 bool isAvailable() const { return m_document; } |
96 // You should not call |document()| when |!isAvailable()|. | 99 // You should not call |document()| when |!isAvailable()|. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void setCaretBlinkingSuspended(bool); | 231 void setCaretBlinkingSuspended(bool); |
229 bool isCaretBlinkingSuspended() const; | 232 bool isCaretBlinkingSuspended() const; |
230 | 233 |
231 // Focus | 234 // Focus |
232 void setFocused(bool); | 235 void setFocused(bool); |
233 bool isFocused() const { return m_focused; } | 236 bool isFocused() const { return m_focused; } |
234 bool isFocusedAndActive() const; | 237 bool isFocusedAndActive() const; |
235 void pageActivationChanged(); | 238 void pageActivationChanged(); |
236 | 239 |
237 void setUseSecureKeyboardEntryWhenActive(bool); | 240 void setUseSecureKeyboardEntryWhenActive(bool); |
| 241 |
| 242 bool isHandleVisible() const { |
| 243 return m_handleVisibility == HandleVisibility::Visible; |
| 244 } |
| 245 |
238 void updateSecureKeyboardEntryIfActive(); | 246 void updateSecureKeyboardEntryIfActive(); |
239 | 247 |
240 // Returns true if a word is selected. | 248 // Returns true if a word is selected. |
241 bool selectWordAroundPosition(const VisiblePosition&); | 249 bool selectWordAroundPosition(const VisiblePosition&); |
242 | 250 |
243 #ifndef NDEBUG | 251 #ifndef NDEBUG |
244 void showTreeForThis() const; | 252 void showTreeForThis() const; |
245 #endif | 253 #endif |
246 | 254 |
247 void setFocusedNodeIfNeeded(); | 255 void setFocusedNodeIfNeeded(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 const Member<PendingSelection> m_pendingSelection; | 336 const Member<PendingSelection> m_pendingSelection; |
329 const Member<SelectionEditor> m_selectionEditor; | 337 const Member<SelectionEditor> m_selectionEditor; |
330 | 338 |
331 TextGranularity m_granularity; | 339 TextGranularity m_granularity; |
332 LayoutUnit m_xPosForVerticalArrowNavigation; | 340 LayoutUnit m_xPosForVerticalArrowNavigation; |
333 | 341 |
334 Member<EditingStyle> m_typingStyle; | 342 Member<EditingStyle> m_typingStyle; |
335 | 343 |
336 bool m_focused : 1; | 344 bool m_focused : 1; |
337 | 345 |
| 346 HandleVisibility m_handleVisibility = HandleVisibility::NotVisible; |
| 347 |
338 // Controls text granularity used to adjust the selection's extent in | 348 // Controls text granularity used to adjust the selection's extent in |
339 // moveRangeSelectionExtent. | 349 // moveRangeSelectionExtent. |
340 std::unique_ptr<GranularityStrategy> m_granularityStrategy; | 350 std::unique_ptr<GranularityStrategy> m_granularityStrategy; |
341 | 351 |
342 const Member<FrameCaret> m_frameCaret; | 352 const Member<FrameCaret> m_frameCaret; |
343 bool m_useSecureKeyboardEntryWhenActive = false; | 353 bool m_useSecureKeyboardEntryWhenActive = false; |
344 }; | 354 }; |
345 | 355 |
346 inline EditingStyle* FrameSelection::typingStyle() const { | 356 inline EditingStyle* FrameSelection::typingStyle() const { |
347 return m_typingStyle.get(); | 357 return m_typingStyle.get(); |
348 } | 358 } |
349 | 359 |
350 inline void FrameSelection::clearTypingStyle() { | 360 inline void FrameSelection::clearTypingStyle() { |
351 m_typingStyle.clear(); | 361 m_typingStyle.clear(); |
352 } | 362 } |
353 | 363 |
354 inline void FrameSelection::setTypingStyle(EditingStyle* style) { | 364 inline void FrameSelection::setTypingStyle(EditingStyle* style) { |
355 m_typingStyle = style; | 365 m_typingStyle = style; |
356 } | 366 } |
357 } // namespace blink | 367 } // namespace blink |
358 | 368 |
359 #ifndef NDEBUG | 369 #ifndef NDEBUG |
360 // Outside the WebCore namespace for ease of invocation from gdb. | 370 // Outside the WebCore namespace for ease of invocation from gdb. |
361 void showTree(const blink::FrameSelection&); | 371 void showTree(const blink::FrameSelection&); |
362 void showTree(const blink::FrameSelection*); | 372 void showTree(const blink::FrameSelection*); |
363 #endif | 373 #endif |
364 | 374 |
365 #endif // FrameSelection_h | 375 #endif // FrameSelection_h |
OLD | NEW |