Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1067)

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.h

Issue 2709983005: Selection API: Do not change focus by Selection functions. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 const VisibleSelection& computeVisibleSelectionInDOMTree() const; 113 const VisibleSelection& computeVisibleSelectionInDOMTree() const;
114 const VisibleSelectionInFlatTree& computeVisibleSelectionInFlatTree() const; 114 const VisibleSelectionInFlatTree& computeVisibleSelectionInFlatTree() const;
115 115
116 // TODO(editing-dev): We should replace 116 // TODO(editing-dev): We should replace
117 // |computeVisibleSelectionInDOMTreeDeprecated()| with update layout and 117 // |computeVisibleSelectionInDOMTreeDeprecated()| with update layout and
118 // |computeVisibleSelectionInDOMTree()| to increase places hoisting update 118 // |computeVisibleSelectionInDOMTree()| to increase places hoisting update
119 // layout. 119 // layout.
120 const VisibleSelection& computeVisibleSelectionInDOMTreeDeprecated() const; 120 const VisibleSelection& computeVisibleSelectionInDOMTreeDeprecated() const;
121 121
122 // setSelection() and setSelectedRange() functions may dispatch focus-related
123 // synchronous events unless DoNotSetFocus is specified.
122 void setSelection(const SelectionInDOMTree&, 124 void setSelection(const SelectionInDOMTree&,
123 SetSelectionOptions = CloseTyping | ClearTypingStyle, 125 SetSelectionOptions = CloseTyping | ClearTypingStyle,
124 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, 126 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded,
125 TextGranularity = CharacterGranularity); 127 TextGranularity = CharacterGranularity);
126 128
127 void setSelection(const SelectionInFlatTree&, 129 void setSelection(const SelectionInFlatTree&,
128 SetSelectionOptions = CloseTyping | ClearTypingStyle, 130 SetSelectionOptions = CloseTyping | ClearTypingStyle,
129 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, 131 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded,
130 TextGranularity = CharacterGranularity); 132 TextGranularity = CharacterGranularity);
131 133
(...skipping 10 matching lines...) Expand all
142 void setSelection(const VisibleSelectionInFlatTree&, 144 void setSelection(const VisibleSelectionInFlatTree&,
143 HandleVisibility = HandleVisibility::NotVisible, 145 HandleVisibility = HandleVisibility::NotVisible,
144 SetSelectionOptions = CloseTyping | ClearTypingStyle, 146 SetSelectionOptions = CloseTyping | ClearTypingStyle,
145 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, 147 CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded,
146 TextGranularity = CharacterGranularity); 148 TextGranularity = CharacterGranularity);
147 bool setSelectedRange( 149 bool setSelectedRange(
148 const EphemeralRange&, 150 const EphemeralRange&,
149 TextAffinity, 151 TextAffinity,
150 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, 152 SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional,
151 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle); 153 FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle);
154
155 // selectAll() may dispatch focus-related synchronous events.
152 void selectAll(); 156 void selectAll();
157
153 void clear(); 158 void clear();
154 159
155 // 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
156 // the frame you entirely selected. 161 // the frame you entirely selected.
157 void selectFrameElementInParentIfFullySelected(); 162 void selectFrameElementInParentIfFullySelected();
158 163
159 bool contains(const LayoutPoint&); 164 bool contains(const LayoutPoint&);
160 165
166 // This function may dispatch focus-related synchronous events unless
167 // DoNotSetFocus is specified.
168 //
169 // |noFocusFlag| must be 0 or SetSelectionOptions::DoNotSetFocus.
161 bool modify(EAlteration, 170 bool modify(EAlteration,
162 SelectionDirection, 171 SelectionDirection,
163 TextGranularity, 172 TextGranularity,
164 EUserTriggered = NotUserTriggered); 173 EUserTriggered = NotUserTriggered,
174 SetSelectionOptions noFocusFlag = 0);
165 enum VerticalDirection { DirectionUp, DirectionDown }; 175 enum VerticalDirection { DirectionUp, DirectionDown };
166 bool modify(EAlteration, unsigned verticalDistance, VerticalDirection); 176 bool modify(EAlteration, unsigned verticalDistance, VerticalDirection);
167 177
168 // Moves the selection extent based on the selection granularity strategy. 178 // Moves the selection extent based on the selection granularity strategy.
169 // This function does not allow the selection to collapse. If the new 179 // This function does not allow the selection to collapse. If the new
170 // extent is resolved to the same position as the current base, this 180 // extent is resolved to the same position as the current base, this
171 // function will do nothing. 181 // function will do nothing.
172 void moveRangeSelectionExtent(const IntPoint&); 182 void moveRangeSelectionExtent(const IntPoint&);
173 void moveRangeSelection(const VisiblePosition& base, 183 void moveRangeSelection(const VisiblePosition& base,
174 const VisiblePosition& extent, 184 const VisiblePosition& extent,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 346
337 } // namespace blink 347 } // namespace blink
338 348
339 #ifndef NDEBUG 349 #ifndef NDEBUG
340 // Outside the WebCore namespace for ease of invocation from gdb. 350 // Outside the WebCore namespace for ease of invocation from gdb.
341 void showTree(const blink::FrameSelection&); 351 void showTree(const blink::FrameSelection&);
342 void showTree(const blink::FrameSelection*); 352 void showTree(const blink::FrameSelection*);
343 #endif 353 #endif
344 354
345 #endif // FrameSelection_h 355 #endif // FrameSelection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698