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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/object_ui/ObjectPopoverHelper.js

Issue 2703143002: [DevTools] Prepare to move Popover to shadow DOM. (Closed)
Patch Set: fix Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 this.hidePopover(); 121 this.hidePopover();
122 return; 122 return;
123 } 123 }
124 this._objectTarget = result.target(); 124 this._objectTarget = result.target();
125 var anchorElement = anchorOverride || element; 125 var anchorElement = anchorOverride || element;
126 var description = result.description.trimEnd(ObjectUI.ObjectPopoverHelper. MaxPopoverTextLength); 126 var description = result.description.trimEnd(ObjectUI.ObjectPopoverHelper. MaxPopoverTextLength);
127 var popoverContentElement = null; 127 var popoverContentElement = null;
128 if (result.type !== 'object') { 128 if (result.type !== 'object') {
129 popoverContentElement = createElement('span'); 129 popoverContentElement = createElement('span');
130 UI.appendStyle(popoverContentElement, 'object_ui/objectValue.css'); 130 UI.appendStyle(popoverContentElement, 'object_ui/objectValue.css');
131 UI.appendStyle(popoverContentElement, 'object_ui/objectPopover.css');
131 var valueElement = popoverContentElement.createChild('span', 'monospace object-value-' + result.type); 132 var valueElement = popoverContentElement.createChild('span', 'monospace object-value-' + result.type);
132 valueElement.style.whiteSpace = 'pre'; 133 valueElement.style.whiteSpace = 'pre';
133 134
134 if (result.type === 'string') 135 if (result.type === 'string')
135 valueElement.createTextChildren('"', description, '"'); 136 valueElement.createTextChildren('"', description, '"');
136 else if (result.type !== 'function') 137 else if (result.type !== 'function')
137 valueElement.textContent = description; 138 valueElement.textContent = description;
138 139
139 if (result.type === 'function') { 140 if (result.type === 'function') {
140 result.getOwnProperties( 141 result.getOwnProperties(
141 false /* generatePreview */, 142 false /* generatePreview */,
142 didGetFunctionProperties.bind(this, result, popoverContentElement, valueElement, anchorElement)); 143 didGetFunctionProperties.bind(this, result, popoverContentElement, valueElement, anchorElement));
143 return; 144 return;
144 } 145 }
145 popover.showForAnchor(popoverContentElement, anchorElement); 146 popover.showForAnchor(popoverContentElement, anchorElement);
146 } else { 147 } else {
147 if (result.subtype === 'node') { 148 if (result.subtype === 'node') {
148 SDK.DOMModel.highlightObjectAsDOMNode(result); 149 SDK.DOMModel.highlightObjectAsDOMNode(result);
149 this._resultHighlightedAsDOM = true; 150 this._resultHighlightedAsDOM = true;
150 } 151 }
151 152
152 if (result.customPreview()) { 153 if (result.customPreview()) {
153 var customPreviewComponent = new ObjectUI.CustomPreviewComponent(resul t); 154 var customPreviewComponent = new ObjectUI.CustomPreviewComponent(resul t);
154 customPreviewComponent.expandIfPossible(); 155 customPreviewComponent.expandIfPossible();
155 popoverContentElement = customPreviewComponent.element; 156 popoverContentElement = customPreviewComponent.element;
156 } else { 157 } else {
157 popoverContentElement = createElement('div'); 158 popoverContentElement = createElement('div');
159 UI.appendStyle(popoverContentElement, 'object_ui/objectPopover.css');
158 this._titleElement = popoverContentElement.createChild('div', 'monospa ce'); 160 this._titleElement = popoverContentElement.createChild('div', 'monospa ce');
159 this._titleElement.createChild('span', 'source-frame-popover-title').t extContent = description; 161 this._titleElement.createChild('span', 'object-popover-title').textCon tent = description;
160 var section = new ObjectUI.ObjectPropertiesSection(result, '', this._l azyLinkifier()); 162 var section = new ObjectUI.ObjectPropertiesSection(result, '', this._l azyLinkifier());
161 section.element.classList.add('source-frame-popover-tree'); 163 section.element.classList.add('object-popover-tree');
162 section.titleLessMode(); 164 section.titleLessMode();
163 popoverContentElement.appendChild(section.element); 165 popoverContentElement.appendChild(section.element);
164 } 166 }
165 var popoverWidth = 300; 167 var popoverWidth = 300;
166 var popoverHeight = 250; 168 var popoverHeight = 250;
167 popover.showForAnchor(popoverContentElement, anchorElement, popoverWidth , popoverHeight); 169 popover.showForAnchor(popoverContentElement, anchorElement, popoverWidth , popoverHeight);
168 } 170 }
169 } 171 }
170 this._queryObject(element, didQueryObject.bind(this), this._popoverObjectGro up); 172 this._queryObject(element, didQueryObject.bind(this), this._popoverObjectGro up);
171 } 173 }
(...skipping 19 matching lines...) Expand all
191 * @return {!Components.Linkifier} 193 * @return {!Components.Linkifier}
192 */ 194 */
193 _lazyLinkifier() { 195 _lazyLinkifier() {
194 if (!this._linkifier) 196 if (!this._linkifier)
195 this._linkifier = new Components.Linkifier(); 197 this._linkifier = new Components.Linkifier();
196 return this._linkifier; 198 return this._linkifier;
197 } 199 }
198 }; 200 };
199 201
200 ObjectUI.ObjectPopoverHelper.MaxPopoverTextLength = 10000; 202 ObjectUI.ObjectPopoverHelper.MaxPopoverTextLength = 10000;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698