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 14 matching lines...) Expand all Loading... |
25 */ | 25 */ |
26 | 26 |
27 #ifndef FrameSelection_h | 27 #ifndef FrameSelection_h |
28 #define FrameSelection_h | 28 #define FrameSelection_h |
29 | 29 |
30 #include <memory> | 30 #include <memory> |
31 #include "core/CoreExport.h" | 31 #include "core/CoreExport.h" |
32 #include "core/dom/Range.h" | 32 #include "core/dom/Range.h" |
33 #include "core/dom/SynchronousMutationObserver.h" | 33 #include "core/dom/SynchronousMutationObserver.h" |
34 #include "core/editing/EphemeralRange.h" | 34 #include "core/editing/EphemeralRange.h" |
35 #include "core/editing/LayoutSelection.h" | |
36 #include "core/editing/VisiblePosition.h" | 35 #include "core/editing/VisiblePosition.h" |
37 #include "core/editing/VisibleSelection.h" | 36 #include "core/editing/VisibleSelection.h" |
38 #include "core/editing/iterators/TextIteratorBehavior.h" | 37 #include "core/editing/iterators/TextIteratorBehavior.h" |
39 #include "core/layout/ScrollAlignment.h" | 38 #include "core/layout/ScrollAlignment.h" |
40 #include "platform/Timer.h" | 39 #include "platform/Timer.h" |
41 #include "platform/geometry/IntRect.h" | 40 #include "platform/geometry/IntRect.h" |
42 #include "platform/geometry/LayoutRect.h" | 41 #include "platform/geometry/LayoutRect.h" |
43 #include "platform/graphics/PaintInvalidationReason.h" | 42 #include "platform/graphics/PaintInvalidationReason.h" |
44 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
45 #include "platform/wtf/Noncopyable.h" | 44 #include "platform/wtf/Noncopyable.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 SetSelectionOptions = kCloseTyping | kClearTypingStyle, | 123 SetSelectionOptions = kCloseTyping | kClearTypingStyle, |
125 CursorAlignOnScroll = CursorAlignOnScroll::kIfNeeded, | 124 CursorAlignOnScroll = CursorAlignOnScroll::kIfNeeded, |
126 TextGranularity = kCharacterGranularity); | 125 TextGranularity = kCharacterGranularity); |
127 bool SetSelectedRange( | 126 bool SetSelectedRange( |
128 const EphemeralRange&, | 127 const EphemeralRange&, |
129 TextAffinity, | 128 TextAffinity, |
130 SelectionDirectionalMode = SelectionDirectionalMode::kNonDirectional, | 129 SelectionDirectionalMode = SelectionDirectionalMode::kNonDirectional, |
131 FrameSelection::SetSelectionOptions = kCloseTyping | kClearTypingStyle); | 130 FrameSelection::SetSelectionOptions = kCloseTyping | kClearTypingStyle); |
132 void SelectAll(); | 131 void SelectAll(); |
133 void Clear(); | 132 void Clear(); |
| 133 bool IsHidden() const; |
134 | 134 |
135 // TODO(tkent): These two functions were added to fix crbug.com/695211 without | 135 // TODO(tkent): These two functions were added to fix crbug.com/695211 without |
136 // changing focus behavior. Once we fix crbug.com/690272, we can remove these | 136 // changing focus behavior. Once we fix crbug.com/690272, we can remove these |
137 // functions. | 137 // functions. |
138 // setSelectionDeprecated() returns true if didSetSelectionDeprecated() should | 138 // setSelectionDeprecated() returns true if didSetSelectionDeprecated() should |
139 // be called. | 139 // be called. |
140 bool SetSelectionDeprecated(const SelectionInDOMTree&, | 140 bool SetSelectionDeprecated(const SelectionInDOMTree&, |
141 SetSelectionOptions = kCloseTyping | | 141 SetSelectionOptions = kCloseTyping | |
142 kClearTypingStyle, | 142 kClearTypingStyle, |
143 TextGranularity = kCharacterGranularity); | 143 TextGranularity = kCharacterGranularity); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void UpdateStyleAndLayoutIfNeeded(); | 196 void UpdateStyleAndLayoutIfNeeded(); |
197 void InvalidatePaint(const LayoutBlock&, const PaintInvalidatorContext&); | 197 void InvalidatePaint(const LayoutBlock&, const PaintInvalidatorContext&); |
198 | 198 |
199 void PaintCaret(GraphicsContext&, const LayoutPoint&); | 199 void PaintCaret(GraphicsContext&, const LayoutPoint&); |
200 | 200 |
201 // Used to suspend caret blinking while the mouse is down. | 201 // Used to suspend caret blinking while the mouse is down. |
202 void SetCaretBlinkingSuspended(bool); | 202 void SetCaretBlinkingSuspended(bool); |
203 bool IsCaretBlinkingSuspended() const; | 203 bool IsCaretBlinkingSuspended() const; |
204 | 204 |
205 // Focus | 205 // Focus |
206 void SetFocused(bool); | 206 bool SelectionHasFocus() const; |
207 bool IsFocused() const { return focused_; } | 207 // TODO(hugoh): Rename the following 3 methods to: |
208 bool IsFocusedAndActive() const; | 208 void SetFocused(bool); // SetFrameIsFocused(), |
| 209 bool IsFocused() const { return focused_; } // FrameIsFocused(), |
| 210 bool IsFocusedAndActive() const; // FrameIsFocusedAndActive(). |
209 void PageActivationChanged(); | 211 void PageActivationChanged(); |
210 | 212 |
211 void SetUseSecureKeyboardEntryWhenActive(bool); | 213 void SetUseSecureKeyboardEntryWhenActive(bool); |
212 | 214 |
213 bool IsHandleVisible() const; | 215 bool IsHandleVisible() const; |
214 | 216 |
215 void UpdateSecureKeyboardEntryIfActive(); | 217 void UpdateSecureKeyboardEntryIfActive(); |
216 | 218 |
217 // Returns true if a word is selected. | 219 // Returns true if a word is selected. |
218 bool SelectWordAroundPosition(const VisiblePosition&); | 220 bool SelectWordAroundPosition(const VisiblePosition&); |
(...skipping 16 matching lines...) Expand all Loading... |
235 | 237 |
236 HTMLFormElement* CurrentForm() const; | 238 HTMLFormElement* CurrentForm() const; |
237 | 239 |
238 // TODO(tkent): This function has a bug that scrolling doesn't work well in | 240 // TODO(tkent): This function has a bug that scrolling doesn't work well in |
239 // a case of RangeSelection. crbug.com/443061 | 241 // a case of RangeSelection. crbug.com/443061 |
240 void RevealSelection( | 242 void RevealSelection( |
241 const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded, | 243 const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded, |
242 RevealExtentOption = kDoNotRevealExtent); | 244 RevealExtentOption = kDoNotRevealExtent); |
243 void SetSelectionFromNone(); | 245 void SetSelectionFromNone(); |
244 | 246 |
245 void UpdateAppearance(LayoutSelection::PaintHint); | 247 void UpdateAppearance(); |
246 bool ShouldShowBlockCursor() const; | 248 bool ShouldShowBlockCursor() const; |
247 void SetShouldShowBlockCursor(bool); | 249 void SetShouldShowBlockCursor(bool); |
248 | 250 |
249 void CacheRangeOfDocument(Range*); | 251 void CacheRangeOfDocument(Range*); |
250 Range* DocumentCachedRange() const; | 252 Range* DocumentCachedRange() const; |
251 void ClearDocumentCachedRange(); | 253 void ClearDocumentCachedRange(); |
252 | 254 |
253 FrameCaret& FrameCaretForTesting() const { return *frame_caret_; } | 255 FrameCaret& FrameCaretForTesting() const { return *frame_caret_; } |
254 | 256 |
255 std::pair<int, int> LayoutSelectionStartEnd(); | 257 std::pair<int, int> LayoutSelectionStartEnd(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 LayoutUnit x_pos_for_vertical_arrow_navigation_; | 303 LayoutUnit x_pos_for_vertical_arrow_navigation_; |
302 | 304 |
303 bool focused_ : 1; | 305 bool focused_ : 1; |
304 | 306 |
305 // Controls text granularity used to adjust the selection's extent in | 307 // Controls text granularity used to adjust the selection's extent in |
306 // moveRangeSelectionExtent. | 308 // moveRangeSelectionExtent. |
307 std::unique_ptr<GranularityStrategy> granularity_strategy_; | 309 std::unique_ptr<GranularityStrategy> granularity_strategy_; |
308 | 310 |
309 const Member<FrameCaret> frame_caret_; | 311 const Member<FrameCaret> frame_caret_; |
310 bool use_secure_keyboard_entry_when_active_ = false; | 312 bool use_secure_keyboard_entry_when_active_ = false; |
311 bool text_control_focused_ = false; | |
312 }; | 313 }; |
313 | 314 |
314 } // namespace blink | 315 } // namespace blink |
315 | 316 |
316 #ifndef NDEBUG | 317 #ifndef NDEBUG |
317 // Outside the WebCore namespace for ease of invocation from gdb. | 318 // Outside the WebCore namespace for ease of invocation from gdb. |
318 void showTree(const blink::FrameSelection&); | 319 void showTree(const blink::FrameSelection&); |
319 void showTree(const blink::FrameSelection*); | 320 void showTree(const blink::FrameSelection*); |
320 #endif | 321 #endif |
321 | 322 |
322 #endif // FrameSelection_h | 323 #endif // FrameSelection_h |
OLD | NEW |