Changeset 33991 in webkit
- Timestamp:
- May 21, 2008 8:31:50 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r33990 r33991 1 2008-05-21 Timothy Hatcher <timothy@apple.com> 2 3 Adds the Request and Response headers to the Resource view. 4 5 <rdar://problem/5940782> REGRESSION: Resource Request and Response 6 headers aren't shown (18451) 7 8 Reviewed by Adam Roben. 9 10 * English.lproj/localizedStrings.js: Added new strings. 11 * css/view-source.css: Add comments to make sure a couple of 12 style rules stay in sync with inspector.css. 13 * page/inspector/Resource.js: 14 (WebInspector.Resource.prototype.set url): Dispatch an event when 15 this property changes. 16 (WebInspector.Resource.prototype.set requestHeaders): Ditto. 17 (WebInspector.Resource.prototype.set responseHeaders): Ditto. 18 * page/inspector/ResourceView.js: 19 (WebInspector.ResourceView): Add new elements for the headers 20 and a headers TreeOutline. Add event listeners for resource 21 property changes. Calls the three new refresh functions. 22 (WebInspector.ResourceView.prototype.set headersVisible): Implemented. 23 Toggles the headers-visible class name. 24 (WebInspector.ResourceView.prototype._refreshURL): Update the URL 25 tree element. 26 (WebInspector.ResourceView.prototype._refreshRequestHeaders): Call _refreshHeaders. 27 (WebInspector.ResourceView.prototype._refreshResponseHeaders): Ditto. 28 (WebInspector.ResourceView.prototype._refreshHeaders): Remove the previous 29 headers fromm the tree element. Loop throuh the headers and create new 30 tree elements and append them. 31 * page/inspector/ResourcesPanel.js: 32 (WebInspector.ResourcesPanel.prototype._updateSidebarWidth): Call resize 33 on the visible view if it is implemented. 34 * page/inspector/SourceFrame.js: 35 (WebInspector.SourceFrame.prototype.get autoSizesToFitContentHeight): 36 (WebInspector.SourceFrame.prototype.set autoSizesToFitContentHeight): 37 (WebInspector.SourceFrame.prototype.sizeToFitContentHeight): 38 (WebInspector.SourceFrame.prototype._loaded): 39 (WebInspector.SourceFrame.prototype._windowResized): 40 * page/inspector/SourceView.js: 41 (WebInspector.SourceView): Move the SourceFrame creation so it is 42 available when headersVisible is set. Add a gutter element to fill 43 the vertical space no covered by the SourceFrame now. 44 (WebInspector.SourceView.prototype.set headersVisible): Set the 45 SourceFrame.autoSizesToFitContentHeight when this property changes. 46 (WebInspector.SourceView.prototype.resize): Call SourceFrame.sizeToFitContentHeight 47 when autoSizesToFitContentHeight is true. This happens when resizing the 48 Resources sidebar. 49 * page/inspector/inspector.css: Add a copy of webkit-line-gutter-backdrop 50 and a comment to keep in sync with view-source.css. Adds other styles 51 for the headers area of resource-view. 52 1 53 2008-05-21 Sam Weinig <sam@webkit.org> 2 54 -
trunk/WebCore/css/view-source.css
r33395 r33991 44 44 45 45 .webkit-line-gutter-backdrop, .webkit-line-number { 46 /* Keep this in sync with inspector.css (.webkit-line-gutter-backdrop) */ 46 47 -webkit-box-sizing: border-box; 47 48 padding: 0 4px !important; … … 53 54 54 55 .webkit-line-gutter-backdrop { 56 /* Keep this in sync with inspector.css (.webkit-line-gutter-backdrop) */ 55 57 position: absolute; 56 58 z-index: -1; -
trunk/WebCore/page/inspector/Resource.js
r33525 r33991 94 94 var oldURL = this._url; 95 95 this._url = x; 96 97 // FIXME: We should make the WebInspector object listen for the "url changed" event. 98 // Then resourceURLChanged can be removed. 96 99 WebInspector.resourceURLChanged(this, oldURL); 100 101 this.dispatchEventToListeners("url changed"); 97 102 }, 98 103 … … 342 347 delete this._sortedRequestHeaders; 343 348 344 if (WebInspector.panels.resources) 345 WebInspector.panels.resources.refreshResource(this); 349 this.dispatchEventToListeners("requestHeaders changed"); 346 350 }, 347 351 … … 374 378 delete this._sortedResponseHeaders; 375 379 376 if (WebInspector.panels.resources) 377 WebInspector.panels.resources.refreshResource(this); 380 this.dispatchEventToListeners("responseHeaders changed"); 378 381 }, 379 382 -
trunk/WebCore/page/inspector/ResourceView.js
r33411 r33991 35 35 this.resource = resource; 36 36 37 // FIXME: Implement the setter for headersVisible when the header element is added. 37 this.headersElement = document.createElement("div"); 38 this.headersElement.className = "resource-view-headers"; 39 this.element.appendChild(this.headersElement); 38 40 39 41 this.contentElement = document.createElement("div"); 40 42 this.contentElement.className = "resource-view-content"; 41 43 this.element.appendChild(this.contentElement); 44 45 this.headersListElement = document.createElement("ol"); 46 this.headersListElement.className = "outline-disclosure"; 47 this.headersElement.appendChild(this.headersListElement); 48 49 this.headersTreeOutline = new TreeOutline(this.headersListElement); 50 this.headersTreeOutline.expandTreeElementsWhenArrowing = true; 51 52 this.urlTreeElement = new TreeElement("", null, false); 53 this.urlTreeElement.selectable = false; 54 this.headersTreeOutline.appendChild(this.urlTreeElement); 55 56 this.requestHeadersTreeElement = new TreeElement("", null, true); 57 this.requestHeadersTreeElement.expanded = false; 58 this.requestHeadersTreeElement.selectable = false; 59 this.headersTreeOutline.appendChild(this.requestHeadersTreeElement); 60 61 this.responseHeadersTreeElement = new TreeElement("", null, true); 62 this.responseHeadersTreeElement.expanded = false; 63 this.responseHeadersTreeElement.selectable = false; 64 this.headersTreeOutline.appendChild(this.responseHeadersTreeElement); 65 66 this.headersVisible = true; 67 68 resource.addEventListener("url changed", this._refreshURL, this); 69 resource.addEventListener("requestHeaders changed", this._refreshRequestHeaders, this); 70 resource.addEventListener("responseHeaders changed", this._refreshResponseHeaders, this); 71 72 this._refreshURL(); 73 this._refreshRequestHeaders(); 74 this._refreshResponseHeaders(); 42 75 } 43 76 … … 55 88 this._headersVisible = x; 56 89 57 if (x) { 58 // FIXME: Implement this when headers are added. 59 } else { 60 // FIXME: Implement this when headers are added. 61 } 90 if (x) 91 this.element.addStyleClass("headers-visible"); 92 else 93 this.element.removeStyleClass("headers-visible"); 62 94 }, 63 95 … … 66 98 if (!this.element.parentNode) 67 99 document.getElementById("resource-views").appendChild(this.element); 100 }, 101 102 _refreshURL: function() 103 { 104 this.urlTreeElement.title = this.resource.url.escapeHTML(); 105 }, 106 107 _refreshRequestHeaders: function() 108 { 109 this._refreshHeaders(WebInspector.UIString("Request Headers"), this.resource.sortedRequestHeaders, this.requestHeadersTreeElement); 110 }, 111 112 _refreshResponseHeaders: function() 113 { 114 this._refreshHeaders(WebInspector.UIString("Response Headers"), this.resource.sortedResponseHeaders, this.responseHeadersTreeElement); 115 }, 116 117 _refreshHeaders: function(title, headers, headersTreeElement) 118 { 119 headersTreeElement.removeChildren(); 120 121 var length = headers.length; 122 headersTreeElement.title = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>"; 123 headersTreeElement.hidden = !length; 124 125 var length = headers.length; 126 for (var i = 0; i < length; ++i) { 127 var title = "<div class=\"header-name\">" + headers[i].header.escapeHTML() + ":</div>"; 128 title += "<div class=\"header-value\">" + headers[i].value.escapeHTML() + "</div>" 129 130 var headerTreeElement = new TreeElement(title, null, false); 131 headerTreeElement.selectable = false; 132 headersTreeElement.appendChild(headerTreeElement); 133 } 68 134 } 69 135 } -
trunk/WebCore/page/inspector/ResourcesPanel.js
r33411 r33991 1054 1054 this._updateGraphBars(); 1055 1055 this._updateGraphDividersIfNeeded(); 1056 1057 var visibleResourceView = this.visibleResourceView; 1058 if (visibleResourceView && "resize" in visibleResourceView) 1059 visibleResourceView.resize(); 1056 1060 } 1057 1061 } -
trunk/WebCore/page/inspector/SourceFrame.js
r33408 r33991 55 55 }, 56 56 57 get autoSizesToFitContentHeight() 58 { 59 return this._autoSizesToFitContentHeight; 60 }, 61 62 set autoSizesToFitContentHeight(x) 63 { 64 if (this._autoSizesToFitContentHeight === x) 65 return; 66 67 this._autoSizesToFitContentHeight = x; 68 69 if (this._autoSizesToFitContentHeight) { 70 this._windowResizeListener = this._windowResized.bind(this); 71 window.addEventListener("resize", this._windowResizeListener, false); 72 this.sizeToFitContentHeight(); 73 } else { 74 this.element.style.removeProperty("height"); 75 if (this.element.contentDocument) 76 this.element.contentDocument.body.addStyleClass("webkit-height-sized-to-fit"); 77 window.removeEventListener("resize", this._windowResizeListener, false); 78 delete this._windowResizeListener; 79 } 80 }, 81 57 82 sourceRow: function(lineNumber) 58 83 { … … 129 154 var bubble = bubbles[i]; 130 155 bubble.parentNode.removeChild(bubble); 156 } 157 }, 158 159 sizeToFitContentHeight: function() 160 { 161 if (this.element.contentDocument) { 162 this.element.style.setProperty("height", this.element.contentDocument.body.offsetHeight + "px"); 163 this.element.contentDocument.body.addStyleClass("webkit-height-sized-to-fit"); 131 164 } 132 165 }, … … 155 188 styleText += ".webkit-breakpoint-disabled.webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(breakpoint-disabled-program-counter); }\n"; 156 189 styleText += ".webkit-execution-line .webkit-line-content { background-color: rgb(171, 191, 254); outline: 1px solid rgb(64, 115, 244); }\n"; 190 styleText += ".webkit-height-sized-to-fit { overflow-y: hidden }\n"; 157 191 158 192 styleElement.textContent = styleText; … … 169 203 this._addExistingBreakpointsToSource(); 170 204 this._updateExecutionLine(); 205 206 if (this.autoSizesToFitContentHeight) 207 this.sizeToFitContentHeight(); 208 }, 209 210 _windowResized: function(event) 211 { 212 if (!this._autoSizesToFitContentHeight) 213 return; 214 this.sizeToFitContentHeight(); 171 215 }, 172 216 -
trunk/WebCore/page/inspector/SourceView.js
r33411 r33991 29 29 WebInspector.SourceView = function(resource) 30 30 { 31 // Set the sourceFrame first since WebInspector.ResourceView will set headersVisible 32 // and our override of headersVisible needs the sourceFrame. 33 this.sourceFrame = new WebInspector.SourceFrame(null, this._addBreakpoint.bind(this)); 34 31 35 WebInspector.ResourceView.call(this, resource); 32 36 … … 37 41 this._frameNeedsSetup = true; 38 42 39 this. sourceFrame = new WebInspector.SourceFrame(null, this._addBreakpoint.bind(this));43 this.contentElement.appendChild(this.sourceFrame.element); 40 44 41 this.contentElement.appendChild(this.sourceFrame.element); 45 var gutterElement = document.createElement("div"); 46 gutterElement.className = "webkit-line-gutter-backdrop"; 47 this.element.appendChild(gutterElement); 42 48 } 43 49 44 50 WebInspector.SourceView.prototype = { 51 set headersVisible(x) 52 { 53 if (x === this._headersVisible) 54 return; 55 56 var superSetter = WebInspector.ResourceView.prototype.__lookupSetter__("headersVisible"); 57 if (superSetter) 58 superSetter.call(this, x); 59 60 this.sourceFrame.autoSizesToFitContentHeight = x; 61 }, 62 45 63 show: function(parentElement) 46 64 { 47 65 WebInspector.ResourceView.prototype.show.call(this, parentElement); 48 66 this.setupSourceFrameIfNeeded(); 67 }, 68 69 resize: function() 70 { 71 if (this.sourceFrame.autoSizesToFitContentHeight) 72 this.sourceFrame.sizeToFitContentHeight(); 49 73 }, 50 74 -
trunk/WebCore/page/inspector/inspector.css
r33976 r33991 529 529 right: 0; 530 530 bottom: 0; 531 overflow: hidden; 531 532 } 532 533 … … 535 536 } 536 537 538 .resource-view.headers-visible { 539 overflow-y: auto; 540 overflow-x: hidden; 541 } 542 543 .resource-view-headers { 544 display: none; 545 padding: 6px; 546 border-bottom: 1px solid rgb(64%, 64%, 64%); 547 background-color: white; 548 -webkit-user-select: text; 549 } 550 551 .resource-view-headers .outline-disclosure .parent { 552 -webkit-user-select: none; 553 font-weight: bold; 554 } 555 556 .resource-view.headers-visible .resource-view-headers { 557 display: block; 558 } 559 560 .resource-view-headers .outline-disclosure .children li { 561 white-space: nowrap; 562 } 563 564 .resource-view-headers .outline-disclosure li.expanded .header-count { 565 display: none; 566 } 567 568 .resource-view-headers .outline-disclosure .header-name { 569 color: rgb(33%, 33%, 33%); 570 display: inline-block; 571 width: 105px; 572 text-align: right; 573 margin-right: 0.5em; 574 font-weight: bold; 575 vertical-align: top; 576 overflow: hidden; 577 text-overflow: ellipsis; 578 } 579 580 .resource-view-headers .outline-disclosure .header-value { 581 display: inline-block; 582 white-space: normal; 583 word-break: break-word; 584 vertical-align: top; 585 margin-right: 100px; 586 } 587 537 588 .resource-view .resource-view-content { 538 589 position: absolute; … … 541 592 left: 0; 542 593 bottom: 0; 594 } 595 596 .resource-view.headers-visible .resource-view-content { 597 position: relative; 598 top: auto; 599 right: auto; 600 left: auto; 601 bottom: auto; 602 } 603 604 .resource-view.headers-visible .source-view-frame { 605 height: auto; 606 } 607 608 .webkit-line-gutter-backdrop { 609 /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */ 610 width: 31px; 611 background-color: rgb(240, 240, 240); 612 border-right: 1px solid rgb(187, 187, 187); 613 position: absolute; 614 z-index: -1; 615 left: 0; 616 top: 0; 617 height: 100% 543 618 } 544 619
Note: See TracChangeset
for help on using the changeset viewer.