#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_EDITING_UTILITIES_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_EDITING_UTILITIES_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/editing/editing_boundary.h"
#include "third_party/blink/renderer/core/editing/forward.h"
#include "third_party/blink/renderer/core/events/input_event.h"
#include "third_party/blink/renderer/core/html/html_br_element.h"
#include "third_party/blink/renderer/platform/text/text_direction.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
#include "ui/gfx/geometry/quad_f.h"
namespace blink {
enum class PositionMoveType { … };
class Document;
class Element;
class HTMLElement;
class HTMLImageElement;
class HTMLSpanElement;
struct LocalCaretRect;
class Node;
class SystemClipboard;
bool NeedsLayoutTreeUpdate(const Node&);
CORE_EXPORT bool NeedsLayoutTreeUpdate(const Position&);
CORE_EXPORT bool NeedsLayoutTreeUpdate(const PositionInFlatTree&);
CORE_EXPORT bool IsUserSelectContain(const Node& );
CORE_EXPORT bool IsEditableElement(const Node&);
CORE_EXPORT bool IsEditable(const Node&);
CORE_EXPORT bool IsRichlyEditable(const Node&);
CORE_EXPORT bool IsRootEditableElement(const Node&);
CORE_EXPORT Element* RootEditableElement(const Node&);
Element* RootEditableElementOf(const Position&);
Element* RootEditableElementOf(const PositionInFlatTree&);
ContainerNode* RootEditableElementOrTreeScopeRootNodeOf(const Position&);
CORE_EXPORT ContainerNode* HighestEditableRoot(const Position&);
ContainerNode* HighestEditableRoot(const PositionInFlatTree&);
Node* HighestEnclosingNodeOfType(
const Position&,
bool (*node_is_of_type)(const Node*),
EditingBoundaryCrossingRule = kCannotCrossEditingBoundary,
Node* stay_within = nullptr);
Element* EnclosingBlock(
const Node*,
EditingBoundaryCrossingRule = kCannotCrossEditingBoundary);
CORE_EXPORT Element* EnclosingBlock(const Position&,
EditingBoundaryCrossingRule);
CORE_EXPORT Element* EnclosingBlock(const PositionInFlatTree&,
EditingBoundaryCrossingRule);
Element* EnclosingBlockFlowElement(
const Node&);
Element* AssociatedElementOf(const Position&);
Element* EnclosingAnchorElement(const Position&);
Element* EnclosingElementWithTag(const Position&, const QualifiedName&);
CORE_EXPORT Node* EnclosingNodeOfType(
const Position&,
bool (*node_is_of_type)(const Node*),
EditingBoundaryCrossingRule = kCannotCrossEditingBoundary);
CORE_EXPORT Node* EnclosingNodeOfType(
const PositionInFlatTree&,
bool (*node_is_of_type)(const Node*),
EditingBoundaryCrossingRule = kCannotCrossEditingBoundary);
HTMLSpanElement* TabSpanElement(const Node*);
Element* TableElementJustAfter(const VisiblePosition&);
CORE_EXPORT Element* TableElementJustBefore(const VisiblePosition&);
CORE_EXPORT Element* TableElementJustBefore(const VisiblePositionInFlatTree&);
Element* EnclosingTableCell(const Position&);
Element* EnclosingTableCell(const PositionInFlatTree&);
template <typename Strategy>
ContainerNode* ParentCrossingShadowBoundaries(const Node&);
template <>
inline ContainerNode* ParentCrossingShadowBoundaries<EditingStrategy>(
const Node& node) { … }
template <>
inline ContainerNode* ParentCrossingShadowBoundaries<EditingInFlatTreeStrategy>(
const Node& node) { … }
void WriteImageToClipboard(SystemClipboard& system_clipboard,
const scoped_refptr<Image>& image,
const KURL& url_string,
const String& title);
void WriteImageNodeToClipboard(SystemClipboard&, const Node&, const String&);
CORE_EXPORT bool EditingIgnoresContent(const Node&);
inline bool CanHaveChildrenForEditing(const Node* node) { … }
bool IsAtomicNode(const Node*);
bool IsAtomicNodeInFlatTree(const Node*);
CORE_EXPORT bool IsEnclosingBlock(const Node*);
CORE_EXPORT bool IsTabHTMLSpanElement(const Node*);
bool IsTabHTMLSpanElementTextNode(const Node*);
bool IsMailHTMLBlockquoteElement(const Node*);
bool IsDisplayInsideTable(const Node*);
bool IsTableCell(const Node*);
bool IsHTMLListElement(const Node*);
bool IsListItem(const Node*);
bool IsListItemTag(const Node*);
bool IsListElementTag(const Node*);
bool IsPresentationalHTMLElement(const Node*);
CORE_EXPORT bool IsRenderedAsNonInlineTableImageOrHR(const Node*);
bool IsNonTableCellHTMLBlockElement(const Node*);
bool IsBlockFlowElement(const Node&);
bool IsInPasswordField(const Position&);
CORE_EXPORT TextDirection DirectionOfEnclosingBlockOf(const Position&);
CORE_EXPORT TextDirection
DirectionOfEnclosingBlockOf(const PositionInFlatTree&);
CORE_EXPORT TextDirection PrimaryDirectionOf(const Node&);
Position NextCandidate(const Position&);
PositionInFlatTree NextCandidate(const PositionInFlatTree&);
Position PreviousCandidate(const Position&);
PositionInFlatTree PreviousCandidate(const PositionInFlatTree&);
CORE_EXPORT Position NextVisuallyDistinctCandidate(const Position&);
CORE_EXPORT PositionInFlatTree
NextVisuallyDistinctCandidate(const PositionInFlatTree&);
Position PreviousVisuallyDistinctCandidate(const Position&);
PositionInFlatTree PreviousVisuallyDistinctCandidate(const PositionInFlatTree&);
inline Position FirstPositionInOrBeforeNode(const Node& node) { … }
inline Position LastPositionInOrAfterNode(const Node& node) { … }
CORE_EXPORT Position FirstEditablePositionAfterPositionInRoot(const Position&,
const Node&);
CORE_EXPORT Position LastEditablePositionBeforePositionInRoot(const Position&,
const Node&);
CORE_EXPORT PositionInFlatTree
FirstEditablePositionAfterPositionInRoot(const PositionInFlatTree&,
const Node&);
CORE_EXPORT PositionInFlatTree
LastEditablePositionBeforePositionInRoot(const PositionInFlatTree&,
const Node&);
CORE_EXPORT Position PreviousPositionOf(const Position&, PositionMoveType);
CORE_EXPORT Position NextPositionOf(const Position&, PositionMoveType);
CORE_EXPORT PositionInFlatTree PreviousPositionOf(const PositionInFlatTree&,
PositionMoveType);
CORE_EXPORT PositionInFlatTree NextPositionOf(const PositionInFlatTree&,
PositionMoveType);
CORE_EXPORT int PreviousGraphemeBoundaryOf(const Node&, int current);
CORE_EXPORT int NextGraphemeBoundaryOf(const Node&, int current);
int16_t ComparePositionsInDOMTree(const Node* container_a,
int offset_a,
const Node* container_b,
int offset_b,
bool* disconnected = nullptr);
int16_t ComparePositionsInFlatTree(const Node* container_a,
int offset_a,
const Node* container_b,
int offset_b,
bool* disconnected = nullptr);
int16_t ComparePositions(const Position&, const Position&);
int16_t ComparePositions(const PositionWithAffinity&,
const PositionWithAffinity&);
int16_t ComparePositions(const PositionInFlatTree&, const PositionInFlatTree&);
bool IsNodeFullyContained(const EphemeralRange& range, const Node& node);
CORE_EXPORT bool IsEditablePosition(const Position&);
bool IsEditablePosition(const PositionInFlatTree&);
bool IsRichlyEditablePosition(const Position&);
CORE_EXPORT PositionWithAffinity
PositionRespectingEditingBoundary(const Position&, const HitTestResult&);
PositionWithAffinity AdjustForEditingBoundary(const PositionWithAffinity&);
PositionWithAffinity AdjustForEditingBoundary(const Position&);
CORE_EXPORT Position ComputePositionForNodeRemoval(const Position&,
const Node&);
Position ComputePlaceholderToCollapseAt(const Position&);
CORE_EXPORT Position PositionBeforeNode(const Node&);
Position PositionAfterNode(const Node&);
int16_t ComparePositions(const VisiblePosition&, const VisiblePosition&);
CORE_EXPORT int IndexForVisiblePosition(const VisiblePosition&,
ContainerNode*& scope);
EphemeralRange MakeRange(const VisiblePosition&, const VisiblePosition&);
EphemeralRange NormalizeRange(const EphemeralRange&);
EphemeralRangeInFlatTree NormalizeRange(const EphemeralRangeInFlatTree&);
CORE_EXPORT VisiblePosition VisiblePositionForIndex(int index,
ContainerNode* scope);
bool AreSameRanges(Node* node,
const Position& start_position,
const Position& end_position);
bool AreSameRanges(Node* node,
const PositionInFlatTree& start_position,
const PositionInFlatTree& end_position);
HTMLElement* CreateDefaultParagraphElement(Document&);
HTMLSpanElement* CreateTabSpanElement(Document&);
HTMLSpanElement* CreateTabSpanElement(Document&, const String& tab_text);
Element* FindEventTargetFrom(LocalFrame&, const VisibleSelection&);
HTMLImageElement* ImageElementFromImageDocument(const Document*);
CORE_EXPORT bool ElementCannotHaveEndTag(const Node&);
inline bool IsWhitespace(UChar c) { … }
inline bool IsCollapsibleWhitespace(UChar c) { … }
String StringWithRebalancedWhitespace(const String&,
bool start_is_start_of_paragraph,
bool should_emit_nbs_pbefore_end);
CORE_EXPORT String RepeatString(const String&, unsigned);
wtf_size_t ComputeDistanceToLeftGraphemeBoundary(const Position&);
wtf_size_t ComputeDistanceToRightGraphemeBoundary(const Position&);
gfx::QuadF LocalToAbsoluteQuadOf(const LocalCaretRect&);
const StaticRangeVector* TargetRangesForInputEvent(const Node&);
DispatchEventResult DispatchBeforeInputInsertText(
Node*,
const String& data,
InputEvent::InputType = InputEvent::InputType::kInsertText,
const StaticRangeVector* = nullptr);
DispatchEventResult DispatchBeforeInputEditorCommand(Node*,
InputEvent::InputType,
const StaticRangeVector*);
DispatchEventResult DispatchBeforeInputDataTransfer(Node*,
InputEvent::InputType,
DataTransfer*);
void InsertTextAndSendInputEventsOfTypeInsertReplacementText(
LocalFrame&,
const String&,
bool allow_edit_context = false);
}
#endif