| 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 r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 | 1330 |
| 1331 bool areRangesEqual(const Range* a, const Range* b) | 1331 bool areRangesEqual(const Range* a, const Range* b) |
| 1332 { | 1332 { |
| 1333 if (a == b) | 1333 if (a == b) |
| 1334 return true; | 1334 return true; |
| 1335 if (!a || !b) | 1335 if (!a || !b) |
| 1336 return false; | 1336 return false; |
| 1337 return a->startPosition() == b->startPosition() && a->endPosition() == b->en
dPosition(); | 1337 return a->startPosition() == b->startPosition() && a->endPosition() == b->en
dPosition(); |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 static inline void boundaryNodeChildrenChanged(RangeBoundaryPoint& boundary, Con
tainerNode* container) | |
| 1341 { | |
| 1342 boundary.markValid(); | |
| 1343 if (!boundary.childBefore()) | |
| 1344 return; | |
| 1345 if (boundary.container() != container) | |
| 1346 return; | |
| 1347 boundary.invalidateOffset(); | |
| 1348 } | |
| 1349 | |
| 1350 void Range::nodeChildrenChanged(ContainerNode* container) | |
| 1351 { | |
| 1352 DCHECK(container); | |
| 1353 DCHECK_EQ(container->document(), m_ownerDocument); | |
| 1354 boundaryNodeChildrenChanged(m_start, container); | |
| 1355 boundaryNodeChildrenChanged(m_end, container); | |
| 1356 } | |
| 1357 | |
| 1358 static inline void boundaryNodeChildrenWillBeRemoved(RangeBoundaryPoint& boundar
y, ContainerNode& container) | 1340 static inline void boundaryNodeChildrenWillBeRemoved(RangeBoundaryPoint& boundar
y, ContainerNode& container) |
| 1359 { | 1341 { |
| 1360 for (Node* nodeToBeRemoved = container.firstChild(); nodeToBeRemoved; nodeTo
BeRemoved = nodeToBeRemoved->nextSibling()) { | 1342 for (Node* nodeToBeRemoved = container.firstChild(); nodeToBeRemoved; nodeTo
BeRemoved = nodeToBeRemoved->nextSibling()) { |
| 1361 if (boundary.childBefore() == nodeToBeRemoved) { | 1343 if (boundary.childBefore() == nodeToBeRemoved) { |
| 1362 boundary.setToStartOfNode(container); | 1344 boundary.setToStartOfNode(container); |
| 1363 return; | 1345 return; |
| 1364 } | 1346 } |
| 1365 | 1347 |
| 1366 for (Node* n = boundary.container(); n; n = n->parentNode()) { | 1348 for (Node* n = boundary.container(); n; n = n->parentNode()) { |
| 1367 if (n == nodeToBeRemoved) { | 1349 if (n == nodeToBeRemoved) { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 { | 1592 { |
| 1611 if (range && range->boundaryPointsValid()) { | 1593 if (range && range->boundaryPointsValid()) { |
| 1612 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1594 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
| 1613 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1595 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
| 1614 } else { | 1596 } else { |
| 1615 fprintf(stderr, "Cannot show tree if range is null, or if boundary point
s are invalid.\n"); | 1597 fprintf(stderr, "Cannot show tree if range is null, or if boundary point
s are invalid.\n"); |
| 1616 } | 1598 } |
| 1617 } | 1599 } |
| 1618 | 1600 |
| 1619 #endif | 1601 #endif |
| OLD | NEW |