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