#include "third_party/blink/renderer/core/editing/bidi_adjustment.h"
#include <unicode/ubidi.h>
#include "third_party/blink/renderer/core/editing/inline_box_position.h"
#include "third_party/blink/renderer/core/editing/ng_flat_tree_shorthands.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/visible_position.h"
#include "third_party/blink/renderer/core/layout/inline/inline_caret_position.h"
#include "third_party/blink/renderer/platform/text/text_direction.h"
namespace blink {
namespace {
TextDirection ResolvedDirection(const InlineCursor& cursor) { … }
UBiDiLevel BidiLevel(const InlineCursor& cursor) { … }
class AbstractInlineBox { … };
enum SideAffinity { … };
bool IsAtFragmentStart(const InlineCaretPosition& caret_position) { … }
bool IsAtFragmentEnd(const InlineCaretPosition& caret_position) { … }
SideAffinity GetSideAffinity(const InlineCaretPosition& caret_position) { … }
class AbstractInlineBoxAndSideAffinity { … };
struct TraverseRight;
struct TraverseLeft { … };
struct TraverseRight { … };
AbstractInlineBox TraverseLeft::Backward(const AbstractInlineBox& box) { … }
AbstractInlineBox TraverseLeft::BackwardIgnoringLineBreak(
const AbstractInlineBox& box) { … }
Backwards;
template <typename TraversalStrategy>
AbstractInlineBoxAndSideAffinity AbstractInlineBoxAndForwardSideAffinity(
const AbstractInlineBox& box) { … }
template <typename TraversalStrategy>
AbstractInlineBoxAndSideAffinity AbstractInlineBoxAndBackwardSideAffinity(
const AbstractInlineBox& box) { … }
template <typename TraversalStrategy>
AbstractInlineBox FindBidiRun(const AbstractInlineBox& start,
unsigned bidi_level) { … }
template <typename TraversalStrategy>
AbstractInlineBox FindBoundaryOfBidiRunIgnoringLineBreak(
const AbstractInlineBox& start,
unsigned bidi_level) { … }
AbstractInlineBox FindBoundaryOfEntireBidiRunInternal(
const AbstractInlineBox& start,
unsigned bidi_level,
AbstractInlineBox (*forward)(const AbstractInlineBox&)) { … }
template <typename TraversalStrategy>
AbstractInlineBox FindBoundaryOfEntireBidiRun(const AbstractInlineBox& start,
unsigned bidi_level) { … }
template <typename TraversalStrategy>
AbstractInlineBox FindBoundaryOfEntireBidiRunIgnoringLineBreak(
const AbstractInlineBox& start,
unsigned bidi_level) { … }
template <typename TraversalStrategy>
class InlineCaretPositionResolutionAdjuster { … };
template <>
bool InlineCaretPositionResolutionAdjuster<
TraverseLeft>::IsStartOfDifferentDirection(const AbstractInlineBox& box) { … }
template <>
bool InlineCaretPositionResolutionAdjuster<
TraverseRight>::IsStartOfDifferentDirection(const AbstractInlineBox& box) { … }
template <typename TraversalStrategy>
class HitTestAdjuster { … };
class RangeSelectionAdjuster { … };
RangeSelectionAdjuster::RenderedPosition
RangeSelectionAdjuster::RenderedPosition::Create(
const PositionInFlatTreeWithAffinity& position) { … }
}
InlineCaretPosition BidiAdjustment::AdjustForInlineCaretPositionResolution(
const InlineCaretPosition& caret_position) { … }
InlineCaretPosition BidiAdjustment::AdjustForHitTest(
const InlineCaretPosition& caret_position) { … }
SelectionInFlatTree BidiAdjustment::AdjustForRangeSelection(
const PositionInFlatTreeWithAffinity& base,
const PositionInFlatTreeWithAffinity& extent) { … }
}