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

Side by Side Diff: Source/core/dom/Range.cpp

Issue 14904005: Make Range constructable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update expectations Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Range.h ('k') | Source/core/dom/Range.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, PassRefPtr<N ode> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffs et) 98 PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, PassRefPtr<N ode> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffs et)
99 { 99 {
100 return adoptRef(new Range(ownerDocument, startContainer, startOffset, endCon tainer, endOffset)); 100 return adoptRef(new Range(ownerDocument, startContainer, startOffset, endCon tainer, endOffset));
101 } 101 }
102 102
103 PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, const Positi on& start, const Position& end) 103 PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, const Positi on& start, const Position& end)
104 { 104 {
105 return adoptRef(new Range(ownerDocument, start.containerNode(), start.comput eOffsetInContainerNode(), end.containerNode(), end.computeOffsetInContainerNode( ))); 105 return adoptRef(new Range(ownerDocument, start.containerNode(), start.comput eOffsetInContainerNode(), end.containerNode(), end.computeOffsetInContainerNode( )));
106 } 106 }
107 107
108 PassRefPtr<Range> Range::create(ScriptExecutionContext* context)
109 {
110 return adoptRef(new Range(toDocument(context)));
111 }
112
108 Range::~Range() 113 Range::~Range()
109 { 114 {
110 // Always detach (even if we've already detached) to fix https://bugs.webkit .org/show_bug.cgi?id=26044 115 // Always detach (even if we've already detached) to fix https://bugs.webkit .org/show_bug.cgi?id=26044
111 m_ownerDocument->detachRange(this); 116 m_ownerDocument->detachRange(this);
112 117
113 #ifndef NDEBUG 118 #ifndef NDEBUG
114 rangeCounter.decrement(); 119 rangeCounter.decrement();
115 #endif 120 #endif
116 } 121 }
117 122
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 1972
1968 void showTree(const WebCore::Range* range) 1973 void showTree(const WebCore::Range* range)
1969 { 1974 {
1970 if (range && range->boundaryPointsValid()) { 1975 if (range && range->boundaryPointsValid()) {
1971 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1976 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1972 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1977 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1973 } 1978 }
1974 } 1979 }
1975 1980
1976 #endif 1981 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Range.h ('k') | Source/core/dom/Range.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698