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

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

Issue 988023005: Implementing directional selection strategy in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 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 23 matching lines...) Expand all
34 #include "platform/Timer.h" 34 #include "platform/Timer.h"
35 #include "platform/geometry/IntRect.h" 35 #include "platform/geometry/IntRect.h"
36 #include "platform/geometry/LayoutRect.h" 36 #include "platform/geometry/LayoutRect.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 class CharacterData; 42 class CharacterData;
43 class LocalFrame; 43 class LocalFrame;
44 class GranularityStrategy;
44 class GraphicsContext; 45 class GraphicsContext;
45 class HTMLFormElement; 46 class HTMLFormElement;
46 class Text; 47 class Text;
47 class VisiblePosition; 48 class VisiblePosition;
48 49
49 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 }; 50 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 };
50 51
51 enum RevealExtentOption { 52 enum RevealExtentOption {
52 RevealExtent, 53 RevealExtent,
53 DoNotRevealExtent 54 DoNotRevealExtent
(...skipping 13 matching lines...) Expand all
67 enum EAlteration { AlterationMove, AlterationExtend }; 68 enum EAlteration { AlterationMove, AlterationExtend };
68 enum CursorAlignOnScroll { AlignCursorOnScrollIfNeeded, 69 enum CursorAlignOnScroll { AlignCursorOnScrollIfNeeded,
69 AlignCursorOnScrollAlways }; 70 AlignCursorOnScrollAlways };
70 enum SetSelectionOption { 71 enum SetSelectionOption {
71 // 1 << 0 is reserved for EUserTriggered 72 // 1 << 0 is reserved for EUserTriggered
72 CloseTyping = 1 << 1, 73 CloseTyping = 1 << 1,
73 ClearTypingStyle = 1 << 2, 74 ClearTypingStyle = 1 << 2,
74 SpellCorrectionTriggered = 1 << 3, 75 SpellCorrectionTriggered = 1 << 3,
75 DoNotSetFocus = 1 << 4, 76 DoNotSetFocus = 1 << 4,
76 DoNotUpdateAppearance = 1 << 5, 77 DoNotUpdateAppearance = 1 << 5,
78 ApplyStrategy = 1 << 6,
77 }; 79 };
78 typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOpti on and EUserTriggered 80 typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOpti on and EUserTriggered
79 static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOpt ions options) 81 static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOpt ions options)
80 { 82 {
81 return static_cast<EUserTriggered>(options & UserTriggered); 83 return static_cast<EUserTriggered>(options & UserTriggered);
82 } 84 }
83 85
84 enum DirectoinalOption { 86 enum DirectoinalOption {
85 NonDirectional, 87 NonDirectional,
86 Directional 88 Directional
(...skipping 29 matching lines...) Expand all
116 bool contains(const LayoutPoint&); 118 bool contains(const LayoutPoint&);
117 119
118 SelectionType selectionType() const { return m_selection.selectionType(); } 120 SelectionType selectionType() const { return m_selection.selectionType(); }
119 121
120 EAffinity affinity() const { return m_selection.affinity(); } 122 EAffinity affinity() const { return m_selection.affinity(); }
121 123
122 bool modify(EAlteration, SelectionDirection, TextGranularity, EUserTriggered = NotUserTriggered); 124 bool modify(EAlteration, SelectionDirection, TextGranularity, EUserTriggered = NotUserTriggered);
123 enum VerticalDirection { DirectionUp, DirectionDown }; 125 enum VerticalDirection { DirectionUp, DirectionDown };
124 bool modify(EAlteration, unsigned verticalDistance, VerticalDirection, EUser Triggered = NotUserTriggered, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded) ; 126 bool modify(EAlteration, unsigned verticalDistance, VerticalDirection, EUser Triggered = NotUserTriggered, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded) ;
125 // Currently we support only CharaterGranularity and WordGranurarity. 127 // Currently we support only CharaterGranularity and WordGranurarity.
126 void moveRangeSelectionExtent(const VisiblePosition&, TextGranularity); 128 void moveRangeSelectionExtent(const VisiblePosition&);
127 void moveRangeSelection(const VisiblePosition& base, const VisiblePosition& extent, TextGranularity); 129 void moveRangeSelection(const VisiblePosition& base, const VisiblePosition& extent, TextGranularity);
128 130
129 TextGranularity granularity() const { return m_granularity; } 131 TextGranularity granularity() const { return m_granularity; }
130 132
131 void setStart(const VisiblePosition &, EUserTriggered = NotUserTriggered); 133 void setStart(const VisiblePosition &, EUserTriggered = NotUserTriggered);
132 void setEnd(const VisiblePosition &, EUserTriggered = NotUserTriggered); 134 void setEnd(const VisiblePosition &, EUserTriggered = NotUserTriggered);
133 135
134 void setBase(const VisiblePosition&, EUserTriggered = NotUserTriggered); 136 void setBase(const VisiblePosition&, EUserTriggered = NotUserTriggered);
135 void setExtent(const VisiblePosition&, EUserTriggered = NotUserTriggered); 137 void setExtent(const VisiblePosition&, EUserTriggered = NotUserTriggered);
136 138
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 292
291 RefPtrWillBeMember<EditingStyle> m_typingStyle; 293 RefPtrWillBeMember<EditingStyle> m_typingStyle;
292 294
293 Timer<FrameSelection> m_caretBlinkTimer; 295 Timer<FrameSelection> m_caretBlinkTimer;
294 296
295 bool m_caretRectDirty : 1; 297 bool m_caretRectDirty : 1;
296 bool m_shouldPaintCaret : 1; 298 bool m_shouldPaintCaret : 1;
297 bool m_isCaretBlinkingSuspended : 1; 299 bool m_isCaretBlinkingSuspended : 1;
298 bool m_focused : 1; 300 bool m_focused : 1;
299 bool m_shouldShowBlockCursor : 1; 301 bool m_shouldShowBlockCursor : 1;
302
303 OwnPtr<GranularityStrategy> m_granularityStrategy;
300 }; 304 };
301 305
302 inline EditingStyle* FrameSelection::typingStyle() const 306 inline EditingStyle* FrameSelection::typingStyle() const
303 { 307 {
304 return m_typingStyle.get(); 308 return m_typingStyle.get();
305 } 309 }
306 310
307 inline void FrameSelection::clearTypingStyle() 311 inline void FrameSelection::clearTypingStyle()
308 { 312 {
309 m_typingStyle.clear(); 313 m_typingStyle.clear();
310 } 314 }
311 315
312 inline void FrameSelection::setTypingStyle(PassRefPtrWillBeRawPtr<EditingStyle> style) 316 inline void FrameSelection::setTypingStyle(PassRefPtrWillBeRawPtr<EditingStyle> style)
313 { 317 {
314 m_typingStyle = style; 318 m_typingStyle = style;
315 } 319 }
316 } // namespace blink 320 } // namespace blink
317 321
318 #ifndef NDEBUG 322 #ifndef NDEBUG
319 // Outside the WebCore namespace for ease of invocation from gdb. 323 // Outside the WebCore namespace for ease of invocation from gdb.
320 void showTree(const blink::FrameSelection&); 324 void showTree(const blink::FrameSelection&);
321 void showTree(const blink::FrameSelection*); 325 void showTree(const blink::FrameSelection*);
322 #endif 326 #endif
323 327
324 #endif // FrameSelection_h 328 #endif // FrameSelection_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/FrameSelection.cpp » ('j') | Source/core/editing/FrameSelection.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698