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

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: More robust logic (no need to modify LayoutTests?) and new C++ unit tests 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 IsHidden();
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 HTMLFormElement* CurrentForm() const; 237 HTMLFormElement* CurrentForm() const;
238 238
239 // TODO(tkent): This function has a bug that scrolling doesn't work well in 239 // TODO(tkent): This function has a bug that scrolling doesn't work well in
240 // a case of RangeSelection. crbug.com/443061 240 // a case of RangeSelection. crbug.com/443061
241 void RevealSelection( 241 void RevealSelection(
242 const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded, 242 const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded,
243 RevealExtentOption = kDoNotRevealExtent); 243 RevealExtentOption = kDoNotRevealExtent);
244 void SetSelectionFromNone(); 244 void SetSelectionFromNone();
245 245
246 void UpdateAppearance(LayoutSelection::PaintHint); 246 void UpdateAppearance();
247 bool ShouldShowBlockCursor() const; 247 bool ShouldShowBlockCursor() const;
248 void SetShouldShowBlockCursor(bool); 248 void SetShouldShowBlockCursor(bool);
249 249
250 void CacheRangeOfDocument(Range*); 250 void CacheRangeOfDocument(Range*);
251 Range* DocumentCachedRange() const; 251 Range* DocumentCachedRange() const;
252 void ClearDocumentCachedRange(); 252 void ClearDocumentCachedRange();
253 253
254 FrameCaret& FrameCaretForTesting() const { return *frame_caret_; } 254 FrameCaret& FrameCaretForTesting() const { return *frame_caret_; }
255 255
256 std::pair<int, int> LayoutSelectionStartEnd(); 256 std::pair<int, int> LayoutSelectionStartEnd();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 LayoutUnit x_pos_for_vertical_arrow_navigation_; 302 LayoutUnit x_pos_for_vertical_arrow_navigation_;
303 303
304 bool focused_ : 1; 304 bool focused_ : 1;
305 305
306 // Controls text granularity used to adjust the selection's extent in 306 // Controls text granularity used to adjust the selection's extent in
307 // moveRangeSelectionExtent. 307 // moveRangeSelectionExtent.
308 std::unique_ptr<GranularityStrategy> granularity_strategy_; 308 std::unique_ptr<GranularityStrategy> granularity_strategy_;
309 309
310 const Member<FrameCaret> frame_caret_; 310 const Member<FrameCaret> frame_caret_;
311 bool use_secure_keyboard_entry_when_active_ = false; 311 bool use_secure_keyboard_entry_when_active_ = false;
312 bool text_control_focused_ = false;
313 }; 312 };
314 313
315 } // namespace blink 314 } // namespace blink
316 315
317 #ifndef NDEBUG 316 #ifndef NDEBUG
318 // Outside the WebCore namespace for ease of invocation from gdb. 317 // Outside the WebCore namespace for ease of invocation from gdb.
319 void showTree(const blink::FrameSelection&); 318 void showTree(const blink::FrameSelection&);
320 void showTree(const blink::FrameSelection*); 319 void showTree(const blink::FrameSelection*);
321 #endif 320 #endif
322 321
323 #endif // FrameSelection_h 322 #endif // FrameSelection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698