#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/layout/inline/inline_layout_algorithm.h"
#include <memory>
#include "base/compiler_specific.h"
#include "base/containers/adapters.h"
#include "base/metrics/histogram_macros.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/layout/block_break_token.h"
#include "third_party/blink/renderer/core/layout/constraint_space.h"
#include "third_party/blink/renderer/core/layout/disable_layout_side_effects_scope.h"
#include "third_party/blink/renderer/core/layout/floats_utils.h"
#include "third_party/blink/renderer/core/layout/fragmentation_utils.h"
#include "third_party/blink/renderer/core/layout/inline/initial_letter_utils.h"
#include "third_party/blink/renderer/core/layout/inline/inline_box_state.h"
#include "third_party/blink/renderer/core/layout/inline/inline_break_token.h"
#include "third_party/blink/renderer/core/layout/inline/inline_child_layout_context.h"
#include "third_party/blink/renderer/core/layout/inline/inline_item_result.h"
#include "third_party/blink/renderer/core/layout/inline/inline_node.h"
#include "third_party/blink/renderer/core/layout/inline/justification_utils.h"
#include "third_party/blink/renderer/core/layout/inline/line_box_fragment_builder.h"
#include "third_party/blink/renderer/core/layout/inline/line_breaker.h"
#include "third_party/blink/renderer/core/layout/inline/line_info.h"
#include "third_party/blink/renderer/core/layout/inline/line_truncator.h"
#include "third_party/blink/renderer/core/layout/inline/line_widths.h"
#include "third_party/blink/renderer/core/layout/inline/logical_line_builder.h"
#include "third_party/blink/renderer/core/layout/inline/logical_line_container.h"
#include "third_party/blink/renderer/core/layout/inline/paragraph_line_breaker.h"
#include "third_party/blink/renderer/core/layout/inline/ruby_utils.h"
#include "third_party/blink/renderer/core/layout/inline/score_line_breaker.h"
#include "third_party/blink/renderer/core/layout/layout_result.h"
#include "third_party/blink/renderer/core/layout/layout_text_combine.h"
#include "third_party/blink/renderer/core/layout/length_utils.h"
#include "third_party/blink/renderer/core/layout/list/layout_outside_list_marker.h"
#include "third_party/blink/renderer/core/layout/list/unpositioned_list_marker.h"
#include "third_party/blink/renderer/core/layout/logical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/positioned_float.h"
#include "third_party/blink/renderer/core/layout/relative_utils.h"
#include "third_party/blink/renderer/core/layout/space_utils.h"
#include "third_party/blink/renderer/core/layout/svg/layout_svg_inline_text.h"
#include "third_party/blink/renderer/core/layout/unpositioned_float.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
namespace blink {
namespace {
class LineBreakStrategy { … };
void PlaceRelativePositionedItems(const ConstraintSpace& constraint_space,
LogicalLineItems* line_box) { … }
}
InlineLayoutAlgorithm::InlineLayoutAlgorithm(
InlineNode inline_node,
const ConstraintSpace& space,
const InlineBreakToken* break_token,
const ColumnSpannerPath* column_spanner_path,
InlineChildLayoutContext* context)
: … { … }
InlineLayoutAlgorithm::~InlineLayoutAlgorithm() = default;
void InlineLayoutAlgorithm::PrepareBoxStates(
const LineInfo& line_info,
const InlineBreakToken* break_token) { … }
static LayoutUnit AdjustLineOffsetForHanging(LineInfo* line_info,
LayoutUnit& line_offset) { … }
#if EXPENSIVE_DCHECKS_ARE_ON()
void InlineLayoutAlgorithm::CheckBoxStates(const LineInfo& line_info) const { … }
#endif
ALWAYS_INLINE InlineLayoutAlgorithm::LineClampState
InlineLayoutAlgorithm::GetLineClampState(const LineInfo* line_info,
LayoutUnit line_box_height) const { … }
void InlineLayoutAlgorithm::CreateLine(const LineLayoutOpportunity& opportunity,
LineInfo* line_info,
LogicalLineContainer* line_container) { … }
void InlineLayoutAlgorithm::ApplyTextBoxTrim(LineInfo& line_info,
bool is_truncated) { … }
void InlineLayoutAlgorithm::PlaceBlockInInline(const InlineItem& item,
InlineItemResult* item_result,
LogicalLineItems* line_box) { … }
void InlineLayoutAlgorithm::PlaceOutOfFlowObjects(
const LineInfo& line_info,
const FontHeight& line_box_metrics,
LogicalLineItems* line_box) { … }
void InlineLayoutAlgorithm::PlaceFloatingObjects(
const FontHeight& line_box_metrics,
const LineLayoutOpportunity& opportunity,
LayoutUnit ruby_block_start_adjust,
LineInfo* line_info,
LogicalLineItems* line_box) { … }
LayoutUnit InlineLayoutAlgorithm::ApplyTextAlign(LineInfo* line_info) { … }
LayoutUnit InlineLayoutAlgorithm::SetAnnotationOverflow(
const LineInfo& line_info,
const LogicalLineItems& line_box,
const FontHeight& line_box_metrics,
std::optional<FontHeight> annotation_font_height) { … }
bool InlineLayoutAlgorithm::AddAnyClearanceAfterLine(
const LineInfo& line_info) { … }
const LayoutResult* InlineLayoutAlgorithm::Layout() { … }
void InlineLayoutAlgorithm::PositionLeadingFloats(
ExclusionSpace& exclusion_space,
LeadingFloats& leading_floats) { … }
PositionedFloat InlineLayoutAlgorithm::PositionFloat(
LayoutUnit origin_bfc_block_offset,
LayoutObject* floating_object,
ExclusionSpace* exclusion_space) { … }
}