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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 2712513002: DevTools: extract ObjectUI module from Components (Closed)
Patch Set: fix build.gn 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 */ 37 */
38 constructor(uiSourceCode) { 38 constructor(uiSourceCode) {
39 super(uiSourceCode); 39 super(uiSourceCode);
40 this._debuggerSourceCode = uiSourceCode; 40 this._debuggerSourceCode = uiSourceCode;
41 41
42 this._scriptsPanel = Sources.SourcesPanel.instance(); 42 this._scriptsPanel = Sources.SourcesPanel.instance();
43 this._breakpointManager = Bindings.breakpointManager; 43 this._breakpointManager = Bindings.breakpointManager;
44 if (uiSourceCode.project().type() === Workspace.projectTypes.Debugger) 44 if (uiSourceCode.project().type() === Workspace.projectTypes.Debugger)
45 this.element.classList.add('source-frame-debugger-script'); 45 this.element.classList.add('source-frame-debugger-script');
46 46
47 this._popoverHelper = new Components.ObjectPopoverHelper( 47 this._popoverHelper = new ObjectUI.ObjectPopoverHelper(
48 this._scriptsPanel.element, this._getPopoverAnchor.bind(this), this._res olveObjectForPopover.bind(this), 48 this._scriptsPanel.element, this._getPopoverAnchor.bind(this), this._res olveObjectForPopover.bind(this),
49 this._onHidePopover.bind(this), true); 49 this._onHidePopover.bind(this), true);
50 this._popoverHelper.setTimeout(250, 250); 50 this._popoverHelper.setTimeout(250, 250);
51 51
52 this.textEditor.element.addEventListener('keydown', this._onKeyDown.bind(thi s), true); 52 this.textEditor.element.addEventListener('keydown', this._onKeyDown.bind(thi s), true);
53 53
54 this.textEditor.addEventListener( 54 this.textEditor.addEventListener(
55 SourceFrame.SourcesTextEditor.Events.GutterClick, this._handleGutterClic k.bind(this), this); 55 SourceFrame.SourcesTextEditor.Events.GutterClick, this._handleGutterClic k.bind(this), this);
56 56
57 this._breakpointManager.addEventListener( 57 this._breakpointManager.addEventListener(
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 this.textEditor.operation(this._renderDecorations.bind(this, valuesMap, name sPerLine, fromLine, toLine)); 648 this.textEditor.operation(this._renderDecorations.bind(this, valuesMap, name sPerLine, fromLine, toLine));
649 } 649 }
650 650
651 /** 651 /**
652 * @param {!Map.<string,!SDK.RemoteObject>} valuesMap 652 * @param {!Map.<string,!SDK.RemoteObject>} valuesMap
653 * @param {!Map.<number, !Set<string>>} namesPerLine 653 * @param {!Map.<number, !Set<string>>} namesPerLine
654 * @param {number} fromLine 654 * @param {number} fromLine
655 * @param {number} toLine 655 * @param {number} toLine
656 */ 656 */
657 _renderDecorations(valuesMap, namesPerLine, fromLine, toLine) { 657 _renderDecorations(valuesMap, namesPerLine, fromLine, toLine) {
658 var formatter = new Components.RemoteObjectPreviewFormatter(); 658 var formatter = new ObjectUI.RemoteObjectPreviewFormatter();
659 for (var i = fromLine; i < toLine; ++i) { 659 for (var i = fromLine; i < toLine; ++i) {
660 var names = namesPerLine.get(i); 660 var names = namesPerLine.get(i);
661 var oldWidget = this._valueWidgets.get(i); 661 var oldWidget = this._valueWidgets.get(i);
662 if (!names) { 662 if (!names) {
663 if (oldWidget) { 663 if (oldWidget) {
664 this._valueWidgets.delete(i); 664 this._valueWidgets.delete(i);
665 this.textEditor.removeDecoration(oldWidget, i); 665 this.textEditor.removeDecoration(oldWidget, i);
666 } 666 }
667 continue; 667 continue;
668 } 668 }
(...skipping 16 matching lines...) Expand all
685 widget.createTextChild(', '); 685 widget.createTextChild(', ');
686 var nameValuePair = widget.createChild('span'); 686 var nameValuePair = widget.createChild('span');
687 widget.__nameToToken.set(name, nameValuePair); 687 widget.__nameToToken.set(name, nameValuePair);
688 nameValuePair.createTextChild(name + ' = '); 688 nameValuePair.createTextChild(name + ' = ');
689 var value = valuesMap.get(name); 689 var value = valuesMap.get(name);
690 var propertyCount = value.preview ? value.preview.properties.length : 0; 690 var propertyCount = value.preview ? value.preview.properties.length : 0;
691 var entryCount = value.preview && value.preview.entries ? value.preview. entries.length : 0; 691 var entryCount = value.preview && value.preview.entries ? value.preview. entries.length : 0;
692 if (value.preview && propertyCount + entryCount < 10) { 692 if (value.preview && propertyCount + entryCount < 10) {
693 formatter.appendObjectPreview(nameValuePair, value.preview, false /* i sEntry */); 693 formatter.appendObjectPreview(nameValuePair, value.preview, false /* i sEntry */);
694 } else { 694 } else {
695 nameValuePair.appendChild(Components.ObjectPropertiesSection.createVal ueElement( 695 nameValuePair.appendChild(ObjectUI.ObjectPropertiesSection.createValue Element(
696 value, false /* wasThrown */, false /* showPreview */)); 696 value, false /* wasThrown */, false /* showPreview */));
697 } 697 }
698 ++renderedNameCount; 698 ++renderedNameCount;
699 } 699 }
700 700
701 var widgetChanged = true; 701 var widgetChanged = true;
702 if (oldWidget) { 702 if (oldWidget) {
703 widgetChanged = false; 703 widgetChanged = false;
704 for (var name of widget.__nameToToken.keys()) { 704 for (var name of widget.__nameToToken.keys()) {
705 var oldText = oldWidget.__nameToToken.get(name) ? oldWidget.__nameToTo ken.get(name).textContent : ''; 705 var oldText = oldWidget.__nameToToken.get(name) ? oldWidget.__nameToTo ken.get(name).textContent : '';
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 hide() { 1375 hide() {
1376 if (!this.bookmark) 1376 if (!this.bookmark)
1377 return; 1377 return;
1378 this.bookmark.clear(); 1378 this.bookmark.clear();
1379 this.bookmark = null; 1379 this.bookmark = null;
1380 } 1380 }
1381 }; 1381 };
1382 1382
1383 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book mark'); 1383 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book mark');
1384 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo l('element'); 1384 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo l('element');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698