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

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

Issue 2257053003: Fix a crash when pseudo elements are used for a shadow host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp ('k') | no next file » | 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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 // PseudoElements and VTTElements. It's possible we can just eliminate all the c hecks 963 // PseudoElements and VTTElements. It's possible we can just eliminate all the c hecks
964 // since those elements will never have class names, inline style, or other thin gs that 964 // since those elements will never have class names, inline style, or other thin gs that
965 // this apparently guards against. 965 // this apparently guards against.
966 bool Node::isStyledElement() const 966 bool Node::isStyledElement() const
967 { 967 {
968 return isHTMLElement() || isSVGElement() || (isElementNode() && toElement(th is)->namespaceURI() == MathMLNames::mathmlNamespaceURI); 968 return isHTMLElement() || isSVGElement() || (isElementNode() && toElement(th is)->namespaceURI() == MathMLNames::mathmlNamespaceURI);
969 } 969 }
970 970
971 bool Node::canParticipateInFlatTree() const 971 bool Node::canParticipateInFlatTree() const
972 { 972 {
973 // TODO(hayato): Return false for pseudo elements.
973 return !isShadowRoot() && !isSlotOrActiveInsertionPoint(); 974 return !isShadowRoot() && !isSlotOrActiveInsertionPoint();
974 } 975 }
975 976
976 bool Node::isSlotOrActiveInsertionPoint() const 977 bool Node::isSlotOrActiveInsertionPoint() const
977 { 978 {
978 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this); 979 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this);
979 } 980 }
980 981
981 AtomicString Node::slotName() const 982 AtomicString Node::slotName() const
982 { 983 {
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 DCHECK(insertionPoint->containingShadowRoot()); 2178 DCHECK(insertionPoint->containingShadowRoot());
2178 if (!insertionPoint->containingShadowRoot()->isOpenOrV0()) 2179 if (!insertionPoint->containingShadowRoot()->isOpenOrV0())
2179 break; 2180 break;
2180 filteredInsertionPoints.append(insertionPoint); 2181 filteredInsertionPoints.append(insertionPoint);
2181 } 2182 }
2182 return StaticNodeList::adopt(filteredInsertionPoints); 2183 return StaticNodeList::adopt(filteredInsertionPoints);
2183 } 2184 }
2184 2185
2185 HTMLSlotElement* Node::assignedSlot() const 2186 HTMLSlotElement* Node::assignedSlot() const
2186 { 2187 {
2188 DCHECK(!isPseudoElement());
2187 if (ShadowRoot* root = v1ShadowRootOfParent()) 2189 if (ShadowRoot* root = v1ShadowRootOfParent())
2188 return root->ensureSlotAssignment().findSlot(*this); 2190 return root->ensureSlotAssignment().findSlot(*this);
2189 return nullptr; 2191 return nullptr;
2190 } 2192 }
2191 2193
2192 HTMLSlotElement* Node::assignedSlotForBinding() 2194 HTMLSlotElement* Node::assignedSlotForBinding()
2193 { 2195 {
2194 updateDistribution(); 2196 updateDistribution();
2195 if (ShadowRoot* root = v1ShadowRootOfParent()) { 2197 if (ShadowRoot* root = v1ShadowRootOfParent()) {
2196 if (root->type() == ShadowRootType::Open) 2198 if (root->type() == ShadowRootType::Open)
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 2431
2430 void showNodePath(const blink::Node* node) 2432 void showNodePath(const blink::Node* node)
2431 { 2433 {
2432 if (node) 2434 if (node)
2433 node->showNodePathForThis(); 2435 node->showNodePathForThis();
2434 else 2436 else
2435 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2437 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2436 } 2438 }
2437 2439
2438 #endif 2440 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698