OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights 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 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static PassRefPtrWillBeRawPtr<DOMSelection> create(const TreeScope* treeScop
e) | 54 static PassRefPtrWillBeRawPtr<DOMSelection> create(const TreeScope* treeScop
e) |
55 { | 55 { |
56 return adoptRefWillBeNoop(new DOMSelection(treeScope)); | 56 return adoptRefWillBeNoop(new DOMSelection(treeScope)); |
57 } | 57 } |
58 | 58 |
59 void clearTreeScope(); | 59 void clearTreeScope(); |
60 | 60 |
61 // Safari Selection Object API | 61 // Safari Selection Object API |
62 // These methods return the valid equivalents of internal editing positions. | 62 // These methods return the valid equivalents of internal editing positions. |
63 Node* baseNode() const; | 63 Node* baseNode() const; |
64 int baseOffset() const; | 64 unsigned baseOffset() const; |
65 Node* extentNode() const; | 65 Node* extentNode() const; |
66 int extentOffset() const; | 66 unsigned extentOffset() const; |
67 String type() const; | 67 String type() const; |
68 void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int
extentOffset, ExceptionState&); | 68 void setBaseAndExtent(Node* baseNode, unsigned baseOffset, Node* extentNode,
unsigned extentOffset, ExceptionState&); |
69 void modify(const String& alter, const String& direction, const String& gran
ularity); | 69 void modify(const String& alter, const String& direction, const String& gran
ularity); |
70 | 70 |
71 // Mozilla Selection Object API | 71 // Mozilla Selection Object API |
72 // In Firefox, anchor/focus are the equal to the start/end of the selection, | 72 // In Firefox, anchor/focus are the equal to the start/end of the selection, |
73 // but reflect the direction in which the selection was made by the user. Th
at does | 73 // but reflect the direction in which the selection was made by the user. Th
at does |
74 // not mean that they are base/extent, since the base/extent don't reflect | 74 // not mean that they are base/extent, since the base/extent don't reflect |
75 // expansion. | 75 // expansion. |
76 // These methods return the valid equivalents of internal editing positions. | 76 // These methods return the valid equivalents of internal editing positions. |
77 Node* anchorNode() const; | 77 Node* anchorNode() const; |
78 int anchorOffset() const; | 78 unsigned anchorOffset() const; |
79 Node* focusNode() const; | 79 Node* focusNode() const; |
80 int focusOffset() const; | 80 unsigned focusOffset() const; |
81 bool isCollapsed() const; | 81 bool isCollapsed() const; |
82 int rangeCount() const; | 82 unsigned rangeCount() const; |
83 void collapse(Node*, int offset, ExceptionState&); | 83 void collapse(Node*, unsigned offset, ExceptionState&); |
84 void collapseToEnd(ExceptionState&); | 84 void collapseToEnd(ExceptionState&); |
85 void collapseToStart(ExceptionState&); | 85 void collapseToStart(ExceptionState&); |
86 void extend(Node*, int offset, ExceptionState&); | 86 void extend(Node*, unsigned offset, ExceptionState&); |
87 PassRefPtrWillBeRawPtr<Range> getRangeAt(int, ExceptionState&); | 87 PassRefPtrWillBeRawPtr<Range> getRangeAt(unsigned, ExceptionState&); |
88 void removeAllRanges(); | 88 void removeAllRanges(); |
89 void addRange(Range*); | 89 void addRange(Range*); |
90 void deleteFromDocument(); | 90 void deleteFromDocument(); |
91 bool containsNode(const Node*, bool partlyContained) const; | 91 bool containsNode(const Node*, bool partlyContained) const; |
92 void selectAllChildren(Node*, ExceptionState&); | 92 void selectAllChildren(Node*, ExceptionState&); |
93 | 93 |
94 String toString(); | 94 String toString(); |
95 | 95 |
96 // Microsoft Selection Object API | 96 // Microsoft Selection Object API |
97 void empty(); | 97 void empty(); |
98 | 98 |
99 DECLARE_VIRTUAL_TRACE(); | 99 DECLARE_VIRTUAL_TRACE(); |
100 | 100 |
101 private: | 101 private: |
102 explicit DOMSelection(const TreeScope*); | 102 explicit DOMSelection(const TreeScope*); |
103 | 103 |
104 // Convenience method for accessors, does not check m_frame present. | 104 // Convenience method for accessors, does not check m_frame present. |
105 const VisibleSelection& visibleSelection() const; | 105 const VisibleSelection& visibleSelection() const; |
106 | 106 |
107 Node* shadowAdjustedNode(const Position&) const; | 107 Node* shadowAdjustedNode(const Position&) const; |
108 int shadowAdjustedOffset(const Position&) const; | 108 unsigned shadowAdjustedOffset(const Position&) const; |
109 | 109 |
110 bool isValidForPosition(Node*) const; | 110 bool isValidForPosition(Node*) const; |
111 | 111 |
112 void addConsoleError(const String& message); | 112 void addConsoleError(const String& message); |
113 | 113 |
114 RawPtrWillBeMember<const TreeScope> m_treeScope; | 114 RawPtrWillBeMember<const TreeScope> m_treeScope; |
115 }; | 115 }; |
116 | 116 |
117 } // namespace blink | 117 } // namespace blink |
118 | 118 |
119 #endif // DOMSelection_h | 119 #endif // DOMSelection_h |
OLD | NEW |