Title: [125005] trunk/Source/WebCore
Revision
125005
Author
vse...@chromium.org
Date
2012-08-08 00:39:14 -0700 (Wed, 08 Aug 2012)

Log Message

Web Inspector: TabbedPane should use floating point width values for measuring.
https://bugs.webkit.org/show_bug.cgi?id=93349

Reviewed by Pavel Feldman.

TabbedPane now uses getBoundingClientRect().width instead of offsetWidth for more precise calculation.

* inspector/front-end/TabbedPane.js:
(WebInspector.TabbedPane.prototype._totalWidth):
(WebInspector.TabbedPane.prototype._updateTabsDropDown):
(WebInspector.TabbedPane.prototype._measureDropDownButton):
(WebInspector.TabbedPane.prototype._updateWidths):
(WebInspector.TabbedPaneTab.prototype._measure):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125004 => 125005)


--- trunk/Source/WebCore/ChangeLog	2012-08-08 07:31:12 UTC (rev 125004)
+++ trunk/Source/WebCore/ChangeLog	2012-08-08 07:39:14 UTC (rev 125005)
@@ -1,3 +1,19 @@
+2012-08-07  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: TabbedPane should use floating point width values for measuring.
+        https://bugs.webkit.org/show_bug.cgi?id=93349
+
+        Reviewed by Pavel Feldman.
+
+        TabbedPane now uses getBoundingClientRect().width instead of offsetWidth for more precise calculation.
+
+        * inspector/front-end/TabbedPane.js:
+        (WebInspector.TabbedPane.prototype._totalWidth):
+        (WebInspector.TabbedPane.prototype._updateTabsDropDown):
+        (WebInspector.TabbedPane.prototype._measureDropDownButton):
+        (WebInspector.TabbedPane.prototype._updateWidths):
+        (WebInspector.TabbedPaneTab.prototype._measure):
+
 2012-08-08  Douglas Stockwell  <dstockw...@chromium.org>
 
         'highlight' should not be parsed for a composite operation

Modified: trunk/Source/WebCore/inspector/front-end/TabbedPane.js (125004 => 125005)


--- trunk/Source/WebCore/inspector/front-end/TabbedPane.js	2012-08-08 07:31:12 UTC (rev 125004)
+++ trunk/Source/WebCore/inspector/front-end/TabbedPane.js	2012-08-08 07:39:14 UTC (rev 125005)
@@ -304,9 +304,14 @@
         return dropDownContainer;
     },
 
+    _totalWidth: function()
+    {
+        return this._headerContentsElement.getBoundingClientRect().width;
+    },
+
     _updateTabsDropDown: function()
     {
-        var tabsToShowIndexes = this._tabsToShowIndexes(this._tabs, this._tabsHistory, this._headerContentsElement.offsetWidth, this._measuredDropDownButtonWidth);
+        var tabsToShowIndexes = this._tabsToShowIndexes(this._tabs, this._tabsHistory, this._totalWidth(), this._measuredDropDownButtonWidth);
 
         for (var i = 0; i < this._tabs.length; ++i) {
             if (this._tabs[i]._shown && tabsToShowIndexes.indexOf(i) === -1)
@@ -362,7 +367,7 @@
     {
         this._dropDownButton.addStyleClass("measuring");
         this._headerContentsElement.appendChild(this._dropDownButton);
-        this._measuredDropDownButtonWidth = this._dropDownButton.offsetWidth;
+        this._measuredDropDownButtonWidth = this._dropDownButton.getBoundingClientRect().width;
         this._headerContentsElement.removeChild(this._dropDownButton);
         this._dropDownButton.removeStyleClass("measuring");
     },
@@ -373,8 +378,7 @@
         for (var tabId in this._tabs)
             measuredWidths.push(this._tabs[tabId].measuredWidth);
         
-        const roundingError = 5;
-        var maxWidth = this._calculateMaxWidth(measuredWidths, this._headerContentsElement.offsetWidth - 5);
+        var maxWidth = this._calculateMaxWidth(measuredWidths, this._totalWidth());
         
         for (var tabId in this._tabs) {
             var tab = this._tabs[tabId];
@@ -657,7 +661,7 @@
     {
         var measuringTabElement = this._createTabElement(true);
         this._measureElement.appendChild(measuringTabElement);
-        this._measuredWidth = measuringTabElement.offsetWidth;
+        this._measuredWidth = measuringTabElement.getBoundingClientRect().width;
         this._measureElement.removeChild(measuringTabElement);
     },
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to