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

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

Issue 1994883002: [Editing][CodeHealth] Extract new FrameCaret class from FrameSelection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 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 29 matching lines...) Expand all
40 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
41 #include "wtf/Noncopyable.h" 41 #include "wtf/Noncopyable.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class CaretBase; 45 class CaretBase;
46 class CharacterData; 46 class CharacterData;
47 class CullRect; 47 class CullRect;
48 class LayoutBlock; 48 class LayoutBlock;
49 class LocalFrame; 49 class LocalFrame;
50 class FrameCaret;
50 class GranularityStrategy; 51 class GranularityStrategy;
51 class GraphicsContext; 52 class GraphicsContext;
52 class HTMLFormElement; 53 class HTMLFormElement;
53 class SelectionEditor; 54 class SelectionEditor;
54 class PendingSelection; 55 class PendingSelection;
55 class Text; 56 class Text;
56 57
57 enum class CursorAlignOnScroll { IfNeeded, Always }; 58 enum class CursorAlignOnScroll { IfNeeded, Always };
58 59
59 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 }; 60 enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 };
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void nodeWillBeRemoved(Node&); 175 void nodeWillBeRemoved(Node&);
175 void dataWillChange(const CharacterData& node); 176 void dataWillChange(const CharacterData& node);
176 void didUpdateCharacterData(CharacterData*, unsigned offset, unsigned oldLen gth, unsigned newLength); 177 void didUpdateCharacterData(CharacterData*, unsigned offset, unsigned oldLen gth, unsigned newLength);
177 void didMergeTextNodes(const Text& oldNode, unsigned offset); 178 void didMergeTextNodes(const Text& oldNode, unsigned offset);
178 void didSplitTextNode(const Text& oldNode); 179 void didSplitTextNode(const Text& oldNode);
179 180
180 bool isAppearanceDirty() const; 181 bool isAppearanceDirty() const;
181 void commitAppearanceIfNeeded(LayoutView&); 182 void commitAppearanceIfNeeded(LayoutView&);
182 void updateAppearance(); 183 void updateAppearance();
183 void setCaretVisible(bool caretIsVisible); 184 void setCaretVisible(bool caretIsVisible);
184 bool isCaretBoundsDirty() const { return m_caretRectDirty; } 185 bool isCaretBoundsDirty() const;
185 void setCaretRectNeedsUpdate(); 186 void setCaretRectNeedsUpdate();
186 void scheduleVisualUpdate() const; 187 void scheduleVisualUpdate() const;
187 void invalidateCaretRect(); 188 void invalidateCaretRect();
188 void paintCaret(GraphicsContext&, const LayoutPoint&); 189 void paintCaret(GraphicsContext&, const LayoutPoint&);
189 190
190 // Used to suspend caret blinking while the mouse is down. 191 // Used to suspend caret blinking while the mouse is down.
191 void setCaretBlinkingSuspended(bool suspended) { m_isCaretBlinkingSuspended = suspended; } 192 void setCaretBlinkingSuspended(bool);
192 bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; } 193 bool isCaretBlinkingSuspended() const;
193 194
194 // Focus 195 // Focus
195 void setFocused(bool); 196 void setFocused(bool);
196 bool isFocused() const { return m_focused; } 197 bool isFocused() const { return m_focused; }
197 bool isFocusedAndActive() const; 198 bool isFocusedAndActive() const;
198 void pageActivationChanged(); 199 void pageActivationChanged();
199 200
200 void updateSecureKeyboardEntryIfActive(); 201 void updateSecureKeyboardEntryIfActive();
201 202
202 // Returns true if a word is selected. 203 // Returns true if a word is selected.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, SetSel ectionOptions, CursorAlignOnScroll, TextGranularity); 265 void setSelectionAlgorithm(const VisibleSelectionTemplate<Strategy>&, SetSel ectionOptions, CursorAlignOnScroll, TextGranularity);
265 266
266 void respondToNodeModification(Node&, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved); 267 void respondToNodeModification(Node&, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved);
267 268
268 void notifyAccessibilityForSelectionChange(); 269 void notifyAccessibilityForSelectionChange();
269 void notifyCompositorForSelectionChange(); 270 void notifyCompositorForSelectionChange();
270 void notifyEventHandlerForSelectionChange(); 271 void notifyEventHandlerForSelectionChange();
271 272
272 void focusedOrActiveStateChanged(); 273 void focusedOrActiveStateChanged();
273 274
274 void caretBlinkTimerFired(Timer<FrameSelection>*);
275 void stopCaretBlinkTimer();
276
277 void setUseSecureKeyboardEntry(bool); 275 void setUseSecureKeyboardEntry(bool);
278 276
279 void setCaretVisibility(CaretVisibility); 277 void setCaretVisibility(CaretVisibility);
280 bool shouldBlinkCaret() const; 278 bool shouldBlinkCaret() const;
281 279
282 void updateSelectionIfNeeded(const Position& base, const Position& extent, c onst Position& start, const Position& end); 280 void updateSelectionIfNeeded(const Position& base, const Position& extent, c onst Position& start, const Position& end);
283 281
284 template <typename Strategy> 282 template <typename Strategy>
285 VisibleSelectionTemplate<Strategy> validateSelection(const VisibleSelectionT emplate<Strategy>&); 283 VisibleSelectionTemplate<Strategy> validateSelection(const VisibleSelectionT emplate<Strategy>&);
286 284
287 GranularityStrategy* granularityStrategy(); 285 GranularityStrategy* granularityStrategy();
288 286
289 // For unittests 287 // For unittests
290 bool shouldPaintCaretForTesting() const { return m_shouldPaintCaret; } 288 bool shouldPaintCaretForTesting() const;
291 bool isPreviousCaretDirtyForTesting() const { return m_previousCaretNode; } 289 bool isPreviousCaretDirtyForTesting() const;
292 290
293 Member<LocalFrame> m_frame; 291 Member<LocalFrame> m_frame;
294 const Member<PendingSelection> m_pendingSelection; 292 const Member<PendingSelection> m_pendingSelection;
295 const Member<SelectionEditor> m_selectionEditor; 293 const Member<SelectionEditor> m_selectionEditor;
296 294
297 // Used to store base before the adjustment at bidi boundary 295 // Used to store base before the adjustment at bidi boundary
298 VisiblePosition m_originalBase; 296 VisiblePosition m_originalBase;
299 VisiblePositionInFlatTree m_originalBaseInFlatTree; 297 VisiblePositionInFlatTree m_originalBaseInFlatTree;
300 TextGranularity m_granularity; 298 TextGranularity m_granularity;
301 LayoutUnit m_xPosForVerticalArrowNavigation; 299 LayoutUnit m_xPosForVerticalArrowNavigation;
302 300
303 Member<Node> m_previousCaretNode; // The last node which painted the caret. Retained for clearing the old caret when it moves.
304 LayoutRect m_previousCaretRect;
305 CaretVisibility m_previousCaretVisibility;
306
307 Member<EditingStyle> m_typingStyle; 301 Member<EditingStyle> m_typingStyle;
308 302
309 Timer<FrameSelection> m_caretBlinkTimer;
310
311 bool m_caretRectDirty : 1;
312 bool m_shouldPaintCaret : 1;
313 bool m_isCaretBlinkingSuspended : 1;
314 bool m_focused : 1; 303 bool m_focused : 1;
315 bool m_shouldShowBlockCursor : 1; 304 bool m_shouldShowBlockCursor : 1;
316 305
317 // Controls text granularity used to adjust the selection's extent in moveRa ngeSelectionExtent. 306 // Controls text granularity used to adjust the selection's extent in moveRa ngeSelectionExtent.
318 OwnPtr<GranularityStrategy> m_granularityStrategy; 307 OwnPtr<GranularityStrategy> m_granularityStrategy;
319 308
320 OwnPtr<CaretBase> m_caretBase; 309 const Member<FrameCaret> m_frameCaret;
321 }; 310 };
322 311
323 inline EditingStyle* FrameSelection::typingStyle() const 312 inline EditingStyle* FrameSelection::typingStyle() const
324 { 313 {
325 return m_typingStyle.get(); 314 return m_typingStyle.get();
326 } 315 }
327 316
328 inline void FrameSelection::clearTypingStyle() 317 inline void FrameSelection::clearTypingStyle()
329 { 318 {
330 m_typingStyle.clear(); 319 m_typingStyle.clear();
331 } 320 }
332 321
333 inline void FrameSelection::setTypingStyle(EditingStyle* style) 322 inline void FrameSelection::setTypingStyle(EditingStyle* style)
334 { 323 {
335 m_typingStyle = style; 324 m_typingStyle = style;
336 } 325 }
337 } // namespace blink 326 } // namespace blink
338 327
339 #ifndef NDEBUG 328 #ifndef NDEBUG
340 // Outside the WebCore namespace for ease of invocation from gdb. 329 // Outside the WebCore namespace for ease of invocation from gdb.
341 void showTree(const blink::FrameSelection&); 330 void showTree(const blink::FrameSelection&);
342 void showTree(const blink::FrameSelection*); 331 void showTree(const blink::FrameSelection*);
343 #endif 332 #endif
344 333
345 #endif // FrameSelection_h 334 #endif // FrameSelection_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698