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

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

Issue 23467007: Have Range constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 return 0; 1217 return 0;
1218 LayoutPoint localPoint; 1218 LayoutPoint localPoint;
1219 Node* node = nodeFromPoint(this, x, y, &localPoint); 1219 Node* node = nodeFromPoint(this, x, y, &localPoint);
1220 if (!node) 1220 if (!node)
1221 return 0; 1221 return 0;
1222 1222
1223 Node* shadowAncestorNode = ancestorInThisScope(node); 1223 Node* shadowAncestorNode = ancestorInThisScope(node);
1224 if (shadowAncestorNode != node) { 1224 if (shadowAncestorNode != node) {
1225 unsigned offset = shadowAncestorNode->nodeIndex(); 1225 unsigned offset = shadowAncestorNode->nodeIndex();
1226 ContainerNode* container = shadowAncestorNode->parentNode(); 1226 ContainerNode* container = shadowAncestorNode->parentNode();
1227 return Range::create(this, container, offset, container, offset); 1227 return Range::create(*this, container, offset, container, offset);
1228 } 1228 }
1229 1229
1230 RenderObject* renderer = node->renderer(); 1230 RenderObject* renderer = node->renderer();
1231 if (!renderer) 1231 if (!renderer)
1232 return 0; 1232 return 0;
1233 PositionWithAffinity positionWithAffinity = renderer->positionForPoint(local Point); 1233 PositionWithAffinity positionWithAffinity = renderer->positionForPoint(local Point);
1234 if (positionWithAffinity.position().isNull()) 1234 if (positionWithAffinity.position().isNull())
1235 return 0; 1235 return 0;
1236 1236
1237 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch oredEquivalent(); 1237 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch oredEquivalent();
1238 return Range::create(this, rangeCompliantPosition, rangeCompliantPosition); 1238 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition);
1239 } 1239 }
1240 1240
1241 /* 1241 /*
1242 * Performs three operations: 1242 * Performs three operations:
1243 * 1. Convert control characters to spaces 1243 * 1. Convert control characters to spaces
1244 * 2. Trim leading and trailing spaces 1244 * 2. Trim leading and trailing spaces
1245 * 3. Collapse internal whitespace. 1245 * 3. Collapse internal whitespace.
1246 */ 1246 */
1247 template <typename CharacterType> 1247 template <typename CharacterType>
1248 static inline String canonicalizedTitle(Document* document, const String& title) 1248 static inline String canonicalizedTitle(Document* document, const String& title)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 return m_frame ? m_frame->page() : 0; 1450 return m_frame ? m_frame->page() : 0;
1451 } 1451 }
1452 1452
1453 Settings* Document::settings() const 1453 Settings* Document::settings() const
1454 { 1454 {
1455 return m_frame ? m_frame->settings() : 0; 1455 return m_frame ? m_frame->settings() : 0;
1456 } 1456 }
1457 1457
1458 PassRefPtr<Range> Document::createRange() 1458 PassRefPtr<Range> Document::createRange()
1459 { 1459 {
1460 return Range::create(this); 1460 return Range::create(*this);
1461 } 1461 }
1462 1462
1463 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState & es) 1463 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState & es)
1464 { 1464 {
1465 // FIXME: Probably this should be handled within the bindings layer and Type Error should be thrown. 1465 // FIXME: Probably this should be handled within the bindings layer and Type Error should be thrown.
1466 if (!root) { 1466 if (!root) {
1467 es.throwDOMException(NotSupportedError); 1467 es.throwDOMException(NotSupportedError);
1468 return 0; 1468 return 0;
1469 } 1469 }
1470 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte r>()); 1470 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte r>());
(...skipping 3850 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 { 5321 {
5322 return DocumentLifecycleNotifier::create(this); 5322 return DocumentLifecycleNotifier::create(this);
5323 } 5323 }
5324 5324
5325 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5325 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5326 { 5326 {
5327 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5327 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5328 } 5328 }
5329 5329
5330 } // namespace WebCore 5330 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698