#pragma once
#include "Position.h"
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
class Document;
class HTMLElement;
class HTMLImageElement;
class HTMLSpanElement;
class HTMLTextFormControlElement;
class RenderBlock;
class VisiblePosition;
class VisibleSelection;
struct SimpleRange;
ContainerNode* highestEditableRoot(const Position&, EditableType = ContentIsEditable);
Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr);
Node* highestNodeToRemoveInPruning(Node*);
Element* lowestEditableAncestor(Node*);
Element* deprecatedEnclosingBlockFlowElement(Node*); Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
Element* enclosingTableCell(const Position&);
Node* enclosingEmptyListItem(const VisiblePosition&);
Element* enclosingAnchorElement(const Position&);
Element* enclosingElementWithTag(const Position&, const QualifiedName&);
Node* enclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
HTMLSpanElement* tabSpanNode(const Node*);
Element* isLastPositionBeforeTable(const VisiblePosition&); Element* isFirstPositionAfterTable(const VisiblePosition&);
Node* nextLeafNode(const Node*);
Node* previousLeafNode(const Node*);
WEBCORE_EXPORT int lastOffsetForEditing(const Node&);
int caretMinOffset(const Node&);
int caretMaxOffset(const Node&);
bool hasEditableStyle(const Node&, EditableType);
bool isEditableNode(const Node&);
bool editingIgnoresContent(const Node&);
bool canHaveChildrenForEditing(const Node&);
bool isAtomicNode(const Node*);
bool isBlock(const Node*);
bool isBlockFlowElement(const Node&);
bool isInline(const Node*);
bool isTabSpanNode(const Node*);
bool isTabSpanTextNode(const Node*);
bool isMailBlockquote(const Node*);
bool isRenderedTable(const Node*);
bool isTableCell(const Node*);
bool isEmptyTableCell(const Node*);
bool isTableStructureNode(const Node*);
bool isListHTMLElement(Node*);
bool isListItem(const Node*);
bool isNodeRendered(const Node&);
bool isRenderedAsNonInlineTableImageOrHR(const Node*);
bool isNonTableCellHTMLBlockElement(const Node*);
bool isNodeVisiblyContainedWithin(Node&, const SimpleRange&);
bool areIdenticalElements(const Node&, const Node&);
bool positionBeforeOrAfterNodeIsCandidate(Node&);
WEBCORE_EXPORT HashSet<RefPtr<HTMLImageElement>> visibleImageElementsInRangeWithNonLoadedImages(const SimpleRange&);
Position nextCandidate(const Position&);
Position previousCandidate(const Position&);
Position nextVisuallyDistinctCandidate(const Position&);
Position previousVisuallyDistinctCandidate(const Position&);
Position positionBeforeContainingSpecialElement(const Position&, HTMLElement** containingSpecialElement = nullptr);
Position positionAfterContainingSpecialElement(const Position&, HTMLElement** containingSpecialElement = nullptr);
Position firstPositionInOrBeforeNode(Node*);
Position lastPositionInOrAfterNode(Node*);
Position firstEditablePositionAfterPositionInRoot(const Position&, ContainerNode* root);
Position lastEditablePositionBeforePositionInRoot(const Position&, ContainerNode* root);
WEBCORE_EXPORT int comparePositions(const Position&, const Position&);
WEBCORE_EXPORT bool isEditablePosition(const Position&, EditableType = ContentIsEditable);
bool isRichlyEditablePosition(const Position&);
bool lineBreakExistsAtPosition(const Position&);
bool isAtUnsplittableElement(const Position&);
unsigned numEnclosingMailBlockquotes(const Position&);
void updatePositionForNodeRemoval(Position&, Node&);
WEBCORE_EXPORT TextDirection directionOfEnclosingBlock(const Position&);
VisiblePosition visiblePositionBeforeNode(Node&);
VisiblePosition visiblePositionAfterNode(Node&);
bool lineBreakExistsAtVisiblePosition(const VisiblePosition&);
WEBCORE_EXPORT int comparePositions(const VisiblePosition&, const VisiblePosition&);
WEBCORE_EXPORT int indexForVisiblePosition(const VisiblePosition&, RefPtr<ContainerNode>& scope);
int indexForVisiblePosition(Node&, const VisiblePosition&, bool forSelectionPreservation);
WEBCORE_EXPORT VisiblePosition visiblePositionForPositionWithOffset(const VisiblePosition&, int offset);
WEBCORE_EXPORT VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope);
VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node&, int index);
WEBCORE_EXPORT VisiblePosition closestEditablePositionInElementForAbsolutePoint(const Element&, const IntPoint&);
WEBCORE_EXPORT Ref<HTMLElement> createDefaultParagraphElement(Document&);
Ref<HTMLElement> createHTMLElement(Document&, const QualifiedName&);
Ref<HTMLElement> createHTMLElement(Document&, const AtomString&);
WEBCORE_EXPORT HTMLElement* enclosingList(Node*);
HTMLElement* outermostEnclosingList(Node*, Node* rootList = nullptr);
Node* enclosingListChild(Node*);
Ref<Element> createTabSpanElement(Document&);
Ref<Element> createTabSpanElement(Document&, const String& tabText);
Ref<Element> createBlockPlaceholderElement(Document&);
Element* editableRootForPosition(const Position&, EditableType = ContentIsEditable);
Element* unsplittableElementForPosition(const Position&);
bool canMergeLists(Element* firstList, Element* secondList);
VisibleSelection selectionForParagraphIteration(const VisibleSelection&);
Position adjustedSelectionStartForStyleComputation(const VisibleSelection&);
bool deprecatedIsEditingWhitespace(UChar);
bool deprecatedIsCollapsibleWhitespace(UChar);
bool isAmbiguousBoundaryCharacter(UChar);
String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagraph, bool endIsEndOfParagraph);
const String& nonBreakingSpaceString();
RenderBlock* rendererForCaretPainting(const Node*);
LayoutRect localCaretRectInRendererForCaretPainting(const VisiblePosition&, RenderBlock*&);
LayoutRect localCaretRectInRendererForRect(LayoutRect&, Node*, RenderObject*, RenderBlock*&);
IntRect absoluteBoundsForLocalCaretRect(RenderBlock* rendererForCaretPainting, const LayoutRect&, bool* insideFixed = nullptr);
inline bool deprecatedIsEditingWhitespace(UChar c)
{
return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
}
inline bool deprecatedIsCollapsibleWhitespace(UChar c)
{
return c == ' ' || c == '\n';
}
bool isAmbiguousBoundaryCharacter(UChar);
inline bool editingIgnoresContent(const Node& node)
{
return !node.canContainRangeEndPoint();
}
inline bool positionBeforeOrAfterNodeIsCandidate(Node& node)
{
return isRenderedTable(&node) || editingIgnoresContent(node);
}
inline Position firstPositionInOrBeforeNode(Node* node)
{
if (!node)
return { };
return editingIgnoresContent(*node) ? positionBeforeNode(node) : firstPositionInNode(node);
}
inline Position lastPositionInOrAfterNode(Node* node)
{
if (!node)
return { };
return editingIgnoresContent(*node) ? positionAfterNode(node) : lastPositionInNode(node);
}
}