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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 inline Range::Range(Document& ownerDocument) | 60 inline Range::Range(Document& ownerDocument) |
61 : m_ownerDocument(&ownerDocument) | 61 : m_ownerDocument(&ownerDocument) |
62 , m_start(m_ownerDocument) | 62 , m_start(m_ownerDocument) |
63 , m_end(m_ownerDocument) | 63 , m_end(m_ownerDocument) |
64 { | 64 { |
65 #ifndef NDEBUG | 65 #ifndef NDEBUG |
66 rangeCounter.increment(); | 66 rangeCounter.increment(); |
67 #endif | 67 #endif |
68 | 68 |
69 ScriptWrappable::init(this); | |
70 m_ownerDocument->attachRange(this); | 69 m_ownerDocument->attachRange(this); |
71 } | 70 } |
72 | 71 |
73 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument) | 72 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument) |
74 { | 73 { |
75 return adoptRefWillBeNoop(new Range(ownerDocument)); | 74 return adoptRefWillBeNoop(new Range(ownerDocument)); |
76 } | 75 } |
77 | 76 |
78 inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
et, Node* endContainer, int endOffset) | 77 inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
et, Node* endContainer, int endOffset) |
79 : m_ownerDocument(&ownerDocument) | 78 : m_ownerDocument(&ownerDocument) |
80 , m_start(m_ownerDocument) | 79 , m_start(m_ownerDocument) |
81 , m_end(m_ownerDocument) | 80 , m_end(m_ownerDocument) |
82 { | 81 { |
83 #ifndef NDEBUG | 82 #ifndef NDEBUG |
84 rangeCounter.increment(); | 83 rangeCounter.increment(); |
85 #endif | 84 #endif |
86 | 85 |
87 ScriptWrappable::init(this); | |
88 m_ownerDocument->attachRange(this); | 86 m_ownerDocument->attachRange(this); |
89 | 87 |
90 // Simply setting the containers and offsets directly would not do any of th
e checking | 88 // Simply setting the containers and offsets directly would not do any of th
e checking |
91 // that setStart and setEnd do, so we call those functions. | 89 // that setStart and setEnd do, so we call those functions. |
92 setStart(startContainer, startOffset); | 90 setStart(startContainer, startOffset); |
93 setEnd(endContainer, endOffset); | 91 setEnd(endContainer, endOffset); |
94 } | 92 } |
95 | 93 |
96 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) |
97 { | 95 { |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 | 1706 |
1709 void showTree(const blink::Range* range) | 1707 void showTree(const blink::Range* range) |
1710 { | 1708 { |
1711 if (range && range->boundaryPointsValid()) { | 1709 if (range && range->boundaryPointsValid()) { |
1712 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1710 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1713 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1711 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1714 } | 1712 } |
1715 } | 1713 } |
1716 | 1714 |
1717 #endif | 1715 #endif |
OLD | NEW |