| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 3 * reserved. |
| 3 * | 4 * |
| 4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 6 * are met: | 7 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 12 * | 13 * |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 enum EAlteration { AlterationMove, AlterationExtend }; | 80 enum EAlteration { AlterationMove, AlterationExtend }; |
| 80 enum SetSelectionOption { | 81 enum SetSelectionOption { |
| 81 // 1 << 0 is reserved for EUserTriggered | 82 // 1 << 0 is reserved for EUserTriggered |
| 82 CloseTyping = 1 << 1, | 83 CloseTyping = 1 << 1, |
| 83 ClearTypingStyle = 1 << 2, | 84 ClearTypingStyle = 1 << 2, |
| 84 DoNotSetFocus = 1 << 3, | 85 DoNotSetFocus = 1 << 3, |
| 85 DoNotUpdateAppearance = 1 << 4, | 86 DoNotUpdateAppearance = 1 << 4, |
| 86 DoNotClearStrategy = 1 << 5, | 87 DoNotClearStrategy = 1 << 5, |
| 87 DoNotAdjustInFlatTree = 1 << 6, | 88 DoNotAdjustInFlatTree = 1 << 6, |
| 88 }; | 89 }; |
| 89 typedef unsigned | 90 // Union of values in SetSelectionOption and EUserTriggered |
| 90 SetSelectionOptions; // Union of values in SetSelectionOption and EUserTr
iggered | 91 typedef unsigned SetSelectionOptions; |
| 91 static inline EUserTriggered selectionOptionsToUserTriggered( | 92 static inline EUserTriggered selectionOptionsToUserTriggered( |
| 92 SetSelectionOptions options) { | 93 SetSelectionOptions options) { |
| 93 return static_cast<EUserTriggered>(options & UserTriggered); | 94 return static_cast<EUserTriggered>(options & UserTriggered); |
| 94 } | 95 } |
| 95 | 96 |
| 96 bool isAvailable() const { return m_document; } | 97 bool isAvailable() const { return m_document; } |
| 97 // You should not call |document()| when |!isAvailable()|. | 98 // You should not call |document()| when |!isAvailable()|. |
| 98 const Document& document() const; | 99 const Document& document() const; |
| 99 Document& document(); | 100 Document& document(); |
| 100 LocalFrame* frame() const { return m_frame; } | 101 LocalFrame* frame() const { return m_frame; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, | 144 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, |
| 144 SetSelectionOptions = CloseTyping | ClearTypingStyle); | 145 SetSelectionOptions = CloseTyping | ClearTypingStyle); |
| 145 bool setSelectedRange( | 146 bool setSelectedRange( |
| 146 const EphemeralRange&, | 147 const EphemeralRange&, |
| 147 TextAffinity, | 148 TextAffinity, |
| 148 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, | 149 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, |
| 149 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); | 150 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); |
| 150 void selectAll(); | 151 void selectAll(); |
| 151 void clear(); | 152 void clear(); |
| 152 | 153 |
| 153 // Call this after doing user-triggered selections to make it easy to delete t
he frame you entirely selected. | 154 // Call this after doing user-triggered selections to make it easy to delete |
| 155 // the frame you entirely selected. |
| 154 void selectFrameElementInParentIfFullySelected(); | 156 void selectFrameElementInParentIfFullySelected(); |
| 155 | 157 |
| 156 bool contains(const LayoutPoint&); | 158 bool contains(const LayoutPoint&); |
| 157 | 159 |
| 158 SelectionType getSelectionType() const { | 160 SelectionType getSelectionType() const { |
| 159 return selection().getSelectionType(); | 161 return selection().getSelectionType(); |
| 160 } | 162 } |
| 161 | 163 |
| 162 TextAffinity affinity() const { return selection().affinity(); } | 164 TextAffinity affinity() const { return selection().affinity(); } |
| 163 | 165 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 181 const VisiblePosition& extent, | 183 const VisiblePosition& extent, |
| 182 TextGranularity); | 184 TextGranularity); |
| 183 | 185 |
| 184 TextGranularity granularity() const { return m_granularity; } | 186 TextGranularity granularity() const { return m_granularity; } |
| 185 | 187 |
| 186 Position base() const { return selection().base(); } | 188 Position base() const { return selection().base(); } |
| 187 Position extent() const { return selection().extent(); } | 189 Position extent() const { return selection().extent(); } |
| 188 Position start() const { return selection().start(); } | 190 Position start() const { return selection().start(); } |
| 189 Position end() const { return selection().end(); } | 191 Position end() const { return selection().end(); } |
| 190 | 192 |
| 191 // Return the layoutObject that is responsible for painting the caret (in the
selection start node) | 193 // Return the layoutObject that is responsible for painting the caret (in the |
| 194 // selection start node) |
| 192 LayoutBlock* caretLayoutObject() const; | 195 LayoutBlock* caretLayoutObject() const; |
| 193 | 196 |
| 194 // Bounds of (possibly transformed) caret in absolute coords | 197 // Bounds of (possibly transformed) caret in absolute coords |
| 195 IntRect absoluteCaretBounds(); | 198 IntRect absoluteCaretBounds(); |
| 196 | 199 |
| 197 void didChangeFocus(); | 200 void didChangeFocus(); |
| 198 | 201 |
| 199 bool isNone() const { return selection().isNone(); } | 202 bool isNone() const { return selection().isNone(); } |
| 200 bool isCaret() const { return selection().isCaret(); } | 203 bool isCaret() const { return selection().isCaret(); } |
| 201 bool isRange() const { return selection().isRange(); } | 204 bool isRange() const { return selection().isRange(); } |
| 202 bool isInPasswordField() const; | 205 bool isInPasswordField() const; |
| 203 bool isDirectional() const { return selection().isDirectional(); } | 206 bool isDirectional() const { return selection().isDirectional(); } |
| 204 | 207 |
| 205 // If this FrameSelection has a logical range which is still valid, this funct
ion return its clone. Otherwise, | 208 // If this FrameSelection has a logical range which is still valid, this |
| 206 // the return value from underlying VisibleSelection's firstRange() is returne
d. | 209 // function return its clone. Otherwise, the return value from underlying |
| 210 // VisibleSelection's firstRange() is returned. |
| 207 Range* firstRange() const; | 211 Range* firstRange() const; |
| 208 | 212 |
| 209 void documentAttached(Document*); | 213 void documentAttached(Document*); |
| 210 void documentDetached(const Document&); | 214 void documentDetached(const Document&); |
| 211 void nodeChildrenWillBeRemoved(ContainerNode&); | 215 void nodeChildrenWillBeRemoved(ContainerNode&); |
| 212 void nodeWillBeRemoved(Node&); | 216 void nodeWillBeRemoved(Node&); |
| 213 void dataWillChange(const CharacterData& node); | 217 void dataWillChange(const CharacterData& node); |
| 214 void didUpdateCharacterData(CharacterData*, | 218 void didUpdateCharacterData(CharacterData*, |
| 215 unsigned offset, | 219 unsigned offset, |
| 216 unsigned oldLength, | 220 unsigned oldLength, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 353 |
| 350 // Used to store base before the adjustment at bidi boundary | 354 // Used to store base before the adjustment at bidi boundary |
| 351 VisiblePositionInFlatTree m_originalBaseInFlatTree; | 355 VisiblePositionInFlatTree m_originalBaseInFlatTree; |
| 352 TextGranularity m_granularity; | 356 TextGranularity m_granularity; |
| 353 LayoutUnit m_xPosForVerticalArrowNavigation; | 357 LayoutUnit m_xPosForVerticalArrowNavigation; |
| 354 | 358 |
| 355 Member<EditingStyle> m_typingStyle; | 359 Member<EditingStyle> m_typingStyle; |
| 356 | 360 |
| 357 bool m_focused : 1; | 361 bool m_focused : 1; |
| 358 | 362 |
| 359 // Controls text granularity used to adjust the selection's extent in moveRang
eSelectionExtent. | 363 // Controls text granularity used to adjust the selection's extent in |
| 364 // moveRangeSelectionExtent. |
| 360 std::unique_ptr<GranularityStrategy> m_granularityStrategy; | 365 std::unique_ptr<GranularityStrategy> m_granularityStrategy; |
| 361 | 366 |
| 362 const Member<FrameCaret> m_frameCaret; | 367 const Member<FrameCaret> m_frameCaret; |
| 363 }; | 368 }; |
| 364 | 369 |
| 365 inline EditingStyle* FrameSelection::typingStyle() const { | 370 inline EditingStyle* FrameSelection::typingStyle() const { |
| 366 return m_typingStyle.get(); | 371 return m_typingStyle.get(); |
| 367 } | 372 } |
| 368 | 373 |
| 369 inline void FrameSelection::clearTypingStyle() { | 374 inline void FrameSelection::clearTypingStyle() { |
| 370 m_typingStyle.clear(); | 375 m_typingStyle.clear(); |
| 371 } | 376 } |
| 372 | 377 |
| 373 inline void FrameSelection::setTypingStyle(EditingStyle* style) { | 378 inline void FrameSelection::setTypingStyle(EditingStyle* style) { |
| 374 m_typingStyle = style; | 379 m_typingStyle = style; |
| 375 } | 380 } |
| 376 } // namespace blink | 381 } // namespace blink |
| 377 | 382 |
| 378 #ifndef NDEBUG | 383 #ifndef NDEBUG |
| 379 // Outside the WebCore namespace for ease of invocation from gdb. | 384 // Outside the WebCore namespace for ease of invocation from gdb. |
| 380 void showTree(const blink::FrameSelection&); | 385 void showTree(const blink::FrameSelection&); |
| 381 void showTree(const blink::FrameSelection*); | 386 void showTree(const blink::FrameSelection*); |
| 382 #endif | 387 #endif |
| 383 | 388 |
| 384 #endif // FrameSelection_h | 389 #endif // FrameSelection_h |
| OLD | NEW |