// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/351564777): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "third_party/blink/renderer/core/layout/inline/inline_text_auto_space.h" #include <unicode/uchar.h> #include <unicode/uscript.h> #include "base/check.h" #include "third_party/blink/renderer/core/layout/inline/inline_item.h" namespace blink { namespace { // Check if the argument maybe "Ideographs" defined in CSS Text: // https://drafts.csswg.org/css-text-4/#text-spacing-classes // without getting Unicode properties, which is not slow but also not trivial. // // If this returns `false`, the text with the script does not contain // "Ideographs." // // Note, this doesn't cover all ideographs as defined in Unicode. inline bool MaybeIdeograph(UScriptCode script, StringView text) { … } // `TextAutoSpace::ApplyIfNeeded` computes offsets to insert spacing *before*, // but `ShapeResult` can handle spacing *after* a glyph. Due to this difference, // when adding a spacing before the start offset of an item, the spacing // should be added to the end of the previous item. This class keeps the // previous item's `shape_result_` for this purpose. class SpacingApplier { … }; } // namespace void InlineTextAutoSpace::Initialize(const InlineItemsData& data) { … } void InlineTextAutoSpace::Apply(InlineItemsData& data, Vector<wtf_size_t>* offsets_out) { … } } // namespace blink