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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 } | 1612 } |
1613 | 1613 |
1614 PassRefPtrWillBeRawPtr<Range> rangeOfContents(Node* node) | 1614 PassRefPtrWillBeRawPtr<Range> rangeOfContents(Node* node) |
1615 { | 1615 { |
1616 ASSERT(node); | 1616 ASSERT(node); |
1617 RefPtrWillBeRawPtr<Range> range = Range::create(node->document()); | 1617 RefPtrWillBeRawPtr<Range> range = Range::create(node->document()); |
1618 range->selectNodeContents(node, IGNORE_EXCEPTION); | 1618 range->selectNodeContents(node, IGNORE_EXCEPTION); |
1619 return range.release(); | 1619 return range.release(); |
1620 } | 1620 } |
1621 | 1621 |
1622 int Range::maxStartOffset() const | |
1623 { | |
1624 if (!m_start.container()) | |
1625 return 0; | |
1626 if (!m_start.container()->offsetInCharacters()) | |
1627 return m_start.container()->countChildren(); | |
1628 return m_start.container()->maxCharacterOffset(); | |
1629 } | |
1630 | |
1631 int Range::maxEndOffset() const | |
1632 { | |
1633 if (!m_end.container()) | |
1634 return 0; | |
1635 if (!m_end.container()->offsetInCharacters()) | |
1636 return m_end.container()->countChildren(); | |
1637 return m_end.container()->maxCharacterOffset(); | |
1638 } | |
1639 | |
1640 static inline void boundaryNodeChildrenChanged(RangeBoundaryPoint& boundary, Con
tainerNode* container) | 1622 static inline void boundaryNodeChildrenChanged(RangeBoundaryPoint& boundary, Con
tainerNode* container) |
1641 { | 1623 { |
1642 if (!boundary.childBefore()) | 1624 if (!boundary.childBefore()) |
1643 return; | 1625 return; |
1644 if (boundary.container() != container) | 1626 if (boundary.container() != container) |
1645 return; | 1627 return; |
1646 boundary.invalidateOffset(); | 1628 boundary.invalidateOffset(); |
1647 } | 1629 } |
1648 | 1630 |
1649 void Range::nodeChildrenChanged(ContainerNode* container) | 1631 void Range::nodeChildrenChanged(ContainerNode* container) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 | 1876 |
1895 void showTree(const WebCore::Range* range) | 1877 void showTree(const WebCore::Range* range) |
1896 { | 1878 { |
1897 if (range && range->boundaryPointsValid()) { | 1879 if (range && range->boundaryPointsValid()) { |
1898 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1880 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1899 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1881 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1900 } | 1882 } |
1901 } | 1883 } |
1902 | 1884 |
1903 #endif | 1885 #endif |
OLD | NEW |