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

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

Issue 178333005: Avoid calling Node::numberOfScopedHTMLStyleChildren() to check for existence (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | « no previous file | Source/core/dom/StyleSheetScopingNodeList.cpp » ('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 * 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 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 } 2458 }
2459 2459
2460 void Node::registerScopedHTMLStyleChild() 2460 void Node::registerScopedHTMLStyleChild()
2461 { 2461 {
2462 setHasScopedHTMLStyleChild(true); 2462 setHasScopedHTMLStyleChild(true);
2463 } 2463 }
2464 2464
2465 void Node::unregisterScopedHTMLStyleChild() 2465 void Node::unregisterScopedHTMLStyleChild()
2466 { 2466 {
2467 ASSERT(hasScopedHTMLStyleChild()); 2467 ASSERT(hasScopedHTMLStyleChild());
2468 setHasScopedHTMLStyleChild(numberOfScopedHTMLStyleChildren()); 2468 for (Element* child = ElementTraversal::firstWithin(*this); child; child = E lementTraversal::nextSibling(*child)) {
2469 if (child->hasTagName(HTMLNames::styleTag) && toHTMLStyleElement(child)- >isRegisteredAsScoped())
2470 return;
2471 }
2472 setHasScopedHTMLStyleChild(false);
2469 } 2473 }
2470 2474
2471 size_t Node::numberOfScopedHTMLStyleChildren() const 2475 size_t Node::numberOfScopedHTMLStyleChildren() const
2472 { 2476 {
2473 size_t count = 0; 2477 size_t count = 0;
2474 for (Element* child = ElementTraversal::firstWithin(*this); child; child = E lementTraversal::nextSibling(*child)) { 2478 for (Element* child = ElementTraversal::firstWithin(*this); child; child = E lementTraversal::nextSibling(*child)) {
2475 if (child->hasTagName(HTMLNames::styleTag) && toHTMLStyleElement(child)- >isRegisteredAsScoped()) 2479 if (child->hasTagName(HTMLNames::styleTag) && toHTMLStyleElement(child)- >isRegisteredAsScoped())
2476 ++count; 2480 ++count;
2477 } 2481 }
2478 2482
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 node->showTreeForThis(); 2558 node->showTreeForThis();
2555 } 2559 }
2556 2560
2557 void showNodePath(const WebCore::Node* node) 2561 void showNodePath(const WebCore::Node* node)
2558 { 2562 {
2559 if (node) 2563 if (node)
2560 node->showNodePathForThis(); 2564 node->showNodePathForThis();
2561 } 2565 }
2562 2566
2563 #endif 2567 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/StyleSheetScopingNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698