Changeset 57003 in webkit
- Timestamp:
- Apr 2, 2010 8:43:08 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r57000 r57003 1 2010-04-01 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: start editing DOM and styles on click-and-pause. 6 7 https://bugs.webkit.org/show_bug.cgi?id=36965 8 9 * inspector/front-end/ElementsTreeOutline.js: 10 (WebInspector.ElementsTreeElement.prototype.onattach): 11 (WebInspector.ElementsTreeElement.prototype.selectOnMouseDown): 12 (WebInspector.ElementsTreeElement.prototype.ondblclick): 13 (WebInspector.ElementsTreeElement.prototype._handleClickAndPause): 14 (WebInspector.ElementsTreeElement.prototype._startEditingTarget): 15 (WebInspector.ElementsTreeElement.prototype._startEditingAttribute): 16 (WebInspector.ElementsTreeElement.prototype._startEditingTextNode): 17 (WebInspector.ElementsTreeElement.prototype._startEditingTagName): 18 (WebInspector.ElementsTreeElement.prototype._startEditingAsHTML): 19 * inspector/front-end/StylesSidebarPane.js: 20 (WebInspector.StylePropertiesSection.prototype._handleEmptySpaceDoubleClick): 21 (WebInspector.StylePropertiesSection.prototype._handleSelectorClick): 22 (WebInspector.StylePropertiesSection.prototype._handleSelectorClickAndPause): 23 (WebInspector.StylePropertiesSection.prototype._handleSelectorDoubleClick): 24 (WebInspector.StylePropertiesSection.prototype._startEditingOnMouseEvent): 25 (WebInspector.StylePropertyTreeElement.prototype.onattach): 26 (WebInspector.StylePropertyTreeElement.prototype): 27 * inspector/front-end/inspector.css: 28 * inspector/front-end/inspector.js: 29 * inspector/front-end/treeoutline.js: 30 (TreeElement.prototype._attach): 31 (TreeElement.treeElementMouseDown): 32 (TreeElement.prototype.selectOnMouseDown): 33 1 34 2010-04-02 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2 35 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r56727 r57003 471 471 onattach: function() 472 472 { 473 this.listItemElement.addEventListener("mousedown", this.onmousedown.bind(this), false);474 475 473 if (this._hovered) { 476 474 this.updateSelection(); … … 688 686 }, 689 687 690 onmousedown: function(event) 691 { 688 selectOnMouseDown: function(event) 689 { 690 TreeElement.prototype.selectOnMouseDown.call(this, event); 691 692 692 if (this._editing) 693 return;694 695 if (this.isEventWithinDisclosureTriangle(event))696 693 return; 697 694 … … 711 708 return; 712 709 713 if (this._startEditing FromEvent(event))710 if (this._startEditingTarget(event.target)) 714 711 return; 715 712 … … 733 730 }, 734 731 735 _startEditing FromEvent: function(event)732 _startEditingTarget: function(eventTarget) 736 733 { 737 734 if (this.treeOutline.focusedDOMNode != this.representedObject) … … 741 738 return false; 742 739 743 var textNode = event .target.enclosingNodeOrSelfWithClass("webkit-html-text-node");740 var textNode = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-text-node"); 744 741 if (textNode) 745 742 return this._startEditingTextNode(textNode); 746 743 747 var attribute = event .target.enclosingNodeOrSelfWithClass("webkit-html-attribute");744 var attribute = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-attribute"); 748 745 if (attribute) 749 return this._startEditingAttribute(attribute, event .target);750 751 var tagName = event .target.enclosingNodeOrSelfWithClass("webkit-html-tag-name");746 return this._startEditingAttribute(attribute, eventTarget); 747 748 var tagName = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-tag-name"); 752 749 if (tagName) 753 750 return this._startEditingTagName(tagName); 754 751 755 var newAttribute = event .target.enclosingNodeOrSelfWithClass("add-attribute");752 var newAttribute = eventTarget.enclosingNodeOrSelfWithClass("add-attribute"); 756 753 if (newAttribute) 757 754 return this._addNewAttribute(); … … 864 861 removeZeroWidthSpaceRecursive(attribute); 865 862 866 this._editing = true; 867 868 WebInspector.startEditing(attribute, this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName); 863 this._editing = WebInspector.startEditing(attribute, this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName); 869 864 window.getSelection().setBaseAndExtent(elementForSelection, 0, elementForSelection, 1); 870 865 … … 877 872 return true; 878 873 879 this._editing = true; 880 881 WebInspector.startEditing(textNode, this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this)); 874 this._editing = WebInspector.startEditing(textNode, this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this)); 882 875 window.getSelection().setBaseAndExtent(textNode, 0, textNode, 1); 883 876 … … 900 893 return true; 901 894 902 this._editing = true;903 904 895 var closingTagElement = this._distinctClosingTagElement(); 905 896 … … 924 915 tagNameElement.addEventListener('keyup', keyupListener, false); 925 916 926 WebInspector.startEditing(tagNameElement, editingComitted.bind(this), editingCancelled.bind(this), tagName);917 this._editing = WebInspector.startEditing(tagNameElement, editingComitted.bind(this), editingCancelled.bind(this), tagName); 927 918 window.getSelection().setBaseAndExtent(tagNameElement, 0, tagNameElement, 1); 928 919 return true; … … 933 924 if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement)) 934 925 return true; 935 936 this._editing = true;937 926 938 927 this._htmlEditElement = document.createElement("div"); … … 980 969 } 981 970 982 WebInspector.startEditing(this._htmlEditElement, commit.bind(this), dispose.bind(this), null, true);971 this._editing = WebInspector.startEditing(this._htmlEditElement, commit.bind(this), dispose.bind(this), null, true); 983 972 }, 984 973 … … 1255 1244 var node = this.representedObject; 1256 1245 var result = "<span class=\"webkit-html-tag" + (isClosingTag && isDistinctTreeElement ? " close" : "") + "\"><"; 1257 result += "<span class=\"webkit-html-tag-name\">" + (isClosingTag ? "/" : "") + tagName + "</span>";1246 result += "<span " + (isClosingTag ? "" : "class=\"webkit-html-tag-name\"") + ">" + (isClosingTag ? "/" : "") + tagName + "</span>"; 1258 1247 if (!isClosingTag && node.hasAttributes()) { 1259 1248 for (var i = 0; i < node.attributes.length; ++i) { -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r56846 r57003 543 543 WebInspector.PropertiesSection.call(this, styleRule.selectorText); 544 544 545 this.titleElement.addEventListener("dblclick", this._ dblclickSelector.bind(this), false);546 this.titleElement.addEventListener("click", this._ clickSelector.bind(this), false);547 this.element.addEventListener("dblclick", this._ dblclickEmptySpace.bind(this), false);545 this.titleElement.addEventListener("dblclick", this._handleSelectorDoubleClick.bind(this), false); 546 this.titleElement.addEventListener("click", this._handleSelectorClick.bind(this), false); 547 this.element.addEventListener("dblclick", this._handleEmptySpaceDoubleClick.bind(this), false); 548 548 549 549 this.styleRule = styleRule; … … 562 562 563 563 this._usedProperties = usedProperties; 564 565 if (this.rule) 566 this.titleElement.addStyleClass("styles-selector"); 564 567 565 568 if (computedStyle) { … … 763 766 }, 764 767 765 _ dblclickEmptySpace: function(event)768 _handleEmptySpaceDoubleClick: function(event) 766 769 { 767 770 if (event.target.hasStyleClass("header")) { … … 773 776 }, 774 777 775 _ clickSelector: function(event)778 _handleSelectorClick: function(event) 776 779 { 777 780 event.stopPropagation(); 778 781 }, 779 782 780 _dblclickSelector: function(event) 783 _handleSelectorDoubleClick: function(event) 784 { 785 this._startEditingOnMouseEvent(); 786 event.stopPropagation(); 787 }, 788 789 _startEditingOnMouseEvent: function() 781 790 { 782 791 if (!this.editable) … … 793 802 794 803 this.startEditingSelector(); 795 event.stopPropagation();796 804 }, 797 805 -
trunk/WebCore/inspector/front-end/audits.css
r55999 r57003 218 218 font-size: 11px; 219 219 line-height: 14px; 220 -webkit-user-select: text; 220 221 } 221 222 -
trunk/WebCore/inspector/front-end/inspector.css
r56772 r57003 3928 3928 } 3929 3929 3930 .styles-selector { 3931 cursor: text; 3932 -webkit-user-select: text; 3933 } 3934 3930 3935 .workers-list { 3931 3936 list-style: none; -
trunk/WebCore/inspector/front-end/inspector.js
r56840 r57003 1897 1897 1898 1898 WebInspector.currentFocusElement = element; 1899 return { 1900 cancel: editingCancelled.bind(element), 1901 commit: editingCommitted.bind(element) 1902 }; 1899 1903 } 1900 1904 -
trunk/WebCore/inspector/front-end/treeoutline.js
r56683 r57003 568 568 this._listItemNode.addStyleClass("selected"); 569 569 570 this._listItemNode.addEventListener("mousedown", TreeElement.treeElement Selected, false);570 this._listItemNode.addEventListener("mousedown", TreeElement.treeElementMouseDown, false); 571 571 this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false); 572 572 this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false); … … 596 596 } 597 597 598 TreeElement.treeElement Selected= function(event)598 TreeElement.treeElementMouseDown = function(event) 599 599 { 600 600 var element = event.currentTarget; … … 605 605 return; 606 606 607 element.treeElement.select ();607 element.treeElement.selectOnMouseDown(event); 608 608 } 609 609 … … 768 768 } 769 769 770 TreeElement.prototype.selectOnMouseDown = function(event) 771 { 772 this.select(); 773 } 774 770 775 TreeElement.prototype.select = function(supressOnSelect) 771 776 {
Note: See TracChangeset
for help on using the changeset viewer.