<commit_before>/* ***********************************************************************************************

    Unify Project

    Homepage: unify-project.org
    License: MIT + Apache (V2)
    Copyright: 2012, <NAME>, Mainz, Germany, http://unify-training.com

*********************************************************************************************** */

/**
 * #break(unify.ui.layout.queue.Manager)
 */

(function() {
  
  var widgetQueue = [];
  
  var sortWidgets = function(a,b) {
    if (!a) {
      return 1;
    }
    if (!b) {
      return -1;
    }
    return a.getNestingLevel() - b.getNestingLevel();
  };
  
  core.Module("unify.ui.layout.queue.Layout", {
    name : "layout",
    
    add : function(widget) {
      widgetQueue.push(widget);
      unify.ui.layout.queue.Manager.run(unify.ui.layout.queue.Layout.name);
    },
    
    flush : function() {
      widgetQueue.sort(sortWidgets);
      for (var i=0,ii=widgetQueue.length; i<ii; i++) {
        for (var j=i-1;j>=0;j--) {
          if (widgetQueue[i] === widgetQueue[j]) {
            widgetQueue[i]  = null;
          }
        }
      }
      
      var widget;
      while ((widget = widgetQueue.shift())) {
        var sizeHint = widget.getSizeHint(true);
        if (widget.isRootWidget()) {
          widget.renderLayout(0, 0, sizeHint.width, sizeHint.height);
        } else {
          var bounds = widget.getBounds();
          if (bounds) {
            widget.renderLayout(bounds.left, bounds.top, bound.width, bounds.height);
          }
        }
      }<commit_msg>Fix usage of widget bounds<commit_after>/* ***********************************************************************************************

    Unify Project

    Homepage: unify-project.org
    License: MIT + Apache (V2)
    Copyright: 2012, <NAME>, Mainz, Germany, http://unify-training.com

*********************************************************************************************** */

/**
 * #break(unify.ui.layout.queue.Manager)
 */

(function() {
  
  var widgetQueue = [];
  
  var sortWidgets = function(a,b) {
    if (!a) {
      return 1;
    }
    if (!b) {
      return -1;
    }
    return a.getNestingLevel() - b.getNestingLevel();
  };
  
  core.Module("unify.ui.layout.queue.Layout", {
    name : "layout",
    
    add : function(widget) {
      widgetQueue.push(widget);
      unify.ui.layout.queue.Manager.run(unify.ui.layout.queue.Layout.name);
    },
    
    flush : function() {
      widgetQueue.sort(sortWidgets);
      for (var i=0,ii=widgetQueue.length; i<ii; i++) {
        for (var j=i-1;j>=0;j--) {
          if (widgetQueue[i] === widgetQueue[j]) {
            widgetQueue[i]  = null;
          }
        }
      }
      
      var widget;
      while ((widget = widgetQueue.shift())) {
        var sizeHint = widget.getSizeHint(true);
        if (widget.isRootWidget()) {
          widget.renderLayout(0, 0, sizeHint.width, sizeHint.height);
        } else {
          var bounds = widget.getBounds();
          
          if (bounds) {
            widget.renderLayout(bounds[0], bounds[1], bounds[2], bounds[3]);
          }
        }
      }
{'fraction_non_alphanumeric': 0.25818759936406993, 'fraction_numerical': 0.00890302066772655, 'mean_word_length': 2.375536480686695, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5525648', 'n_tokens_mistral': 975, 'n_tokens_neox': 943, 'n_words': 164}