Commit 404f0361 authored by Ehsan Akhgari's avatar Ehsan Akhgari
Browse files

Backout changeset 7fbc721aa455 (bug 634672) because it breaks the Mac...

Backout changeset 7fbc721aa455 (bug 634672) because it breaks the Mac mochitest-browser-chrome tests
parent d9b393ef
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1251,7 +1251,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
      count: count || this._children.length,
      hideTitle: false
    };
    let arrObj = Items.arrange(this._children, bb, options);
    let arrObj = Items.arrange(null, bb, options);
 
    let shouldStack = arrObj.childWidth < TabItems.minTabWidth * 1.35;
    this._columns = shouldStack ? null : arrObj.columns;
+1 −0
Original line number Diff line number Diff line
@@ -943,6 +943,7 @@ let Items = {
  //     width of children and the columns.
  //   count - overrides the item count for layout purposes;
  //     default: the actual item count
  //   padding - pixels between each item
  //   columns - (int) a preset number of columns to use
  //   dropPos - a <Point> which should have a one-tab space left open, used
  //             when a tab is dragged over.
+49 −39
Original line number Diff line number Diff line
@@ -230,6 +230,16 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
    this.tabCanvas.paint();
  },

  // ----------
  // Function: _getFontSizeFromWidth
  // Private method that returns the fontsize to use given the tab's width
  _getFontSizeFromWidth: function TabItem__getFontSizeFromWidth(width) {
    let widthRange = new Range(0,TabItems.tabWidth);
    let proportion = widthRange.proportion(width-TabItems.tabItemPadding.x, true);
    // proportion is in [0,1]
    return TabItems.fontSizeRange.scale(proportion);
  },

  // ----------
  // Function: unforceCanvasSize
  // Stops holding the thumbnail resolution; allows it to shift to the
@@ -431,14 +441,16 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {

    if (rect.width != this.bounds.width || options.force) {
      css.width = rect.width - TabItems.tabItemPadding.x;
      css.fontSize = TabItems.getFontSizeFromWidth(rect.width);
      css.fontSize = this._getFontSizeFromWidth(rect.width);
      css.fontSize += 'px';
    }

    if (rect.height != this.bounds.height || options.force) {
      css.height = rect.height - TabItems.tabItemPadding.y;
      if (!this.isStacked)
        css.height -= TabItems.fontSizeRange.max;
          css.height = rect.height - TabItems.tabItemPadding.y -
                       TabItems.fontSizeRange.max;
      else
        css.height = rect.height - TabItems.tabItemPadding.y;
    }

    if (Utils.isEmptyObject(css))
@@ -1277,28 +1289,28 @@ let TabItems = {
    return sane;
  },
  
  // ----------
  // Function: getFontSizeFromWidth
  // Private method that returns the fontsize to use given the tab's width
  getFontSizeFromWidth: function TabItem_getFontSizeFromWidth(width) {
    let widthRange = new Range(0, TabItems.tabWidth);
    let proportion = widthRange.proportion(width - TabItems.tabItemPadding.x, true);
    // proportion is in [0,1]
    return TabItems.fontSizeRange.scale(proportion);
  },

  // ----------
  // Function: _getWidthForHeight
  // Private method that returns the tabitem width given a height.
  _getWidthForHeight: function TabItems__getWidthForHeight(height) {
    return height * TabItems.invTabAspect;
  // Set options.hideTitle=true to measure without a title.
  // Default is to measure with a title.
  _getWidthForHeight: function TabItems__getWidthForHeight(height, options) {    
    let titleSize = (options !== undefined && options.hideTitle === true) ? 
      0 : TabItems.fontSizeRange.max;
    return Math.max(0, Math.max(TabItems.minTabHeight, height - titleSize)) * 
      TabItems.invTabAspect;
  },

  // ----------
  // Function: _getHeightForWidth
  // Private method that returns the tabitem height given a width.
  _getHeightForWidth: function TabItems__getHeightForWidth(width) {
    return width * TabItems.tabAspect;
  // Set options.hideTitle=false to measure without a title.
  // Default is to measure with a title.
  _getHeightForWidth: function TabItems__getHeightForWidth(width, options) {
    let titleSize = (options !== undefined && options.hideTitle === true) ? 
      0 : TabItems.fontSizeRange.max;
    return Math.max(0, Math.max(TabItems.minTabWidth,width)) *
      TabItems.tabAspect + titleSize;
  },
  
  // ----------
@@ -1307,28 +1319,26 @@ let TabItems = {
  // size and aspect ratio.
  calcValidSize: function TabItems_calcValidSize(size, options) {
    Utils.assert(Utils.isPoint(size), 'input is a Point');
    let retSize = new Point(0,0);
    if (size.x==-1) {
      retSize.x = this._getWidthForHeight(size.y, options);
      retSize.y = size.y;
    } else if (size.y==-1) {
      retSize.x = size.x;
      retSize.y = this._getHeightForWidth(size.x, options);
    } else {
      let fitHeight = this._getHeightForWidth(size.x, options);
      let fitWidth = this._getWidthForHeight(size.y, options);

    let width = Math.max(TabItems.minTabWidth, size.x);
    let showTitle = !options || !options.hideTitle;
    let titleSize = showTitle ? TabItems.fontSizeRange.max : 0;
    let height = Math.max(TabItems.minTabHeight, size.y - titleSize);
    let retSize = new Point(width, height);

    if (size.x > -1)
      retSize.y = this._getHeightForWidth(width);
    if (size.y > -1)
      retSize.x = this._getWidthForHeight(height);

    if (size.x > -1 && size.y > -1) {
      if (retSize.x < size.x)
        retSize.y = this._getHeightForWidth(retSize.x);
      else
        retSize.x = this._getWidthForHeight(retSize.y);
      // Go with the smallest final dimension.
      if (fitWidth < size.x) {
        retSize.x = fitWidth;
        retSize.y = size.y;
      } else {
        retSize.x = size.x;
        retSize.y = fitHeight;
      }
    }

    if (showTitle)
      retSize.y += titleSize;

    return retSize;
  }
};
+0 −2
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ _BROWSER_FILES = \
                 browser_tabview_bug624953.js \
                 browser_tabview_bug625269.js \
                 browser_tabview_bug625424.js \
                 browser_tabview_bug625666.js \
                 browser_tabview_bug626368.js \
                 browser_tabview_bug626525.js \
                 browser_tabview_bug626791.js \
@@ -123,7 +122,6 @@ _BROWSER_FILES = \
                 browser_tabview_bug634077.js \
                 browser_tabview_bug634085.js \
                 browser_tabview_bug634158.js \
                 browser_tabview_bug634672.js \
                 browser_tabview_bug635696.js \
                 browser_tabview_dragdrop.js \
                 browser_tabview_exit_button.js \
+22 −6
Original line number Diff line number Diff line
@@ -4,20 +4,36 @@
function test() {
  waitForExplicitFinish();

  let finishTest = function (groupItem) {
    groupItem.addSubscriber(groupItem, 'groupHidden', function () {
      groupItem.removeSubscriber(groupItem, 'groupHidden');
      groupItem.closeHidden();
      hideTabView(finish);
    });

    groupItem.closeAll();
  }

  showTabView(function () {
    let cw = TabView.getContentWindow();

    let groupItem = createGroupItemWithBlankTabs(window, 200, 240, 20, 4)
    ok(!groupItem.isStacked(), 'groupItem is not stacked');
    let bounds = new cw.Rect(20, 20, 150, 200);
    let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true});
    cw.GroupItems.setActiveGroupItem(groupItem);

    for (let i=0; i<4; i++)
      gBrowser.loadOneTab('about:blank', {inBackground: true});

    ok(!groupItem._isStacked, 'groupItem is not stacked');
    cw.GroupItems.pauseArrange();

    groupItem.setSize(100, 100, true);
    groupItem.setSize(150, 150);
    groupItem.setUserSize();
    ok(!groupItem.isStacked(), 'groupItem is still not stacked');
    ok(!groupItem._isStacked, 'groupItem is still not stacked');

    cw.GroupItems.resumeArrange();
    ok(groupItem.isStacked(), 'groupItem is now stacked');
    ok(groupItem._isStacked, 'groupItem is now stacked');

    closeGroupItem(groupItem, finish);
    finishTest(groupItem);
  });
}
Loading