Support serializing shadow DOM to MHTML

Desktop / Chromium - jianli [chromium.org] - 14 June 2017 20:11 EDT

The content of shadow DOM tree will be serialized and put within a template element that appends to the children of the shadow host element. The template element contains a special attribute to denote the mode of the shadow dom tree.

When MHTML page is being loaded, the shadow DOM tree will be recreated by the injected script to convert the templates to the shadow DOM trees.

Please see the bug for the link to the design doc.

BUG=695738 TEST=new tests added

Review-Url: https://codereview.chromium.org/2912213002 Cr-Commit-Position: refs/heads/master@{#479550}

05d4157 Support serializing shadow DOM to MHTML
.../core/editing/serializers/MarkupAccumulator.cpp | 24 +++++++
.../core/editing/serializers/MarkupAccumulator.h | 9 +++
.../WebKit/Source/core/frame/FrameSerializer.cpp | 6 ++
.../WebKit/Source/core/frame/FrameSerializer.h | 7 ++
.../WebKit/Source/web/LocalFrameClientImpl.cpp | 39 ++++++++++++
.../WebKit/Source/web/WebFrameSerializer.cpp | 74 ++++++++++++++++++++--
third_party/WebKit/Source/web/tests/MHTMLTest.cpp | 41 +++++++++++-
.../tests/WebFrameSerializerSanitizationTest.cpp | 53 ++++++++++++++--
.../tests/data/frameserialization/shadow_dom.html | 18 ++++++
.../Source/web/tests/data/mhtml/.gitattributes | 6 ++
.../web/tests/data/mhtml/page_with_javascript.mht | 29 +++++++++
.../WebKit/Source/web/tests/data/mhtml/shadow.mht | 40 ++++++++++++
12 files changed, 334 insertions(+), 12 deletions(-)

Upstream: git.chromium.org


  • Share