| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 enum EAlteration { AlterationMove, AlterationExtend }; | 84 enum EAlteration { AlterationMove, AlterationExtend }; |
| 85 enum SetSelectionOption { | 85 enum SetSelectionOption { |
| 86 // 1 << 0 is reserved for EUserTriggered | 86 // 1 << 0 is reserved for EUserTriggered |
| 87 CloseTyping = 1 << 1, | 87 CloseTyping = 1 << 1, |
| 88 ClearTypingStyle = 1 << 2, | 88 ClearTypingStyle = 1 << 2, |
| 89 DoNotSetFocus = 1 << 3, | 89 DoNotSetFocus = 1 << 3, |
| 90 DoNotUpdateAppearance = 1 << 4, | 90 DoNotUpdateAppearance = 1 << 4, |
| 91 DoNotClearStrategy = 1 << 5, | 91 DoNotClearStrategy = 1 << 5, |
| 92 DoNotAdjustInFlatTree = 1 << 6, | 92 DoNotAdjustInFlatTree = 1 << 6, |
| 93 HandleVisible = 1 << 7, | |
| 94 }; | 93 }; |
| 95 // Union of values in SetSelectionOption and EUserTriggered | 94 // Union of values in SetSelectionOption and EUserTriggered |
| 96 typedef unsigned SetSelectionOptions; | 95 typedef unsigned SetSelectionOptions; |
| 97 static inline EUserTriggered selectionOptionsToUserTriggered( | 96 static inline EUserTriggered selectionOptionsToUserTriggered( |
| 98 SetSelectionOptions options) { | 97 SetSelectionOptions options) { |
| 99 return static_cast<EUserTriggered>(options & UserTriggered); | 98 return static_cast<EUserTriggered>(options & UserTriggered); |
| 100 } | 99 } |
| 101 | 100 |
| 102 bool isAvailable() const { return lifecycleContext(); } | 101 bool isAvailable() const { return lifecycleContext(); } |
| 103 // You should not call |document()| when |!isAvailable()|. | 102 // You should not call |document()| when |!isAvailable()|. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 130 TextGranularity = CharacterGranularity); | 129 TextGranularity = CharacterGranularity); |
| 131 | 130 |
| 132 void setSelection(const SelectionInFlatTree&, | 131 void setSelection(const SelectionInFlatTree&, |
| 133 SetSelectionOptions = CloseTyping | ClearTypingStyle, | 132 SetSelectionOptions = CloseTyping | ClearTypingStyle, |
| 134 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, | 133 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, |
| 135 TextGranularity = CharacterGranularity); | 134 TextGranularity = CharacterGranularity); |
| 136 | 135 |
| 137 // TODO(yosin): We should use |SelectionInDOMTree| version instead of | 136 // TODO(yosin): We should use |SelectionInDOMTree| version instead of |
| 138 // |VisibleSelection| version. | 137 // |VisibleSelection| version. |
| 139 void setSelection(const VisibleSelection&, | 138 void setSelection(const VisibleSelection&, |
| 139 HandleVisibility = HandleVisibility::NotVisible, |
| 140 SetSelectionOptions = CloseTyping | ClearTypingStyle, | 140 SetSelectionOptions = CloseTyping | ClearTypingStyle, |
| 141 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, | 141 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, |
| 142 TextGranularity = CharacterGranularity); | 142 TextGranularity = CharacterGranularity); |
| 143 void setSelection(const VisibleSelection&, SetSelectionOptions); |
| 143 // TODO(yosin): We should use |SelectionInFlatTree| version instead of | 144 // TODO(yosin): We should use |SelectionInFlatTree| version instead of |
| 144 // |VisibleSelectionInFlatTree| version. | 145 // |VisibleSelectionInFlatTree| version. |
| 145 void setSelection(const VisibleSelectionInFlatTree&, | 146 void setSelection(const VisibleSelectionInFlatTree&, |
| 147 HandleVisibility = HandleVisibility::NotVisible, |
| 146 SetSelectionOptions = CloseTyping | ClearTypingStyle, | 148 SetSelectionOptions = CloseTyping | ClearTypingStyle, |
| 147 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, | 149 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, |
| 148 TextGranularity = CharacterGranularity); | 150 TextGranularity = CharacterGranularity); |
| 151 void setSelection(const VisibleSelectionInFlatTree&, SetSelectionOptions); |
| 149 bool setSelectedRange( | 152 bool setSelectedRange( |
| 150 const EphemeralRange&, | 153 const EphemeralRange&, |
| 151 TextAffinity, | 154 TextAffinity, |
| 152 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, | 155 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, |
| 153 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); | 156 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); |
| 154 void selectAll(); | 157 void selectAll(); |
| 155 void clear(); | 158 void clear(); |
| 156 | 159 |
| 157 // Call this after doing user-triggered selections to make it easy to delete | 160 // Call this after doing user-triggered selections to make it easy to delete |
| 158 // the frame you entirely selected. | 161 // the frame you entirely selected. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 293 |
| 291 // For |PaintControllerPaintTestForSlimmingPaintV1AndV2|. | 294 // For |PaintControllerPaintTestForSlimmingPaintV1AndV2|. |
| 292 const DisplayItemClient& caretDisplayItemClientForTesting() const; | 295 const DisplayItemClient& caretDisplayItemClientForTesting() const; |
| 293 | 296 |
| 294 // Note: We have |selectionInFlatTree()| for unit tests, we should | 297 // Note: We have |selectionInFlatTree()| for unit tests, we should |
| 295 // use |visibleSelection<EditingInFlatTreeStrategy>()|. | 298 // use |visibleSelection<EditingInFlatTreeStrategy>()|. |
| 296 const VisibleSelectionInFlatTree& selectionInFlatTree() const; | 299 const VisibleSelectionInFlatTree& selectionInFlatTree() const; |
| 297 | 300 |
| 298 template <typename Strategy> | 301 template <typename Strategy> |
| 299 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, | 302 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, |
| 303 HandleVisibility, |
| 300 SetSelectionOptions, | 304 SetSelectionOptions, |
| 301 CursorAlignOnScroll, | 305 CursorAlignOnScroll, |
| 302 TextGranularity); | 306 TextGranularity); |
| 303 | 307 |
| 304 void respondToNodeModification(Node&, | 308 void respondToNodeModification(Node&, |
| 305 bool baseRemoved, | 309 bool baseRemoved, |
| 306 bool extentRemoved, | 310 bool extentRemoved, |
| 307 bool startRemoved, | 311 bool startRemoved, |
| 308 bool endRemoved); | 312 bool endRemoved); |
| 309 | 313 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 364 |
| 361 } // namespace blink | 365 } // namespace blink |
| 362 | 366 |
| 363 #ifndef NDEBUG | 367 #ifndef NDEBUG |
| 364 // Outside the WebCore namespace for ease of invocation from gdb. | 368 // Outside the WebCore namespace for ease of invocation from gdb. |
| 365 void showTree(const blink::FrameSelection&); | 369 void showTree(const blink::FrameSelection&); |
| 366 void showTree(const blink::FrameSelection*); | 370 void showTree(const blink::FrameSelection*); |
| 367 #endif | 371 #endif |
| 368 | 372 |
| 369 #endif // FrameSelection_h | 373 #endif // FrameSelection_h |
| OLD | NEW |