<commit_before># coding: utf8
"""
    weasyprint.layout.inline
    ------------------------

    Line breaking and layout for inline-level boxes.

    :copyright: Copyright 2011-2012 <NAME> and contributors, see AUTHORS.
    :license: BSD, see LICENSE for details.

"""

from __future__ import division, unicode_literals
import functools

import cairo

from .absolute import absolute_layout, AbsolutePlaceholder
from .markers import image_marker_layout
from .percentages import resolve_percentages, resolve_one_percentage
from .preferred import shrink_to_fit
from .tables import find_in_flow_baseline, table_wrapper_width
from ..text import TextFragment
from ..formatting_structure import boxes
from ..css.computed_values import used_line_height


def iter_line_boxes(document, box, position_y, skip_stack,
                    containing_block, device_size, absolute_boxes):
    """Return an iterator of ``(line, resume_at)``.

    ``line`` is a laid-out LineBox with as much content as possible that
    fits in the available width.

    :param linebox: a non-laid-out :class:`LineBox`
    :param position_y: vertical top position of the line box on the page
    :param skip_stack: ``None`` to start at the beginning of ``linebox``,
                       or a ``resume_at`` value to continue just after an
                       already laid-out line.
    :param containing_block: Containing block of the line box:
                             a :class:`BlockContainerBox`
    :param device_size: ``(width, height)`` of the current page.

    """
    while 1:
        line, resume_at = get_next_linebox(
            document, box, position_y, skip_stack,
            containing_block, device_size, absolute_boxes)
        if line is None:
            return
        yield line, resume_at<commit_msg>Account for the "strut" on block containers.<commit_after># coding: utf8
"""
    weasyprint.layout.inline
    ------------------------

    Line breaking and layout for inline-level boxes.

    :copyright: Copyright 2011-2012 <NAME> and contributors, see AUTHORS.
    :license: BSD, see LICENSE for details.

"""

from __future__ import division, unicode_literals
import functools

import cairo

from .absolute import absolute_layout, AbsolutePlaceholder
from .markers import image_marker_layout
from .percentages import resolve_percentages, resolve_one_percentage
from .preferred import shrink_to_fit
from .tables import find_in_flow_baseline, table_wrapper_width
from ..text import TextFragment
from ..formatting_structure import boxes
from ..css.computed_values import used_line_height


def iter_line_boxes(document, box, position_y, skip_stack,
                    containing_block, device_size, absolute_boxes):
    """Return an iterator of ``(line, resume_at)``.

    ``line`` is a laid-out LineBox with as much content as possible that
    fits in the available width.

    :param linebox: a non-laid-out :class:`LineBox`
    :param position_y: vertical top position of the line box on the page
    :param skip_stack: ``None`` to start at the beginning of ``linebox``,
                       or a ``resume_at`` value to continue just after an
                       already laid-out line.
    :param containing_block: Containing block of the line box:
                             a :class:`BlockContainerBox`
    :param device_size: ``(width, height)`` of the current page.

    """
    strut = used_line_height(containing_block.style)
    while 1:
        line, resume_at = get_next_linebox(
            document, box, position_y, skip_stack,
            containing_block, device_size, absolute_boxes)
        if line is None:
            return
        # TODO: Make sure the line and the strut are on the same baseline.
        # See http://www.w3.org/TR/CSS21/visudet.html#line-height
        line.height = max(line.height, strut)
        yield line, resume_at
{'fraction_non_alphanumeric': 0.08572166279369997, 'fraction_numerical': 0.0059385489284792155, 'mean_word_length': 2.917087967644085, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '4124649', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1037, 'n_words': 379}