| 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
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 SpellCorrectionTriggered = 1 << 3, | 78 SpellCorrectionTriggered = 1 << 3, |
| 79 DoNotSetFocus = 1 << 4, | 79 DoNotSetFocus = 1 << 4, |
| 80 DoNotUpdateAppearance = 1 << 5, | 80 DoNotUpdateAppearance = 1 << 5, |
| 81 }; | 81 }; |
| 82 typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOpti
on and EUserTriggered | 82 typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOpti
on and EUserTriggered |
| 83 static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOpt
ions options) | 83 static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOpt
ions options) |
| 84 { | 84 { |
| 85 return static_cast<EUserTriggered>(options & UserTriggered); | 85 return static_cast<EUserTriggered>(options & UserTriggered); |
| 86 } | 86 } |
| 87 | 87 |
| 88 enum DirectoinalOption { |
| 89 NonDirectional, |
| 90 Directional |
| 91 }; |
| 92 |
| 88 Element* rootEditableElement() const { return m_selection.rootEditableElemen
t(); } | 93 Element* rootEditableElement() const { return m_selection.rootEditableElemen
t(); } |
| 89 Element* rootEditableElementOrDocumentElement() const; | 94 Element* rootEditableElementOrDocumentElement() const; |
| 90 Node* rootEditableElementOrTreeScopeRootNode() const; | 95 Node* rootEditableElementOrTreeScopeRootNode() const; |
| 91 | 96 |
| 92 bool rendererIsEditable() const { return m_selection.rendererIsEditable(); } | 97 bool rendererIsEditable() const { return m_selection.rendererIsEditable(); } |
| 93 bool isContentEditable() const { return m_selection.isContentEditable(); } | 98 bool isContentEditable() const { return m_selection.isContentEditable(); } |
| 94 bool isContentRichlyEditable() const { return m_selection.isContentRichlyEdi
table(); } | 99 bool isContentRichlyEditable() const { return m_selection.isContentRichlyEdi
table(); } |
| 95 | 100 |
| 96 void moveTo(const VisiblePosition&, EUserTriggered = NotUserTriggered, Curso
rAlignOnScroll = AlignCursorOnScrollIfNeeded); | 101 void moveTo(const VisiblePosition&, EUserTriggered = NotUserTriggered, Curso
rAlignOnScroll = AlignCursorOnScrollIfNeeded); |
| 97 void moveTo(const VisiblePosition&, const VisiblePosition&, EUserTriggered =
NotUserTriggered); | 102 void moveTo(const VisiblePosition&, const VisiblePosition&, EUserTriggered =
NotUserTriggered); |
| 98 void moveTo(const Position&, EAffinity, EUserTriggered = NotUserTriggered); | 103 void moveTo(const Position&, EAffinity, EUserTriggered = NotUserTriggered); |
| 99 | 104 |
| 100 const VisibleSelection& selection() const { return m_selection; } | 105 const VisibleSelection& selection() const { return m_selection; } |
| 101 void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping
| ClearTypingStyle, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGran
ularity = CharacterGranularity); | 106 void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping
| ClearTypingStyle, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGran
ularity = CharacterGranularity); |
| 102 void setSelection(const VisibleSelection& selection, TextGranularity granula
rity) { setSelection(selection, CloseTyping | ClearTypingStyle, AlignCursorOnScr
ollIfNeeded, granularity); } | 107 void setSelection(const VisibleSelection& selection, TextGranularity granula
rity) { setSelection(selection, CloseTyping | ClearTypingStyle, AlignCursorOnScr
ollIfNeeded, granularity); } |
| 103 bool setSelectedRange(Range*, EAffinity, bool isDirectional = false, SetSele
ctionOptions = CloseTyping | ClearTypingStyle); | 108 bool setSelectedRange(Range*, EAffinity, DirectoinalOption directional = Non
Directional, SetSelectionOptions = CloseTyping | ClearTypingStyle); |
| 104 void selectAll(); | 109 void selectAll(); |
| 105 void clear(); | 110 void clear(); |
| 106 void prepareForDestruction(); | 111 void prepareForDestruction(); |
| 107 | 112 |
| 108 // Call this after doing user-triggered selections to make it easy to delete
the frame you entirely selected. | 113 // Call this after doing user-triggered selections to make it easy to delete
the frame you entirely selected. |
| 109 void selectFrameElementInParentIfFullySelected(); | 114 void selectFrameElementInParentIfFullySelected(); |
| 110 | 115 |
| 111 bool contains(const LayoutPoint&); | 116 bool contains(const LayoutPoint&); |
| 112 | 117 |
| 113 SelectionType selectionType() const { return m_selection.selectionType(); } | 118 SelectionType selectionType() const { return m_selection.selectionType(); } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 305 } |
| 301 } // namespace WebCore | 306 } // namespace WebCore |
| 302 | 307 |
| 303 #ifndef NDEBUG | 308 #ifndef NDEBUG |
| 304 // Outside the WebCore namespace for ease of invocation from gdb. | 309 // Outside the WebCore namespace for ease of invocation from gdb. |
| 305 void showTree(const WebCore::FrameSelection&); | 310 void showTree(const WebCore::FrameSelection&); |
| 306 void showTree(const WebCore::FrameSelection*); | 311 void showTree(const WebCore::FrameSelection*); |
| 307 #endif | 312 #endif |
| 308 | 313 |
| 309 #endif // FrameSelection_h | 314 #endif // FrameSelection_h |
| OLD | NEW |