OLD | NEW |
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, 2010, 2011 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 8 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void Range::collapse(bool toStart) { | 225 void Range::collapse(bool toStart) { |
226 if (toStart) | 226 if (toStart) |
227 m_end = m_start; | 227 m_end = m_start; |
228 else | 228 else |
229 m_start = m_end; | 229 m_start = m_end; |
230 } | 230 } |
231 | 231 |
232 bool Range::isNodeFullyContained(Node& node) const { | 232 bool Range::isNodeFullyContained(Node& node) const { |
233 ContainerNode* parentNode = node.parentNode(); | 233 ContainerNode* parentNode = node.parentNode(); |
234 int nodeIndex = node.nodeIndex(); | 234 int nodeIndex = node.nodeIndex(); |
235 return isPointInRange(parentNode, nodeIndex, | 235 return isPointInRange( |
236 IGNORE_EXCEPTION) // starts in the middle of this | 236 parentNode, nodeIndex, |
237 // range, or on the boundary points. | 237 IGNORE_EXCEPTION_FOR_TESTING) // starts in the middle of this |
238 && isPointInRange(parentNode, nodeIndex + 1, | 238 // range, or on the boundary points. |
239 IGNORE_EXCEPTION); // ends in the middle of this | 239 && isPointInRange( |
240 // range, or on the boundary | 240 parentNode, nodeIndex + 1, |
241 // points. | 241 IGNORE_EXCEPTION_FOR_TESTING); // ends in the middle of this |
| 242 // range, or on the boundary |
| 243 // points. |
242 } | 244 } |
243 | 245 |
244 bool Range::hasSameRoot(const Node& node) const { | 246 bool Range::hasSameRoot(const Node& node) const { |
245 if (node.document() != m_ownerDocument) | 247 if (node.document() != m_ownerDocument) |
246 return false; | 248 return false; |
247 // commonAncestorContainer() is O(depth). We should avoid to call it in common | 249 // commonAncestorContainer() is O(depth). We should avoid to call it in common |
248 // cases. | 250 // cases. |
249 if (node.isInTreeScope() && m_start.container()->isInTreeScope() && | 251 if (node.isInTreeScope() && m_start.container()->isInTreeScope() && |
250 &node.treeScope() == &m_start.container()->treeScope()) | 252 &node.treeScope() == &m_start.container()->treeScope()) |
251 return true; | 253 return true; |
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 .data() | 1714 .data() |
1713 << "start offset: " << range->startOffset() | 1715 << "start offset: " << range->startOffset() |
1714 << ", end offset: " << range->endOffset(); | 1716 << ", end offset: " << range->endOffset(); |
1715 } else { | 1717 } else { |
1716 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are " | 1718 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are " |
1717 "invalid."; | 1719 "invalid."; |
1718 } | 1720 } |
1719 } | 1721 } |
1720 | 1722 |
1721 #endif | 1723 #endif |
OLD | NEW |