OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 // TODO(yosin): We will rename |SelectionEditor| to appropriate name since | 35 // TODO(yosin): We will rename |SelectionEditor| to appropriate name since |
36 // it is no longer have a changing selection functionality, it was moved to | 36 // it is no longer have a changing selection functionality, it was moved to |
37 // |SelectionModifier| class. | 37 // |SelectionModifier| class. |
38 class SelectionEditor final | 38 class SelectionEditor final |
39 : public GarbageCollectedFinalized<SelectionEditor> { | 39 : public GarbageCollectedFinalized<SelectionEditor> { |
40 WTF_MAKE_NONCOPYABLE(SelectionEditor); | 40 WTF_MAKE_NONCOPYABLE(SelectionEditor); |
41 | 41 |
42 public: | 42 public: |
43 static SelectionEditor* create(LocalFrame* frame) { | 43 static SelectionEditor* create(LocalFrame& frame) { |
44 return new SelectionEditor(frame); | 44 return new SelectionEditor(frame); |
45 } | 45 } |
46 virtual ~SelectionEditor(); | 46 virtual ~SelectionEditor(); |
47 void dispose(); | 47 void dispose(); |
48 | 48 |
49 bool hasEditableStyle() const { return m_selection.hasEditableStyle(); } | 49 bool hasEditableStyle() const { return m_selection.hasEditableStyle(); } |
50 bool isContentEditable() const { return m_selection.isContentEditable(); } | 50 bool isContentEditable() const { return m_selection.isContentEditable(); } |
51 bool isContentRichlyEditable() const { | 51 bool isContentRichlyEditable() const { |
52 return m_selection.isContentRichlyEditable(); | 52 return m_selection.isContentRichlyEditable(); |
53 } | 53 } |
(...skipping 24 matching lines...) Expand all Loading... |
78 void resetLogicalRange(); | 78 void resetLogicalRange(); |
79 void setLogicalRange(Range*); | 79 void setLogicalRange(Range*); |
80 | 80 |
81 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date | 81 // Updates |m_selection| and |m_selectionInFlatTree| with up-to-date |
82 // layout if needed. | 82 // layout if needed. |
83 void updateIfNeeded(); | 83 void updateIfNeeded(); |
84 | 84 |
85 DECLARE_TRACE(); | 85 DECLARE_TRACE(); |
86 | 86 |
87 private: | 87 private: |
88 explicit SelectionEditor(LocalFrame*); | 88 explicit SelectionEditor(LocalFrame&); |
89 | 89 |
90 const Document& document() const; | 90 const Document& document() const; |
91 LocalFrame* frame() const { return m_frame.get(); } | 91 LocalFrame* frame() const { return m_frame.get(); } |
92 | 92 |
93 void clearVisibleSelection(); | 93 void clearVisibleSelection(); |
94 bool shouldAlwaysUseDirectionalSelection() const; | 94 bool shouldAlwaysUseDirectionalSelection() const; |
95 | 95 |
96 Member<Document> m_document; | 96 Member<Document> m_document; |
97 Member<LocalFrame> m_frame; | 97 Member<LocalFrame> m_frame; |
98 | 98 |
99 VisibleSelection m_selection; | 99 VisibleSelection m_selection; |
100 VisibleSelectionInFlatTree m_selectionInFlatTree; | 100 VisibleSelectionInFlatTree m_selectionInFlatTree; |
101 bool m_observingVisibleSelection; | 101 bool m_observingVisibleSelection; |
102 | 102 |
103 // The range specified by the user, which may not be visually canonicalized | 103 // The range specified by the user, which may not be visually canonicalized |
104 // (hence "logical"). This will be invalidated if the underlying | 104 // (hence "logical"). This will be invalidated if the underlying |
105 // |VisibleSelection| changes. If that happens, this variable will | 105 // |VisibleSelection| changes. If that happens, this variable will |
106 // become |nullptr|, in which case logical positions == visible positions. | 106 // become |nullptr|, in which case logical positions == visible positions. |
107 Member<Range> m_logicalRange; | 107 Member<Range> m_logicalRange; |
108 }; | 108 }; |
109 | 109 |
110 } // namespace blink | 110 } // namespace blink |
111 | 111 |
112 #endif // SelectionEditor_h | 112 #endif // SelectionEditor_h |
OLD | NEW |