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

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

Issue 2630293003: Do not allocate SlotAssignment unless a shadowroot has a slot (Closed)
Patch Set: renamed Created 3 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DCHECK_EQ(type(), ShadowRootType::V0); 94 DCHECK_EQ(type(), ShadowRootType::V0);
95 ensureShadowRootRareDataV0().setOlderShadowRoot(root); 95 ensureShadowRootRareDataV0().setOlderShadowRoot(root);
96 } 96 }
97 97
98 SlotAssignment& ShadowRoot::ensureSlotAssignment() { 98 SlotAssignment& ShadowRoot::ensureSlotAssignment() {
99 if (!m_slotAssignment) 99 if (!m_slotAssignment)
100 m_slotAssignment = SlotAssignment::create(*this); 100 m_slotAssignment = SlotAssignment::create(*this);
101 return *m_slotAssignment; 101 return *m_slotAssignment;
102 } 102 }
103 103
104 HTMLSlotElement* ShadowRoot::assignedSlotFor(const Node& node) {
105 if (!m_slotAssignment)
106 return nullptr;
107 return m_slotAssignment->findSlot(node);
108 }
109
110 void ShadowRoot::didAddSlot(HTMLSlotElement& slot) {
111 DCHECK(isV1());
112 ensureSlotAssignment().didAddSlot(slot);
113 }
114
115 void ShadowRoot::didChangeHostChildSlotName(const AtomicString& oldValue,
116 const AtomicString& newValue) {
117 if (!m_slotAssignment)
118 return;
119 m_slotAssignment->didChangeHostChildSlotName(oldValue, newValue);
120 }
121
104 Node* ShadowRoot::cloneNode(bool, ExceptionState& exceptionState) { 122 Node* ShadowRoot::cloneNode(bool, ExceptionState& exceptionState) {
105 exceptionState.throwDOMException(NotSupportedError, 123 exceptionState.throwDOMException(NotSupportedError,
106 "ShadowRoot nodes are not clonable."); 124 "ShadowRoot nodes are not clonable.");
107 return nullptr; 125 return nullptr;
108 } 126 }
109 127
110 String ShadowRoot::innerHTML() const { 128 String ShadowRoot::innerHTML() const {
111 return createMarkup(this, ChildrenOnly); 129 return createMarkup(this, ChildrenOnly);
112 } 130 }
113 131
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ostream << "ShadowRootType::Open"; 334 ostream << "ShadowRootType::Open";
317 break; 335 break;
318 case ShadowRootType::Closed: 336 case ShadowRootType::Closed:
319 ostream << "ShadowRootType::Closed"; 337 ostream << "ShadowRootType::Closed";
320 break; 338 break;
321 } 339 }
322 return ostream; 340 return ostream;
323 } 341 }
324 342
325 } // namespace blink 343 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h ('k') | third_party/WebKit/Source/core/dom/shadow/SlotAssignment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698