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

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

Issue 2841093002: Algorithm for deciding if a frame's selection should be hidden (Closed)
Patch Set: Rebase + cosmetic changes Created 3 years, 7 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 14 matching lines...) Expand all
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
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 IsActive() const;
Xiaocheng 2017/05/02 20:05:17 "Active" is a heavily overloaded term. Judging fr
hugoh_UTC2 2017/05/03 07:18:55 It is not only used for deciding if a selection is
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 HTMLFormElement* CurrentForm() const; 236 HTMLFormElement* CurrentForm() const;
237 237
238 // TODO(tkent): This function has a bug that scrolling doesn't work well in 238 // TODO(tkent): This function has a bug that scrolling doesn't work well in
239 // a case of RangeSelection. crbug.com/443061 239 // a case of RangeSelection. crbug.com/443061
240 void RevealSelection( 240 void RevealSelection(
241 const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded, 241 const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded,
242 RevealExtentOption = kDoNotRevealExtent); 242 RevealExtentOption = kDoNotRevealExtent);
243 void SetSelectionFromNone(); 243 void SetSelectionFromNone();
244 244
245 void UpdateAppearance(LayoutSelection::PaintHint); 245 void UpdateAppearance();
246 bool ShouldShowBlockCursor() const; 246 bool ShouldShowBlockCursor() const;
247 void SetShouldShowBlockCursor(bool); 247 void SetShouldShowBlockCursor(bool);
248 248
249 void CacheRangeOfDocument(Range*); 249 void CacheRangeOfDocument(Range*);
250 Range* DocumentCachedRange() const; 250 Range* DocumentCachedRange() const;
251 void ClearDocumentCachedRange(); 251 void ClearDocumentCachedRange();
252 252
253 FrameCaret& FrameCaretForTesting() const { return *frame_caret_; } 253 FrameCaret& FrameCaretForTesting() const { return *frame_caret_; }
254 254
255 std::pair<int, int> LayoutSelectionStartEnd(); 255 std::pair<int, int> LayoutSelectionStartEnd();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 LayoutUnit x_pos_for_vertical_arrow_navigation_; 301 LayoutUnit x_pos_for_vertical_arrow_navigation_;
302 302
303 bool focused_ : 1; 303 bool focused_ : 1;
304 304
305 // Controls text granularity used to adjust the selection's extent in 305 // Controls text granularity used to adjust the selection's extent in
306 // moveRangeSelectionExtent. 306 // moveRangeSelectionExtent.
307 std::unique_ptr<GranularityStrategy> granularity_strategy_; 307 std::unique_ptr<GranularityStrategy> granularity_strategy_;
308 308
309 const Member<FrameCaret> frame_caret_; 309 const Member<FrameCaret> frame_caret_;
310 bool use_secure_keyboard_entry_when_active_ = false; 310 bool use_secure_keyboard_entry_when_active_ = false;
311 bool text_control_focused_ = false;
312 }; 311 };
313 312
314 } // namespace blink 313 } // namespace blink
315 314
316 #ifndef NDEBUG 315 #ifndef NDEBUG
317 // Outside the WebCore namespace for ease of invocation from gdb. 316 // Outside the WebCore namespace for ease of invocation from gdb.
318 void showTree(const blink::FrameSelection&); 317 void showTree(const blink::FrameSelection&);
319 void showTree(const blink::FrameSelection*); 318 void showTree(const blink::FrameSelection*);
320 #endif 319 #endif
321 320
322 #endif // FrameSelection_h 321 #endif // FrameSelection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698