Changeset 183331 in webkit
- Timestamp:
- Apr 25, 2015, 6:20:59 PM (10 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r183330 r183331 1 2015-04-23 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: Make showing a content view work in the tab world 4 https://bugs.webkit.org/show_bug.cgi?id=144110 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Base/Main.js: 9 (WebInspector.loaded): 10 (WebInspector.hideSplitConsole): 11 (WebInspector.showSourceCodeLocation): 12 (WebInspector.showOriginalUnformattedSourceCodeLocation): 13 (WebInspector.showOriginalOrFormattedSourceCodeLocation): 14 (WebInspector.showOriginalOrFormattedSourceCodeTextRange): 15 (WebInspector.showResourceRequest): 16 (WebInspector.debuggerToggleBreakpoints): 17 (WebInspector.debuggerPauseResumeToggle): 18 (WebInspector.debuggerStepOver): 19 (WebInspector.debuggerStepInto): 20 (WebInspector.debuggerStepOut): 21 (WebInspector._focusChanged): 22 (WebInspector._mouseWasClicked): 23 (WebInspector._dragOver): 24 (WebInspector._captureDidStart): 25 (WebInspector._debuggerDidPause): 26 (WebInspector._debuggerDidResume): 27 (WebInspector._frameWasAdded): 28 (WebInspector._undock): 29 (WebInspector._updateDockNavigationItems): 30 * UserInterface/Models/Breakpoint.js: 31 (WebInspector.Breakpoint.prototype.appendContextMenuItems.revealOriginalSourceCodeLocation): 32 (WebInspector.Breakpoint.prototype.appendContextMenuItems): 33 * UserInterface/Protocol/InspectorFrontendAPI.js: 34 (InspectorFrontendAPI.showMainResourceForFrame): 35 * UserInterface/Views/CSSStyleDeclarationTextEditor.js: 36 (WebInspector.CSSStyleDeclarationTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked): 37 * UserInterface/Views/ComputedStyleDetailsPanel.js: 38 (WebInspector.ComputedStyleDetailsPanel.prototype._goToRegionFlowArrowWasClicked): 39 (WebInspector.ComputedStyleDetailsPanel.prototype._goToContentFlowArrowWasClicked): 40 (WebInspector.ComputedStyleDetailsPanel): 41 * UserInterface/Views/ContentBrowser.js: 42 (WebInspector.ContentBrowser.prototype.updateHierarchicalPathForCurrentContentView): 43 * UserInterface/Views/ContentView.js: 44 (WebInspector.ContentView): 45 * UserInterface/Views/DOMTreeContentView.js: 46 (WebInspector.DOMTreeContentView.prototype.restoreFromCookie): 47 * UserInterface/Views/DOMTreeDataGridNode.js: 48 (WebInspector.DOMTreeDataGridNode.prototype._goToArrowWasClicked): 49 * UserInterface/Views/DebuggerSidebarPanel.js: 50 (WebInspector.DebuggerSidebarPanel.prototype.showDefaultContentView): 51 (WebInspector.DebuggerSidebarPanel.prototype._addTreeElementForSourceCodeToContentTreeOutline): 52 (WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected): 53 (WebInspector.DebuggerSidebarPanel.prototype._addIssue): 54 (WebInspector.DebuggerSidebarPanel.prototype._handleIssueAdded): 55 * UserInterface/Views/LayerTreeDataGridNode.js: 56 (WebInspector.LayerTreeDataGridNode.prototype._goToArrowWasClicked): 57 * UserInterface/Views/LayoutTimelineView.js: 58 (WebInspector.LayoutTimelineView.prototype._treeElementSelected): 59 * UserInterface/Views/NavigationSidebarPanel.js: 60 (WebInspector.NavigationSidebarPanel.prototype.get contentBrowser): 61 (WebInspector.NavigationSidebarPanel.prototype.set contentBrowser): 62 (WebInspector.NavigationSidebarPanel.prototype._updateFilter): 63 * UserInterface/Views/NetworkTimelineView.js: 64 (WebInspector.NetworkTimelineView.prototype._treeElementSelected): 65 * UserInterface/Views/ObjectTreeBaseTreeElement.js: 66 (WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject): 67 (WebInspector.ObjectTreeBaseTreeElement): 68 * UserInterface/Views/OverviewTimelineView.js: 69 (WebInspector.OverviewTimelineView.prototype._treeElementSelected): 70 * UserInterface/Views/ResourceDetailsSidebarPanel.js: 71 (WebInspector.ResourceDetailsSidebarPanel.prototype._goToRequestDataClicked): 72 * UserInterface/Views/ResourceSidebarPanel.js: 73 (WebInspector.ResourceSidebarPanel): 74 (WebInspector.ResourceSidebarPanel.prototype.showDefaultContentView): 75 (WebInspector.ResourceSidebarPanel.prototype._mainFrameDidChange): 76 (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork): 77 (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange): 78 (WebInspector.ResourceSidebarPanel.prototype._treeElementSelected): 79 (WebInspector.ResourceSidebarPanel.prototype._storageCleared): 80 * UserInterface/Views/ResourceTimelineDataGridNode.js: 81 (WebInspector.ResourceTimelineDataGridNode.prototype._goToResource): 82 * UserInterface/Views/ScriptTimelineView.js: 83 (WebInspector.ScriptTimelineView.prototype._treeElementSelected): 84 * UserInterface/Views/SourceCodeTextEditor.js: 85 (WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked): 86 * UserInterface/Views/TimelineDataGrid.js: 87 (WebInspector.TimelineDataGrid.prototype._popoverCallStackTreeElementSelected): 88 * UserInterface/Views/TimelineSidebarPanel.js: 89 (WebInspector.TimelineSidebarPanel): 90 (WebInspector.TimelineSidebarPanel.prototype.shown): 91 (WebInspector.TimelineSidebarPanel.showTimelineViewForTimeline): 92 1 93 2015-04-22 Timothy Hatcher <timothy@apple.com> 2 94 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r183330 r183331 129 129 this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this); 130 130 this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this); 131 this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this); 131 132 132 133 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); … … 548 549 if (resource) { 549 550 var position = new WebInspector.SourceCodePosition(lineNumber, 0); 550 this. resourceSidebarPanel.showSourceCode(resource, position);551 this.showSourceCode(resource, position); 551 552 return; 552 553 } … … 733 734 }; 734 735 736 WebInspector.tabContentViewClassForRepresentedObject = function(representedObject) 737 { 738 if (representedObject instanceof WebInspector.DOMTree) 739 return WebInspector.ElementsTabContentView; 740 741 if (representedObject instanceof WebInspector.TimelineRecording) 742 return WebInspector.TimelineTabContentView; 743 744 // We only support one console tab right now. So this isn't an instanceof check. 745 if (representedObject === this._consoleRepresentedObject) 746 return WebInspector.ConsoleTabContentView; 747 748 if (WebInspector.debuggerManager.paused) { 749 if (representedObject instanceof WebInspector.Script) 750 return WebInspector.DebuggerTabContentView; 751 752 if (representedObject instanceof WebInspector.Resource && (representedObject.type === WebInspector.Resource.Type.Document || representedObject.type === WebInspector.Resource.Type.Script)) 753 return WebInspector.DebuggerTabContentView; 754 } 755 756 if (representedObject instanceof WebInspector.Frame || representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Script) 757 return WebInspector.ResourcesTabContentView; 758 759 // FIXME: Move Content Flows to the Elements tab? 760 if (representedObject instanceof WebInspector.ContentFlow) 761 return WebInspector.ResourcesTabContentView; 762 763 // FIXME: Move these to a Storage tab. 764 if (representedObject instanceof WebInspector.DOMStorageObject || representedObject instanceof WebInspector.CookieStorageObject || 765 representedObject instanceof WebInspector.DatabaseTableObject || representedObject instanceof WebInspector.DatabaseObject || 766 representedObject instanceof WebInspector.ApplicationCacheFrame || representedObject instanceof WebInspector.IndexedDatabaseObjectStore || 767 representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex) 768 return WebInspector.ResourcesTabContentView; 769 770 return null; 771 }; 772 773 WebInspector.tabContentViewForRepresentedObject = function(representedObject) 774 { 775 var tabContentView = this.tabBrowser.bestTabContentViewForRepresentedObject(representedObject); 776 if (tabContentView) 777 return tabContentView; 778 779 var tabContentViewClass = this.tabContentViewClassForRepresentedObject(representedObject); 780 if (!tabContentViewClass) { 781 console.error("Unknown representedObject, couldn't create TabContentView.", representedObject); 782 return null; 783 } 784 785 tabContentView = new tabContentViewClass; 786 787 this.tabBrowser.addTabForContentView(tabContentView); 788 789 return tabContentView; 790 }; 791 792 WebInspector.showRepresentedObject = function(representedObject, cookie, forceShowTab) 793 { 794 var tabContentView = this.tabContentViewForRepresentedObject(representedObject); 795 console.assert(tabContentView); 796 if (!tabContentView) 797 return; 798 799 if (window.event || forceShowTab) 800 this.tabBrowser.showTabForContentView(tabContentView); 801 802 tabContentView.showRepresentedObject(representedObject, cookie); 803 }; 804 805 WebInspector.showMainFrameDOMTree = function(nodeToSelect, forceShowTab) 806 { 807 console.assert(WebInspector.frameResourceManager.mainFrame); 808 if (!WebInspector.frameResourceManager.mainFrame) 809 return; 810 this.showRepresentedObject(WebInspector.frameResourceManager.mainFrame.domTree, {nodeToSelect}, forceShowTab); 811 }; 812 813 WebInspector.showContentFlowDOMTree = function(contentFlow, nodeToSelect, forceShowTab) 814 { 815 this.showRepresentedObject(contentFlow, {nodeToSelect}, forceShowTab); 816 }; 817 818 WebInspector.showSourceCodeForFrame = function(frameIdentifier, forceShowTab) 819 { 820 var frame = WebInspector.frameResourceManager.frameForIdentifier(frameIdentifier); 821 if (!frame) { 822 this._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier; 823 return; 824 } 825 826 this._frameIdentifierToShowSourceCodeWhenAvailable = undefined; 827 828 this.showRepresentedObject(frame, null, forceShowTab); 829 }; 830 831 WebInspector.showSourceCode = function(sourceCode, positionToReveal, textRangeToSelect, forceUnformatted, forceShowTab) 832 { 833 console.assert(!positionToReveal || positionToReveal instanceof WebInspector.SourceCodePosition, positionToReveal); 834 var representedObject = sourceCode; 835 836 if (representedObject instanceof WebInspector.Script) { 837 // A script represented by a resource should always show the resource. 838 representedObject = representedObject.resource || representedObject; 839 } 840 841 var cookie = positionToReveal ? {lineNumber: positionToReveal.lineNumber, columnNumber: positionToReveal.columnNumber} : {}; 842 this.showRepresentedObject(representedObject, cookie, forceShowTab); 843 }; 844 845 WebInspector.showSourceCodeLocation = function(sourceCodeLocation, forceShowTab) 846 { 847 this.showSourceCode(sourceCodeLocation.displaySourceCode, sourceCodeLocation.displayPosition(), null, false, forceShowTab); 848 }; 849 850 WebInspector.showOriginalUnformattedSourceCodeLocation = function(sourceCodeLocation, forceShowTab) 851 { 852 this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.position(), null, true); 853 }; 854 855 WebInspector.showOriginalOrFormattedSourceCodeLocation = function(sourceCodeLocation, forceShowTab) 856 { 857 this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.formattedPosition(), null, false, forceShowTab); 858 }; 859 860 WebInspector.showOriginalOrFormattedSourceCodeTextRange = function(sourceCodeTextRange, forceShowTab) 861 { 862 var textRangeToSelect = sourceCodeTextRange.formattedTextRange; 863 this.showSourceCode(sourceCodeTextRange.sourceCode, textRangeToSelect.startPosition(), textRangeToSelect, false, forceShowTab); 864 }; 865 866 WebInspector.showResourceRequest = function(resource, forceShowTab) 867 { 868 this.showRepresentedObject(resource, {[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WebInspector.ResourceClusterContentView.RequestIdentifier}, forceShowTab); 869 }; 870 735 871 WebInspector.debuggerToggleBreakpoints = function(event) 736 872 { … … 832 968 { 833 969 this.dashboardContainer.closeDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger); 970 }; 971 972 WebInspector._frameWasAdded = function(event) 973 { 974 if (!this._frameIdentifierToShowSourceCodeWhenAvailable) 975 return; 976 977 var frame = event.data.frame; 978 if (frame.id !== this._frameIdentifierToShowSourceCodeWhenAvailable) 979 return; 980 981 this.showSourceCodeForFrame(frame.id); 834 982 }; 835 983 … … 1697 1845 1698 1846 if (event.metaKey) 1699 this. resourceSidebarPanel.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation);1847 this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation); 1700 1848 else 1701 this. resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);1849 this.showSourceCodeLocation(sourceCodeLocation); 1702 1850 } 1703 1851 -
trunk/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
r181769 r183331 242 242 function revealOriginalSourceCodeLocation() 243 243 { 244 WebInspector. resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(this._sourceCodeLocation);244 WebInspector.showOriginalOrFormattedSourceCodeLocation(this._sourceCodeLocation); 245 245 } 246 246 -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
r183268 r183331 93 93 { 94 94 WebInspector.ignoreLastContentCookie = true; 95 WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.resourceSidebarPanel; 96 WebInspector.resourceSidebarPanel.showSourceCodeForFrame(frameIdentifier, true); 95 WebInspector.showSourceCodeForFrame(frameIdentifier, true); 97 96 }, 98 97 -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
r182576 r183331 994 994 } 995 995 996 WebInspector. resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);996 WebInspector.showSourceCodeLocation(sourceCodeLocation); 997 997 } 998 998 -
trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js
r182055 r183331 205 205 _goToRegionFlowArrowWasClicked() 206 206 { 207 WebInspector. resourceSidebarPanel.showContentFlowDOMTree(this._regionFlow);207 WebInspector.showContentFlowDOMTree(this._regionFlow); 208 208 } 209 209 210 210 _goToContentFlowArrowWasClicked() 211 211 { 212 WebInspector. resourceSidebarPanel.showContentFlowDOMTree(this._contentFlow, this.nodeStyles.node, true);212 WebInspector.showContentFlowDOMTree(this._contentFlow, this.nodeStyles.node, true); 213 213 } 214 214 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
r183325 r183331 188 188 }, 189 189 190 updateHierarchicalPathForCurrentContentView: function() 191 { 192 var currentContentView = this.currentContentView; 193 this._updateHierarchicalPathNavigationItem(currentContentView ? currentContentView.representedObject : null); 194 }, 195 190 196 canGoBack: function() 191 197 { -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js
r183326 r183331 32 32 33 33 if (representedObject instanceof WebInspector.Frame) 34 return new WebInspector. FrameContentView(representedObject, extraArguments);34 return new WebInspector.ResourceClusterContentView(representedObject.mainResource, extraArguments); 35 35 36 36 if (representedObject instanceof WebInspector.Resource) -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
r183326 r183331 141 141 }, 142 142 143 restoreFromCookie: function(cookie) 144 { 145 if (!cookie || !cookie.nodeToSelect) 146 return; 147 148 this.selectAndRevealDOMNode(cookie.nodeToSelect); 149 150 // Because nodeToSelect is ephemeral, we don't want to keep 151 // it around in the back-forward history entries. 152 cookie.nodeToSelect = undefined; 153 }, 154 143 155 selectAndRevealDOMNode: function(domNode, preventFocusChange) 144 156 { -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js
r173492 r183331 84 84 _goToArrowWasClicked: function() 85 85 { 86 WebInspector. resourceSidebarPanel.showMainFrameDOMTree(this._domNode, true);86 WebInspector.showMainFrameDOMTree(this._domNode); 87 87 } 88 88 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
r183330 r183331 26 26 WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspector.NavigationSidebarPanel 27 27 { 28 constructor( )28 constructor(contentBrowser) 29 29 { 30 30 super("debugger", WebInspector.UIString("Debugger"), true); 31 32 this.contentBrowser = contentBrowser; 31 33 32 34 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this); … … 180 182 showDefaultContentView() 181 183 { 182 WebInspector.resourceSidebarPanel.showDefaultContentView(); 184 var currentTreeElement = this._contentTreeOutline.children[0]; 185 while (currentTreeElement && !currentTreeElement.root) { 186 if (currentTreeElement instanceof WebInspector.ResourceTreeElement || currentTreeElement instanceof WebInspector.ScriptTreeElement) { 187 currentTreeElement.revealAndSelect(); 188 return; 189 } 190 191 currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, true); 192 } 183 193 } 184 194 … … 307 317 } 308 318 319 if (!treeElement) { 320 console.error("Unknown sourceCode instance", sourceCode); 321 return; 322 } 323 309 324 if (!treeElement.parent) { 310 325 treeElement.hasChildren = false; … … 579 594 deselectCallStackContentTreeElements.call(this); 580 595 deselectPauseReasonContentTreeElements.call(this); 581 WebInspector. resourceSidebarPanel.showSourceCode(treeElement.representedObject);596 WebInspector.showSourceCode(treeElement.representedObject); 582 597 return; 583 598 } … … 590 605 var callFrame = treeElement.callFrame; 591 606 WebInspector.debuggerManager.activeCallFrame = callFrame; 592 WebInspector. resourceSidebarPanel.showSourceCodeLocation(callFrame.sourceCodeLocation);607 WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation); 593 608 return; 594 609 } … … 597 612 deselectCallStackContentTreeElements.call(this); 598 613 deselectPauseReasonContentTreeElements.call(this); 599 WebInspector. resourceSidebarPanel.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation);614 WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation); 600 615 return; 601 616 } … … 614 629 var breakpoint = treeElement.breakpoint; 615 630 if (treeElement.treeOutline === this._pauseReasonTreeOutline) { 616 WebInspector. resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation);631 WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation); 617 632 return; 618 633 } … … 625 640 return; 626 641 627 WebInspector. resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation);642 WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation); 628 643 } 629 644 … … 762 777 { 763 778 var parentTreeElement = this._addTreeElementForSourceCodeToContentTreeOutline(issueMessage.sourceCodeLocation.sourceCode); 779 if (!parentTreeElement) 780 return null; 781 764 782 var issueTreeElement = new WebInspector.IssueTreeElement(issueMessage); 765 783 … … 776 794 777 795 // We only want to show issues originating from JavaScript source code. 778 if (!issue. lineNumber|| (issue.source !== "javascript" && issue.source !== "console-api"))796 if (!issue.sourceCodeLocation || !issue.sourceCodeLocation.sourceCode || (issue.source !== "javascript" && issue.source !== "console-api")) 779 797 return; 780 798 -
trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDataGridNode.js
r173492 r183331 163 163 { 164 164 var domNode = WebInspector.domTreeManager.nodeForId(this._layer.nodeId); 165 WebInspector. resourceSidebarPanel.showMainFrameDOMTree(domNode, true);165 WebInspector.showMainFrameDOMTree(domNode); 166 166 } 167 167 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
r183327 r183331 77 77 // Public 78 78 79 get contentBrowser() 80 { 81 return this._contentBrowser; 82 } 83 84 set contentBrowser(contentBrowser) 85 { 86 this._contentBrowser = contentBrowser || null; 87 } 88 79 89 get contentTreeOutlineElement() 80 90 { … … 478 488 479 489 // Filter may have hidden the selected resource in the timeline view, which should now notify its listeners. 490 // FIXME: This is a layering violation. This should at least be in TimelineSidebarPanel. 480 491 if (selectedTreeElement && selectedTreeElement.hidden !== selectionWasHidden) { 481 var currentContentView = WebInspector.contentBrowser.currentContentView;492 var currentContentView = this.contentBrowser.currentContentView; 482 493 if (currentContentView instanceof WebInspector.TimelineRecordingContentView && typeof currentContentView.currentTimelineView.filterUpdated === "function") 483 494 currentContentView.currentTimelineView.filterUpdated(); -
trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
r183325 r183331 152 152 { 153 153 if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) { 154 WebInspector. resourceSidebarPanel.showSourceCode(treeElement.representedObject);154 WebInspector.showSourceCode(treeElement.representedObject); 155 155 return true; 156 156 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js
r182933 r183331 224 224 225 225 var sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0); 226 WebInspector. resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);226 WebInspector.showSourceCodeLocation(sourceCodeLocation); 227 227 }); 228 228 }); -
trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
r183325 r183331 341 341 342 342 if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) { 343 WebInspector. resourceSidebarPanel.showSourceCode(treeElement.representedObject);343 WebInspector.showSourceCode(treeElement.representedObject); 344 344 this._updateTreeElementWithCloseButton(treeElement); 345 345 return; … … 357 357 } 358 358 359 WebInspector. resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);359 WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation); 360 360 this._updateTreeElementWithCloseButton(treeElement); 361 361 }, -
trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
r183325 r183331 158 158 { 159 159 if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) { 160 WebInspector. resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);160 WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation); 161 161 return true; 162 162 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js
r183327 r183331 399 399 _goToRequestDataClicked() 400 400 { 401 WebInspector. resourceSidebarPanel.showResourceRequest(this._resource);401 WebInspector.showResourceRequest(this._resource); 402 402 } 403 403 -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
r183327 r183331 26 26 WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspector.NavigationSidebarPanel 27 27 { 28 constructor( )28 constructor(contentBrowser) 29 29 { 30 30 super("resource", WebInspector.UIString("Resources"), true, true); 31 32 this.contentBrowser = contentBrowser; 31 33 32 34 var searchElement = document.createElement("div"); … … 80 82 81 83 WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this); 82 WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);83 84 WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this);85 84 86 85 WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptWasAdded, this); … … 106 105 { 107 106 if (WebInspector.frameResourceManager.mainFrame) { 108 this. showMainFrame();107 this.contentBrowser.showContentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame); 109 108 return; 110 109 } … … 120 119 } 121 120 122 showMainFrame(nodeToSelect, preventFocusChange)123 {124 WebInspector.contentBrowser.showContentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);125 }126 127 showMainFrameDOMTree(nodeToSelect, preventFocusChange)128 {129 var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);130 contentView.showDOMTree(nodeToSelect, preventFocusChange);131 WebInspector.contentBrowser.showContentView(contentView);132 }133 134 showMainFrameSourceCode()135 {136 var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);137 contentView.showSourceCode();138 WebInspector.contentBrowser.showContentView(contentView);139 }140 141 showContentFlowDOMTree(contentFlow, nodeToSelect, preventFocusChange)142 {143 var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(contentFlow);144 if (nodeToSelect)145 contentView.selectAndRevealDOMNode(nodeToSelect, preventFocusChange);146 WebInspector.contentBrowser.showContentView(contentView);147 }148 149 showSourceCodeForFrame(frameIdentifier, revealAndSelectTreeElement)150 {151 delete this._frameIdentifierToShowSourceCodeWhenAvailable;152 153 // We can't show anything until we have the main frame in the sidebar.154 // Otherwise the path components in the navigation bar would be missing.155 var frame = WebInspector.frameResourceManager.frameForIdentifier(frameIdentifier);156 if (!frame || !this._mainFrameTreeElement) {157 this._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier;158 return;159 }160 161 var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(frame);162 console.assert(contentView);163 if (!contentView)164 return;165 166 contentView.showSourceCode();167 WebInspector.contentBrowser.showContentView(contentView);168 169 if (revealAndSelectTreeElement)170 this.treeElementForRepresentedObject(frame).revealAndSelect(true, true, true, true);171 }172 173 showSourceCode(sourceCode, positionToReveal, textRangeToSelect, forceUnformatted)174 {175 console.assert(!positionToReveal || positionToReveal instanceof WebInspector.SourceCodePosition, positionToReveal);176 var representedObject = sourceCode;177 178 if (representedObject instanceof WebInspector.Script) {179 // A script represented by a resource should always show the resource.180 representedObject = representedObject.resource || representedObject;181 }182 183 // A main resource is always represented by its parent frame.184 if (representedObject instanceof WebInspector.Resource && representedObject.isMainResource())185 representedObject = representedObject.parentFrame;186 187 var cookie = positionToReveal ? {lineNumber: positionToReveal.lineNumber, columnNumber: positionToReveal.columnNumber} : {};188 WebInspector.contentBrowser.showContentViewForRepresentedObject(representedObject, cookie);189 }190 191 showSourceCodeLocation(sourceCodeLocation)192 {193 this.showSourceCode(sourceCodeLocation.displaySourceCode, sourceCodeLocation.displayPosition());194 }195 196 showOriginalUnformattedSourceCodeLocation(sourceCodeLocation)197 {198 this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.position(), undefined, true);199 }200 201 showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation)202 {203 this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.formattedPosition());204 }205 206 showSourceCodeTextRange(sourceCodeTextRange)207 {208 var textRangeToSelect = sourceCodeTextRange.displayTextRange;209 this.showSourceCode(sourceCodeTextRange.displaySourceCode, textRangeToSelect.startPosition(), textRangeToSelect);210 }211 212 showOriginalOrFormattedSourceCodeTextRange(sourceCodeTextRange)213 {214 var textRangeToSelect = sourceCodeTextRange.formattedTextRange;215 this.showSourceCode(sourceCodeTextRange.sourceCode, textRangeToSelect.startPosition(), textRangeToSelect);216 }217 218 showResource(resource)219 {220 WebInspector.contentBrowser.showContentViewForRepresentedObject(resource.isMainResource() ? resource.parentFrame : resource);221 }222 223 showResourceRequest(resource)224 {225 var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(resource.isMainResource() ? resource.parentFrame : resource);226 227 if (contentView instanceof WebInspector.FrameContentView)228 var resourceContentView = contentView.showResource();229 else if (contentView instanceof WebInspector.ResourceClusterContentView)230 var resourceContentView = contentView;231 232 console.assert(resourceContentView instanceof WebInspector.ResourceClusterContentView);233 if (!(resourceContentView instanceof WebInspector.ResourceClusterContentView))234 return;235 236 resourceContentView.showRequest();237 238 WebInspector.contentBrowser.showContentView(contentView);239 }240 241 121 treeElementForRepresentedObject(representedObject) 242 122 { 243 123 // A custom implementation is needed for this since the frames are populated lazily. 124 125 if (!this._mainFrameTreeElement && (representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Frame)) { 126 // All resources are under the main frame, so we need to return early if we don't have the main frame yet. 127 return null; 128 } 244 129 245 130 // The Frame is used as the representedObject instead of the main resource in our tree. … … 593 478 this._resourcesContentTreeOutline.insertChild(this._mainFrameTreeElement, 0); 594 479 595 // Select by default. Allow onselect if we aren't showing a content view. 596 if (!this._resourcesContentTreeOutline.selectedTreeElement) 597 this._mainFrameTreeElement.revealAndSelect(true, false, !!WebInspector.contentBrowser.currentContentView); 598 599 if (this._frameIdentifierToShowSourceCodeWhenAvailable) 600 this.showSourceCodeForFrame(this._frameIdentifierToShowSourceCodeWhenAvailable, true); 601 } 480 // Select a tree element by default. Allow onselect if we aren't showing a content view. 481 if (!this._resourcesContentTreeOutline.selectedTreeElement) { 482 var currentContentView = this.contentBrowser.currentContentView; 483 var treeElement = currentContentView ? this.treeElementForRepresentedObject(currentContentView.representedObject) : null; 484 if (!treeElement) 485 treeElement = this._mainFrameTreeElement; 486 treeElement.revealAndSelect(true, false, !!currentContentView, true); 487 } 488 } 489 490 // The navigation path needs update when the main frame changes, since all resources are under the main frame. 491 this.contentBrowser.updateHierarchicalPathForCurrentContentView(); 602 492 603 493 // We only care about the first time the main frame changes. … … 609 499 return; 610 500 611 delete this._waitingForInitialMainFrame;501 this._waitingForInitialMainFrame = false; 612 502 613 503 // Only if the last page searched is the same as the current page. … … 622 512 { 623 513 var wasShowingResourceSidebar = this.selected; 624 var currentContentView = WebInspector.contentBrowser.currentContentView;514 var currentContentView = this.contentBrowser.currentContentView; 625 515 var wasShowingResourceContentView = currentContentView instanceof WebInspector.ResourceContentView 626 516 || currentContentView instanceof WebInspector.ResourceClusterContentView … … 628 518 || currentContentView instanceof WebInspector.ScriptContentView; 629 519 630 // Close all resource and frame content views since the main frame has navigated and all resources are cleared. 631 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ResourceClusterContentView); 632 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.FrameContentView); 633 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ScriptContentView); 520 this.contentBrowser.contentViewContainer.closeAllContentViews(); 634 521 635 522 // Break out of search tree outline if there was an active search. … … 640 527 // Show the main frame since there is no content view showing or we were showing a resource before. 641 528 // Cookie restoration will attempt to re-select the resource we were showing. 642 if (!WebInspector.contentBrowser.currentContentView || wasShowingResourceContentView) { 643 // If we were showing a resource inside of the ResourceSidebar, we should 644 // re-show the resource inside of the resource sidebar. It is possible that 645 // the sidebar panel could have switched to another view in the back-forward list. 646 if (wasShowingResourceSidebar) 647 WebInspector.navigationSidebar.selectedSidebarPanel = this; 648 529 if (!this.contentBrowser.currentContentView || wasShowingResourceContentView) { 649 530 // NOTE: This selection, during provisional loading, won't be saved, so it is 650 531 // safe to do and not-clobber cookie restoration. … … 656 537 // before those listeners do their work might cause the content of the old page to show instead of the new page. 657 538 setTimeout(delayedWork.bind(this), 0); 658 }659 660 _frameWasAdded(event)661 {662 if (!this._frameIdentifierToShowSourceCodeWhenAvailable)663 return;664 665 var frame = event.data.frame;666 if (frame.id !== this._frameIdentifierToShowSourceCodeWhenAvailable)667 return;668 669 this.showSourceCodeForFrame(frame.id, true);670 539 } 671 540 … … 777 646 treeElement instanceof WebInspector.ContentFlowTreeElement || treeElement instanceof WebInspector.IndexedDatabaseObjectStoreTreeElement || 778 647 treeElement instanceof WebInspector.IndexedDatabaseObjectStoreIndexTreeElement) { 779 WebInspector. contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);648 WebInspector.showRepresentedObject(treeElement.representedObject); 780 649 return; 781 650 } … … 786 655 787 656 if (treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject) 788 this.showMainFrameDOMTree(treeElement.representedObject.domNode, true);657 WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode); 789 658 else if (treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject) 790 this.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange); 791 } 792 793 _domNodeWasInspected(event) 794 { 795 this.showMainFrameDOMTree(event.data.node); 659 WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange); 796 660 } 797 661 … … 929 793 { 930 794 // Close all DOM and cookie storage content views since the main frame has navigated and all storages are cleared. 931 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CookieStorageContentView);932 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DOMStorageContentView);933 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseTableContentView);934 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseContentView);935 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ApplicationCacheFrameContentView);795 this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CookieStorageContentView); 796 this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DOMStorageContentView); 797 this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseTableContentView); 798 this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseContentView); 799 this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ApplicationCacheFrameContentView); 936 800 937 801 if (this._localStorageRootTreeElement && this._localStorageRootTreeElement.parent) -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
r183134 r183331 170 170 _goToResource: function(event) 171 171 { 172 WebInspector. resourceSidebarPanel.showSourceCode(this._resource);172 WebInspector.showSourceCode(this._resource); 173 173 }, 174 174 -
trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js
r183325 r183331 167 167 { 168 168 if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) { 169 WebInspector. resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);169 WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation); 170 170 return true; 171 171 } -
trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
r182990 r183331 1325 1325 var sourceCodeLocation = this._sourceCodeLocationForEditorPosition(this.tokenTrackingController.candidate.hoveredTokenRange.start); 1326 1326 if (this.sourceCode instanceof WebInspector.SourceMapResource) 1327 WebInspector. resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);1327 WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation); 1328 1328 else 1329 WebInspector. resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);1329 WebInspector.showSourceCodeLocation(sourceCodeLocation); 1330 1330 } 1331 1331 -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js
r182142 r183331 488 488 return; 489 489 490 WebInspector. resourceSidebarPanel.showSourceCodeLocation(callFrame.sourceCodeLocation);490 WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation); 491 491 } 492 492 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js
r183327 r183331 26 26 WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspector.NavigationSidebarPanel 27 27 { 28 constructor( )28 constructor(contentBrowser) 29 29 { 30 30 super("timeline", WebInspector.UIString("Timelines")); 31 32 this.contentBrowser = contentBrowser; 31 33 32 34 this._timelineEventsTitleBarElement = document.createElement("div"); … … 121 123 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingLoaded, this._recordingLoaded, this); 122 124 123 WebInspector.contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);125 this.contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this); 124 126 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStarted, this); 125 127 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this); … … 133 135 134 136 if (this._displayedContentView) 135 WebInspector.contentBrowser.showContentView(this._displayedContentView);137 this.contentBrowser.showContentView(this._displayedContentView); 136 138 } 137 139 … … 237 239 238 240 this._displayedContentView.showOverviewTimelineView(); 239 WebInspector.contentBrowser.showContentView(this._displayedContentView);241 this.contentBrowser.showContentView(this._displayedContentView); 240 242 } 241 243 … … 285 287 console.assert(cookie); 286 288 287 cookie[WebInspector.TimelineSidebarPanel.ShowingTimelineRecordingContentViewCookieKey] = WebInspector.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;289 cookie[WebInspector.TimelineSidebarPanel.ShowingTimelineRecordingContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView; 288 290 289 291 var selectedTreeElement = this._timelinesTreeOutline.selectedTreeElement; … … 357 359 358 360 this._displayedContentView.showTimelineViewForTimeline(timeline); 359 WebInspector.contentBrowser.showContentView(this._displayedContentView);361 this.contentBrowser.showContentView(this._displayedContentView); 360 362 } 361 363 362 364 _contentBrowserCurrentContentViewDidChange(event) 363 365 { 364 var didShowTimelineRecordingContentView = WebInspector.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;366 var didShowTimelineRecordingContentView = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView; 365 367 this.element.classList.toggle(WebInspector.TimelineSidebarPanel.TimelineRecordingContentViewShowingStyleClass, didShowTimelineRecordingContentView); 366 368 } … … 424 426 this._timelineAdded(timeline); 425 427 426 this._displayedContentView = WebInspector.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, false, {timelineSidebarPanel: this});428 this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, false, {timelineSidebarPanel: this}); 427 429 if (this.selected) 428 WebInspector.contentBrowser.showContentView(this._displayedContentView);430 this.contentBrowser.showContentView(this._displayedContentView); 429 431 } 430 432 -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js
r183325 r183331 207 207 } 208 208 209 WebInspector. resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);209 WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation); 210 210 return true; 211 211 },
Note:
See TracChangeset
for help on using the changeset viewer.