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

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

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-08T18:08:39 Created 4 years, 6 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool isContentEditable() const { return m_selection.isContentEditable(); } 48 bool isContentEditable() const { return m_selection.isContentEditable(); }
49 bool isContentRichlyEditable() const { return m_selection.isContentRichlyEdi table(); } 49 bool isContentRichlyEditable() const { return m_selection.isContentRichlyEdi table(); }
50 50
51 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio nalMode, FrameSelection::SetSelectionOptions); 51 bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectio nalMode, FrameSelection::SetSelectionOptions);
52 52
53 template <typename Strategy> 53 template <typename Strategy>
54 const VisibleSelectionTemplate<Strategy>& visibleSelection() const; 54 const VisibleSelectionTemplate<Strategy>& visibleSelection() const;
55 void setVisibleSelection(const VisibleSelection&, FrameSelection::SetSelecti onOptions); 55 void setVisibleSelection(const VisibleSelection&, FrameSelection::SetSelecti onOptions);
56 void setVisibleSelection(const VisibleSelectionInFlatTree&, FrameSelection:: SetSelectionOptions); 56 void setVisibleSelection(const VisibleSelectionInFlatTree&, FrameSelection:: SetSelectionOptions);
57 57
58 void setIsDirectional(bool);
59 void setWithoutValidation(const Position& base, const Position& extent); 58 void setWithoutValidation(const Position& base, const Position& extent);
60 59
60 void documentAttached(Document*);
61 void documentDetached(const Document&);
62
61 // If this FrameSelection has a logical range which is still valid, this 63 // If this FrameSelection has a logical range which is still valid, this
62 // function return its clone. Otherwise, the return value from underlying 64 // function return its clone. Otherwise, the return value from underlying
63 // |VisibleSelection|'s |firstRange()| is returned. 65 // |VisibleSelection|'s |firstRange()| is returned.
64 Range* firstRange() const; 66 Range* firstRange() const;
65 67
66 // There functions are exposed for |FrameSelection|. 68 // There functions are exposed for |FrameSelection|.
67 void resetLogicalRange(); 69 void resetLogicalRange();
68 void setLogicalRange(Range*); 70 void setLogicalRange(Range*);
69 71
70 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date 72 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date
71 // layout if needed. 73 // layout if needed.
72 void updateIfNeeded(); 74 void updateIfNeeded();
73 75
74 DECLARE_VIRTUAL_TRACE(); 76 DECLARE_VIRTUAL_TRACE();
75 77
76 private: 78 private:
77 explicit SelectionEditor(FrameSelection&); 79 explicit SelectionEditor(FrameSelection&);
78 80
81 const Document& document() const;
79 LocalFrame* frame() const; 82 LocalFrame* frame() const;
80 83
84 void clearVisibleSelection();
85 bool shouldAlwaysUseDirectionalSelection() const;
86
87 Member<Document> m_document;
81 Member<FrameSelection> m_frameSelection; 88 Member<FrameSelection> m_frameSelection;
82 89
83 VisibleSelection m_selection; 90 VisibleSelection m_selection;
84 VisibleSelectionInFlatTree m_selectionInFlatTree; 91 VisibleSelectionInFlatTree m_selectionInFlatTree;
85 bool m_observingVisibleSelection; 92 bool m_observingVisibleSelection;
86 93
87 // The range specified by the user, which may not be visually canonicalized 94 // The range specified by the user, which may not be visually canonicalized
88 // (hence "logical"). This will be invalidated if the underlying 95 // (hence "logical"). This will be invalidated if the underlying
89 // |VisibleSelection| changes. If that happens, this variable will 96 // |VisibleSelection| changes. If that happens, this variable will
90 // become |nullptr|, in which case logical positions == visible positions. 97 // become |nullptr|, in which case logical positions == visible positions.
91 Member<Range> m_logicalRange; 98 Member<Range> m_logicalRange;
92 }; 99 };
93 100
94 } // namespace blink 101 } // namespace blink
95 102
96 #endif // SelectionEditor_h 103 #endif // SelectionEditor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698