B2G/gecko/browser/components/tabview/items.js
//   container - the outermost DOM element that describes this item onscreen.
the outermost DOM element that describes this item onscreen.
the outermost DOM element that describes this item onscreen .
function Item__init(container) {
    Utils.assert(typeof this.addSubscriber == 'function' && 
        typeof this.removeSubscriber == 'function' && 
        typeof this._sendToSubscribers == 'function',
        'Subclass must implement the Subscribable interface');
    Utils.assert(Utils.isDOMElement(container), 'container must be a DOM element');
    Utils.assert(typeof this.setBounds == 'function', 'Subclass must provide setBounds');
    Utils.assert(typeof this.setZ == 'function', 'Subclass must provide setZ');
    Utils.assert(typeof this.close == 'function', 'Subclass must provide close');
    Utils.assert(typeof this.save == 'function', 'Subclass must provide save');
    Utils.assert(Utils.isRect(this.bounds), 'Subclass must provide bounds');
    this.container = container;
    this.$container = iQ(container);
    iQ(this.container).data('item', this);
    this.dragOptions = {
      cancelClass: 'close stackExpander',
      start: function(e, ui) {
        UI.setActive(this);
        if (this.isAGroupItem)
          this._unfreezeItemSize();
        else if (this.parent != null)
          this.parent._dropSpaceActive = true;
        drag.info = new Drag(this, e);
      },
      drag: function(e) {
        drag.info.drag(e);
      },
      stop: function() {
        drag.info.stop();
        if (!this.isAGroupItem && !this.parent) {
          new GroupItem([drag.info.$el], {focusTitle: true});
          gTabView.firstUseExperienced = true;
        }
        drag.info = null;
      },
      minDragDistance: 3
    };
    this.dropOptions = {
      over: function() {},
      out: function() {
        let groupItem = drag.info.item.parent;
        if (groupItem)
          groupItem.remove(drag.info.$el, {dontClose: true});
        iQ(this.container).removeClass("acceptsDrop");
      },
      drop: function(event) {
        iQ(this.container).removeClass("acceptsDrop");
      },
      accept: function dropAcceptFunction(item) {
        return (item && item.isATabItem && (!item.parent || !item.parent.expanded));
      }
    };
    var self = this;
    this.resizeOptions = {
      aspectRatio: self.keepProportional,
      minWidth: 90,
      minHeight: 90,
      start: function(e,ui) {
        UI.setActive(this);
        resize.info = new Drag(this, e);
      },
      resize: function(e,ui) {
        resize.info.snap(UI.rtl ? 'topright' : 'topleft', false, self.keepProportional);
      },
      stop: function() {
        self.setUserSize();
        self.pushAway();
        resize.info.stop();
        resize.info = null;
      }
    };
  }
function Item__init ( container ) { Utils . assert ( typeof this . addSubscriber == 'function' && typeof this . removeSubscriber == 'function' && typeof this . _sendToSubscribers == 'function' , 'Subclass must implement the Subscribable interface' ) ; Utils . assert ( Utils . isDOMElement ( container ) , 'container must be a DOM element' ) ; Utils . assert ( typeof this . setBounds == 'function' , 'Subclass must provide setBounds' ) ; Utils . assert ( typeof this . setZ == 'function' , 'Subclass must provide setZ' ) ; Utils . assert ( typeof this . close == 'function' , 'Subclass must provide close' ) ; Utils . assert ( typeof this . save == 'function' , 'Subclass must provide save' ) ; Utils . assert ( Utils . isRect ( this . bounds ) , 'Subclass must provide bounds' ) ; this . container = container ; this . $container = iQ ( container ) ; iQ ( this . container ) . data ( 'item' , this ) ; this . dragOptions = { cancelClass : 'close stackExpander' , start : function ( e , ui ) { UI . setActive ( this ) ; if ( this . isAGroupItem ) this . _unfreezeItemSize ( ) ; else if ( this . parent != null ) this . parent . _dropSpaceActive = true ; drag . info = new Drag ( this , e ) ; } , drag : function ( e ) { drag . info . drag ( e ) ; } , stop : function ( ) { drag . info . stop ( ) ; if ( ! this . isAGroupItem && ! this . parent ) { new GroupItem ( [ drag . info . $el ] , { focusTitle : true } ) ; gTabView . firstUseExperienced = true ; } drag . info = null ; } , minDragDistance : 3 } ; this . dropOptions = { over : function ( ) { } , out : function ( ) { let groupItem = drag . info . item . parent ; if ( groupItem ) groupItem . remove ( drag . info . $el , { dontClose : true } ) ; iQ ( this . container ) . removeClass ( "acceptsDrop" ) ; } , drop : function ( event ) { iQ ( this . container ) . removeClass ( "acceptsDrop" ) ; } , accept : function dropAcceptFunction ( item ) { return ( item && item . isATabItem && ( ! item . parent || ! item . parent . expanded ) ) ; } } ; var self = this ; this . resizeOptions = { aspectRatio : self . keepProportional , minWidth : 90 , minHeight : 90 , start : function ( e , ui ) { UI . setActive ( this ) ; resize . info = new Drag ( this , e ) ; } , resize : function ( e , ui ) { resize . info . snap ( UI . rtl ? 'topright' : 'topleft' , false , self . keepProportional ) ; } , stop : function ( ) { self . setUserSize ( ) ; self . pushAway ( ) ; resize . info . stop ( ) ; resize . info = null ; } } ; }
container - the outermost DOM element that describes this item onscreen.
container - the outermost DOM element that describes this item onscreen .
// ___ drag // if we start dragging a tab within a group, start with dropSpace on. // The minimum the mouse must move after mouseDown in order to move an  // item // ___ drop // Function: dropAcceptFunction // Given a DOM element, returns true if it should accept tabs being dropped on it. // Private to this file. // ___ resize