Source/WebCore:
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Dec 2014 10:50:11 +0000 (10:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Dec 2014 10:50:11 +0000 (10:50 +0000)
commit6592deb5c42410a2941bd33494ecb8f4a20e146b
tree3233df4f4d63badd8b1d06db010fce33551b18db
parent542d7f133fe59e6cfd7993096ece29ba69005cfa
Source/WebCore:
Missing support for innerHTML on SVGElement
https://bugs.webkit.org/show_bug.cgi?id=136903

Patch by Sylvain Galineau <galineau@adobe.com> on 2014-12-02
Reviewed by Dean Jackson.

Two parts to this patch:
1. Move innerHTML/outerHTML to Element so SVG elements can inherit them, per https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#innerhtml
2. Make sure fragment insertion is processed relative to the proper node, per http://www.whatwg.org/specs/web-apps/current-work/#adjusted-current-node

The latter part was ported over from Blink.

Test: svg/in-html/svg-inner-html.html

* bindings/objc/PublicDOMInterfaces.h: Move innerHTML/outerHTML to Element.
* dom/Element.cpp:
(WebCore::Element::mergeWithNextTextNode): Helper used by Element::innerHTML/outerHTML as well as HTMLElement::innerText/outerText; moved to Element as protected static.
(WebCore::Element::innerHTML): Moved from HTMLElement.
(WebCore::Element::outerHTML): Moved from HTMLElement.
(WebCore::Element::setOuterHTML): Moved from HTMLElement.
(WebCore::Element::setInnerHTML): Moved from HTMLElement.
* dom/Element.h:
* dom/Element.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::innerHTML): Deleted.
(WebCore::HTMLElement::outerHTML): Deleted.
(WebCore::HTMLElement::setInnerHTML): Deleted.
(WebCore::mergeWithNextTextNode): Deleted.
(WebCore::HTMLElement::setOuterHTML): Deleted.
* html/HTMLElement.h:
* html/HTMLElement.idl:
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext): no more m_contextElement.
(WebCore::HTMLTreeBuilder::constructTree): read namespace from adjusted current node.
(WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately): use contextElementStackItem for insertion.
(WebCore::HTMLTreeBuilder::adjustedCurrentStackItem): compute adjusted current node.
(WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): use adjusted current node for context.
(WebCore::HTMLTreeBuilder::processTokenInForeignContent): use adjusted current node to read namespace.
* html/parser/HTMLTreeBuilder.h:
(WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElement): Deleted. Read from contextElementStackItem.
(WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElementStackItem): Added.

LayoutTests:
    Missing support for innerHTML on SVGElement
    https://bugs.webkit.org/show_bug.cgi?id=136903

Patch by Sylvain Galineau <galineau@adobe.com> on 2014-12-02
Reviewed by Dean Jackson.

* js/dom/dom-static-property-for-in-iteration-expected.txt: The property enumeration order is different now that inner/outerHTML are inherited from Element
* platform/mac/svg/in-html/svg-inner-html-expected.png: Added.
* svg/css/svg-attribute-length-parsing-expected.txt:
Now that innerHTML works, the output should start with 'Test'
* svg/in-html/svg-inner-html-expected.txt: Added.
* svg/in-html/svg-inner-html.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt
LayoutTests/svg/css/svg-attribute-length-parsing-expected.txt
LayoutTests/svg/in-html/svg-inner-html-expected.txt [new file with mode: 0644]
LayoutTests/svg/in-html/svg-inner-html.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/objc/PublicDOMInterfaces.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLElement.h
Source/WebCore/html/HTMLElement.idl
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/parser/HTMLTreeBuilder.h