#include "third_party/blink/renderer/core/editing/visible_units.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/first_letter_pseudo_element.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/iterators/character_iterator.h"
#include "third_party/blink/renderer/core/editing/local_caret_rect.h"
#include "third_party/blink/renderer/core/editing/position.h"
#include "third_party/blink/renderer/core/editing/position_iterator.h"
#include "third_party/blink/renderer/core/editing/position_with_affinity.h"
#include "third_party/blink/renderer/core/editing/selection_adjuster.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/text_affinity.h"
#include "third_party/blink/renderer/core/editing/visible_position.h"
#include "third_party/blink/renderer/core/editing/visible_selection.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/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/html/html_br_element.h"
#include "third_party/blink/renderer/core/html/html_marquee_element.h"
#include "third_party/blink/renderer/core/html/html_table_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/hit_test_location.h"
#include "third_party/blink/renderer/core/layout/hit_test_request.h"
#include "third_party/blink/renderer/core/layout/hit_test_result.h"
#include "third_party/blink/renderer/core/layout/inline/inline_node_data.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/layout_text_fragment.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/svg/svg_foreign_object_element.h"
#include "third_party/blink/renderer/core/svg/svg_text_element.h"
#include "third_party/blink/renderer/core/svg_element_type_helpers.h"
#include "third_party/blink/renderer/platform/text/text_boundaries.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace blink {
namespace {
bool IsEmptyInline(const LayoutInline& inline_object) { … }
}
template <typename PositionType>
static PositionType CanonicalizeCandidate(const PositionType& candidate) { … }
static bool InSameBlock(const Node* original_node,
const Node* new_position_node) { … }
template <typename PositionType>
static PositionType CanonicalPosition(const PositionType& position) { … }
Position CanonicalPositionOf(const Position& position) { … }
PositionInFlatTree CanonicalPositionOf(const PositionInFlatTree& position) { … }
template <typename Strategy>
static PositionWithAffinityTemplate<Strategy>
AdjustBackwardPositionToAvoidCrossingEditingBoundariesTemplate(
const PositionWithAffinityTemplate<Strategy>& pos,
const PositionTemplate<Strategy>& anchor) { … }
PositionWithAffinity AdjustBackwardPositionToAvoidCrossingEditingBoundaries(
const PositionWithAffinity& pos,
const Position& anchor) { … }
PositionInFlatTreeWithAffinity
AdjustBackwardPositionToAvoidCrossingEditingBoundaries(
const PositionInFlatTreeWithAffinity& pos,
const PositionInFlatTree& anchor) { … }
template <typename Strategy>
static PositionWithAffinityTemplate<Strategy>
AdjustForwardPositionToAvoidCrossingEditingBoundariesTemplate(
const PositionWithAffinityTemplate<Strategy>& pos,
const PositionTemplate<Strategy>& anchor) { … }
PositionWithAffinity AdjustForwardPositionToAvoidCrossingEditingBoundaries(
const PositionWithAffinity& pos,
const Position& anchor) { … }
PositionInFlatTreeWithAffinity
AdjustForwardPositionToAvoidCrossingEditingBoundaries(
const PositionInFlatTreeWithAffinity& pos,
const PositionInFlatTree& anchor) { … }
template <typename Strategy>
static ContainerNode* NonShadowBoundaryParentNode(Node* node) { … }
template <typename Strategy>
static Node* ParentEditingBoundary(const PositionTemplate<Strategy>& position) { … }
template <typename Strategy>
static PositionTemplate<Strategy> StartOfDocumentAlgorithm(
const PositionTemplate<Strategy>& position) { … }
Position StartOfDocument(const Position& c) { … }
PositionInFlatTree StartOfDocument(const PositionInFlatTree& c) { … }
template <typename Strategy>
static VisiblePositionTemplate<Strategy> EndOfDocumentAlgorithm(
const VisiblePositionTemplate<Strategy>& visible_position) { … }
VisiblePosition EndOfDocument(const VisiblePosition& c) { … }
VisiblePositionInFlatTree EndOfDocument(const VisiblePositionInFlatTree& c) { … }
bool IsStartOfDocument(const VisiblePosition& p) { … }
bool IsEndOfDocument(const VisiblePosition& p) { … }
PositionInFlatTree StartOfEditableContent(const PositionInFlatTree& position) { … }
PositionInFlatTree EndOfEditableContent(const PositionInFlatTree& position) { … }
bool IsEndOfEditableOrNonEditableContent(const VisiblePosition& position) { … }
bool IsEndOfEditableOrNonEditableContent(
const VisiblePositionInFlatTree& position) { … }
bool HasRenderedNonAnonymousDescendantsWithHeight(
const LayoutObject* layout_object) { … }
PositionWithAffinity PositionForContentsPointRespectingEditingBoundary(
const gfx::Point& contents_point,
LocalFrame* frame) { … }
int CaretMinOffset(const Node* node) { … }
int CaretMaxOffset(const Node* n) { … }
template <typename Strategy>
static bool InRenderedText(const PositionTemplate<Strategy>& position) { … }
bool RendersInDifferentPosition(const Position& position1,
const Position& position2) { … }
bool EndsOfNodeAreVisuallyDistinctPositions(const Node* node) { … }
template <typename Strategy>
static Node* EnclosingVisualBoundary(Node* node) { … }
template <typename Strategy>
static bool IsStreamer(const PositionIteratorAlgorithm<Strategy>& pos) { … }
template <typename F>
static Position MostBackwardOrForwardCaretPosition(
const Position& position,
EditingBoundaryCrossingRule rule,
SnapToClient client,
F AlgorithmInFlatTree) { … }
template <typename Strategy>
static PositionTemplate<Strategy> AdjustPositionForBackwardIteration(
const PositionTemplate<Strategy>& position) { … }
static bool CanHaveCaretPosition(const Node& node) { … }
template <typename Strategy>
static PositionTemplate<Strategy> MostBackwardCaretPosition(
const PositionTemplate<Strategy>& position,
EditingBoundaryCrossingRule rule,
SnapToClient client) { … }
Position MostBackwardCaretPosition(const Position& position,
EditingBoundaryCrossingRule rule,
SnapToClient client) { … }
PositionInFlatTree MostBackwardCaretPosition(const PositionInFlatTree& position,
EditingBoundaryCrossingRule rule,
SnapToClient client) { … }
namespace {
bool HasInvisibleFirstLetter(const Node* node) { … }
}
template <typename Strategy>
PositionTemplate<Strategy> MostForwardCaretPosition(
const PositionTemplate<Strategy>& position,
EditingBoundaryCrossingRule rule,
SnapToClient client) { … }
Position MostForwardCaretPosition(const Position& position,
EditingBoundaryCrossingRule rule,
SnapToClient client) { … }
PositionInFlatTree MostForwardCaretPosition(const PositionInFlatTree& position,
EditingBoundaryCrossingRule rule,
SnapToClient client) { … }
template <typename Strategy>
static bool AtEditingBoundary(const PositionTemplate<Strategy> positions) { … }
template <typename Strategy>
static bool IsVisuallyEquivalentCandidateAlgorithm(
const PositionTemplate<Strategy>& position) { … }
bool IsVisuallyEquivalentCandidate(const Position& position) { … }
bool IsVisuallyEquivalentCandidate(const PositionInFlatTree& position) { … }
template <typename Strategy>
static PositionTemplate<Strategy> SkipToEndOfEditingBoundary(
const PositionTemplate<Strategy>& pos,
const PositionTemplate<Strategy>& anchor) { … }
template <typename Strategy>
static UChar32 CharacterAfterAlgorithm(
const VisiblePositionTemplate<Strategy>& visible_position) { … }
UChar32 CharacterAfter(const VisiblePosition& visible_position) { … }
UChar32 CharacterAfter(const VisiblePositionInFlatTree& visible_position) { … }
template <typename Strategy>
static UChar32 CharacterBeforeAlgorithm(
const VisiblePositionTemplate<Strategy>& visible_position) { … }
UChar32 CharacterBefore(const VisiblePosition& visible_position) { … }
UChar32 CharacterBefore(const VisiblePositionInFlatTree& visible_position) { … }
template <typename Strategy>
static VisiblePositionTemplate<Strategy> NextPositionOfAlgorithm(
const PositionWithAffinityTemplate<Strategy>& position,
EditingBoundaryCrossingRule rule) { … }
VisiblePosition NextPositionOf(const Position& position,
EditingBoundaryCrossingRule rule) { … }
VisiblePosition NextPositionOf(const VisiblePosition& visible_position,
EditingBoundaryCrossingRule rule) { … }
VisiblePositionInFlatTree NextPositionOf(
const VisiblePositionInFlatTree& visible_position,
EditingBoundaryCrossingRule rule) { … }
template <typename Strategy>
static PositionTemplate<Strategy> SkipToStartOfEditingBoundary(
const PositionTemplate<Strategy>& pos,
const PositionTemplate<Strategy>& anchor) { … }
template <typename Strategy>
static VisiblePositionTemplate<Strategy> PreviousPositionOfAlgorithm(
const PositionTemplate<Strategy>& position,
EditingBoundaryCrossingRule rule) { … }
VisiblePosition PreviousPositionOf(const VisiblePosition& visible_position,
EditingBoundaryCrossingRule rule) { … }
VisiblePositionInFlatTree PreviousPositionOf(
const VisiblePositionInFlatTree& visible_position,
EditingBoundaryCrossingRule rule) { … }
template <typename Strategy>
static EphemeralRangeTemplate<Strategy> MakeSearchRange(
const PositionTemplate<Strategy>& pos) { … }
template <typename Strategy>
static PositionTemplate<Strategy> SkipWhitespaceAlgorithm(
const PositionTemplate<Strategy>& position) { … }
Position SkipWhitespace(const Position& position) { … }
PositionInFlatTree SkipWhitespace(const PositionInFlatTree& position) { … }
template <typename Strategy>
static Vector<gfx::QuadF> ComputeTextBounds(
const EphemeralRangeTemplate<Strategy>& range) { … }
template <typename Strategy>
static gfx::RectF ComputeTextRectTemplate(
const EphemeralRangeTemplate<Strategy>& range) { … }
gfx::Rect ComputeTextRect(const EphemeralRange& range) { … }
gfx::Rect ComputeTextRect(const EphemeralRangeInFlatTree& range) { … }
gfx::RectF ComputeTextRectF(const EphemeralRange& range) { … }
gfx::Rect FirstRectForRange(const EphemeralRange& range) { … }
}