Returns the maximum number of lines of text that should be rendered based
on the current height of the element and the line-height of the text.
502381
function getMaxLines(height) {
        var availHeight = height || element.clientHeight,
          lineHeight = getLineHeight(element);

        return Math.max(Math.floor(availHeight / lineHeight), 0);
      }
900913
private float getColumnBottom() {
        if (desiredHeight == AUTOMATIC) {
            return document.bottom();
        } else {
            return Math.max(top - (desiredHeight - totalHeight), document.bottom());
        }
    }
1249905
def text_length(elem):
    

    if not elem:
        return 0

    value = elem.value()

    try:
        value = len(value)
    except:
        value = 0

    try:
        for a in elem.elements:
            value += len(a.value())
    except:
        pass

    return value
131891
function getLineWidth(itemModel, rawLayout) {
    var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
    return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
}
1154901
def height_max(self, height_max):
        
        if height_max is None:
            self._height_limits[1] = None
            return

        height_max = float(height_max)
        assert(0 <= self.height_min <= height_max)
        self._height_limits[1] = height_max
        self._update_layout()
63535
public function getWidth(): int
    {
        $lines = [];
        foreach ($this as $line) {
            $lines[] = $line->getWidth();
        }

        return max($lines);
    }
601284
def _line(self, text, indent=0):
        """"""
        leading_space = '  ' * indent
        while len(leading_space) + len(text) > self.width:
            # The text is too wide; wrap if possible.

            # Find the rightmost space that would obey our width constraint and
            # that's not an escaped space.
            available_space = self.width - len(leading_space) - len(' $')
            space = available_space
            while True:
                space = text.rfind(' ', 0, space)
                if (space < 0 or
                    self._count_dollars_before_index(text, space) % 2 == 0):
                    break

            if space < 0:
                # No such space; just use the first unescaped space we can find.
                space = available_space - 1
                while True:
                    space = text.find(' ', space + 1)
                    if (space < 0 or
                        self._count_dollars_before_index(text, space) % 2 == 0):
                        break
            if space < 0:
                # Give up on breaking.
                break

            self.output.write(leading_space + text[0:space] + ' $\n')
            text = text[space+1:]

            # Subsequent lines are continuations, so indent them.
            leading_space = '  ' * (indent+2)

        self.output.write(leading_space + text + '\n')
1047699
def _multiline_width(multiline_s, line_width_fn=len):
    """"""
    return max(map(line_width_fn, re.split("[\r\n]", multiline_s)))
1356480
public int calcComponentPageHeight()
    {
        remainingComponentHeight = remainingComponentHeight + this.checkComponentHeight();
        if (remainingComponentHeight <= remainingPageHeight)
            return remainingComponentHeight;
        if (currentComponent == null)
            return 0;   // Never
        if (!(currentComponent instanceof Container))
            return 0;   // Never
        if (currentComponent instanceof JTable)
        {
            int rowHeight = ((JTable)currentComponent).getRowHeight();
            int currentComponentPageBreak = componentStartYLocation + remainingPageHeight;
            int currentComponentPageRow = (int)(currentComponentPageBreak / rowHeight);
            return remainingPageHeight - (currentComponentPageBreak - currentComponentPageRow * rowHeight);
        }
        
        int lastComponentPageHeight = 0;
        int y = 0;
        int maxLowerBreak = (int)(pageHeight * MAX_LOWER_BREAK);
        Component component = null;
        for (y = remainingPageHeight; y > remainingPageHeight - maxLowerBreak; y--)
        {
            int x = 0;
            for (x = 0; x < currentComponent.getWidth(); x++)
            {
                component = ((Container)currentComponent).getComponentAt(x, componentStartYLocation + y);
                if (component != null)
                    if (component != currentComponent)
                        if (component.getY() + component.getHeight() - 1 != y)  // Don't count last line
                            break;  // This line contains a component, don't break here (continue looking)
            }
            if (x == currentComponent.getWidth())
                break;  // White space thru this whole line, use this as a break
            if (component != null)
                lastComponentPageHeight = Math.max(lastComponentPageHeight, component.getY() - 1);
        }
        if (y == remainingPageHeight - maxLowerBreak)
        {   // Did not find a break, try another way
            if ((lastComponentPageHeight == 0) || (lastComponentPageHeight < pageHeight - maxLowerBreak))
                y = pageHeight;    // No break found, break at the end of the page (in the middle of a component)
            else
                y = lastComponentPageHeight;  // No break found, use the start of the lowest component
        }
        
        return y;
    }
218524
function htmlTreeAsString (elem) {
  var MAX_TRAVERSE_HEIGHT = 5
  var MAX_OUTPUT_LEN = 80
  var out = []
  var height = 0
  var len = 0
  var separator = ' > '
  var sepLength = separator.length
  var nextStr

  while (elem && height++ < MAX_TRAVERSE_HEIGHT) {
    nextStr = htmlElementAsString(elem)
    // bail out if
    // - nextStr is the 'html' element
    // - the length of the string that would be created exceeds MAX_OUTPUT_LEN
    //   (ignore this limit if we are on the first iteration)
    if (
      nextStr === 'html' ||
      (height > 1 &&
       len + (out.length * sepLength) + nextStr.length >= MAX_OUTPUT_LEN)
    ) {
      break
    }

    out.push(nextStr)

    len += nextStr.length
    elem = elem.parentNode
  }

  return out.reverse().join(separator)
}
738548
function () {
                var items = this.items;
                var itemsLength = items.length;
                var pageSize = this.pageSize;
                if (pageSize <= 0) {
                    pageSize = -1;
                }
                var pages = [], pageLength = 0;
                var pageIndex = 0;
                var nbElementsInPage = 0;
                var firstElement = -1;
                for (var i = 0; i < itemsLength; i++) {
                    var elt = items[i];
                    if (elt.filteredIn) {
                        if (nbElementsInPage === 0) {
                            firstElement = i;
                        }
                        nbElementsInPage++;
                        elt.pageIndex = pageIndex;
                        if (nbElementsInPage == pageSize) {
                            pages[pageLength++] = {
                                pageIndex : pageIndex,
                                pageNumber : pageIndex + 1,
                                firstItemIndex : firstElement,
                                lastItemIndex : i,
                                firstItemNumber : pageIndex * pageSize + 1,
                                lastItemNumber : (pageIndex + 1) * pageSize
                            };
                            pageIndex++;
                            nbElementsInPage = 0;
                        }
                    } else {
                        elt.pageIndex = -1;
                    }
                }
                this._currentState.pageSize = pageSize;
                this.pageMode = (pageSize > 0);
                this.filteredInCount = pageIndex * pageSize + nbElementsInPage; // true even when pageMode == false (as
                // pageIndex == 0)
                if (nbElementsInPage > 0) {
                    pages[pageLength++] = {
                        pageIndex : pageIndex,
                        pageNumber : pageIndex + 1,
                        firstItemIndex : firstElement,
                        lastItemIndex : itemsLength - 1,
                        firstItemNumber : pageIndex * pageSize + 1,
                        lastItemNumber : this.filteredInCount
                    };
                }
                if (pageLength === 0) {
                    // there always must be at least one page
                    pages = this.EMPTY_PAGES;
                }
                this.pages = pages;
            }
1329914
def width(self) -> int:
        """"""
        max_x = -1.0
        for x, _ in self.entries.keys():
            max_x = max(max_x, x)
        for v in self.vertical_lines:
            max_x = max(max_x, v.x)
        for h in self.horizontal_lines:
            max_x = max(max_x, h.x1, h.x2)
        return 1 + int(max_x)
146159
def get_height_for_line(self, lineno, width):
        
        try:
            return self._line_heights[lineno, width]
        except KeyError:
            text = token_list_to_text(self.get_line(lineno))
            result = self.get_height_for_text(text, width)

            # Cache and return
            self._line_heights[lineno, width] = result
            return result
824865
function() {
    var childLength = this.children.length,
        multiLine   = childLength > 0;
    
    if (childLength == 1 && this.children[0] instanceof Jaml.TextNode) multiLine = false;
    
    return multiLine;
  }
1140798
function(){
			var rows = this.model.get('options').rows*1 || null;
			if(rows) return Math.max(3, rows/2);

			var cellHeight = 70;
			var height = this.$el.parent().height() - this.$el.children(':first').height();

			// Less the maximum required by the tags (Scheduled, Playing, Ended...)
			height -= 180;

			rows = Math.round(height / cellHeight - 0.5);
			console.log(height);
			return Math.max(3, rows);
		}
505460
function () {
            var docEl = document.documentElement;
            return Math.max( docEl.scrollWidth, document.body.scrollWidth, docEl.clientWidth );
        }
907958
def best_fit_font_size(cls, text, extents, max_size, font_file):
        
        line_source = _LineSource(text)
        text_fitter = cls(line_source, extents, font_file)
        return text_fitter._best_fit_font_size(max_size)