Changeset 125005 in webkit


Ignore:
Timestamp:
Aug 8, 2012, 12:39:14 AM (13 years ago)
Author:
vsevik@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r125003 r125005  
     12012-08-07  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: TabbedPane should use floating point width values for measuring.
     4        https://bugs.webkit.org/show_bug.cgi?id=93349
     5
     6        Reviewed by Pavel Feldman.
     7
     8        TabbedPane now uses getBoundingClientRect().width instead of offsetWidth for more precise calculation.
     9
     10        * inspector/front-end/TabbedPane.js:
     11        (WebInspector.TabbedPane.prototype._totalWidth):
     12        (WebInspector.TabbedPane.prototype._updateTabsDropDown):
     13        (WebInspector.TabbedPane.prototype._measureDropDownButton):
     14        (WebInspector.TabbedPane.prototype._updateWidths):
     15        (WebInspector.TabbedPaneTab.prototype._measure):
     16
    1172012-08-08  Douglas Stockwell  <dstockwell@chromium.org>
    218
  • trunk/Source/WebCore/inspector/front-end/TabbedPane.js

    r123313 r125005  
    305305    },
    306306
     307    _totalWidth: function()
     308    {
     309        return this._headerContentsElement.getBoundingClientRect().width;
     310    },
     311
    307312    _updateTabsDropDown: function()
    308313    {
    309         var tabsToShowIndexes = this._tabsToShowIndexes(this._tabs, this._tabsHistory, this._headerContentsElement.offsetWidth, this._measuredDropDownButtonWidth);
     314        var tabsToShowIndexes = this._tabsToShowIndexes(this._tabs, this._tabsHistory, this._totalWidth(), this._measuredDropDownButtonWidth);
    310315
    311316        for (var i = 0; i < this._tabs.length; ++i) {
     
    363368        this._dropDownButton.addStyleClass("measuring");
    364369        this._headerContentsElement.appendChild(this._dropDownButton);
    365         this._measuredDropDownButtonWidth = this._dropDownButton.offsetWidth;
     370        this._measuredDropDownButtonWidth = this._dropDownButton.getBoundingClientRect().width;
    366371        this._headerContentsElement.removeChild(this._dropDownButton);
    367372        this._dropDownButton.removeStyleClass("measuring");
     
    374379            measuredWidths.push(this._tabs[tabId].measuredWidth);
    375380       
    376         const roundingError = 5;
    377         var maxWidth = this._calculateMaxWidth(measuredWidths, this._headerContentsElement.offsetWidth - 5);
     381        var maxWidth = this._calculateMaxWidth(measuredWidths, this._totalWidth());
    378382       
    379383        for (var tabId in this._tabs) {
     
    658662        var measuringTabElement = this._createTabElement(true);
    659663        this._measureElement.appendChild(measuringTabElement);
    660         this._measuredWidth = measuringTabElement.offsetWidth;
     664        this._measuredWidth = measuringTabElement.getBoundingClientRect().width;
    661665        this._measureElement.removeChild(measuringTabElement);
    662666    },
Note: See TracChangeset for help on using the changeset viewer.