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

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

Issue 1872303002: Simplify slot assignments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 bool Node::canParticipateInFlatTree() const 988 bool Node::canParticipateInFlatTree() const
989 { 989 {
990 return !isShadowRoot() && !isSlotOrActiveInsertionPoint(); 990 return !isShadowRoot() && !isSlotOrActiveInsertionPoint();
991 } 991 }
992 992
993 bool Node::isSlotOrActiveInsertionPoint() const 993 bool Node::isSlotOrActiveInsertionPoint() const
994 { 994 {
995 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this); 995 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this);
996 } 996 }
997 997
998 bool Node::slottable() const
999 {
1000 return isElementNode() || isTextNode();
kochi 2016/04/11 10:57:54 How about making this inline (defining in .h file)
hayato 2016/04/12 04:06:52 Done
1001 }
1002
1003 AtomicString Node::slotName() const
1004 {
1005 DCHECK(slottable());
1006 if (isElementNode())
1007 return normalizeSlotName(toElement(*this).fastGetAttribute(HTMLNames::sl otAttr));
1008 DCHECK(isTextNode());
1009 return emptyAtom;
1010 }
1011
1012 // static
1013 AtomicString Node::normalizeSlotName(const AtomicString& name)
1014 {
1015 return (name.isNull() || name.isEmpty()) ? emptyAtom : name;
1016 }
1017
998 bool Node::isInV1ShadowTree() const 1018 bool Node::isInV1ShadowTree() const
999 { 1019 {
1000 ShadowRoot* shadowRoot = containingShadowRoot(); 1020 ShadowRoot* shadowRoot = containingShadowRoot();
1001 return shadowRoot && shadowRoot->isV1(); 1021 return shadowRoot && shadowRoot->isV1();
1002 } 1022 }
1003 1023
1004 bool Node::isInV0ShadowTree() const 1024 bool Node::isInV0ShadowTree() const
1005 { 1025 {
1006 ShadowRoot* shadowRoot = containingShadowRoot(); 1026 ShadowRoot* shadowRoot = containingShadowRoot();
1007 return shadowRoot && !shadowRoot->isV1(); 1027 return shadowRoot && !shadowRoot->isV1();
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 2482
2463 void showNodePath(const blink::Node* node) 2483 void showNodePath(const blink::Node* node)
2464 { 2484 {
2465 if (node) 2485 if (node)
2466 node->showNodePathForThis(); 2486 node->showNodePathForThis();
2467 else 2487 else
2468 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2488 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2469 } 2489 }
2470 2490
2471 #endif 2491 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698