#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h"
#include "third_party/blink/renderer/platform/fonts/shaping/text_auto_space.h"
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"
namespace blink {
ShapingLineBreaker::ShapingLineBreaker(
const ShapeResult* result,
const LazyLineBreakIterator* break_iterator,
const Hyphenation* hyphenation,
const Font* font)
: … { … }
namespace {
inline LayoutUnit FlipRtl(LayoutUnit value, TextDirection direction) { … }
inline float FlipRtl(float value, TextDirection direction) { … }
inline bool IsBreakableSpace(UChar ch) { … }
bool IsAllSpaces(const String& text, unsigned start, unsigned end) { … }
bool ShouldHyphenate(const String& text,
unsigned word_start,
unsigned word_end,
unsigned line_start) { … }
inline void CheckBreakOffset(unsigned offset, unsigned start, unsigned end) { … }
unsigned FindNonHangableEnd(const String& text, unsigned candidate) { … }
}
inline const String& ShapingLineBreaker::GetText() const { … }
inline ShapingLineBreaker::EdgeOffset ShapingLineBreaker::FirstSafeOffset(
unsigned start) const { … }
unsigned ShapingLineBreaker::Hyphenate(unsigned offset,
unsigned word_start,
unsigned word_end,
bool backwards) const { … }
ShapingLineBreaker::BreakOpportunity ShapingLineBreaker::Hyphenate(
unsigned offset,
unsigned start,
bool backwards) const { … }
ShapingLineBreaker::BreakOpportunity
ShapingLineBreaker::PreviousBreakOpportunity(unsigned offset,
unsigned start) const { … }
ShapingLineBreaker::BreakOpportunity ShapingLineBreaker::NextBreakOpportunity(
unsigned offset,
unsigned start,
unsigned len) const { … }
inline void ShapingLineBreaker::SetBreakOffset(unsigned break_offset,
const String& text,
Result* result) { … }
inline void ShapingLineBreaker::SetBreakOffset(
const BreakOpportunity& break_opportunity,
const String& text,
Result* result) { … }
const ShapeResultView* ShapingLineBreaker::ShapeLine(
unsigned start,
LayoutUnit available_space,
ShapingLineBreaker::Result* result_out) { … }
const ShapeResultView* ShapingLineBreaker::ConcatShapeResults(
unsigned start,
unsigned end,
unsigned first_safe,
unsigned last_safe,
const ShapeResult* line_start_result,
const ShapeResult* line_end_result) { … }
const ShapeResultView* ShapingLineBreaker::ShapeToEnd(
unsigned start,
const ShapeResult* line_start_result,
unsigned first_safe,
unsigned range_start,
unsigned range_end) { … }
const ShapeResultView* ShapingLineBreaker::ShapeLineAt(unsigned start,
unsigned end) { … }
}