void SplitElementCommand::executeApply() { if (m_atChild->parentNode() != m_element2) return; HeapVector<Member<Node>> children; for (Node* node = m_element2->firstChild(); node != m_atChild; node = node->nextSibling()) children.append(node); DummyExceptionStateForTesting exceptionState; ContainerNode* parent = m_element2->parentNode(); if (!parent || !hasEditableStyle(*parent)) return; parent->insertBefore(m_element1.get(), m_element2.get(), exceptionState); if (exceptionState.hadException()) return; // Delete id attribute from the second element because the same id cannot be // used for more than one element m_element2->removeAttribute(HTMLNames::idAttr); for (const auto& child : children) m_element1->appendChild(child, exceptionState); }
void InspectorOverlay::drawNodeHighlight() { if (!m_highlightNode) return; String selectors = m_nodeHighlightConfig.selectorList; StaticElementList* elements = nullptr; DummyExceptionStateForTesting exceptionState; ContainerNode* queryBase = m_highlightNode->containingShadowRoot(); if (!queryBase) queryBase = m_highlightNode->ownerDocument(); if (selectors.length()) elements = queryBase->querySelectorAll(AtomicString(selectors), exceptionState); if (elements && !exceptionState.hadException()) { for (unsigned i = 0; i < elements->length(); ++i) { Element* element = elements->item(i); InspectorHighlight highlight(element, m_nodeHighlightConfig, false); std::unique_ptr<protocol::DictionaryValue> highlightJSON = highlight.asProtocolValue(); evaluateInOverlay("drawHighlight", std::move(highlightJSON)); } } bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highlightNode->document().frame(); InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, appendElementInfo); if (m_eventTargetNode) highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighlightConfig); std::unique_ptr<protocol::DictionaryValue> highlightJSON = highlight.asProtocolValue(); evaluateInOverlay("drawHighlight", std::move(highlightJSON)); }