#include "third_party/blink/renderer/core/editing/selection_modifier.h"
#include "third_party/blink/renderer/core/editing/bidi_adjustment.h"
#include "third_party/blink/renderer/core/editing/editing_behavior.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/inline_box_position.h"
#include "third_party/blink/renderer/core/editing/local_caret_rect.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/editing/visible_units.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/layout/inline/inline_caret_position.h"
#include "third_party/blink/renderer/core/layout/inline/offset_mapping.h"
#include "third_party/blink/renderer/core/layout/layout_block.h"
#include "third_party/blink/renderer/core/layout/physical_fragment.h"
#include "third_party/blink/renderer/core/page/spatial_navigation.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
namespace {
const unsigned kMaxIterationForPageGranularityMovement = …;
VisiblePositionInFlatTree LeftBoundaryOfLine(const VisiblePositionInFlatTree& c,
TextDirection direction) { … }
VisiblePositionInFlatTree RightBoundaryOfLine(
const VisiblePositionInFlatTree& c,
TextDirection direction) { … }
}
static bool InSameParagraph(const VisiblePositionInFlatTree& a,
const VisiblePositionInFlatTree& b,
EditingBoundaryCrossingRule boundary_crossing_rule =
kCannotCrossEditingBoundary) { … }
VisiblePositionInFlatTree SelectionModifier::PreviousParagraphPosition(
const VisiblePositionInFlatTree& passed_position,
LayoutUnit x_point) { … }
VisiblePositionInFlatTree SelectionModifier::NextParagraphPosition(
const VisiblePositionInFlatTree& passed_position,
LayoutUnit x_point) { … }
LayoutUnit NoXPosForVerticalArrowNavigation() { … }
bool SelectionModifier::ShouldAlwaysUseDirectionalSelection(
const LocalFrame& frame) { … }
SelectionModifier::SelectionModifier(
const LocalFrame& frame,
const SelectionInDOMTree& selection,
LayoutUnit x_pos_for_vertical_arrow_navigation)
: … { … }
SelectionModifier::SelectionModifier(const LocalFrame& frame,
const SelectionInDOMTree& selection)
: … { … }
VisibleSelection SelectionModifier::Selection() const { … }
static VisiblePositionInFlatTree ComputeVisibleFocus(
const VisibleSelectionInFlatTree& visible_selection) { … }
TextDirection SelectionModifier::DirectionOfEnclosingBlock() const { … }
namespace {
std::optional<TextDirection> DirectionAt(
const PositionInFlatTreeWithAffinity& position) { … }
std::optional<TextDirection> LineDirectionAt(
const PositionInFlatTreeWithAffinity& position) { … }
TextDirection DirectionOf(const VisibleSelectionInFlatTree& visible_selection) { … }
}
TextDirection SelectionModifier::DirectionOfSelection() const { … }
TextDirection SelectionModifier::LineDirectionOfFocus() const { … }
static bool IsAnchorStart(const VisibleSelectionInFlatTree& visible_selection,
SelectionModifyDirection direction) { … }
VisibleSelectionInFlatTree SelectionModifier::PrepareToModifySelection(
SelectionModifyAlteration alter,
SelectionModifyDirection direction) const { … }
VisiblePositionInFlatTree SelectionModifier::PositionForPlatform(
bool is_get_start) const { … }
VisiblePositionInFlatTree SelectionModifier::StartForPlatform() const { … }
VisiblePositionInFlatTree SelectionModifier::EndForPlatform() const { … }
PositionInFlatTree SelectionModifier::NextWordPositionForPlatform(
const PositionInFlatTree& original_position) { … }
static VisiblePositionInFlatTree AdjustForwardPositionForUserSelectAll(
const VisiblePositionInFlatTree& position) { … }
static VisiblePositionInFlatTree AdjustBackwardPositionForUserSelectAll(
const VisiblePositionInFlatTree& position) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingRightInternal(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingRight(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingForwardInternal(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingForward(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyMovingRight(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyMovingForward(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingLeftInternal(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingLeft(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingBackwardInternal(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyExtendingBackward(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyMovingLeft(
TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ModifyMovingBackward(
TextGranularity granularity) { … }
static bool IsBoundary(TextGranularity granularity) { … }
VisiblePositionInFlatTree SelectionModifier::ComputeModifyPosition(
SelectionModifyAlteration alter,
SelectionModifyDirection direction,
TextGranularity granularity) { … }
bool SelectionModifier::Modify(SelectionModifyAlteration alter,
SelectionModifyDirection direction,
TextGranularity granularity) { … }
static bool AbsoluteCaretY(const PositionInFlatTreeWithAffinity& c, int& y) { … }
bool SelectionModifier::ModifyWithPageGranularity(
SelectionModifyAlteration alter,
unsigned vertical_distance,
SelectionModifyVerticalDirection direction) { … }
static LayoutUnit LineDirectionPointForBlockDirectionNavigationOf(
const VisiblePositionInFlatTree& visible_position) { … }
LayoutUnit SelectionModifier::LineDirectionPointForBlockDirectionNavigation(
const PositionInFlatTree& pos) { … }
void SelectionModifier::UpdateLifecycleToPrePaintClean() { … }
}