#include "third_party/blink/renderer/core/layout/inline/ruby_utils.h"
#include <tuple>
#include "third_party/blink/renderer/core/layout/inline/inline_box_state.h"
#include "third_party/blink/renderer/core/layout/inline/inline_cursor.h"
#include "third_party/blink/renderer/core/layout/inline/inline_item_result.h"
#include "third_party/blink/renderer/core/layout/inline/inline_item_result_ruby_column.h"
#include "third_party/blink/renderer/core/layout/inline/justification_utils.h"
#include "third_party/blink/renderer/core/layout/inline/line_info.h"
#include "third_party/blink/renderer/core/layout/inline/logical_line_container.h"
#include "third_party/blink/renderer/core/layout/inline/logical_line_item.h"
#include "third_party/blink/renderer/core/layout/layout_object_inlines.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/platform/fonts/font_height.h"
#include "third_party/blink/renderer/platform/heap/collection_support/clear_collection_scope.h"
namespace blink {
namespace {
std::tuple<LayoutUnit, LayoutUnit> AdjustTextOverUnderOffsetsForEmHeight(
LayoutUnit over,
LayoutUnit under,
const ComputedStyle& style,
const ShapeResultView& shape_view) { … }
FontHeight ComputeEmHeight(const LogicalLineItem& line_item) { … }
}
RubyItemIndexes ParseRubyInInlineItems(const HeapVector<InlineItem>& items,
wtf_size_t start_item_index) { … }
PhysicalRect AdjustTextRectForEmHeight(const PhysicalRect& rect,
const ComputedStyle& style,
const ShapeResultView* shape_view,
WritingMode writing_mode) { … }
AnnotationOverhang GetOverhang(
LayoutUnit ruby_size,
const LineInfo& base_line,
const HeapVector<LineInfo, 1> annotation_line_list) { … }
AnnotationOverhang GetOverhang(const InlineItemResult& item) { … }
bool CanApplyStartOverhang(const LineInfo& line_info,
wtf_size_t ruby_index,
const ComputedStyle& ruby_style,
LayoutUnit& start_overhang) { … }
LayoutUnit CommitPendingEndOverhang(const InlineItem& text_item,
LineInfo* line_info) { … }
std::pair<LayoutUnit, LayoutUnit> ApplyRubyAlign(LayoutUnit available_line_size,
bool on_start_edge,
bool on_end_edge,
LineInfo& line_info) { … }
AnnotationMetrics ComputeAnnotationOverflow(
const LogicalLineItems& logical_line,
const FontHeight& line_box_metrics,
const ComputedStyle& line_style,
std::optional<FontHeight> annotation_metrics) { … }
namespace {
PhysicalRect ComputeRubyEmHeightBox(const PhysicalFragment& fragment,
const PhysicalBoxFragment& container) { … }
void AdjustRubyEmHeightBoxForPropagation(const PhysicalFragment& fragment,
const PhysicalBoxFragment& container,
PhysicalRect* overflow) { … }
PhysicalRect ComputeRubyEmHeightBoxForPropagation(
const PhysicalFragment& fragment,
const PhysicalBoxFragment& container) { … }
void AdjustRubyEmHeightBoxForHanging(const PhysicalRect& rect,
const WritingMode container_writing_mode,
PhysicalRect* overflow) { … }
void AddRubyEmHeightBoxForInlineChild(const PhysicalFragment& child,
const PhysicalBoxFragment& container,
const ComputedStyle& container_style,
const FragmentItem& line,
bool has_hanging,
const InlineCursor& cursor,
PhysicalRect* overflow) { … }
inline void AddInlineSizeToRubyEmHeightBox(
const PhysicalRect& rect,
const WritingMode container_writing_mode,
PhysicalRect* overflow) { … }
PhysicalRect ComputeRubyEmHeightBoxForLine(
const PhysicalLineBoxFragment& line_fragment,
const PhysicalBoxFragment& container,
const ComputedStyle& container_style) { … }
PhysicalRect ComputeRubyEmHeightBoxForLine(
const PhysicalLineBoxFragment& line_fragment,
const PhysicalBoxFragment& container,
const ComputedStyle& container_style,
const FragmentItem& line,
const InlineCursor& cursor) { … }
PhysicalRect ComputeRubyEmHeightBoxFromChildren(
const PhysicalBoxFragment& fragment) { … }
}
PhysicalRect ComputeRubyEmHeightBox(const PhysicalBoxFragment& box_fragment) { … }
void UpdateRubyColumnInlinePositions(
const LogicalLineItems& line_items,
LayoutUnit inline_size,
HeapVector<Member<LogicalRubyColumn>>& column_list) { … }
namespace {
FontHeight ComputeLogicalLineEmHeight(const LogicalLineItems& line_items) { … }
FontHeight ComputeLogicalLineEmHeight(const LogicalLineItems& line_items,
const Vector<wtf_size_t>& index_list) { … }
}
RubyBlockPositionCalculator::RubyBlockPositionCalculator() = default;
RubyBlockPositionCalculator& RubyBlockPositionCalculator::GroupLines(
const HeapVector<Member<LogicalRubyColumn>>& column_list) { … }
void RubyBlockPositionCalculator::HandleRubyLine(
const RubyLine& current_ruby_line,
const HeapVector<Member<LogicalRubyColumn>>& column_list) { … }
RubyBlockPositionCalculator::RubyLine&
RubyBlockPositionCalculator::EnsureRubyLine(const RubyLevel& level) { … }
RubyBlockPositionCalculator& RubyBlockPositionCalculator::PlaceLines(
const LogicalLineItems& base_line_items,
const FontHeight& line_box_metrics) { … }
RubyBlockPositionCalculator& RubyBlockPositionCalculator::AddLinesTo(
LogicalLineContainer& line_container) { … }
FontHeight RubyBlockPositionCalculator::AnnotationMetrics() const { … }
RubyBlockPositionCalculator::RubyLine::RubyLine(const RubyLevel& level)
: … { … }
void RubyBlockPositionCalculator::RubyLine::Trace(Visitor* visitor) const { … }
bool RubyBlockPositionCalculator::RubyLine::operator<(
const RubyLine& another) const { … }
void RubyBlockPositionCalculator::RubyLine::Append(
LogicalRubyColumn& logical_column) { … }
void RubyBlockPositionCalculator::RubyLine::MaybeRecordBaseIndexes(
const LogicalRubyColumn& logical_column) { … }
FontHeight RubyBlockPositionCalculator::RubyLine::UpdateMetrics() { … }
void RubyBlockPositionCalculator::RubyLine::MoveInBlockDirection(
LayoutUnit offset) { … }
void RubyBlockPositionCalculator::RubyLine::AddLinesTo(
LogicalLineContainer& line_container) const { … }
void RubyBlockPositionCalculator::AnnotationDepth::Trace(
Visitor* visitor) const { … }
}