Changeset 51420 in webkit
- Timestamp:
- Nov 26, 2009 12:27:53 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r51410 r51420 1 2009-11-26 Daniel Bates <dbates@webkit.org> 2 3 Reviewed by Pavel Feldman. 4 5 https://bugs.webkit.org/show_bug.cgi?id=21554 6 7 Tests that the tooltip text for an image is its dimensions. 8 9 * inspector/elements-img-tooltip-expected.txt: Added. 10 * inspector/elements-img-tooltip.html: Added. 11 1 12 2009-11-21 Holger Hans Peter Freyther <zecke@selfish.org> 2 13 -
trunk/WebCore/ChangeLog
r51419 r51420 1 2009-11-26 Daniel Bates <dbates@webkit.org> 2 3 Reviewed by Pavel Feldman. 4 5 https://bugs.webkit.org/show_bug.cgi?id=21554 6 7 Implements support for hovering over <img> src to display the height and width of that image 8 in a tooltip. Displays both the displayable and natural dimensions of the image. 9 10 Test: inspector/elements-img-tooltip.html 11 12 * inspector/front-end/ElementsTreeOutline.js: 13 (WebInspector.ElementsTreeElement.prototype.createTooltipForImageNode): Added. 14 (WebInspector.ElementsTreeElement.prototype._updateTitle.callback): 15 (WebInspector.ElementsTreeElement.prototype._updateTitle): 16 (WebInspector.ElementsTreeElement.prototype._nodeTitleInfo): 17 * inspector/front-end/ObjectProxy.js: 18 (WebInspector.ObjectProxy.getPropertiesAsync): Added. 19 * inspector/front-end/inspector.js: 20 (WebInspector.linkifyURLAsNode): Added tooltipText argument. 21 (WebInspector.linkifyURL): Ditto. 22 1 23 2009-11-26 Kevin Ollivier <kevino@theolliviers.com> 2 24 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r50627 r51420 326 326 }, 327 327 328 createTooltipForImageNode: function(node, callback) 329 { 330 function createTooltipThenCallback(properties) 331 { 332 if (!properties) { 333 callback(); 334 return; 335 } 336 337 var tooltipText = null; 338 if (properties.offsetHeight === properties.naturalHeight && properties.offsetWidth === properties.naturalWidth) 339 tooltipText = WebInspector.UIString("%d\u00d7%d pixels", properties.offsetWidth, properties.offsetHeight); 340 else 341 tooltipText = WebInspector.UIString("%d\u00d7%d pixels (Natural: %d\u00d7%d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); 342 callback(tooltipText); 343 } 344 var objectProxy = new WebInspector.ObjectProxy(node.id); 345 WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], createTooltipThenCallback); 346 }, 347 328 348 toggleNewAttributeButton: function(visible) 329 349 { … … 788 808 return; 789 809 790 var title = this._nodeTitleInfo(this.representedObject, this.hasChildren, WebInspector.linkifyURL).title; 791 this.title = "<span class=\"highlight\">" + title + "</span>"; 792 delete this.selectionElement; 793 this.updateSelection(); 794 this._preventFollowingLinksOnDoubleClick(); 795 }, 796 797 _nodeTitleInfo: function(node, hasChildren, linkify) 810 var self = this; 811 function callback(tooltipText) 812 { 813 var title = self._nodeTitleInfo(self.representedObject, self.hasChildren, WebInspector.linkifyURL, tooltipText).title; 814 self.title = "<span class=\"highlight\">" + title + "</span>"; 815 delete self.selectionElement; 816 self.updateSelection(); 817 self._preventFollowingLinksOnDoubleClick(); 818 }; 819 820 // TODO: Replace with InjectedScriptAccess.getBasicProperties(obj, [names]). 821 if (this.representedObject.nodeName.toLowerCase() !== "img") 822 callback(); 823 else 824 this.createTooltipForImageNode(this.representedObject, callback); 825 }, 826 827 _nodeTitleInfo: function(node, hasChildren, linkify, tooltipText) 798 828 { 799 829 var info = {title: "", hasChildren: hasChildren}; … … 815 845 if (linkify && (attr.name === "src" || attr.name === "href")) { 816 846 var value = value.replace(/([\/;:\)\]\}])/g, "$1\u200B"); 817 info.title += linkify(attr.value, value, "webkit-html-attribute-value", node.nodeName.toLowerCase() == "a" );847 info.title += linkify(attr.value, value, "webkit-html-attribute-value", node.nodeName.toLowerCase() == "a", tooltipText); 818 848 } else { 819 849 var value = value.escapeHTML(); -
trunk/WebCore/inspector/front-end/ObjectProxy.js
r48601 r51420 46 46 } 47 47 48 WebInspector.ObjectProxy.getPropertiesAsync = function(objectProxy, propertiesToQueryFor, callback) 49 { 50 function createPropertiesMapThenCallback(propertiesPayload) 51 { 52 if (!propertiesPayload) { 53 callback(); 54 return; 55 } 56 57 var result = []; 58 for (var i = 0; i < propertiesPayload.length; ++i) 59 if (propertiesToQueryFor.indexOf(propertiesPayload[i].name) !== -1) 60 result[propertiesPayload[i].name] = propertiesPayload[i].value.description; 61 callback(result); 62 }; 63 InjectedScriptAccess.getProperties(objectProxy, true, createPropertiesMapThenCallback); 64 } 65 48 66 WebInspector.ObjectPropertyProxy = function(name, value) 49 67 { -
trunk/WebCore/inspector/front-end/inspector.js
r51250 r51420 1499 1499 } 1500 1500 1501 WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal )1501 WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, tooltipText) 1502 1502 { 1503 1503 if (!linkText) … … 1509 1509 a.href = url; 1510 1510 a.className = classes; 1511 a.title = url;1511 a.title = tooltipText || url; 1512 1512 a.target = "_blank"; 1513 1513 a.textContent = linkText; … … 1516 1516 } 1517 1517 1518 WebInspector.linkifyURL = function(url, linkText, classes, isExternal )1518 WebInspector.linkifyURL = function(url, linkText, classes, isExternal, tooltipText) 1519 1519 { 1520 1520 // Use the DOM version of this function so as to avoid needing to escape attributes. 1521 1521 // FIXME: Get rid of linkifyURL entirely. 1522 return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal ).outerHTML;1522 return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal, tooltipText).outerHTML; 1523 1523 } 1524 1524
Note: See TracChangeset
for help on using the changeset viewer.