| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 69 ScriptWrappable::init(this); |
| 70 m_ownerDocument->attachRange(this); | 70 m_ownerDocument->attachRange(this); |
| 71 } | 71 } |
| 72 | 72 |
| 73 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument) | 73 PassRefPtrWillBeRawPtr<Range> Range::create(ExecutionContext* executionContext) |
| 74 { | 74 { |
| 75 return adoptRefWillBeNoop(new Range(ownerDocument)); | 75 return adoptRefWillBeNoop(new Range(*toDocument(executionContext))); |
| 76 } | 76 } |
| 77 | 77 |
| 78 inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
et, Node* endContainer, int endOffset) | 78 inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
et, Node* endContainer, int endOffset) |
| 79 : m_ownerDocument(&ownerDocument) | 79 : m_ownerDocument(&ownerDocument) |
| 80 , m_start(m_ownerDocument) | 80 , m_start(m_ownerDocument) |
| 81 , m_end(m_ownerDocument) | 81 , m_end(m_ownerDocument) |
| 82 { | 82 { |
| 83 #ifndef NDEBUG | 83 #ifndef NDEBUG |
| 84 rangeCounter.increment(); | 84 rangeCounter.increment(); |
| 85 #endif | 85 #endif |
| 86 | 86 |
| 87 ScriptWrappable::init(this); | 87 ScriptWrappable::init(this); |
| 88 m_ownerDocument->attachRange(this); | 88 m_ownerDocument->attachRange(this); |
| 89 | 89 |
| 90 // Simply setting the containers and offsets directly would not do any of th
e checking | 90 // 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. | 91 // that setStart and setEnd do, so we call those functions. |
| 92 setStart(startContainer, startOffset); | 92 setStart(startContainer, startOffset); |
| 93 setEnd(endContainer, endOffset); | 93 setEnd(endContainer, endOffset); |
| 94 } | 94 } |
| 95 | 95 |
| 96 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, Node* start
Container, int startOffset, Node* endContainer, int endOffset) | 96 PassRefPtrWillBeRawPtr<Range> Range::create(ExecutionContext* executionContext,
Node* startContainer, int startOffset, Node* endContainer, int endOffset) |
| 97 { | 97 { |
| 98 return adoptRefWillBeNoop(new Range(ownerDocument, startContainer, startOffs
et, endContainer, endOffset)); | 98 return adoptRefWillBeNoop(new Range(*toDocument(executionContext), startCont
ainer, startOffset, endContainer, endOffset)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, const Posit
ion& start, const Position& end) | 101 PassRefPtrWillBeRawPtr<Range> Range::create(ExecutionContext* executionContext,
const Position& start, const Position& end) |
| 102 { | 102 { |
| 103 return adoptRefWillBeNoop(new Range(ownerDocument, start.containerNode(), st
art.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInCont
ainerNode())); | 103 return adoptRefWillBeNoop(new Range(*toDocument(executionContext), start.con
tainerNode(), start.computeOffsetInContainerNode(), end.containerNode(), end.com
puteOffsetInContainerNode())); |
| 104 } | 104 } |
| 105 | 105 |
| 106 Range::~Range() | 106 Range::~Range() |
| 107 { | 107 { |
| 108 #if !ENABLE(OILPAN) | 108 #if !ENABLE(OILPAN) |
| 109 // Always detach (even if we've already detached) to fix https://bugs.webkit
.org/show_bug.cgi?id=26044 | 109 // Always detach (even if we've already detached) to fix https://bugs.webkit
.org/show_bug.cgi?id=26044 |
| 110 m_ownerDocument->detachRange(this); | 110 m_ownerDocument->detachRange(this); |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 #ifndef NDEBUG | 113 #ifndef NDEBUG |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 | 1671 |
| 1672 void showTree(const WebCore::Range* range) | 1672 void showTree(const WebCore::Range* range) |
| 1673 { | 1673 { |
| 1674 if (range && range->boundaryPointsValid()) { | 1674 if (range && range->boundaryPointsValid()) { |
| 1675 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1675 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
| 1676 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1676 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
| 1677 } | 1677 } |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 #endif | 1680 #endif |
| OLD | NEW |