[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Wed Apr 7 23:35:31 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit c947595a35e1d7969267239576963682c0102423
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 12 23:07:25 2009 +0000

    2009-11-12  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: profile timeline panel, fix obvious problems.
    
            https://bugs.webkit.org/show_bug.cgi?id=31432
    
            * inspector/front-end/AbstractTimelinePanel.js:
            (WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded):
            * inspector/front-end/TimelinePanel.js:
            (WebInspector.TimelinePanel.prototype._setWindowPosition):
            (WebInspector.TimelineCalculator):
            (WebInspector.TimelineCalculator.prototype.get minimumBoundary):
            (WebInspector.TimelineCalculator.prototype.get maximumBoundary):
            (WebInspector.TimelineCalculator.prototype.reset):
            (WebInspector.TimelineCalculator.prototype.updateBoundaries):
            (WebInspector.TimelineCalculator.prototype.formatValue):
            (WebInspector.TimelineGraph):
            (WebInspector.TimelineGraph.prototype.refresh):
            * inspector/front-end/utilities.js:
            (Element.prototype.hasStyleClass):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9507dd6..9f15c37 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,29 @@
 
         Reviewed by Timothy Hatcher.
 
+        Web Inspector: profile timeline panel, fix obvious problems.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31432
+
+        * inspector/front-end/AbstractTimelinePanel.js:
+        (WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._setWindowPosition):
+        (WebInspector.TimelineCalculator):
+        (WebInspector.TimelineCalculator.prototype.get minimumBoundary):
+        (WebInspector.TimelineCalculator.prototype.get maximumBoundary):
+        (WebInspector.TimelineCalculator.prototype.reset):
+        (WebInspector.TimelineCalculator.prototype.updateBoundaries):
+        (WebInspector.TimelineCalculator.prototype.formatValue):
+        (WebInspector.TimelineGraph):
+        (WebInspector.TimelineGraph.prototype.refresh):
+        * inspector/front-end/utilities.js:
+        (Element.prototype.hasStyleClass):
+
+2009-11-12  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
         Web Inspector: preload status bar button glyphs
         in order to prevent them from flickering.
 
diff --git a/WebCore/inspector/front-end/AbstractTimelinePanel.js b/WebCore/inspector/front-end/AbstractTimelinePanel.js
index 6ba9146..ecddff9 100644
--- a/WebCore/inspector/front-end/AbstractTimelinePanel.js
+++ b/WebCore/inspector/front-end/AbstractTimelinePanel.js
@@ -209,13 +209,6 @@ WebInspector.AbstractTimelinePanel.prototype = {
             this.needsRefresh = true;
             return false;
         }
-
-        if (document.body.offsetWidth <= 0) {
-            // The stylesheet hasn't loaded yet or the window is closed,
-            // so we can't calculate what is need. Return early.
-            return false;
-        }
-
         return this._timelineGrid.updateDividers(force, this.calculator);
     },
 
diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js
index 915a380..11cadf3 100644
--- a/WebCore/inspector/front-end/TimelinePanel.js
+++ b/WebCore/inspector/front-end/TimelinePanel.js
@@ -417,21 +417,23 @@ WebInspector.TimelinePanel.prototype = {
         this.calculator.reset();
         this.invalidateAllItems();
         if (typeof start === "number") {
-          if (start > this._rightResizeElement.offsetLeft - 25)
-              start = this._rightResizeElement.offsetLeft - 25;
+            if (start > this._rightResizeElement.offsetLeft - 25)
+                start = this._rightResizeElement.offsetLeft - 25;
 
-          this.calculator.windowLeft = start / this._overviewGridElement.clientWidth;
-          this._leftResizeElement.style.left = this.calculator.windowLeft*100 + "%";
-          this._overviewWindowElement.style.left = this.calculator.windowLeft*100 + "%";
+            var windowLeft = start / this._overviewGridElement.clientWidth;
+            this.calculator.windowLeft = windowLeft;
+            this._leftResizeElement.style.left = windowLeft * 100 + "%";
+            this._overviewWindowElement.style.left = windowLeft * 100 + "%";
         }
         if (typeof end === "number") {
             if (end < this._leftResizeElement.offsetLeft + 30)
                 end = this._leftResizeElement.offsetLeft + 30;
 
-            this.calculator.windowRight = end / this._overviewGridElement.clientWidth;
-            this._rightResizeElement.style.left = this.calculator.windowRight*100 + "%";
+            var windowRight = end / this._overviewGridElement.clientWidth;
+            this.calculator.windowRight = windowRight;
+            this._rightResizeElement.style.left = windowRight * 100 + "%";
         }
-        this._overviewWindowElement.style.width = (this.calculator.windowRight - this.calculator.windowLeft)*100 + "%";
+        this._overviewWindowElement.style.width = (this.calculator.windowRight - this.calculator.windowLeft) * 100 + "%";
         this.needsRefresh = true;
     },
 
@@ -540,7 +542,8 @@ WebInspector.TimelineRecordTreeElement.prototype = {
         }
     },
 
-    _updateDetails: function() {
+    _updateDetails: function()
+    {
         if (this.dataElement && this._record.details !== this._details) {
             this._details = this._record.details;
             this.dataElement.textContent = "(" + this._details + ")";
@@ -573,6 +576,7 @@ WebInspector.TimelineCalculator = function()
     WebInspector.AbstractTimelineCalculator.call(this);
     this.windowLeft = 0.0;
     this.windowRight = 1.0;
+    this._uiString = WebInspector.UIString.bind(WebInspector);
 }
 
 WebInspector.TimelineCalculator.prototype = {
@@ -595,22 +599,34 @@ WebInspector.TimelineCalculator.prototype = {
 
     get minimumBoundary()
     {
+        if (typeof this._minimumBoundary === "number")
+            return this._minimumBoundary;
+
         if (typeof this.windowLeft === "number")
-            return this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
-        return this._absoluteMinimumBoundary;
+            this._minimumBoundary = this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
+        else
+            this._minimumBoundary = this._absoluteMinimumBoundary;
+        return this._minimumBoundary;
     },
 
     get maximumBoundary()
     {
+        if (typeof this._maximumBoundary === "number")
+            return this._maximumBoundary;
+
         if (typeof this.windowLeft === "number")
-            return this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
-        return this._absoluteMaximumBoundary;
+            this._maximumBoundary = this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
+        else
+            this._maximumBoundary = this._absoluteMaximumBoundary;
+        return this._maximumBoundary;
     },
 
     reset: function()
     {
         delete this._absoluteMinimumBoundary;
         delete this._absoluteMaximumBoundary;
+        delete this._minimumBoundary;
+        delete this._maximumBoundary;
     },
 
     updateBoundaries: function(record)
@@ -621,12 +637,14 @@ WebInspector.TimelineCalculator.prototype = {
 
         if (typeof this._absoluteMinimumBoundary === "undefined" || lowerBound < this._absoluteMinimumBoundary) {
             this._absoluteMinimumBoundary = lowerBound;
+            delete this._minimumBoundary;
             didChange = true;
         }
 
         var upperBound = record.endTime;
         if (typeof this._absoluteMaximumBoundary === "undefined" || upperBound > this._absoluteMaximumBoundary) {
             this._absoluteMaximumBoundary = upperBound;
+            delete this._maximumBoundary;
             didChange = true;
         }
 
@@ -635,7 +653,7 @@ WebInspector.TimelineCalculator.prototype = {
 
     formatValue: function(value)
     {
-        return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, WebInspector.UIString.bind(WebInspector));
+        return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, this._uiString);
     }
 }
 
@@ -700,6 +718,7 @@ WebInspector.TimelineGraph = function(record)
     this._barAreaElement.appendChild(this._barElement);
 
     this._graphElement.addStyleClass("timeline-category-" + record.category.name);
+    this._hidden = false;
 }
 
 WebInspector.TimelineGraph.prototype = {
@@ -720,13 +739,19 @@ WebInspector.TimelineGraph.prototype = {
         this._percentages = percentages;
 
         if (percentages.start > 100 || percentages.end < 0) {
-            this._graphElement.addStyleClass("hidden");
-            this.record._itemsTreeElement.listItemElement.addStyleClass("hidden");
+            if (!this._hidden) {
+                this._graphElement.addStyleClass("hidden");
+                this.record._itemsTreeElement.listItemElement.addStyleClass("hidden");
+                this._hidden = true;
+            }
         } else {
             this._barElement.style.setProperty("left", percentages.start + "%");
             this._barElement.style.setProperty("right", (100 - percentages.end) + "%");
-            this._graphElement.removeStyleClass("hidden");
-            this.record._itemsTreeElement.listItemElement.removeStyleClass("hidden");
+            if (this._hidden) {
+                this._graphElement.removeStyleClass("hidden");
+                this.record._itemsTreeElement.listItemElement.removeStyleClass("hidden");
+                this._hidden = false;
+            }
         }
         var tooltip = (labels.tooltip || "");
         this._barElement.title = tooltip;
diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js
index f3e18eb..54720ee 100644
--- a/WebCore/inspector/front-end/utilities.js
+++ b/WebCore/inspector/front-end/utilities.js
@@ -147,13 +147,18 @@ Node.prototype.rangeOfWord = function(offset, stopCharacters, stayWithinNode, di
 
 Element.prototype.removeStyleClass = function(className) 
 {
-    // Test for the simple case before using a RegExp.
+    // Test for the simple case first.
     if (this.className === className) {
         this.className = "";
         return;
     }
 
-    this.removeMatchingStyleClasses(className.escapeForRegExp());
+    var index = this.className.indexOf(className);
+    if (index === -1)
+        return;
+
+    var newClassName = " " + this.className + " ";
+    this.className = newClassName.replace(" " + className + " ", " ");
 }
 
 Element.prototype.removeMatchingStyleClasses = function(classNameRegex)
@@ -176,8 +181,12 @@ Element.prototype.hasStyleClass = function(className)
     // Test for the simple case before using a RegExp.
     if (this.className === className)
         return true;
-    var regex = new RegExp("(^|\\s)" + className.escapeForRegExp() + "($|\\s)");
-    return regex.test(this.className);
+
+    var index = this.className.indexOf(className);
+    if (index === -1)
+        return false;
+    var toTest = " " + this.className + " ";
+    return toTest.indexOf(" " + className + " ", index) !== -1;
 }
 
 Element.prototype.positionAt = function(x, y)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list