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