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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, Node* start
Container, int startOffset, Node* endContainer, int endOffset) | 94 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, Node* start
Container, int startOffset, Node* endContainer, int endOffset) |
95 { | 95 { |
96 return adoptRefWillBeNoop(new Range(ownerDocument, startContainer, startOffs
et, endContainer, endOffset)); | 96 return adoptRefWillBeNoop(new Range(ownerDocument, startContainer, startOffs
et, endContainer, endOffset)); |
97 } | 97 } |
98 | 98 |
99 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, const Posit
ion& start, const Position& end) | 99 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, const Posit
ion& start, const Position& end) |
100 { | 100 { |
101 return adoptRefWillBeNoop(new Range(ownerDocument, start.containerNode(), st
art.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInCont
ainerNode())); | 101 return adoptRefWillBeNoop(new Range(ownerDocument, start.containerNode(), st
art.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInCont
ainerNode())); |
102 } | 102 } |
103 | 103 |
| 104 #if !ENABLE(OILPAN) || !defined(NDEBUG) |
104 Range::~Range() | 105 Range::~Range() |
105 { | 106 { |
106 #if !ENABLE(OILPAN) | 107 #if !ENABLE(OILPAN) |
107 // Always detach (even if we've already detached) to fix https://bugs.webkit
.org/show_bug.cgi?id=26044 | 108 // Always detach (even if we've already detached) to fix https://bugs.webkit
.org/show_bug.cgi?id=26044 |
108 m_ownerDocument->detachRange(this); | 109 m_ownerDocument->detachRange(this); |
109 #endif | 110 #endif |
110 | 111 |
111 #ifndef NDEBUG | 112 #ifndef NDEBUG |
112 rangeCounter.decrement(); | 113 rangeCounter.decrement(); |
113 #endif | 114 #endif |
114 } | 115 } |
| 116 #endif |
115 | 117 |
116 void Range::setDocument(Document& document) | 118 void Range::setDocument(Document& document) |
117 { | 119 { |
118 ASSERT(m_ownerDocument != document); | 120 ASSERT(m_ownerDocument != document); |
119 ASSERT(m_ownerDocument); | 121 ASSERT(m_ownerDocument); |
120 m_ownerDocument->detachRange(this); | 122 m_ownerDocument->detachRange(this); |
121 m_ownerDocument = &document; | 123 m_ownerDocument = &document; |
122 m_start.setToStartOfNode(document); | 124 m_start.setToStartOfNode(document); |
123 m_end.setToStartOfNode(document); | 125 m_end.setToStartOfNode(document); |
124 m_ownerDocument->attachRange(this); | 126 m_ownerDocument->attachRange(this); |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 | 1781 |
1780 void showTree(const blink::Range* range) | 1782 void showTree(const blink::Range* range) |
1781 { | 1783 { |
1782 if (range && range->boundaryPointsValid()) { | 1784 if (range && range->boundaryPointsValid()) { |
1783 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1785 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1784 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1786 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1785 } | 1787 } |
1786 } | 1788 } |
1787 | 1789 |
1788 #endif | 1790 #endif |
OLD | NEW |