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

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

Issue 2476163002: Fixed perf regression by removing tree traversal for text sibling. (Closed)
Patch Set: Created 4 years, 1 month 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 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 while (node->parentNode()) 383 while (node->parentNode())
384 node = node->parentNode(); 384 node = node->parentNode();
385 return const_cast<Node&>(*node); 385 return const_cast<Node&>(*node);
386 } 386 }
387 387
388 Node* Node::getRootNode(const GetRootNodeOptions& options) const { 388 Node* Node::getRootNode(const GetRootNodeOptions& options) const {
389 return (options.hasComposed() && options.composed()) ? &shadowIncludingRoot() 389 return (options.hasComposed() && options.composed()) ? &shadowIncludingRoot()
390 : &treeRoot(); 390 : &treeRoot();
391 } 391 }
392 392
393 Text* Node::nextTextSibling() const {
394 for (Node* sibling = nextSibling();
395 sibling &&
396 (!sibling->isElementNode() || !toElement(sibling)->layoutObject());
397 sibling = sibling->nextSibling()) {
398 if (sibling->isTextNode()) {
399 return toText(sibling);
400 }
401 }
402 return nullptr;
403 }
404
405 Node* Node::insertBefore(Node* newChild, 393 Node* Node::insertBefore(Node* newChild,
406 Node* refChild, 394 Node* refChild,
407 ExceptionState& exceptionState) { 395 ExceptionState& exceptionState) {
408 if (isContainerNode()) 396 if (isContainerNode())
409 return toContainerNode(this)->insertBefore(newChild, refChild, 397 return toContainerNode(this)->insertBefore(newChild, refChild,
410 exceptionState); 398 exceptionState);
411 399
412 exceptionState.throwDOMException( 400 exceptionState.throwDOMException(
413 HierarchyRequestError, "This node type does not support this method."); 401 HierarchyRequestError, "This node type does not support this method.");
414 return nullptr; 402 return nullptr;
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 if (node) { 2475 if (node) {
2488 std::stringstream stream; 2476 std::stringstream stream;
2489 node->printNodePathTo(stream); 2477 node->printNodePathTo(stream);
2490 LOG(INFO) << stream.str(); 2478 LOG(INFO) << stream.str();
2491 } else { 2479 } else {
2492 LOG(INFO) << "Cannot showNodePath for <null>"; 2480 LOG(INFO) << "Cannot showNodePath for <null>";
2493 } 2481 }
2494 } 2482 }
2495 2483
2496 #endif 2484 #endif
OLDNEW
« third_party/WebKit/Source/core/dom/Document.h ('K') | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698