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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1883083002: Introduce Node::containingTreeScope(), which asserts that the node's root is a tree scope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 /* 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 last = currentElement->pseudoElement(PseudoIdBefore); 366 last = currentElement->pseudoElement(PseudoIdBefore);
367 return last; 367 return last;
368 } 368 }
369 369
370 return lastChild(); 370 return lastChild();
371 } 371 }
372 372
373 Node& Node::treeRoot() const 373 Node& Node::treeRoot() const
374 { 374 {
375 if (isInTreeScope()) 375 if (isInTreeScope())
376 return treeScope().rootNode(); 376 return rootTreeScope().rootNode();
377 const Node* node = this; 377 const Node* node = this;
378 while (node->parentNode()) 378 while (node->parentNode())
379 node = node->parentNode(); 379 node = node->parentNode();
380 return const_cast<Node&>(*node); 380 return const_cast<Node&>(*node);
381 } 381 }
382 382
383 Node* Node::insertBefore(Node* newChild, Node* refChild, ExceptionState& excepti onState) 383 Node* Node::insertBefore(Node* newChild, Node* refChild, ExceptionState& excepti onState)
384 { 384 {
385 if (isContainerNode()) 385 if (isContainerNode())
386 return toContainerNode(this)->insertBefore(newChild, refChild, exception State); 386 return toContainerNode(this)->insertBefore(newChild, refChild, exception State);
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 2326
2327 void showNodePath(const blink::Node* node) 2327 void showNodePath(const blink::Node* node)
2328 { 2328 {
2329 if (node) 2329 if (node)
2330 node->showNodePathForThis(); 2330 node->showNodePathForThis();
2331 else 2331 else
2332 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2332 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2333 } 2333 }
2334 2334
2335 #endif 2335 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698