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

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

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 11 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 bool Node::canParticipateInComposedTree() const 961 bool Node::canParticipateInComposedTree() const
962 { 962 {
963 return !isShadowRoot() && !isSlotOrActiveInsertionPoint(); 963 return !isShadowRoot() && !isSlotOrActiveInsertionPoint();
964 } 964 }
965 965
966 bool Node::isSlotOrActiveInsertionPoint() const 966 bool Node::isSlotOrActiveInsertionPoint() const
967 { 967 {
968 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this); 968 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this);
969 } 969 }
970 970
971 bool Node::isInV1ShadowTree() const
972 {
973 ShadowRoot* shadowRoot = containingShadowRoot();
974 return shadowRoot && shadowRoot->isV1();
975 }
976
977 bool Node::isInV0ShadowTree() const
978 {
979 ShadowRoot* shadowRoot = containingShadowRoot();
980 return shadowRoot && !shadowRoot->isV1();
981 }
982
983 static ElementShadow* parentElementShadow(const Node& node)
984 {
985 Element* parent = node.parentElement();
986 if (!parent)
987 return nullptr;
988 return parent->shadow();
989 }
990
991 bool Node::isChildOfV1ShadowHost() const
992 {
993 ElementShadow* parentShadow = parentElementShadow(*this);
994 return parentShadow && parentShadow->isV1();
995 }
996
997 bool Node::isChildOfV0ShadowHost() const
998 {
999 ElementShadow* parentShadow = parentElementShadow(*this);
1000 return parentShadow && !parentShadow->isV1();
1001 }
1002
971 Element* Node::shadowHost() const 1003 Element* Node::shadowHost() const
972 { 1004 {
973 if (ShadowRoot* root = containingShadowRoot()) 1005 if (ShadowRoot* root = containingShadowRoot())
974 return root->host(); 1006 return root->host();
975 return nullptr; 1007 return nullptr;
976 } 1008 }
977 1009
978 ShadowRoot* Node::containingShadowRoot() const 1010 ShadowRoot* Node::containingShadowRoot() const
979 { 1011 {
980 Node& root = treeScope().rootNode(); 1012 Node& root = treeScope().rootNode();
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 if (!insertionPoint->containingShadowRoot()->isOpen()) 2236 if (!insertionPoint->containingShadowRoot()->isOpen())
2205 break; 2237 break;
2206 filteredInsertionPoints.append(insertionPoint); 2238 filteredInsertionPoints.append(insertionPoint);
2207 } 2239 }
2208 return StaticNodeList::adopt(filteredInsertionPoints); 2240 return StaticNodeList::adopt(filteredInsertionPoints);
2209 } 2241 }
2210 2242
2211 HTMLSlotElement* Node::assignedSlot() const 2243 HTMLSlotElement* Node::assignedSlot() const
2212 { 2244 {
2213 ASSERT(!needsDistributionRecalc()); 2245 ASSERT(!needsDistributionRecalc());
2214 Element* parent = parentElement(); 2246 if (ElementShadow* shadow = parentElementShadow(*this))
2215 if (!parent) 2247 return shadow->assignedSlotFor(*this);
2216 return nullptr; 2248 return nullptr;
2217 if (ElementShadow* shadow = parent->shadow()) { 2249 }
2250
2251 HTMLSlotElement* Node::assignedSlotForBinding()
2252 {
2253 updateDistribution();
2254 if (ElementShadow* shadow = parentElementShadow(*this)) {
2218 if (shadow->isV1() && shadow->isOpen()) 2255 if (shadow->isV1() && shadow->isOpen())
2219 return shadow->assignedSlotFor(*this); 2256 return shadow->assignedSlotFor(*this);
2220 } 2257 }
2221 return nullptr; 2258 return nullptr;
2222 } 2259 }
2223 2260
2224 void Node::setFocus(bool flag) 2261 void Node::setFocus(bool flag)
2225 { 2262 {
2226 document().userActionElements().setFocused(this, flag); 2263 document().userActionElements().setFocused(this, flag);
2227 } 2264 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 2406
2370 void showNodePath(const blink::Node* node) 2407 void showNodePath(const blink::Node* node)
2371 { 2408 {
2372 if (node) 2409 if (node)
2373 node->showNodePathForThis(); 2410 node->showNodePathForThis();
2374 else 2411 else
2375 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2412 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2376 } 2413 }
2377 2414
2378 #endif 2415 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698