Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: third_party/WebKit/Source/core/editing/EphemeralRange.cpp

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "core/editing/EphemeralRange.h" 5 #include "core/editing/EphemeralRange.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/dom/Range.h" 9 #include "core/dom/Range.h"
10 #include "core/dom/Text.h" 10 #include "core/dom/Text.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 template <typename Strategy> 14 template <typename Strategy>
15 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const PositionTemplate< Strategy>& start, const PositionTemplate<Strategy>& end) 15 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const PositionTemplate< Strategy>& start, const PositionTemplate<Strategy>& end)
16 : m_startPosition(start) 16 : m_startPosition(start)
17 , m_endPosition(end) 17 , m_endPosition(end)
18 #if ENABLE(ASSERT) 18 #if ENABLE(ASSERT)
19 , m_domTreeVersion(start.isNull() ? 0 : start.document()->domTreeVersion()) 19 , m_domTreeVersion(start.isNull() ? 0 : start.document()->domTreeVersion())
20 #endif 20 #endif
21 { 21 {
22 if (m_startPosition.isNull()) { 22 if (m_startPosition.isNull()) {
23 ASSERT(m_endPosition.isNull()); 23 ASSERT(m_endPosition.isNull());
24 return; 24 return;
25 } 25 }
26 ASSERT(m_endPosition.isNotNull()); 26 ASSERT(m_endPosition.isNotNull());
27 ASSERT(m_startPosition.document() == m_endPosition.document()); 27 ASSERT(m_startPosition.document() == m_endPosition.document());
28 ASSERT(m_startPosition.inDocument()); 28 ASSERT(m_startPosition.inShadowIncludingDocument());
29 ASSERT(m_endPosition.inDocument()); 29 ASSERT(m_endPosition.inShadowIncludingDocument());
30 } 30 }
31 31
32 template <typename Strategy> 32 template <typename Strategy>
33 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const EphemeralRangeTem plate<Strategy>& other) 33 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const EphemeralRangeTem plate<Strategy>& other)
34 : EphemeralRangeTemplate(other.m_startPosition, other.m_endPosition) 34 : EphemeralRangeTemplate(other.m_startPosition, other.m_endPosition)
35 { 35 {
36 ASSERT(other.isValid()); 36 ASSERT(other.isValid());
37 } 37 }
38 38
39 template <typename Strategy> 39 template <typename Strategy>
40 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const PositionTemplate< Strategy>& position) 40 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const PositionTemplate< Strategy>& position)
41 : EphemeralRangeTemplate(position, position) 41 : EphemeralRangeTemplate(position, position)
42 { 42 {
43 } 43 }
44 44
45 template <typename Strategy> 45 template <typename Strategy>
46 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const Range* range) 46 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate(const Range* range)
47 { 47 {
48 if (!range) 48 if (!range)
49 return; 49 return;
50 ASSERT(range->inDocument()); 50 ASSERT(range->inShadowIncludingDocument());
51 m_startPosition = fromPositionInDOMTree<Strategy>(range->startPosition()); 51 m_startPosition = fromPositionInDOMTree<Strategy>(range->startPosition());
52 m_endPosition = fromPositionInDOMTree<Strategy>(range->endPosition()); 52 m_endPosition = fromPositionInDOMTree<Strategy>(range->endPosition());
53 #if ENABLE(ASSERT) 53 #if ENABLE(ASSERT)
54 m_domTreeVersion = range->ownerDocument().domTreeVersion(); 54 m_domTreeVersion = range->ownerDocument().domTreeVersion();
55 #endif 55 #endif
56 } 56 }
57 57
58 template <typename Strategy> 58 template <typename Strategy>
59 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate() 59 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate()
60 { 60 {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 { 141 {
142 if (range.isNull()) 142 if (range.isNull())
143 return nullptr; 143 return nullptr;
144 return Range::create(range.document(), range.startPosition(), range.endPosit ion()); 144 return Range::create(range.document(), range.startPosition(), range.endPosit ion());
145 } 145 }
146 146
147 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>; 147 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>;
148 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingInFlatTreeStra tegy>; 148 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingInFlatTreeStra tegy>;
149 149
150 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/DOMSelection.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698