Changeset 50909 in webkit
- Timestamp:
- Nov 12, 2009 3:07:25 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r50908 r50909 1 2009-11-12 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: profile timeline panel, fix obvious problems. 6 7 https://bugs.webkit.org/show_bug.cgi?id=31432 8 9 * inspector/front-end/AbstractTimelinePanel.js: 10 (WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded): 11 * inspector/front-end/TimelinePanel.js: 12 (WebInspector.TimelinePanel.prototype._setWindowPosition): 13 (WebInspector.TimelineCalculator): 14 (WebInspector.TimelineCalculator.prototype.get minimumBoundary): 15 (WebInspector.TimelineCalculator.prototype.get maximumBoundary): 16 (WebInspector.TimelineCalculator.prototype.reset): 17 (WebInspector.TimelineCalculator.prototype.updateBoundaries): 18 (WebInspector.TimelineCalculator.prototype.formatValue): 19 (WebInspector.TimelineGraph): 20 (WebInspector.TimelineGraph.prototype.refresh): 21 * inspector/front-end/utilities.js: 22 (Element.prototype.hasStyleClass): 23 1 24 2009-11-12 Pavel Feldman <pfeldman@chromium.org> 2 25 -
trunk/WebCore/inspector/front-end/AbstractTimelinePanel.js
r50875 r50909 210 210 return false; 211 211 } 212 213 if (document.body.offsetWidth <= 0) {214 // The stylesheet hasn't loaded yet or the window is closed,215 // so we can't calculate what is need. Return early.216 return false;217 }218 219 212 return this._timelineGrid.updateDividers(force, this.calculator); 220 213 }, -
trunk/WebCore/inspector/front-end/TimelinePanel.js
r50885 r50909 418 418 this.invalidateAllItems(); 419 419 if (typeof start === "number") { 420 if (start > this._rightResizeElement.offsetLeft - 25) 421 start = this._rightResizeElement.offsetLeft - 25; 422 423 this.calculator.windowLeft = start / this._overviewGridElement.clientWidth; 424 this._leftResizeElement.style.left = this.calculator.windowLeft*100 + "%"; 425 this._overviewWindowElement.style.left = this.calculator.windowLeft*100 + "%"; 420 if (start > this._rightResizeElement.offsetLeft - 25) 421 start = this._rightResizeElement.offsetLeft - 25; 422 423 var windowLeft = start / this._overviewGridElement.clientWidth; 424 this.calculator.windowLeft = windowLeft; 425 this._leftResizeElement.style.left = windowLeft * 100 + "%"; 426 this._overviewWindowElement.style.left = windowLeft * 100 + "%"; 426 427 } 427 428 if (typeof end === "number") { … … 429 430 end = this._leftResizeElement.offsetLeft + 30; 430 431 431 this.calculator.windowRight = end / this._overviewGridElement.clientWidth; 432 this._rightResizeElement.style.left = this.calculator.windowRight*100 + "%"; 433 } 434 this._overviewWindowElement.style.width = (this.calculator.windowRight - this.calculator.windowLeft)*100 + "%"; 432 var windowRight = end / this._overviewGridElement.clientWidth; 433 this.calculator.windowRight = windowRight; 434 this._rightResizeElement.style.left = windowRight * 100 + "%"; 435 } 436 this._overviewWindowElement.style.width = (this.calculator.windowRight - this.calculator.windowLeft) * 100 + "%"; 435 437 this.needsRefresh = true; 436 438 }, … … 541 543 }, 542 544 543 _updateDetails: function() { 545 _updateDetails: function() 546 { 544 547 if (this.dataElement && this._record.details !== this._details) { 545 548 this._details = this._record.details; … … 574 577 this.windowLeft = 0.0; 575 578 this.windowRight = 1.0; 579 this._uiString = WebInspector.UIString.bind(WebInspector); 576 580 } 577 581 … … 596 600 get minimumBoundary() 597 601 { 602 if (typeof this._minimumBoundary === "number") 603 return this._minimumBoundary; 604 598 605 if (typeof this.windowLeft === "number") 599 return this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary); 600 return this._absoluteMinimumBoundary; 606 this._minimumBoundary = this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary); 607 else 608 this._minimumBoundary = this._absoluteMinimumBoundary; 609 return this._minimumBoundary; 601 610 }, 602 611 603 612 get maximumBoundary() 604 613 { 614 if (typeof this._maximumBoundary === "number") 615 return this._maximumBoundary; 616 605 617 if (typeof this.windowLeft === "number") 606 return this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary); 607 return this._absoluteMaximumBoundary; 618 this._maximumBoundary = this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary); 619 else 620 this._maximumBoundary = this._absoluteMaximumBoundary; 621 return this._maximumBoundary; 608 622 }, 609 623 … … 612 626 delete this._absoluteMinimumBoundary; 613 627 delete this._absoluteMaximumBoundary; 628 delete this._minimumBoundary; 629 delete this._maximumBoundary; 614 630 }, 615 631 … … 622 638 if (typeof this._absoluteMinimumBoundary === "undefined" || lowerBound < this._absoluteMinimumBoundary) { 623 639 this._absoluteMinimumBoundary = lowerBound; 640 delete this._minimumBoundary; 624 641 didChange = true; 625 642 } … … 628 645 if (typeof this._absoluteMaximumBoundary === "undefined" || upperBound > this._absoluteMaximumBoundary) { 629 646 this._absoluteMaximumBoundary = upperBound; 647 delete this._maximumBoundary; 630 648 didChange = true; 631 649 } … … 636 654 formatValue: function(value) 637 655 { 638 return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, WebInspector.UIString.bind(WebInspector));656 return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, this._uiString); 639 657 } 640 658 } … … 701 719 702 720 this._graphElement.addStyleClass("timeline-category-" + record.category.name); 721 this._hidden = false; 703 722 } 704 723 … … 721 740 722 741 if (percentages.start > 100 || percentages.end < 0) { 723 this._graphElement.addStyleClass("hidden"); 724 this.record._itemsTreeElement.listItemElement.addStyleClass("hidden"); 742 if (!this._hidden) { 743 this._graphElement.addStyleClass("hidden"); 744 this.record._itemsTreeElement.listItemElement.addStyleClass("hidden"); 745 this._hidden = true; 746 } 725 747 } else { 726 748 this._barElement.style.setProperty("left", percentages.start + "%"); 727 749 this._barElement.style.setProperty("right", (100 - percentages.end) + "%"); 728 this._graphElement.removeStyleClass("hidden"); 729 this.record._itemsTreeElement.listItemElement.removeStyleClass("hidden"); 750 if (this._hidden) { 751 this._graphElement.removeStyleClass("hidden"); 752 this.record._itemsTreeElement.listItemElement.removeStyleClass("hidden"); 753 this._hidden = false; 754 } 730 755 } 731 756 var tooltip = (labels.tooltip || ""); -
trunk/WebCore/inspector/front-end/utilities.js
r50663 r50909 148 148 Element.prototype.removeStyleClass = function(className) 149 149 { 150 // Test for the simple case before using a RegExp.150 // Test for the simple case first. 151 151 if (this.className === className) { 152 152 this.className = ""; … … 154 154 } 155 155 156 this.removeMatchingStyleClasses(className.escapeForRegExp()); 156 var index = this.className.indexOf(className); 157 if (index === -1) 158 return; 159 160 var newClassName = " " + this.className + " "; 161 this.className = newClassName.replace(" " + className + " ", " "); 157 162 } 158 163 … … 177 182 if (this.className === className) 178 183 return true; 179 var regex = new RegExp("(^|\\s)" + className.escapeForRegExp() + "($|\\s)"); 180 return regex.test(this.className); 184 185 var index = this.className.indexOf(className); 186 if (index === -1) 187 return false; 188 var toTest = " " + this.className + " "; 189 return toTest.indexOf(" " + className + " ", index) !== -1; 181 190 } 182 191
Note: See TracChangeset
for help on using the changeset viewer.