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

Side by Side Diff: Source/core/dom/Range.h

Issue 23404003: Make Range methods to work with detached node (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 void detach(ExceptionState&); 95 void detach(ExceptionState&);
96 PassRefPtr<Range> cloneRange(ExceptionState&) const; 96 PassRefPtr<Range> cloneRange(ExceptionState&) const;
97 97
98 void setStartAfter(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); 98 void setStartAfter(Node*, ExceptionState& = ASSERT_NO_EXCEPTION);
99 void setEndBefore(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); 99 void setEndBefore(Node*, ExceptionState& = ASSERT_NO_EXCEPTION);
100 void setEndAfter(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); 100 void setEndAfter(Node*, ExceptionState& = ASSERT_NO_EXCEPTION);
101 void selectNode(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); 101 void selectNode(Node*, ExceptionState& = ASSERT_NO_EXCEPTION);
102 void selectNodeContents(Node*, ExceptionState&); 102 void selectNodeContents(Node*, ExceptionState&);
103 void surroundContents(PassRefPtr<Node>, ExceptionState&); 103 void surroundContents(PassRefPtr<Node>, ExceptionState&);
104 void setStartBefore(Node*, ExceptionState&); 104 void setStartBefore(Node*, ExceptionState& = ASSERT_NO_EXCEPTION);
105 105
106 const Position startPosition() const { return m_start.toPosition(); } 106 const Position startPosition() const { return m_start.toPosition(); }
107 const Position endPosition() const { return m_end.toPosition(); } 107 const Position endPosition() const { return m_end.toPosition(); }
108 void setStart(const Position&, ExceptionState& = ASSERT_NO_EXCEPTION); 108 void setStart(const Position&, ExceptionState& = ASSERT_NO_EXCEPTION);
109 void setEnd(const Position&, ExceptionState& = ASSERT_NO_EXCEPTION); 109 void setEnd(const Position&, ExceptionState& = ASSERT_NO_EXCEPTION);
110 110
111 Node* firstNode() const; 111 Node* firstNode() const;
112 Node* pastLastNode() const; 112 Node* pastLastNode() const;
113 113
114 ShadowRoot* shadowRoot() const; 114 ShadowRoot* shadowRoot() const;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void formatForDebugger(char* buffer, unsigned length) const; 149 void formatForDebugger(char* buffer, unsigned length) const;
150 #endif 150 #endif
151 151
152 private: 152 private:
153 explicit Range(PassRefPtr<Document>); 153 explicit Range(PassRefPtr<Document>);
154 Range(PassRefPtr<Document>, PassRefPtr<Node> startContainer, int startOffset , PassRefPtr<Node> endContainer, int endOffset); 154 Range(PassRefPtr<Document>, PassRefPtr<Node> startContainer, int startOffset , PassRefPtr<Node> endContainer, int endOffset);
155 155
156 void setDocument(Document*); 156 void setDocument(Document*);
157 157
158 Node* checkNodeWOffset(Node*, int offset, ExceptionState&) const; 158 Node* checkNodeWOffset(Node*, int offset, ExceptionState&) const;
159 void checkNodeBA(Node*, ExceptionState&) const; 159 void checkNodeBA(Node*, ExceptionState&, const char*) const;
tkent 2013/08/26 22:37:41 It's hard to imagine what the "const char*" argume
yosin_UTC9 2013/08/27 02:18:55 Done.
160 void checkDeleteExtract(ExceptionState&); 160 void checkDeleteExtract(ExceptionState&);
161 int maxStartOffset() const; 161 int maxStartOffset() const;
162 int maxEndOffset() const; 162 int maxEndOffset() const;
163 163
164 enum ActionType { DELETE_CONTENTS, EXTRACT_CONTENTS, CLONE_CONTENTS }; 164 enum ActionType { DELETE_CONTENTS, EXTRACT_CONTENTS, CLONE_CONTENTS };
165 PassRefPtr<DocumentFragment> processContents(ActionType, ExceptionState&); 165 PassRefPtr<DocumentFragment> processContents(ActionType, ExceptionState&);
166 static PassRefPtr<Node> processContentsBetweenOffsets(ActionType, PassRefPtr <DocumentFragment>, Node*, unsigned startOffset, unsigned endOffset, ExceptionSt ate&); 166 static PassRefPtr<Node> processContentsBetweenOffsets(ActionType, PassRefPtr <DocumentFragment>, Node*, unsigned startOffset, unsigned endOffset, ExceptionSt ate&);
167 static void processNodes(ActionType, Vector<RefPtr<Node> >&, PassRefPtr<Node > oldContainer, PassRefPtr<Node> newContainer, ExceptionState&); 167 static void processNodes(ActionType, Vector<RefPtr<Node> >&, PassRefPtr<Node > oldContainer, PassRefPtr<Node> newContainer, ExceptionState&);
168 enum ContentsProcessDirection { ProcessContentsForward, ProcessContentsBackw ard }; 168 enum ContentsProcessDirection { ProcessContentsForward, ProcessContentsBackw ard };
169 static PassRefPtr<Node> processAncestorsAndTheirSiblings(ActionType, Node* c ontainer, ContentsProcessDirection, PassRefPtr<Node> clonedContainer, Node* comm onRoot, ExceptionState&); 169 static PassRefPtr<Node> processAncestorsAndTheirSiblings(ActionType, Node* c ontainer, ContentsProcessDirection, PassRefPtr<Node> clonedContainer, Node* comm onRoot, ExceptionState&);
170 170
171 RefPtr<Document> m_ownerDocument; 171 RefPtr<Document> m_ownerDocument;
172 RangeBoundaryPoint m_start; 172 RangeBoundaryPoint m_start;
173 RangeBoundaryPoint m_end; 173 RangeBoundaryPoint m_end;
174 }; 174 };
175 175
176 PassRefPtr<Range> rangeOfContents(Node*); 176 PassRefPtr<Range> rangeOfContents(Node*);
177 177
178 bool areRangesEqual(const Range*, const Range*); 178 bool areRangesEqual(const Range*, const Range*);
179 179
180 } // namespace 180 } // namespace
181 181
182 #ifndef NDEBUG 182 #ifndef NDEBUG
183 // Outside the WebCore namespace for ease of invocation from gdb. 183 // Outside the WebCore namespace for ease of invocation from gdb.
184 void showTree(const WebCore::Range*); 184 void showTree(const WebCore::Range*);
185 #endif 185 #endif
186 186
187 #endif 187 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698