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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 DoNotUpdateAppearance = 1 << 4, | 86 DoNotUpdateAppearance = 1 << 4, |
87 DoNotClearStrategy = 1 << 5, | 87 DoNotClearStrategy = 1 << 5, |
88 DoNotAdjustInFlatTree = 1 << 6, | 88 DoNotAdjustInFlatTree = 1 << 6, |
89 }; | 89 }; |
90 typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOpti on and EUserTriggered | 90 typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOpti on and EUserTriggered |
91 static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOpt ions options) | 91 static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOpt ions options) |
92 { | 92 { |
93 return static_cast<EUserTriggered>(options & UserTriggered); | 93 return static_cast<EUserTriggered>(options & UserTriggered); |
94 } | 94 } |
95 | 95 |
96 bool isAvailable() const { return m_document; } | |
97 const Document& document() const; | |
tkent
2016/06/07 23:41:59
We should add a comment like |This function must n
| |
98 Document& document(); | |
96 LocalFrame* frame() const { return m_frame; } | 99 LocalFrame* frame() const { return m_frame; } |
97 Element* rootEditableElement() const { return selection().rootEditableElemen t(); } | 100 Element* rootEditableElement() const { return selection().rootEditableElemen t(); } |
98 Element* rootEditableElementOrDocumentElement() const; | 101 Element* rootEditableElementOrDocumentElement() const; |
99 ContainerNode* rootEditableElementOrTreeScopeRootNode() const; | 102 ContainerNode* rootEditableElementOrTreeScopeRootNode() const; |
100 | 103 |
101 bool hasEditableStyle() const { return selection().hasEditableStyle(); } | 104 bool hasEditableStyle() const { return selection().hasEditableStyle(); } |
102 bool isContentEditable() const { return selection().isContentEditable(); } | 105 bool isContentEditable() const { return selection().isContentEditable(); } |
103 bool isContentRichlyEditable() const { return selection().isContentRichlyEdi table(); } | 106 bool isContentRichlyEditable() const { return selection().isContentRichlyEdi table(); } |
104 | 107 |
105 void moveTo(const VisiblePosition&, EUserTriggered = NotUserTriggered, Curso rAlignOnScroll = CursorAlignOnScroll::IfNeeded); | 108 void moveTo(const VisiblePosition&, EUserTriggered = NotUserTriggered, Curso rAlignOnScroll = CursorAlignOnScroll::IfNeeded); |
106 void moveTo(const VisiblePosition&, const VisiblePosition&, EUserTriggered = NotUserTriggered); | 109 void moveTo(const VisiblePosition&, const VisiblePosition&, EUserTriggered = NotUserTriggered); |
107 void moveTo(const Position&, TextAffinity); | 110 void moveTo(const Position&, TextAffinity); |
108 | 111 |
109 template <typename Strategy> | 112 template <typename Strategy> |
110 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; | 113 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; |
111 | 114 |
112 const VisibleSelection& selection() const; | 115 const VisibleSelection& selection() const; |
113 void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, TextGr anularity = CharacterGranularity); | 116 void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, TextGr anularity = CharacterGranularity); |
114 void setSelection(const VisibleSelectionInFlatTree&, SetSelectionOptions = C loseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::IfNeed ed, TextGranularity = CharacterGranularity); | 117 void setSelection(const VisibleSelectionInFlatTree&, SetSelectionOptions = C loseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::IfNeed ed, TextGranularity = CharacterGranularity); |
115 // TODO(yosin) We should get rid of two parameters version of | 118 // TODO(yosin) We should get rid of two parameters version of |
116 // |setSelection()| to avoid conflict of four parameters version. | 119 // |setSelection()| to avoid conflict of four parameters version. |
117 void setSelection(const VisibleSelection& selection, TextGranularity granula rity) { setSelection(selection, CloseTyping | ClearTypingStyle, CursorAlignOnScr oll::IfNeeded, granularity); } | 120 void setSelection(const VisibleSelection& selection, TextGranularity granula rity) { setSelection(selection, CloseTyping | ClearTypingStyle, CursorAlignOnScr oll::IfNeeded, granularity); } |
118 // TODO(yosin) We should get rid of |Range| version of |setSelectedRagne()| | 121 // TODO(yosin) We should get rid of |Range| version of |setSelectedRagne()| |
119 // for Oilpan. | 122 // for Oilpan. |
120 bool setSelectedRange(Range*, TextAffinity, SelectionDirectionalMode = Selec tionDirectionalMode::NonDirectional, SetSelectionOptions = CloseTyping | ClearTy pingStyle); | 123 bool setSelectedRange(Range*, TextAffinity, SelectionDirectionalMode = Selec tionDirectionalMode::NonDirectional, SetSelectionOptions = CloseTyping | ClearTy pingStyle); |
121 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio nalMode = SelectionDirectionalMode::NonDirectional, FrameSelection::SetSelection Options = CloseTyping | ClearTypingStyle); | 124 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio nalMode = SelectionDirectionalMode::NonDirectional, FrameSelection::SetSelection Options = CloseTyping | ClearTypingStyle); |
122 void selectAll(); | 125 void selectAll(); |
123 void clear(); | 126 void clear(); |
124 void prepareForDestruction(); | |
125 | 127 |
126 // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected. | 128 // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected. |
127 void selectFrameElementInParentIfFullySelected(); | 129 void selectFrameElementInParentIfFullySelected(); |
128 | 130 |
129 bool contains(const LayoutPoint&); | 131 bool contains(const LayoutPoint&); |
130 | 132 |
131 SelectionType getSelectionType() const { return selection().getSelectionType (); } | 133 SelectionType getSelectionType() const { return selection().getSelectionType (); } |
132 | 134 |
133 TextAffinity affinity() const { return selection().affinity(); } | 135 TextAffinity affinity() const { return selection().affinity(); } |
134 | 136 |
(...skipping 26 matching lines...) Expand all Loading... | |
161 bool isNone() const { return selection().isNone(); } | 163 bool isNone() const { return selection().isNone(); } |
162 bool isCaret() const { return selection().isCaret(); } | 164 bool isCaret() const { return selection().isCaret(); } |
163 bool isRange() const { return selection().isRange(); } | 165 bool isRange() const { return selection().isRange(); } |
164 bool isInPasswordField() const; | 166 bool isInPasswordField() const; |
165 bool isDirectional() const { return selection().isDirectional(); } | 167 bool isDirectional() const { return selection().isDirectional(); } |
166 | 168 |
167 // If this FrameSelection has a logical range which is still valid, this fun ction return its clone. Otherwise, | 169 // If this FrameSelection has a logical range which is still valid, this fun ction return its clone. Otherwise, |
168 // the return value from underlying VisibleSelection's firstRange() is retur ned. | 170 // the return value from underlying VisibleSelection's firstRange() is retur ned. |
169 Range* firstRange() const; | 171 Range* firstRange() const; |
170 | 172 |
173 void documentAttached(Document*); | |
174 void documentDetached(const Document&); | |
171 void nodeWillBeRemoved(Node&); | 175 void nodeWillBeRemoved(Node&); |
172 void dataWillChange(const CharacterData& node); | 176 void dataWillChange(const CharacterData& node); |
173 void didUpdateCharacterData(CharacterData*, unsigned offset, unsigned oldLen gth, unsigned newLength); | 177 void didUpdateCharacterData(CharacterData*, unsigned offset, unsigned oldLen gth, unsigned newLength); |
174 void didMergeTextNodes(const Text& oldNode, unsigned offset); | 178 void didMergeTextNodes(const Text& oldNode, unsigned offset); |
175 void didSplitTextNode(const Text& oldNode); | 179 void didSplitTextNode(const Text& oldNode); |
176 | 180 |
177 bool isAppearanceDirty() const; | 181 bool isAppearanceDirty() const; |
178 void commitAppearanceIfNeeded(LayoutView&); | 182 void commitAppearanceIfNeeded(LayoutView&); |
179 void updateAppearance(); | 183 void updateAppearance(); |
180 void setCaretVisible(bool caretIsVisible); | 184 void setCaretVisible(bool caretIsVisible); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 | 277 |
274 template <typename Strategy> | 278 template <typename Strategy> |
275 VisibleSelectionTemplate<Strategy> validateSelection(const VisibleSelectionT emplate<Strategy>&); | 279 VisibleSelectionTemplate<Strategy> validateSelection(const VisibleSelectionT emplate<Strategy>&); |
276 | 280 |
277 GranularityStrategy* granularityStrategy(); | 281 GranularityStrategy* granularityStrategy(); |
278 | 282 |
279 // For unittests | 283 // For unittests |
280 bool shouldPaintCaretForTesting() const; | 284 bool shouldPaintCaretForTesting() const; |
281 bool isPreviousCaretDirtyForTesting() const; | 285 bool isPreviousCaretDirtyForTesting() const; |
282 | 286 |
287 Member<Document> m_document; | |
283 Member<LocalFrame> m_frame; | 288 Member<LocalFrame> m_frame; |
284 const Member<PendingSelection> m_pendingSelection; | 289 const Member<PendingSelection> m_pendingSelection; |
285 const Member<SelectionEditor> m_selectionEditor; | 290 const Member<SelectionEditor> m_selectionEditor; |
286 | 291 |
287 // Used to store base before the adjustment at bidi boundary | 292 // Used to store base before the adjustment at bidi boundary |
288 VisiblePosition m_originalBase; | 293 VisiblePosition m_originalBase; |
289 VisiblePositionInFlatTree m_originalBaseInFlatTree; | 294 VisiblePositionInFlatTree m_originalBaseInFlatTree; |
290 TextGranularity m_granularity; | 295 TextGranularity m_granularity; |
291 LayoutUnit m_xPosForVerticalArrowNavigation; | 296 LayoutUnit m_xPosForVerticalArrowNavigation; |
292 | 297 |
(...skipping 23 matching lines...) Expand all Loading... | |
316 } | 321 } |
317 } // namespace blink | 322 } // namespace blink |
318 | 323 |
319 #ifndef NDEBUG | 324 #ifndef NDEBUG |
320 // Outside the WebCore namespace for ease of invocation from gdb. | 325 // Outside the WebCore namespace for ease of invocation from gdb. |
321 void showTree(const blink::FrameSelection&); | 326 void showTree(const blink::FrameSelection&); |
322 void showTree(const blink::FrameSelection*); | 327 void showTree(const blink::FrameSelection*); |
323 #endif | 328 #endif |
324 | 329 |
325 #endif // FrameSelection_h | 330 #endif // FrameSelection_h |
OLD | NEW |