Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Issue 44333002: Move innerHTML and outerHTML to Element (Closed)

Created:
7 years, 1 month ago by davve
Modified:
7 years, 1 month ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, adamk+blink_chromium.org, Inactive, arv (Not doing code reviews), abarth-chromium
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Move innerHTML and outerHTML to Element Per the DOM Parsing specification, innerHTML and outerHTML should be available on Element, not HTMLElement. Since HTMLElement and SVGElement are the only interfaces that inherit from Element, the only Web visible difference should be that innerHTML and outerHTML are now available for SVG elements. For <svg>.innerHTML = "<!-- svg elements here -->" to insert elements with correct namespace URI, one adjustment has to be made to the tree builder step of the html parsing algorithm. The changes are described in the spec change <http://html5.org/r/7768>;. The new concept of 'adjustedCurrentNode' is used when processing and when deciding to process foreign content and makes sure that parsed elements go into the correct namespace. Some layout tests that (perhaps accidentally) use innerHTML and outerHTML on SVG elements are adjusted slightly. BUG=311080 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=160869

Patch Set 1 #

Total comments: 2

Patch Set 2 : Clean up tests #

Patch Set 3 : Code simplifications and added tests for parsing inside foreignObject #

Patch Set 4 : Add XML based tests and -expected.txt files #

Total comments: 7

Patch Set 5 : Fix and add test for introduced faulty cast and simplify adjustedCurrentStackItem() #

Patch Set 6 : Rebased to latest master #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+295 lines, -79 lines) Patch
A LayoutTests/fast/innerHTML/innerHTML-svg-read.html View 1 1 chunk +36 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-svg-read-expected.txt View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-svg-write.html View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-svg-write-expected.txt View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-template-crash.xhtml View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-template-crash-expected.xhtml View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-xml.xhtml View 1 2 3 1 chunk +53 lines, -0 lines 0 comments Download
A LayoutTests/fast/innerHTML/innerHTML-xml-expected.txt View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
M LayoutTests/fast/loader/delete-inside-cancelTimer-expected.txt View 2 chunks +0 lines, -4 lines 0 comments Download
M LayoutTests/svg/css/script-tests/svg-attribute-length-parsing.js View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/dom/Element.h View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 2 3 4 5 3 chunks +46 lines, -0 lines 0 comments Download
M Source/core/dom/Element.idl View 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/editing/markup.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/editing/markup.cpp View 1 chunk +14 lines, -0 lines 0 comments Download
M Source/core/html/HTMLElement.h View 1 chunk +0 lines, -4 lines 0 comments Download
M Source/core/html/HTMLElement.cpp View 1 2 3 4 5 1 chunk +0 lines, -58 lines 0 comments Download
M Source/core/html/HTMLElement.idl View 1 chunk +0 lines, -2 lines 0 comments Download
M Source/core/html/parser/HTMLTreeBuilder.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/parser/HTMLTreeBuilder.cpp View 1 2 3 4 5 7 chunks +27 lines, -11 lines 1 comment Download

Messages

Total messages: 17 (0 generated)
davve
This started out as a simple fix but grew slightly more complex as I wanted ...
7 years, 1 month ago (2013-10-25 13:53:33 UTC) #1
Erik Dahlström (inactive)
On 2013/10/25 13:53:33, davve wrote: > This started out as a simple fix but grew ...
7 years, 1 month ago (2013-10-25 14:31:36 UTC) #2
eseidel
So this will use the xml parser when in an xml doc and the HTML ...
7 years, 1 month ago (2013-10-25 17:39:45 UTC) #3
pdr.
Wow, this is fantastic. 1x LGTM. @eseidel or @abarth, can you give an additional LGTM ...
7 years, 1 month ago (2013-10-25 17:57:13 UTC) #4
davve
On 2013/10/25 17:39:45, eseidel wrote: > So this will use the xml parser when in ...
7 years, 1 month ago (2013-10-25 18:00:09 UTC) #5
arv (Not doing code reviews)
This is great. https://codereview.chromium.org/44333002/diff/1/LayoutTests/fast/innerHTML/innerHTML-svg-read.html File LayoutTests/fast/innerHTML/innerHTML-svg-read.html (right): https://codereview.chromium.org/44333002/diff/1/LayoutTests/fast/innerHTML/innerHTML-svg-read.html#newcode31 LayoutTests/fast/innerHTML/innerHTML-svg-read.html:31: shouldBe(tests[i][0], tests[i][1]); FYI. If you used ...
7 years, 1 month ago (2013-10-25 19:15:31 UTC) #6
davve
https://codereview.chromium.org/44333002/diff/1/LayoutTests/fast/innerHTML/innerHTML-svg-read.html File LayoutTests/fast/innerHTML/innerHTML-svg-read.html (right): https://codereview.chromium.org/44333002/diff/1/LayoutTests/fast/innerHTML/innerHTML-svg-read.html#newcode31 LayoutTests/fast/innerHTML/innerHTML-svg-read.html:31: shouldBe(tests[i][0], tests[i][1]); On 2013/10/25 19:15:31, arv wrote: > FYI. ...
7 years, 1 month ago (2013-10-25 19:50:44 UTC) #7
davve
On 2013/10/25 18:00:09, davve wrote: > What we might want to do here is to ...
7 years, 1 month ago (2013-10-28 16:54:49 UTC) #8
abarth-chromium
This generally looks good, but I'd like to look at the CL after you fix ...
7 years, 1 month ago (2013-10-29 04:04:41 UTC) #9
davve
https://codereview.chromium.org/44333002/diff/240001/Source/core/dom/Element.cpp File Source/core/dom/Element.cpp (right): https://codereview.chromium.org/44333002/diff/240001/Source/core/dom/Element.cpp#newcode2224 Source/core/dom/Element.cpp:2224: container = toHTMLTemplateElement(this)->content(); On 2013/10/29 04:04:42, abarth wrote: > ...
7 years, 1 month ago (2013-10-29 09:15:37 UTC) #10
abarth-chromium
LGTM Thanks!
7 years, 1 month ago (2013-10-29 16:27:46 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davve@opera.com/44333002/300001
7 years, 1 month ago (2013-10-29 16:27:57 UTC) #12
commit-bot: I haz the power
Failed to apply patch for Source/core/dom/Element.h: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
7 years, 1 month ago (2013-10-29 16:28:05 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davve@opera.com/44333002/370001
7 years, 1 month ago (2013-10-29 19:23:06 UTC) #14
commit-bot: I haz the power
Change committed as 160869
7 years, 1 month ago (2013-10-29 23:19:59 UTC) #15
eseidel
https://codereview.chromium.org/44333002/diff/370001/Source/core/html/parser/HTMLTreeBuilder.cpp File Source/core/html/parser/HTMLTreeBuilder.cpp (right): https://codereview.chromium.org/44333002/diff/370001/Source/core/html/parser/HTMLTreeBuilder.cpp#newcode2691 Source/core/html/parser/HTMLTreeBuilder.cpp:2691: RefPtr<HTMLStackItem> adjustedCurrentNode = adjustedCurrentStackItem(); This change looks like it's ...
7 years, 1 month ago (2013-11-12 21:05:22 UTC) #16
davve
7 years, 1 month ago (2013-11-13 13:15:16 UTC) #17
Message was sent while issue was closed.
On 2013/11/12 21:05:22, eseidel wrote:
>
https://codereview.chromium.org/44333002/diff/370001/Source/core/html/parser/...
> File Source/core/html/parser/HTMLTreeBuilder.cpp (right):
> 
>
https://codereview.chromium.org/44333002/diff/370001/Source/core/html/parser/...
> Source/core/html/parser/HTMLTreeBuilder.cpp:2691: RefPtr<HTMLStackItem>
> adjustedCurrentNode = adjustedCurrentStackItem();
> This change looks like it's adding a malloc here just to check the
namespace... 
> That seems very bad.

Good catch! I've reported
https://code.google.com/p/chromium/issues/detail?id=318711 to investigate this
further.

Powered by Google App Engine
This is Rietveld 408576698