| OLD | NEW |
| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 | 2356 |
| 2357 DCHECK(isHTMLElement() || isSVGElement()); | 2357 DCHECK(isHTMLElement() || isSVGElement()); |
| 2358 DCHECK(CustomElementState::Custom != getCustomElementState()); | 2358 DCHECK(CustomElementState::Custom != getCustomElementState()); |
| 2359 setFlag(V0CustomElementFlag); | 2359 setFlag(V0CustomElementFlag); |
| 2360 setFlag(newState == V0Upgraded, V0CustomElementUpgradedFlag); | 2360 setFlag(newState == V0Upgraded, V0CustomElementUpgradedFlag); |
| 2361 | 2361 |
| 2362 if (oldState == V0NotCustomElement || newState == V0Upgraded) | 2362 if (oldState == V0NotCustomElement || newState == V0Upgraded) |
| 2363 toElement(this)->pseudoStateChanged(CSSSelector::PseudoUnresolved); | 2363 toElement(this)->pseudoStateChanged(CSSSelector::PseudoUnresolved); |
| 2364 } | 2364 } |
| 2365 | 2365 |
| 2366 void Node::checkSlotChange() { | 2366 void Node::checkSlotChange(SlotChangeType slotChangeType) { |
| 2367 // Common check logic is used in both cases, "after inserted" and "before | 2367 // Common check logic is used in both cases, "after inserted" and "before |
| 2368 // removed". | 2368 // removed". |
| 2369 if (!isSlotable()) | 2369 if (!isSlotable()) |
| 2370 return; | 2370 return; |
| 2371 if (ShadowRoot* root = v1ShadowRootOfParent()) { | 2371 if (ShadowRoot* root = v1ShadowRootOfParent()) { |
| 2372 // Relevant DOM Standard: | 2372 // Relevant DOM Standard: |
| 2373 // https://dom.spec.whatwg.org/#concept-node-insert | 2373 // https://dom.spec.whatwg.org/#concept-node-insert |
| 2374 // - 6.1.2: If parent is a shadow host and node is a slotable, then assign a | 2374 // - 6.1.2: If parent is a shadow host and node is a slotable, then assign a |
| 2375 // slot for node. | 2375 // slot for node. |
| 2376 // https://dom.spec.whatwg.org/#concept-node-remove | 2376 // https://dom.spec.whatwg.org/#concept-node-remove |
| 2377 // - 10. If node is assigned, then run assign slotables for node’s assigned | 2377 // - 10. If node is assigned, then run assign slotables for node’s assigned |
| 2378 // slot. | 2378 // slot. |
| 2379 | 2379 |
| 2380 // Although DOM Standard requires "assign a slot for node / run assign | 2380 // Although DOM Standard requires "assign a slot for node / run assign |
| 2381 // slotables" at this timing, we skip it as an optimization. | 2381 // slotables" at this timing, we skip it as an optimization. |
| 2382 if (HTMLSlotElement* slot = root->ensureSlotAssignment().findSlot(*this)) | 2382 if (HTMLSlotElement* slot = root->ensureSlotAssignment().findSlot(*this)) |
| 2383 slot->enqueueSlotChangeEvent(); | 2383 slot->didSlotChange(slotChangeType); |
| 2384 } else { | 2384 } else { |
| 2385 // Relevant DOM Standard: | 2385 // Relevant DOM Standard: |
| 2386 // https://dom.spec.whatwg.org/#concept-node-insert | 2386 // https://dom.spec.whatwg.org/#concept-node-insert |
| 2387 // - 6.1.3: If parent is a slot whose assigned nodes is the empty list, then | 2387 // - 6.1.3: If parent is a slot whose assigned nodes is the empty list, then |
| 2388 // run signal a slot change for parent. | 2388 // run signal a slot change for parent. |
| 2389 // https://dom.spec.whatwg.org/#concept-node-remove | 2389 // https://dom.spec.whatwg.org/#concept-node-remove |
| 2390 // - 11. If parent is a slot whose assigned nodes is the empty list, then | 2390 // - 11. If parent is a slot whose assigned nodes is the empty list, then |
| 2391 // run signal a slot change for parent. | 2391 // run signal a slot change for parent. |
| 2392 Element* parent = parentElement(); | 2392 Element* parent = parentElement(); |
| 2393 if (parent && isHTMLSlotElement(parent)) { | 2393 if (parent && isHTMLSlotElement(parent)) { |
| 2394 HTMLSlotElement& parentSlot = toHTMLSlotElement(*parent); | 2394 HTMLSlotElement& parentSlot = toHTMLSlotElement(*parent); |
| 2395 // TODO(hayato): Support slotchange for slots in non-shadow trees. | 2395 // TODO(hayato): Support slotchange for slots in non-shadow trees. |
| 2396 if (ShadowRoot* root = containingShadowRoot()) { | 2396 if (ShadowRoot* root = containingShadowRoot()) { |
| 2397 if (root && root->isV1() && !parentSlot.hasAssignedNodesSlow()) | 2397 if (root && root->isV1() && !parentSlot.hasAssignedNodesSlow()) |
| 2398 parentSlot.enqueueSlotChangeEvent(); | 2398 parentSlot.didSlotChange(slotChangeType); |
| 2399 } | 2399 } |
| 2400 } | 2400 } |
| 2401 } | 2401 } |
| 2402 } | 2402 } |
| 2403 | 2403 |
| 2404 DEFINE_TRACE(Node) { | 2404 DEFINE_TRACE(Node) { |
| 2405 visitor->trace(m_parentOrShadowHostNode); | 2405 visitor->trace(m_parentOrShadowHostNode); |
| 2406 visitor->trace(m_previous); | 2406 visitor->trace(m_previous); |
| 2407 visitor->trace(m_next); | 2407 visitor->trace(m_next); |
| 2408 // rareData() and m_data.m_layoutObject share their storage. We have to trace | 2408 // rareData() and m_data.m_layoutObject share their storage. We have to trace |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 if (node) { | 2487 if (node) { |
| 2488 std::stringstream stream; | 2488 std::stringstream stream; |
| 2489 node->printNodePathTo(stream); | 2489 node->printNodePathTo(stream); |
| 2490 LOG(INFO) << stream.str(); | 2490 LOG(INFO) << stream.str(); |
| 2491 } else { | 2491 } else { |
| 2492 LOG(INFO) << "Cannot showNodePath for <null>"; | 2492 LOG(INFO) << "Cannot showNodePath for <null>"; |
| 2493 } | 2493 } |
| 2494 } | 2494 } |
| 2495 | 2495 |
| 2496 #endif | 2496 #endif |
| OLD | NEW |