Changeset 31009 in webkit
- Timestamp:
- Mar 12, 2008 4:00:00 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31008 r31009 1 2008-03-12 Adam Roben <aroben@apple.com> 2 3 Part of Bug 17224: DOM nodes/attributes should be editable 4 5 <http://bugs.webkit.org/show_bug.cgi?id=17224> 6 <rdar://problem/5732825> 7 8 We now start editing if the user single-clicks on an attribute, 9 attribute value, or text node while the parent element is selected. 10 Previously, we started editing on double-click regardless of the 11 selection state of the element. 12 13 URLs in the DOM tree are now followed on Alt/Option-click, rather than 14 on just click. 15 16 Reviewed by Tim. 17 18 * English.lproj/InspectorLocalizedStrings.js: Added four new localized 19 strings. 20 * page/inspector/DocumentPanel.js: 21 (WebInspector.DOMNodeTreeElement.onattach): Call new 22 _makeURLSActivateOnModifiedClick. 23 (WebInspector.DOMNodeTreeElement._makeURLsActivateOnModifiedClick): 24 Added. Changes the tooltip of each link in this element to indicate 25 that Alt/Option-click will follow the URL, and sets the 26 followOnAltClick property on each link. 27 (WebInspector.DOMNodeTreeElement.onselect): Mark that we're being 28 selected. 29 (WebInspector.DOMNodeTreeElement.onmousedown): If we're not currently 30 being selected, start editing. 31 (WebInspector.DOMNodeTreeElement.ondblclick): We no longer start 32 editing here. We block re-rooting of the tree if we're currently 33 editing. 34 (WebInspector.DOMNodeTreeElement._startEditing): 35 - Don't do anything if we're not focused 36 - Pass the event down to _startEditingAttribute. 37 (WebInspector.DOMNodeTreeElement._startEditingAttribute): Don't do 38 anything if the event target is a URL and the Alt/Option key is 39 pressed -- in this case we want to follow the link. 40 (WebInspector.DOMNodeTreeElement._updateTitle): Call 41 _makeURLsActivateOnClick again since the anchor elements have all been 42 recreated. 43 * page/inspector/inspector.js: 44 (WebInspector.documentClick): If the anchor as a followOnAltClick 45 property and the Alt/Option key is not pressed, do nothing. 46 1 47 2008-03-12 Ada Chan <adachan@apple.com> 2 48 -
trunk/WebCore/English.lproj/InspectorLocalizedStrings.js
r28918 r31009 5 5 "(text)": "(text)", 6 6 "(whitespace)": "(whitespace)", 7 "Alt-click to visit %s.": "Alt-click to visit %s.", 8 "Alt-click to show %s.": "Alt-click to show %s.", 7 9 "An error occurred trying to\nread the “%s” table.": "An error occurred trying to\nread the “%s” table.", 8 10 "An unexpected error %s occured.": "An unexpected error %s occured.", … … 19 21 "Metrics": "Metrics", 20 22 "Network": "Network", 23 "Option-click to visit %s.": "Option-click to visit %s.", 24 "Option-click to show %s.": "Option-click to show %s.", 21 25 "Properties": "Properties", 22 26 "Prototype": "Prototype", -
trunk/WebCore/page/inspector/DocumentPanel.js
r30966 r31009 770 770 { 771 771 this.listItemElement.addEventListener("mousedown", this.onmousedown.bind(this), false); 772 773 this._makeURLsActivateOnModifiedClick(); 774 }, 775 776 _makeURLsActivateOnModifiedClick: function() 777 { 778 var links = this.listItemElement.querySelectorAll("li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-external-link, li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-resource-link"); 779 if (!links) 780 return; 781 782 var isMac = InspectorController.platform().indexOf("mac") == 0; 783 784 for (var i = 0; i < links.length; ++i) { 785 var link = links[i]; 786 var isExternal = link.hasStyleClass("webkit-html-external-link"); 787 var href = link.getAttribute("href"); 788 var title; 789 if (isMac) { 790 if (isExternal) 791 title = WebInspector.UIString("Option-click to visit %s.", href); 792 else 793 title = WebInspector.UIString("Option-click to show %s.", href); 794 } else { 795 if (isExternal) 796 title = WebInspector.UIString("Alt-click to visit %s.", href); 797 else 798 title = WebInspector.UIString("Alt-click to show %s.", href); 799 } 800 link.setAttribute("title", title); 801 link.followOnAltClick = true; 802 } 772 803 }, 773 804 … … 812 843 onselect: function() 813 844 { 845 this._selectedByCurrentMouseDown = true; 814 846 this.treeOutline.panel.focusedDOMNode = this.representedObject; 815 847 this.updateSelection(); … … 820 852 if (this._editing) 821 853 return; 854 855 if (this._selectedByCurrentMouseDown) 856 delete this._selectedByCurrentMouseDown; 857 else if (this._startEditing(event)) { 858 event.preventDefault(); 859 return; 860 } 822 861 823 862 // Prevent selecting the nearest word on double click. … … 828 867 ondblclick: function(treeElement, event) 829 868 { 830 if (this._ startEditing(event))869 if (this._editing) 831 870 return; 832 871 … … 841 880 _startEditing: function(event) 842 881 { 882 if (this.treeOutline.panel.focusedDOMNode != this.representedObject) 883 return; 884 843 885 if (this.representedObject.nodeType != Node.ELEMENT_NODE && this.representedObject.nodeType != Node.TEXT_NODE) 844 886 return false; … … 850 892 var attribute = event.target.firstParentOrSelfWithClass("webkit-html-attribute"); 851 893 if (attribute) 852 return this._startEditingAttribute(attribute );894 return this._startEditingAttribute(attribute, event); 853 895 854 896 return false; 855 897 }, 856 898 857 _startEditingAttribute: function(attribute )899 _startEditingAttribute: function(attribute, event) 858 900 { 859 901 if (WebInspector.isBeingEdited(attribute)) … … 862 904 var attributeNameElement = attribute.getElementsByClassName("webkit-html-attribute-name")[0]; 863 905 if (!attributeNameElement) 906 return false; 907 908 var isURL = event.target.firstParentOrSelfWithClass("webkit-html-external-link") || event.target.firstParentOrSelfWithClass("webkit-html-resource-link"); 909 if (isURL && event.altKey) 864 910 return false; 865 911 … … 958 1004 delete this.selectionElement; 959 1005 this.updateSelection(); 1006 this._makeURLsActivateOnModifiedClick(); 960 1007 }, 961 1008 } -
trunk/WebCore/page/inspector/inspector.js
r30931 r31009 329 329 { 330 330 var anchor = event.target.firstParentOrSelfWithNodeName("a"); 331 if (!anchor || !anchor.hasStyleClass("webkit-html-resource-link")) 331 if (!anchor) 332 return; 333 334 if (anchor.followOnAltClick && !event.altKey) { 335 event.preventDefault(); 336 return; 337 } 338 339 if (!anchor.hasStyleClass("webkit-html-resource-link")) 332 340 return; 333 341
Note: See TracChangeset
for help on using the changeset viewer.