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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "core/dom/SelectorQuery.h" | 65 #include "core/dom/SelectorQuery.h" |
66 #include "core/dom/Text.h" | 66 #include "core/dom/Text.h" |
67 #include "core/dom/WhitespaceChildList.h" | 67 #include "core/dom/WhitespaceChildList.h" |
68 #include "core/dom/custom/CustomElement.h" | 68 #include "core/dom/custom/CustomElement.h" |
69 #include "core/dom/custom/CustomElementRegistrationContext.h" | 69 #include "core/dom/custom/CustomElementRegistrationContext.h" |
70 #include "core/dom/shadow/InsertionPoint.h" | 70 #include "core/dom/shadow/InsertionPoint.h" |
71 #include "core/dom/shadow/ShadowRoot.h" | 71 #include "core/dom/shadow/ShadowRoot.h" |
72 #include "core/editing/FrameSelection.h" | 72 #include "core/editing/FrameSelection.h" |
73 #include "core/editing/TextIterator.h" | 73 #include "core/editing/TextIterator.h" |
74 #include "core/editing/htmlediting.h" | 74 #include "core/editing/htmlediting.h" |
75 #include "core/editing/markup.h" | |
76 #include "core/events/EventDispatcher.h" | 75 #include "core/events/EventDispatcher.h" |
77 #include "core/events/FocusEvent.h" | 76 #include "core/events/FocusEvent.h" |
78 #include "core/frame/ContentSecurityPolicy.h" | 77 #include "core/frame/ContentSecurityPolicy.h" |
79 #include "core/frame/Frame.h" | 78 #include "core/frame/Frame.h" |
80 #include "core/frame/FrameView.h" | 79 #include "core/frame/FrameView.h" |
81 #include "core/html/ClassList.h" | 80 #include "core/html/ClassList.h" |
82 #include "core/html/HTMLCollection.h" | 81 #include "core/html/HTMLCollection.h" |
83 #include "core/html/HTMLDocument.h" | 82 #include "core/html/HTMLDocument.h" |
84 #include "core/html/HTMLElement.h" | 83 #include "core/html/HTMLElement.h" |
85 #include "core/html/HTMLFormControlsCollection.h" | 84 #include "core/html/HTMLFormControlsCollection.h" |
86 #include "core/html/HTMLFrameOwnerElement.h" | 85 #include "core/html/HTMLFrameOwnerElement.h" |
87 #include "core/html/HTMLLabelElement.h" | 86 #include "core/html/HTMLLabelElement.h" |
88 #include "core/html/HTMLOptionsCollection.h" | 87 #include "core/html/HTMLOptionsCollection.h" |
89 #include "core/html/HTMLTableRowsCollection.h" | 88 #include "core/html/HTMLTableRowsCollection.h" |
90 #include "core/html/HTMLTemplateElement.h" | |
91 #include "core/html/parser/HTMLParserIdioms.h" | 89 #include "core/html/parser/HTMLParserIdioms.h" |
92 #include "core/page/FocusController.h" | 90 #include "core/page/FocusController.h" |
93 #include "core/page/Page.h" | 91 #include "core/page/Page.h" |
94 #include "core/page/PointerLockController.h" | 92 #include "core/page/PointerLockController.h" |
95 #include "core/rendering/FlowThreadController.h" | 93 #include "core/rendering/FlowThreadController.h" |
96 #include "core/rendering/RenderRegion.h" | 94 #include "core/rendering/RenderRegion.h" |
97 #include "core/rendering/RenderView.h" | 95 #include "core/rendering/RenderView.h" |
98 #include "core/rendering/RenderWidget.h" | 96 #include "core/rendering/RenderWidget.h" |
99 #include "core/svg/SVGDocumentExtensions.h" | 97 #include "core/svg/SVGDocumentExtensions.h" |
100 #include "core/svg/SVGElement.h" | 98 #include "core/svg/SVGElement.h" |
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(Foc
usEvent::create(eventType, true, false, document().domWindow(), 0, oldFocusedEle
ment))); | 2195 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(Foc
usEvent::create(eventType, true, false, document().domWindow(), 0, oldFocusedEle
ment))); |
2198 } | 2196 } |
2199 | 2197 |
2200 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF
ocusedElement) | 2198 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF
ocusedElement) |
2201 { | 2199 { |
2202 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 2200 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
2203 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames:
:DOMFocusOut); | 2201 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames:
:DOMFocusOut); |
2204 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(Fo
cusEvent::create(eventType, true, false, document().domWindow(), 0, newFocusedEl
ement))); | 2202 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(Fo
cusEvent::create(eventType, true, false, document().domWindow(), 0, newFocusedEl
ement))); |
2205 } | 2203 } |
2206 | 2204 |
2207 String Element::innerHTML() const | |
2208 { | |
2209 return createMarkup(this, ChildrenOnly); | |
2210 } | |
2211 | |
2212 String Element::outerHTML() const | |
2213 { | |
2214 return createMarkup(this); | |
2215 } | |
2216 | |
2217 void Element::setInnerHTML(const String& html, ExceptionState& es) | |
2218 { | |
2219 if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html
, this, AllowScriptingContent, "innerHTML", es)) { | |
2220 ContainerNode* container = this; | |
2221 if (hasTagName(templateTag)) | |
2222 container = toHTMLTemplateElement(this)->content(); | |
2223 replaceChildrenWithFragment(container, fragment.release(), es); | |
2224 } | |
2225 } | |
2226 | |
2227 void Element::setOuterHTML(const String& html, ExceptionState& es) | |
2228 { | |
2229 Node* p = parentNode(); | |
2230 if (!p || !p->isElementNode()) { | |
2231 es.throwUninformativeAndGenericDOMException(NoModificationAllowedError); | |
2232 return; | |
2233 } | |
2234 RefPtr<Element> parent = toElement(p); | |
2235 RefPtr<Node> prev = previousSibling(); | |
2236 RefPtr<Node> next = nextSibling(); | |
2237 | |
2238 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, pa
rent.get(), AllowScriptingContent, "outerHTML", es); | |
2239 if (es.hadException()) | |
2240 return; | |
2241 | |
2242 parent->replaceChild(fragment.release(), this, es); | |
2243 RefPtr<Node> node = next ? next->previousSibling() : 0; | |
2244 if (!es.hadException() && node && node->isTextNode()) | |
2245 mergeWithNextTextNode(node.release(), es); | |
2246 | |
2247 if (!es.hadException() && prev && prev->isTextNode()) | |
2248 mergeWithNextTextNode(prev.release(), es); | |
2249 } | |
2250 | |
2251 String Element::innerText() | 2205 String Element::innerText() |
2252 { | 2206 { |
2253 // We need to update layout, since plainText uses line boxes in the render t
ree. | 2207 // We need to update layout, since plainText uses line boxes in the render t
ree. |
2254 document().updateLayoutIgnorePendingStylesheets(); | 2208 document().updateLayoutIgnorePendingStylesheets(); |
2255 | 2209 |
2256 if (!renderer()) | 2210 if (!renderer()) |
2257 return textContent(true); | 2211 return textContent(true); |
2258 | 2212 |
2259 return plainText(rangeOfContents(const_cast<Element*>(this)).get()); | 2213 return plainText(rangeOfContents(const_cast<Element*>(this)).get()); |
2260 } | 2214 } |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3471 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3425 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
3472 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3426 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
3473 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3427 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
3474 return false; | 3428 return false; |
3475 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3429 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3476 return false; | 3430 return false; |
3477 return true; | 3431 return true; |
3478 } | 3432 } |
3479 | 3433 |
3480 } // namespace WebCore | 3434 } // namespace WebCore |
OLD | NEW |