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