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

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

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 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 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 /** 153 /**
154 * @param {!WebInspector.Target} target 154 * @param {!WebInspector.Target} target
155 * @param {string} originalImageURL 155 * @param {string} originalImageURL
156 * @param {boolean} showDimensions 156 * @param {boolean} showDimensions
157 * @param {function(!Element=)} userCallback 157 * @param {function(!Element=)} userCallback
158 * @param {!Object=} precomputedFeatures 158 * @param {!Object=} precomputedFeatures
159 */ 159 */
160 WebInspector.DOMPresentationUtils.buildImagePreviewContents = function(target, o riginalImageURL, showDimensions, userCallback, precomputedFeatures) 160 WebInspector.DOMPresentationUtils.buildImagePreviewContents = function(target, o riginalImageURL, showDimensions, userCallback, precomputedFeatures)
161 { 161 {
162 var resource = target.resourceTreeModel.resourceForURL(originalImageURL); 162 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
163 if (!resourceTreeModel) {
164 userCallback();
165 return;
166 }
167 var resource = resourceTreeModel.resourceForURL(originalImageURL);
163 var imageURL = originalImageURL; 168 var imageURL = originalImageURL;
164 if (!isImageResource(resource) && precomputedFeatures && precomputedFeatures .currentSrc) { 169 if (!isImageResource(resource) && precomputedFeatures && precomputedFeatures .currentSrc) {
165 imageURL = precomputedFeatures.currentSrc; 170 imageURL = precomputedFeatures.currentSrc;
166 resource = target.resourceTreeModel.resourceForURL(imageURL); 171 resource = resourceTreeModel.resourceForURL(imageURL);
167 } 172 }
168 if (!isImageResource(resource)) { 173 if (!isImageResource(resource)) {
169 userCallback(); 174 userCallback();
170 return; 175 return;
171 } 176 }
172 177
173 var imageElement = createElement("img"); 178 var imageElement = createElement("img");
174 imageElement.addEventListener("load", buildContent, false); 179 imageElement.addEventListener("load", buildContent, false);
175 imageElement.addEventListener("error", errorCallback, false); 180 imageElement.addEventListener("error", errorCallback, false);
176 resource.populateImageSource(imageElement); 181 resource.populateImageSource(imageElement);
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 /** 658 /**
654 * @override 659 * @override
655 * @param {!WebInspector.DOMNode} node 660 * @param {!WebInspector.DOMNode} node
656 * @return {?{title: string, color: string}} 661 * @return {?{title: string, color: string}}
657 */ 662 */
658 decorate: function(node) 663 decorate: function(node)
659 { 664 {
660 return { title: this._title, color: this._color }; 665 return { title: this._title, color: this._color };
661 } 666 }
662 } 667 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698