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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js

Issue 2605693003: DevTools: introduce object previews experiment (Closed)
Patch Set: tests Created 3 years, 12 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: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
index 47d2893dadbb1a1f117593fd1b153a233c012340..24648d9471ee30c4434304dd48a8cf4c11186ee4 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
@@ -219,15 +219,17 @@ Components.ObjectPropertiesSection = class extends TreeOutlineInShadow {
* @param {boolean} wasThrown
* @param {!Element=} parentElement
* @param {!Components.Linkifier=} linkifier
+ * @param {boolean=} hidePreview
* @return {!Element}
*/
- static createValueElementWithCustomSupport(value, wasThrown, parentElement, linkifier) {
+ static createValueElementWithCustomSupport(value, wasThrown, parentElement, linkifier, hidePreview) {
if (value.customPreview()) {
var result = (new Components.CustomPreviewComponent(value)).element;
result.classList.add('object-properties-section-custom-section');
return result;
}
- return Components.ObjectPropertiesSection.createValueElement(value, wasThrown, parentElement, linkifier);
+ return Components.ObjectPropertiesSection.createValueElement(
+ value, wasThrown, parentElement, linkifier, hidePreview);
}
/**
@@ -235,9 +237,10 @@ Components.ObjectPropertiesSection = class extends TreeOutlineInShadow {
* @param {boolean} wasThrown
* @param {!Element=} parentElement
* @param {!Components.Linkifier=} linkifier
+ * @param {boolean=} hidePreview
* @return {!Element}
*/
- static createValueElement(value, wasThrown, parentElement, linkifier) {
+ static createValueElement(value, wasThrown, parentElement, linkifier, hidePreview) {
var valueElement;
var type = value.type;
var subtype = value.subtype;
@@ -264,8 +267,13 @@ Components.ObjectPropertiesSection = class extends TreeOutlineInShadow {
parentElement.classList.add('hbox');
} else {
valueElement = createElementWithClass('span', 'object-value-' + (subtype || type));
- valueElement.setTextContentTruncatedIfNeeded(description);
valueElement.title = description;
+ if (value.preview && !hidePreview) {
dgozman 2017/01/10 22:26:09 You should check experiment here, not at the call
luoe 2017/01/13 01:11:45 Done.
+ var previewFormatter = new Components.RemoteObjectPreviewFormatter();
+ previewFormatter.appendObjectPreview(valueElement, value.preview);
+ } else {
+ valueElement.setTextContentTruncatedIfNeeded(description);
+ }
}
if (wasThrown) {
@@ -781,8 +789,9 @@ Components.ObjectPropertyTreeElement = class extends TreeElement {
separatorElement.textContent = ': ';
if (this.property.value) {
+ var hidePreview = this.property.name === '__proto__' || !Runtime.experiments.isEnabled('objectPreviews');
this.valueElement = Components.ObjectPropertiesSection.createValueElementWithCustomSupport(
- this.property.value, this.property.wasThrown, this.listItemElement, this._linkifier);
+ this.property.value, this.property.wasThrown, this.listItemElement, this._linkifier, hidePreview);
this.valueElement.addEventListener('contextmenu', this._contextMenuFired.bind(this, this.property), false);
} else if (this.property.getter) {
this.valueElement = Components.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(

Powered by Google App Engine
This is Rietveld 408576698