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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js

Issue 2782773002: [DevTools] Remove SDKModels' fromTarget methods (Closed)
Patch Set: addressed review comments Created 3 years, 8 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 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 /** 147 /**
148 * @param {!SDK.Target} target 148 * @param {!SDK.Target} target
149 * @param {string} originalImageURL 149 * @param {string} originalImageURL
150 * @param {boolean} showDimensions 150 * @param {boolean} showDimensions
151 * @param {!Object=} precomputedFeatures 151 * @param {!Object=} precomputedFeatures
152 * @return {!Promise<?Element>} 152 * @return {!Promise<?Element>}
153 */ 153 */
154 Components.DOMPresentationUtils.buildImagePreviewContents = function( 154 Components.DOMPresentationUtils.buildImagePreviewContents = function(
155 target, originalImageURL, showDimensions, precomputedFeatures) { 155 target, originalImageURL, showDimensions, precomputedFeatures) {
156 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(target); 156 var resourceTreeModel = target.model(SDK.ResourceTreeModel);
157 if (!resourceTreeModel) 157 if (!resourceTreeModel)
158 return Promise.resolve(/** @type {?Element} */ (null)); 158 return Promise.resolve(/** @type {?Element} */ (null));
159 var resource = resourceTreeModel.resourceForURL(originalImageURL); 159 var resource = resourceTreeModel.resourceForURL(originalImageURL);
160 var imageURL = originalImageURL; 160 var imageURL = originalImageURL;
161 if (!isImageResource(resource) && precomputedFeatures && precomputedFeatures.c urrentSrc) { 161 if (!isImageResource(resource) && precomputedFeatures && precomputedFeatures.c urrentSrc) {
162 imageURL = precomputedFeatures.currentSrc; 162 imageURL = precomputedFeatures.currentSrc;
163 resource = resourceTreeModel.resourceForURL(imageURL); 163 resource = resourceTreeModel.resourceForURL(imageURL);
164 } 164 }
165 if (!isImageResource(resource)) 165 if (!isImageResource(resource))
166 return Promise.resolve(/** @type {?Element} */ (null)); 166 return Promise.resolve(/** @type {?Element} */ (null));
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 635
636 /** 636 /**
637 * @override 637 * @override
638 * @param {!SDK.DOMNode} node 638 * @param {!SDK.DOMNode} node
639 * @return {?{title: string, color: string}} 639 * @return {?{title: string, color: string}}
640 */ 640 */
641 decorate(node) { 641 decorate(node) {
642 return {title: this._title, color: this._color}; 642 return {title: this._title, color: this._color};
643 } 643 }
644 }; 644 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698