chromium/third_party/blink/renderer/core/layout/inline/line_truncator.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/layout/inline/line_truncator.h"

#include "base/containers/adapters.h"
#include "third_party/blink/renderer/core/layout/inline/inline_box_state.h"
#include "third_party/blink/renderer/core/layout/inline/inline_item_result.h"
#include "third_party/blink/renderer/core/layout/inline/line_info.h"
#include "third_party/blink/renderer/core/layout/inline/logical_line_item.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/platform/fonts/font_baseline.h"
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h"

namespace blink {

namespace {

bool IsLeftMostOffset(const ShapeResult& shape_result, unsigned offset) {}

bool IsRightMostOffset(const ShapeResult& shape_result, unsigned offset) {}

}  // namespace

LineTruncator::LineTruncator(const LineInfo& line_info)
    :{}

const ComputedStyle& LineTruncator::EllipsisStyle() const {}

void LineTruncator::SetupEllipsis() {}

LayoutUnit LineTruncator::PlaceEllipsisNextTo(
    LogicalLineItems* line_box,
    LogicalLineItem* ellipsized_child) {}

wtf_size_t LineTruncator::AddTruncatedChild(
    wtf_size_t source_index,
    bool leave_one_character,
    LayoutUnit position,
    TextDirection edge,
    LogicalLineItems* line_box,
    InlineLayoutStateStack* box_states) {}

LayoutUnit LineTruncator::TruncateLine(LayoutUnit line_width,
                                       LogicalLineItems* line_box,
                                       InlineLayoutStateStack* box_states) {}

// This function was designed to work only with <input type=file>.
// We assume the line box contains:
//     (Optional) children without in-flow fragments
//     Children with in-flow fragments, and
//     (Optional) children without in-flow fragments
// in this order, and the children with in-flow fragments have no padding,
// no border, and no margin.
// Children with IsPlaceholder() can appear anywhere.
LayoutUnit LineTruncator::TruncateLineInTheMiddle(
    LayoutUnit line_width,
    LogicalLineItems* line_box,
    InlineLayoutStateStack* box_states) {}

// Hide this child from being painted. Leaves a hidden fragment so that layout
// queries such as |offsetWidth| work as if it is not truncated.
void LineTruncator::HideChild(LogicalLineItem* child) {}

// Return the offset to place the ellipsis.
//
// This function may truncate or move the child so that the ellipsis can fit.
bool LineTruncator::EllipsizeChild(
    LayoutUnit line_width,
    LayoutUnit ellipsis_width,
    bool is_first_child,
    LogicalLineItem* child,
    std::optional<LogicalLineItem>* truncated_child) {}

// Truncate the specified child. Returns true if truncated successfully, false
// otherwise.
//
// Note that this function may return true even if it can't fit the child when
// |is_first_child|, because the spec defines that the first character or atomic
// inline-level element on a line must be clipped rather than ellipsed.
// https://drafts.csswg.org/css-ui/#text-overflow
bool LineTruncator::TruncateChild(
    LayoutUnit space_for_child,
    bool is_first_child,
    const LogicalLineItem& child,
    std::optional<LogicalLineItem>* truncated_child) {}

LogicalLineItem LineTruncator::TruncateText(const LogicalLineItem& item,
                                            const ShapeResult& shape_result,
                                            unsigned offset_to_fit,
                                            TextDirection direction) {}

}  // namespace blink