#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"
#include <unicode/uchar.h>
#include <unicode/uvernum.h>
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/text/break_iterator_data_inline_header.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
#include "third_party/blink/renderer/platform/wtf/text/unicode.h"
namespace blink {
unsigned NumGraphemeClusters(const String& string) { … }
void GraphemesClusterList(const StringView& text, Vector<unsigned>* graphemes) { … }
unsigned LengthOfGraphemeCluster(const String& string, unsigned offset) { … }
static const UChar kAsciiLineBreakTableFirstChar = …;
static const UChar kAsciiLineBreakTableLastChar = …;
#define B …
#define DI …
#define AL …
#define F …
#define CHECK_ASCII_LINE_BRAEK_TABLE …
static const unsigned char kAsciiLineBreakTable[][(kAsciiLineBreakTableLastChar - kAsciiLineBreakTableFirstChar) / 8 + 1] = …;
#if CHECK_ASCII_LINE_BRAEK_TABLE
void CheckAsciiLineBreakTable() {
for (UChar ch2 = kAsciiLineBreakTableFirstChar;
ch2 <= kAsciiLineBreakTableLastChar; ++ch2) {
for (UChar ch1 = kAsciiLineBreakTableFirstChar;
ch1 <= kAsciiLineBreakTableLastChar; ++ch1) {
const UChar i2 = ch2 - kAsciiLineBreakTableFirstChar;
const bool ascii =
kAsciiLineBreakTable[ch1 - kAsciiLineBreakTableFirstChar][i2 / 8] &
(1 << (i2 % 8));
const bool fast = GetFastLineBreak(ch1, ch2);
CHECK_EQ(ascii, fast)
<< String::Format("%02X/%02X (%c/%c)", ch1, ch2, ch1, ch2);
}
}
}
#endif
#define BA_LB_COUNT …
static const unsigned char kBreakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = …;
#undef B
#undef F
#undef DI
#undef AL
static_assert …;
static_assert …;
static inline ULineBreak LineBreakPropertyValue(UChar last_ch, UChar ch) { … }
static inline bool ShouldBreakAfterBreakAll(ULineBreak last_line_break,
ULineBreak line_break) { … }
static inline bool ShouldKeepAfterKeepAll(UChar last_ch,
UChar ch,
UChar next_ch) { … }
enum class FastBreakResult : uint8_t { … };
template <typename CharacterType, bool use_fast_table>
struct LazyLineBreakIterator::Context { … };
template <typename CharacterType,
LineBreakType line_break_type,
BreakSpaceType break_space>
inline unsigned LazyLineBreakIterator::NextBreakablePosition(
unsigned pos,
const CharacterType* str,
unsigned len) const { … }
template <typename CharacterType,
LineBreakType line_break_type,
BreakSpaceType break_space,
bool use_fast_table>
inline unsigned LazyLineBreakIterator::NextBreakablePosition(
unsigned pos,
const CharacterType* str,
unsigned len) const { … }
template <typename CharacterType, LineBreakType lineBreakType>
inline unsigned LazyLineBreakIterator::NextBreakablePosition(
unsigned pos,
const CharacterType* str,
unsigned len) const { … }
template <LineBreakType lineBreakType>
inline unsigned LazyLineBreakIterator::NextBreakablePosition(
unsigned pos,
unsigned len) const { … }
unsigned LazyLineBreakIterator::NextBreakablePositionBreakCharacter(
unsigned pos) const { … }
unsigned LazyLineBreakIterator::NextBreakablePosition(unsigned pos,
unsigned len) const { … }
unsigned LazyLineBreakIterator::NextBreakOpportunity(unsigned offset) const { … }
unsigned LazyLineBreakIterator::NextBreakOpportunity(unsigned offset,
unsigned len) const { … }
unsigned LazyLineBreakIterator::PreviousBreakOpportunity(unsigned offset,
unsigned min) const { … }
std::ostream& operator<<(std::ostream& ostream, LineBreakType line_break_type) { … }
std::ostream& operator<<(std::ostream& ostream, BreakSpaceType break_space) { … }
}