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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 2697603006: DevTools: Fix an exception on adding watch expression. (Closed)
Patch Set: Created 3 years, 10 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 function postKeyDownFinishHandler(event) { 632 function postKeyDownFinishHandler(event) {
633 UI.handleElementValueModifications(event, attribute); 633 UI.handleElementValueModifications(event, attribute);
634 return ''; 634 return '';
635 } 635 }
636 636
637 if (!attributeValueElement.textContent.asParsedURL()) 637 if (!attributeValueElement.textContent.asParsedURL())
638 config.setPostKeydownFinishHandler(postKeyDownFinishHandler); 638 config.setPostKeydownFinishHandler(postKeyDownFinishHandler);
639 639
640 this._editing = UI.InplaceEditor.startEditing(attribute, config); 640 this._editing = UI.InplaceEditor.startEditing(attribute, config);
641 641
642 this.listItemElement.getComponentSelection().setBaseAndExtent(elementForSele ction, 0, elementForSelection, 1); 642 this.listItemElement.getComponentSelection().selectAllChildren(elementForSel ection);
643 643
644 return true; 644 return true;
645 } 645 }
646 646
647 /** 647 /**
648 * @param {!Element} textNodeElement 648 * @param {!Element} textNodeElement
649 */ 649 */
650 _startEditingTextNode(textNodeElement) { 650 _startEditingTextNode(textNodeElement) {
651 if (UI.isBeingEdited(textNodeElement)) 651 if (UI.isBeingEdited(textNodeElement))
652 return true; 652 return true;
653 653
654 var textNode = this._node; 654 var textNode = this._node;
655 // We only show text nodes inline in elements if the element only 655 // We only show text nodes inline in elements if the element only
656 // has a single child, and that child is a text node. 656 // has a single child, and that child is a text node.
657 if (textNode.nodeType() === Node.ELEMENT_NODE && textNode.firstChild) 657 if (textNode.nodeType() === Node.ELEMENT_NODE && textNode.firstChild)
658 textNode = textNode.firstChild; 658 textNode = textNode.firstChild;
659 659
660 var container = textNodeElement.enclosingNodeOrSelfWithClass('webkit-html-te xt-node'); 660 var container = textNodeElement.enclosingNodeOrSelfWithClass('webkit-html-te xt-node');
661 if (container) 661 if (container)
662 container.textContent = textNode.nodeValue(); // Strip the CSS or JS high lighting if present. 662 container.textContent = textNode.nodeValue(); // Strip the CSS or JS high lighting if present.
663 var config = new UI.InplaceEditor.Config( 663 var config = new UI.InplaceEditor.Config(
664 this._textNodeEditingCommitted.bind(this, textNode), this._editingCancel led.bind(this)); 664 this._textNodeEditingCommitted.bind(this, textNode), this._editingCancel led.bind(this));
665 this._editing = UI.InplaceEditor.startEditing(textNodeElement, config); 665 this._editing = UI.InplaceEditor.startEditing(textNodeElement, config);
666 this.listItemElement.getComponentSelection().setBaseAndExtent(textNodeElemen t, 0, textNodeElement, 1); 666 this.listItemElement.getComponentSelection().selectAllChildren(textNodeEleme nt);
667 667
668 return true; 668 return true;
669 } 669 }
670 670
671 /** 671 /**
672 * @param {!Element=} tagNameElement 672 * @param {!Element=} tagNameElement
673 */ 673 */
674 _startEditingTagName(tagNameElement) { 674 _startEditingTagName(tagNameElement) {
675 if (!tagNameElement) { 675 if (!tagNameElement) {
676 tagNameElement = this.listItemElement.getElementsByClassName('webkit-html- tag-name')[0]; 676 tagNameElement = this.listItemElement.getElementsByClassName('webkit-html- tag-name')[0];
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 */ 710 */
711 function editingCancelled() { 711 function editingCancelled() {
712 tagNameElement.removeEventListener('keyup', keyupListener, false); 712 tagNameElement.removeEventListener('keyup', keyupListener, false);
713 this._editingCancelled.apply(this, arguments); 713 this._editingCancelled.apply(this, arguments);
714 } 714 }
715 715
716 tagNameElement.addEventListener('keyup', keyupListener, false); 716 tagNameElement.addEventListener('keyup', keyupListener, false);
717 717
718 var config = new UI.InplaceEditor.Config(editingComitted.bind(this), editing Cancelled.bind(this), tagName); 718 var config = new UI.InplaceEditor.Config(editingComitted.bind(this), editing Cancelled.bind(this), tagName);
719 this._editing = UI.InplaceEditor.startEditing(tagNameElement, config); 719 this._editing = UI.InplaceEditor.startEditing(tagNameElement, config);
720 this.listItemElement.getComponentSelection().setBaseAndExtent(tagNameElement , 0, tagNameElement, 1); 720 this.listItemElement.getComponentSelection().selectAllChildren(tagNameElemen t);
721 return true; 721 return true;
722 } 722 }
723 723
724 /** 724 /**
725 * @param {function(string, string)} commitCallback 725 * @param {function(string, string)} commitCallback
726 * @param {function()} disposeCallback 726 * @param {function()} disposeCallback
727 * @param {?Protocol.Error} error 727 * @param {?Protocol.Error} error
728 * @param {string} initialValue 728 * @param {string} initialValue
729 */ 729 */
730 _startEditingAsHTML(commitCallback, disposeCallback, error, initialValue) { 730 _startEditingAsHTML(commitCallback, disposeCallback, error, initialValue) {
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 1566
1567 // A union of HTML4 and HTML5-Draft elements that explicitly 1567 // A union of HTML4 and HTML5-Draft elements that explicitly
1568 // or implicitly (for HTML5) forbid the closing tag. 1568 // or implicitly (for HTML5) forbid the closing tag.
1569 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ 1569 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([
1570 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', 1570 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr',
1571 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' 1571 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'
1572 ]); 1572 ]);
1573 1573
1574 // These tags we do not allow editing their tag name. 1574 // These tags we do not allow editing their tag name.
1575 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); 1575 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] );
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698