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

Unified Diff: telemetry/third_party/snap-it/HTMLSerializer.js

Issue 3017573002: Make sure snap_page combined iframe serialized dom
Patch Set: . Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: telemetry/third_party/snap-it/HTMLSerializer.js
diff --git a/telemetry/third_party/snap-it/HTMLSerializer.js b/telemetry/third_party/snap-it/HTMLSerializer.js
index 7dcc3f69aa8ce4abcda1e65326c1459c4b23e84c..80e28fd805a12c0a0f2cec2abfbfc60f1e57e700 100644
--- a/telemetry/third_party/snap-it/HTMLSerializer.js
+++ b/telemetry/third_party/snap-it/HTMLSerializer.js
@@ -70,7 +70,7 @@ var HTMLSerializer = class {
/**
* @public {Array<string>} This array represents the serialized html that
- * makes up a node or document.
+ * makes up a node or document.
*/
this.html = [];
@@ -187,7 +187,7 @@ var HTMLSerializer = class {
* eventually be converted into an html file.
*
* @param {Document} doc The Document to serialize.
- */
+ */
processDocument(doc) {
this.windowHeight = doc.defaultView.innerHeight;
this.windowWidth = doc.defaultView.innerWidth;
@@ -231,7 +231,7 @@ var HTMLSerializer = class {
*
* @param {Node} node The Node to serialize.
* @private
- */
+ */
processTree(node) {
var tagName = node.tagName;
if (!tagName && node.nodeType != Node.TEXT_NODE) {
@@ -336,7 +336,7 @@ var HTMLSerializer = class {
* @param {Element} element The Element to serialize.
* @param {string} id The id of the Element being serialized.
* @private
- */
+ */
processAttributes(element, id) {
var win = element.ownerDocument.defaultView;
var style = win.getComputedStyle(element, null);
@@ -583,7 +583,7 @@ var HTMLSerializer = class {
} else {
var fullyQualifiedName = this.iframeFullyQualifiedName(win.parent);
var index = this.iframeIndex(win);
- return fullyQualifiedName + '.' + index;
+ return fullyQualifiedName + '.' + index;
}
}
@@ -723,6 +723,31 @@ var HTMLSerializer = class {
}
}
+ /**
+ * Return a JSONizable dictionary that contain all the data of this object.
+ */
+ asDict() {
wkorman 2017/09/20 20:11:04 Add a unit test for this? May as well while we're
nednguyen 2017/09/26 13:01:35 Acknowledged. I filed a tracking bug here https://
+ return {
+ 'html': htmlSerializer.html,
+ 'frameHoles': htmlSerializer.frameHoles,
+ 'idToStyleIndex': htmlSerializer.idToStyleIndex,
+ 'idToStyleMap': htmlSerializer.idToStyleMap,
+ 'windowHeight': htmlSerializer.windowHeight,
+ 'windowWidth': htmlSerializer.windowWidth,
+ 'rootId': htmlSerializer.rootId,
+ 'rootStyleIndex': htmlSerializer.rootStyleIndex,
+ 'pseudoElementSelectorToCSSMap':
+ htmlSerializer.pseudoElementSelectorToCSSMap,
+ 'pseudoElementPlaceHolderIndex':
+ htmlSerializer.pseudoElementPlaceHolderIndex,
+ 'pseudoElementTestingStyleIndex':
+ htmlSerializer.pseudoElementStyleTestingIndex,
+ 'pseudoElementTestingStyleId': htmlSerializer.pseudoElementTestingStyleId,
+ 'unusedId': htmlSerializer.generateId(document),
+ 'frameIndex': htmlSerializer.iframeFullyQualifiedName(window)
+ };
+ }
+
/**
* Take all of the srcHoles and create data urls for the resources, placing
* them in |this.html|. Calls the callback when complete.

Powered by Google App Engine
This is Rietveld 408576698