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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return adoptRefWillBeNoop(new Range(ownerDocument, startContainer, startOffs
et, endContainer, endOffset)); | 99 return adoptRefWillBeNoop(new Range(ownerDocument, startContainer, startOffs
et, endContainer, endOffset)); |
100 } | 100 } |
101 | 101 |
102 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, const Posit
ion& start, const Position& end) | 102 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, const Posit
ion& start, const Position& end) |
103 { | 103 { |
104 return adoptRefWillBeNoop(new Range(ownerDocument, start.containerNode(), st
art.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInCont
ainerNode())); | 104 return adoptRefWillBeNoop(new Range(ownerDocument, start.containerNode(), st
art.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInCont
ainerNode())); |
105 } | 105 } |
106 | 106 |
107 Range::~Range() | 107 Range::~Range() |
108 { | 108 { |
| 109 #if !ENABLE(OILPAN) |
109 // Always detach (even if we've already detached) to fix https://bugs.webkit
.org/show_bug.cgi?id=26044 | 110 // Always detach (even if we've already detached) to fix https://bugs.webkit
.org/show_bug.cgi?id=26044 |
110 m_ownerDocument->detachRange(this); | 111 m_ownerDocument->detachRange(this); |
| 112 #endif |
111 | 113 |
112 #ifndef NDEBUG | 114 #ifndef NDEBUG |
113 rangeCounter.decrement(); | 115 rangeCounter.decrement(); |
114 #endif | 116 #endif |
115 } | 117 } |
116 | 118 |
117 void Range::setDocument(Document& document) | 119 void Range::setDocument(Document& document) |
118 { | 120 { |
119 ASSERT(m_ownerDocument != document); | 121 ASSERT(m_ownerDocument != document); |
120 ASSERT(m_ownerDocument); | 122 ASSERT(m_ownerDocument); |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 if (n == nodeToBeRemoved) { | 1491 if (n == nodeToBeRemoved) { |
1490 boundary.setToBeforeChild(nodeToBeRemoved); | 1492 boundary.setToBeforeChild(nodeToBeRemoved); |
1491 return; | 1493 return; |
1492 } | 1494 } |
1493 } | 1495 } |
1494 } | 1496 } |
1495 | 1497 |
1496 void Range::nodeWillBeRemoved(Node& node) | 1498 void Range::nodeWillBeRemoved(Node& node) |
1497 { | 1499 { |
1498 ASSERT(node.document() == m_ownerDocument); | 1500 ASSERT(node.document() == m_ownerDocument); |
1499 ASSERT(node != m_ownerDocument); | 1501 ASSERT(node != m_ownerDocument.get()); |
1500 | 1502 |
1501 // FIXME: Once DOMNodeRemovedFromDocument mutation event removed, we | 1503 // FIXME: Once DOMNodeRemovedFromDocument mutation event removed, we |
1502 // should change following if-statement to ASSERT(!node->parentNode). | 1504 // should change following if-statement to ASSERT(!node->parentNode). |
1503 if (!node.parentNode()) | 1505 if (!node.parentNode()) |
1504 return; | 1506 return; |
1505 boundaryNodeWillBeRemoved(m_start, node); | 1507 boundaryNodeWillBeRemoved(m_start, node); |
1506 boundaryNodeWillBeRemoved(m_end, node); | 1508 boundaryNodeWillBeRemoved(m_end, node); |
1507 } | 1509 } |
1508 | 1510 |
1509 static inline void boundaryTextInserted(RangeBoundaryPoint& boundary, Node* text
, unsigned offset, unsigned length) | 1511 static inline void boundaryTextInserted(RangeBoundaryPoint& boundary, Node* text
, unsigned offset, unsigned length) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 if (quads.isEmpty()) | 1673 if (quads.isEmpty()) |
1672 return FloatRect(); | 1674 return FloatRect(); |
1673 | 1675 |
1674 FloatRect result; | 1676 FloatRect result; |
1675 for (size_t i = 0; i < quads.size(); ++i) | 1677 for (size_t i = 0; i < quads.size(); ++i) |
1676 result.unite(quads[i].boundingBox()); | 1678 result.unite(quads[i].boundingBox()); |
1677 | 1679 |
1678 return result; | 1680 return result; |
1679 } | 1681 } |
1680 | 1682 |
1681 void Range::trace(Visitor*) | 1683 void Range::trace(Visitor* visitor) |
1682 { | 1684 { |
| 1685 visitor->trace(m_ownerDocument); |
1683 } | 1686 } |
1684 | 1687 |
1685 } // namespace WebCore | 1688 } // namespace WebCore |
1686 | 1689 |
1687 #ifndef NDEBUG | 1690 #ifndef NDEBUG |
1688 | 1691 |
1689 void showTree(const WebCore::Range* range) | 1692 void showTree(const WebCore::Range* range) |
1690 { | 1693 { |
1691 if (range && range->boundaryPointsValid()) { | 1694 if (range && range->boundaryPointsValid()) { |
1692 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1695 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1693 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1696 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1694 } | 1697 } |
1695 } | 1698 } |
1696 | 1699 |
1697 #endif | 1700 #endif |
OLD | NEW |