OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // https://discourse.wicg.io/t/proposal-staticrange-to-be-used-instead-of-range-
for-new-apis/1472 | 5 // https://discourse.wicg.io/t/proposal-staticrange-to-be-used-instead-of-range-
for-new-apis/1472 |
6 | 6 |
7 #include "core/dom/StaticRange.h" | 7 #include "core/dom/StaticRange.h" |
8 | 8 |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
11 #include "core/dom/Range.h" | 11 #include "core/dom/Range.h" |
12 #include "core/frame/LocalDOMWindow.h" | 12 #include "core/frame/LocalDOMWindow.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 StaticRange::StaticRange(Document& document) | 16 StaticRange::StaticRange(Document& document) |
17 : m_ownerDocument(document), | 17 : m_ownerDocument(document), |
18 m_startContainer(nullptr), | 18 m_startContainer(document), |
19 m_startOffset(0), | 19 m_startOffset(0), |
20 m_endContainer(nullptr), | 20 m_endContainer(document), |
21 m_endOffset(0) {} | 21 m_endOffset(0) {} |
22 | 22 |
23 StaticRange::StaticRange(Document& document, | 23 StaticRange::StaticRange(Document& document, |
24 Node* startContainer, | 24 Node* startContainer, |
25 int startOffset, | 25 int startOffset, |
26 Node* endContainer, | 26 Node* endContainer, |
27 int endOffset) | 27 int endOffset) |
28 : m_ownerDocument(document), | 28 : m_ownerDocument(document), |
29 m_startContainer(startContainer), | 29 m_startContainer(startContainer), |
30 m_startOffset(startOffset), | 30 m_startOffset(startOffset), |
(...skipping 18 matching lines...) Expand all Loading... |
49 return range; | 49 return range; |
50 } | 50 } |
51 | 51 |
52 DEFINE_TRACE(StaticRange) { | 52 DEFINE_TRACE(StaticRange) { |
53 visitor->trace(m_ownerDocument); | 53 visitor->trace(m_ownerDocument); |
54 visitor->trace(m_startContainer); | 54 visitor->trace(m_startContainer); |
55 visitor->trace(m_endContainer); | 55 visitor->trace(m_endContainer); |
56 } | 56 } |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
OLD | NEW |