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

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

Issue 1412713003: Reland 'Use FrameSelection::selectedText where possible.' Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use SelectionEditor::setWithoutValidation. Created 5 years, 1 month 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 15 matching lines...) Expand all
26 #ifndef FrameSelection_h 26 #ifndef FrameSelection_h
27 #define FrameSelection_h 27 #define FrameSelection_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/dom/Range.h" 30 #include "core/dom/Range.h"
31 #include "core/editing/CaretBase.h" 31 #include "core/editing/CaretBase.h"
32 #include "core/editing/EditingStyle.h" 32 #include "core/editing/EditingStyle.h"
33 #include "core/editing/EphemeralRange.h" 33 #include "core/editing/EphemeralRange.h"
34 #include "core/editing/VisiblePosition.h" 34 #include "core/editing/VisiblePosition.h"
35 #include "core/editing/VisibleSelection.h" 35 #include "core/editing/VisibleSelection.h"
36 #include "core/editing/iterators/TextIteratorFlags.h"
36 #include "core/layout/ScrollAlignment.h" 37 #include "core/layout/ScrollAlignment.h"
37 #include "platform/Timer.h" 38 #include "platform/Timer.h"
38 #include "platform/geometry/IntRect.h" 39 #include "platform/geometry/IntRect.h"
39 #include "platform/geometry/LayoutRect.h" 40 #include "platform/geometry/LayoutRect.h"
40 #include "platform/heap/Handle.h" 41 #include "platform/heap/Handle.h"
41 #include "wtf/Noncopyable.h" 42 #include "wtf/Noncopyable.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 class CharacterData; 46 class CharacterData;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 template <typename Strategy> 111 template <typename Strategy>
111 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; 112 const VisibleSelectionTemplate<Strategy>& visibleSelection() const;
112 113
113 const VisibleSelection& selection() const; 114 const VisibleSelection& selection() const;
114 void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, TextGr anularity = CharacterGranularity); 115 void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::IfNeeded, TextGr anularity = CharacterGranularity);
115 void setSelection(const VisibleSelectionInComposedTree&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::If Needed, TextGranularity = CharacterGranularity); 116 void setSelection(const VisibleSelectionInComposedTree&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = CursorAlignOnScroll::If Needed, TextGranularity = CharacterGranularity);
116 // TODO(yosin) We should get rid of two parameters version of 117 // TODO(yosin) We should get rid of two parameters version of
117 // |setSelection()| to avoid conflict of four parameters version. 118 // |setSelection()| to avoid conflict of four parameters version.
118 void setSelection(const VisibleSelection& selection, TextGranularity granula rity) { setSelection(selection, CloseTyping | ClearTypingStyle, CursorAlignOnScr oll::IfNeeded, granularity); } 119 void setSelection(const VisibleSelection& selection, TextGranularity granula rity) { setSelection(selection, CloseTyping | ClearTypingStyle, CursorAlignOnScr oll::IfNeeded, granularity); }
119 void setSelection(const VisibleSelectionInComposedTree& selection, TextGranu larity granularity) { setSelection(selection, CloseTyping | ClearTypingStyle, Cu rsorAlignOnScroll::IfNeeded, granularity); } 120 void setSelection(const VisibleSelectionInComposedTree& selection, TextGranu larity granularity) { setSelection(selection, CloseTyping | ClearTypingStyle, Cu rsorAlignOnScroll::IfNeeded, granularity); }
121 void setSelectionInTextFormControl(const VisibleSelection&, SetSelectionOpti ons);
120 // TODO(yosin) We should get rid of |Range| version of |setSelectedRagne()| 122 // TODO(yosin) We should get rid of |Range| version of |setSelectedRagne()|
121 // for Oilpan. 123 // for Oilpan.
122 bool setSelectedRange(Range*, TextAffinity, SelectionDirectionalMode = Selec tionDirectionalMode::NonDirectional, SetSelectionOptions = CloseTyping | ClearTy pingStyle); 124 bool setSelectedRange(Range*, TextAffinity, SelectionDirectionalMode = Selec tionDirectionalMode::NonDirectional, SetSelectionOptions = CloseTyping | ClearTy pingStyle);
123 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio nalMode = SelectionDirectionalMode::NonDirectional, FrameSelection::SetSelection Options = CloseTyping | ClearTypingStyle); 125 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio nalMode = SelectionDirectionalMode::NonDirectional, FrameSelection::SetSelection Options = CloseTyping | ClearTypingStyle);
124 void selectAll(); 126 void selectAll();
125 void clear(); 127 void clear();
126 void prepareForDestruction(); 128 void prepareForDestruction();
127 129
128 // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected. 130 // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
129 void selectFrameElementInParentIfFullySelected(); 131 void selectFrameElementInParentIfFullySelected();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void setNonDirectionalSelectionIfNeeded(const VisibleSelection&, TextGranula rity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints); 219 void setNonDirectionalSelectionIfNeeded(const VisibleSelection&, TextGranula rity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
218 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInComposedTree &, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints); 220 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInComposedTree &, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
219 void setFocusedNodeIfNeeded(); 221 void setFocusedNodeIfNeeded();
220 void notifyLayoutObjectOfSelectionChange(EUserTriggered); 222 void notifyLayoutObjectOfSelectionChange(EUserTriggered);
221 223
222 EditingStyle* typingStyle() const; 224 EditingStyle* typingStyle() const;
223 void setTypingStyle(PassRefPtrWillBeRawPtr<EditingStyle>); 225 void setTypingStyle(PassRefPtrWillBeRawPtr<EditingStyle>);
224 void clearTypingStyle(); 226 void clearTypingStyle();
225 227
226 String selectedHTMLForClipboard() const; 228 String selectedHTMLForClipboard() const;
227 String selectedText() const; 229 String selectedText(TextIteratorBehavior = TextIteratorDefaultBehavior) cons t;
228 String selectedTextForClipboard() const; 230 String selectedTextForClipboard() const;
229 231
230 // The bounds are clipped to the viewport as this is what callers expect. 232 // The bounds are clipped to the viewport as this is what callers expect.
231 LayoutRect bounds() const; 233 LayoutRect bounds() const;
232 LayoutRect unclippedBounds() const; 234 LayoutRect unclippedBounds() const;
233 235
234 HTMLFormElement* currentForm() const; 236 HTMLFormElement* currentForm() const;
235 237
236 void revealSelection(const ScrollAlignment& = ScrollAlignment::alignCenterIf Needed, RevealExtentOption = DoNotRevealExtent); 238 void revealSelection(const ScrollAlignment& = ScrollAlignment::alignCenterIf Needed, RevealExtentOption = DoNotRevealExtent);
237 void setSelectionFromNone(); 239 void setSelectionFromNone();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 331 }
330 } // namespace blink 332 } // namespace blink
331 333
332 #ifndef NDEBUG 334 #ifndef NDEBUG
333 // Outside the WebCore namespace for ease of invocation from gdb. 335 // Outside the WebCore namespace for ease of invocation from gdb.
334 void showTree(const blink::FrameSelection&); 336 void showTree(const blink::FrameSelection&);
335 void showTree(const blink::FrameSelection*); 337 void showTree(const blink::FrameSelection*);
336 #endif 338 #endif
337 339
338 #endif // FrameSelection_h 340 #endif // FrameSelection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698