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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/DOMModel.js

Issue 2932543002: DevTools: reveal and highlight dom nodes when searching in elements panel. (Closed)
Patch Set: Created 3 years, 6 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) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 highlight(mode, objectId) { 856 highlight(mode, objectId) {
857 this._domModel.overlayModel().highlightDOMNode(this.id, mode, undefined, obj ectId); 857 this._domModel.overlayModel().highlightDOMNode(this.id, mode, undefined, obj ectId);
858 } 858 }
859 859
860 highlightForTwoSeconds() { 860 highlightForTwoSeconds() {
861 this._domModel.overlayModel().highlightDOMNodeForTwoSeconds(this.id); 861 this._domModel.overlayModel().highlightDOMNodeForTwoSeconds(this.id);
862 } 862 }
863 863
864 /** 864 /**
865 * @param {string=} objectGroup 865 * @param {string=} objectGroup
866 * @param {function(?SDK.RemoteObject)=} callback
867 */
868 resolveToObject(objectGroup, callback) {
869 this.resolveToObjectPromise(objectGroup).then(object => callback && callback (object));
870 }
871
872 /**
873 * @param {string=} objectGroup
874 * @return {!Promise<?SDK.RemoteObject>} 866 * @return {!Promise<?SDK.RemoteObject>}
875 */ 867 */
876 async resolveToObjectPromise(objectGroup) { 868 async resolveToObject(objectGroup) {
877 var object = await this._agent.resolveNode(this.id, objectGroup); 869 var object = await this._agent.resolveNode(this.id, objectGroup);
878 return object && this._domModel._runtimeModel.createRemoteObject(object); 870 return object && this._domModel._runtimeModel.createRemoteObject(object);
879 } 871 }
880 872
881 /** 873 /**
882 * @return {!Promise<?Protocol.DOM.BoxModel>} 874 * @return {!Promise<?Protocol.DOM.BoxModel>}
883 */ 875 */
884 boxModel() { 876 boxModel() {
885 return this._agent.getBoxModel(this.id); 877 return this._agent.getBoxModel(this.id);
886 } 878 }
(...skipping 18 matching lines...) Expand all
905 */ 897 */
906 enclosingElementOrSelf() { 898 enclosingElementOrSelf() {
907 var node = this; 899 var node = this;
908 if (node && node.nodeType() === Node.TEXT_NODE && node.parentNode) 900 if (node && node.nodeType() === Node.TEXT_NODE && node.parentNode)
909 node = node.parentNode; 901 node = node.parentNode;
910 902
911 if (node && node.nodeType() !== Node.ELEMENT_NODE) 903 if (node && node.nodeType() !== Node.ELEMENT_NODE)
912 node = null; 904 node = null;
913 return node; 905 return node;
914 } 906 }
907
908 async scrollIntoView() {
caseq 2017/06/07 21:22:29 scrollIntoViewAndHighlight()?
909 var node = this.enclosingElementOrSelf();
caseq 2017/06/07 21:22:29 var element =
910 var object = await node.resolveToObject('');
911 if (object)
912 object.callFunction(scrollIntoView);
913 object.release();
914 node.highlightForTwoSeconds();
915
916 /**
917 * @suppressReceiverCheck
918 * @this {!Element}
919 */
920 function scrollIntoView() {
921 this.scrollIntoViewIfNeeded(true);
922 }
923 }
915 }; 924 };
916 925
917 /** 926 /**
918 * @enum {string} 927 * @enum {string}
919 */ 928 */
920 SDK.DOMNode.PseudoElementNames = { 929 SDK.DOMNode.PseudoElementNames = {
921 Before: 'before', 930 Before: 'before',
922 After: 'after' 931 After: 'after'
923 }; 932 };
924 933
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 1702
1694 /** 1703 /**
1695 * @override 1704 * @override
1696 * @param {!Protocol.DOM.NodeId} insertionPointId 1705 * @param {!Protocol.DOM.NodeId} insertionPointId
1697 * @param {!Array.<!Protocol.DOM.BackendNode>} distributedNodes 1706 * @param {!Array.<!Protocol.DOM.BackendNode>} distributedNodes
1698 */ 1707 */
1699 distributedNodesUpdated(insertionPointId, distributedNodes) { 1708 distributedNodesUpdated(insertionPointId, distributedNodes) {
1700 this._domModel._distributedNodesUpdated(insertionPointId, distributedNodes); 1709 this._domModel._distributedNodesUpdated(insertionPointId, distributedNodes);
1701 } 1710 }
1702 }; 1711 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698