| 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 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(Foc
usEvent::create(eventType, true, false, document().domWindow(), 0, oldFocusedEle
ment))); | 1534 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(Foc
usEvent::create(eventType, true, false, document().domWindow(), 0, oldFocusedEle
ment))); |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF
ocusedElement) | 1537 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF
ocusedElement) |
| 1538 { | 1538 { |
| 1539 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 1539 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 1540 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames:
:DOMFocusOut); | 1540 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames:
:DOMFocusOut); |
| 1541 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(Fo
cusEvent::create(eventType, true, false, document().domWindow(), 0, newFocusedEl
ement))); | 1541 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(Fo
cusEvent::create(eventType, true, false, document().domWindow(), 0, newFocusedEl
ement))); |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 String Element::innerHTML() const | |
| 1545 { | |
| 1546 return createMarkup(this, ChildrenOnly); | |
| 1547 } | |
| 1548 | |
| 1549 String Element::outerHTML() const | |
| 1550 { | |
| 1551 return createMarkup(this); | |
| 1552 } | |
| 1553 | |
| 1554 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState) | |
| 1555 { | |
| 1556 if (RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOu
terHTML(html, this, "innerHTML", exceptionState)) { | |
| 1557 ContainerNode* container = this; | |
| 1558 if (isHTMLTemplateElement(*this)) | |
| 1559 container = toHTMLTemplateElement(this)->content(); | |
| 1560 replaceChildrenWithFragment(container, fragment.release(), exceptionStat
e); | |
| 1561 } | |
| 1562 } | |
| 1563 | |
| 1564 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState) | |
| 1565 { | |
| 1566 Node* p = parentNode(); | |
| 1567 if (!p) { | |
| 1568 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme
nt has no parent node."); | |
| 1569 return; | |
| 1570 } | |
| 1571 if (!p->isElementNode()) { | |
| 1572 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme
nt's parent is of type '" + p->nodeName() + "', which is not an element node."); | |
| 1573 return; | |
| 1574 } | |
| 1575 | |
| 1576 RefPtrWillBeRawPtr<Element> parent = toElement(p); | |
| 1577 RefPtrWillBeRawPtr<Node> prev = previousSibling(); | |
| 1578 RefPtrWillBeRawPtr<Node> next = nextSibling(); | |
| 1579 | |
| 1580 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH
TML(html, parent.get(), "outerHTML", exceptionState); | |
| 1581 if (exceptionState.hadException()) | |
| 1582 return; | |
| 1583 | |
| 1584 parent->replaceChild(fragment.release(), this, exceptionState); | |
| 1585 RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : 0; | |
| 1586 if (!exceptionState.hadException() && node && node->isTextNode()) | |
| 1587 mergeWithNextTextNode(toText(node.get()), exceptionState); | |
| 1588 | |
| 1589 if (!exceptionState.hadException() && prev && prev->isTextNode()) | |
| 1590 mergeWithNextTextNode(toText(prev.get()), exceptionState); | |
| 1591 } | |
| 1592 | |
| 1593 String Element::innerText() | 1544 String Element::innerText() |
| 1594 { | 1545 { |
| 1595 // We need to update layout, since plainText uses line boxes in the render t
ree. | 1546 // We need to update layout, since plainText uses line boxes in the render t
ree. |
| 1596 document().updateLayoutIgnorePendingStylesheets(); | 1547 document().updateLayoutIgnorePendingStylesheets(); |
| 1597 | 1548 |
| 1598 if (!renderer()) | 1549 if (!renderer()) |
| 1599 return textContent(true); | 1550 return textContent(true); |
| 1600 | 1551 |
| 1601 return plainText(rangeOfContents(const_cast<Element*>(this)).get()); | 1552 return plainText(rangeOfContents(const_cast<Element*>(this)).get()); |
| 1602 } | 1553 } |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 { | 2164 { |
| 2214 #if ENABLE(OILPAN) | 2165 #if ENABLE(OILPAN) |
| 2215 if (hasRareData()) | 2166 if (hasRareData()) |
| 2216 visitor->trace(elementRareData()); | 2167 visitor->trace(elementRareData()); |
| 2217 visitor->trace(m_elementData); | 2168 visitor->trace(m_elementData); |
| 2218 #endif | 2169 #endif |
| 2219 ContainerNode::trace(visitor); | 2170 ContainerNode::trace(visitor); |
| 2220 } | 2171 } |
| 2221 | 2172 |
| 2222 } // namespace blink | 2173 } // namespace blink |
| OLD | NEW |