#include "third_party/blink/renderer/core/dom/range.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_document_state.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h"
#include "third_party/blink/renderer/core/dom/character_data.h"
#include "third_party/blink/renderer/core/dom/container_node.h"
#include "third_party/blink/renderer/core/dom/document_fragment.h"
#include "third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h"
#include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/node_with_index.h"
#include "third_party/blink/renderer/core/dom/processing_instruction.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/text_iterator.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/editing/set_selection_options.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_dom_window.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/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/geometry/dom_rect_list.h"
#include "third_party/blink/renderer/core/highlight/highlight_registry.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/html/html_html_element.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/layout/layout_text_fragment.h"
#include "third_party/blink/renderer/core/page/scrolling/sync_scroll_attempt_heuristic.h"
#include "third_party/blink/renderer/core/svg/svg_svg_element.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "ui/gfx/geometry/quad_f.h"
namespace blink {
class RangeUpdateScope { … };
int RangeUpdateScope::scope_count_ = …;
#if DCHECK_IS_ON()
Range* RangeUpdateScope::current_range_;
#endif
Range::Range(Document& owner_document)
: … { … }
Range* Range::Create(Document& owner_document) { … }
Range::Range(Document& owner_document,
Node* start_container,
unsigned start_offset,
Node* end_container,
unsigned end_offset)
: … { … }
Range::Range(Document& owner_document,
const Position& start,
const Position& end)
: … { … }
void Range::Dispose() { … }
bool Range::IsConnected() const { … }
void Range::SetDocument(Document& document) { … }
Node* Range::commonAncestorContainer() const { … }
Node* Range::commonAncestorContainer(const Node* container_a,
const Node* container_b) { … }
void Range::setStart(Node* ref_node,
unsigned offset,
ExceptionState& exception_state) { … }
void Range::setEnd(Node* ref_node,
unsigned offset,
ExceptionState& exception_state) { … }
void Range::setStart(const Position& start, ExceptionState& exception_state) { … }
void Range::setEnd(const Position& end, ExceptionState& exception_state) { … }
void Range::collapse(bool to_start) { … }
void Range::CollapseIfNeeded(bool did_move_document, bool collapse_to_start) { … }
bool Range::HasSameRoot(const Node& node) const { … }
bool Range::isPointInRange(Node* ref_node,
unsigned offset,
ExceptionState& exception_state) const { … }
int16_t Range::comparePoint(Node* ref_node,
unsigned offset,
ExceptionState& exception_state) const { … }
int16_t Range::compareBoundaryPoints(unsigned how,
const Range* source_range,
ExceptionState& exception_state) const { … }
int16_t Range::compareBoundaryPoints(Node* container_a,
unsigned offset_a,
Node* container_b,
unsigned offset_b,
ExceptionState& exception_state) { … }
int16_t Range::compareBoundaryPoints(const RangeBoundaryPoint& boundary_a,
const RangeBoundaryPoint& boundary_b,
ExceptionState& exception_state) { … }
bool Range::BoundaryPointsValid() const { … }
void Range::deleteContents(ExceptionState& exception_state) { … }
bool Range::intersectsNode(Node* ref_node, ExceptionState& exception_state) { … }
static inline Node* HighestAncestorUnderCommonRoot(Node* node,
Node* common_root) { … }
static inline Node* ChildOfCommonRootBeforeOffset(Node* container,
unsigned offset,
Node* common_root) { … }
DocumentFragment* Range::ProcessContents(ActionType action,
ExceptionState& exception_state) { … }
static inline void DeleteCharacterData(CharacterData* data,
unsigned start_offset,
unsigned end_offset,
ExceptionState& exception_state) { … }
Node* Range::ProcessContentsBetweenOffsets(ActionType action,
DocumentFragment* fragment,
Node* container,
unsigned start_offset,
unsigned end_offset,
ExceptionState& exception_state) { … }
void Range::ProcessNodes(ActionType action,
NodeVector& nodes,
Node* old_container,
Node* new_container,
ExceptionState& exception_state) { … }
Node* Range::ProcessAncestorsAndTheirSiblings(
ActionType action,
Node* container,
ContentsProcessDirection direction,
Node* cloned_container,
Node* common_root,
ExceptionState& exception_state) { … }
DocumentFragment* Range::extractContents(ExceptionState& exception_state) { … }
DocumentFragment* Range::cloneContents(ExceptionState& exception_state) { … }
void Range::insertNode(Node* new_node, ExceptionState& exception_state) { … }
String Range::toString() const { … }
String Range::GetText() const { … }
DocumentFragment* Range::createContextualFragment(
const String& markup,
ExceptionState& exception_state) { … }
void Range::detach() { … }
Node* Range::CheckNodeWOffset(Node* n,
unsigned offset,
ExceptionState& exception_state) { … }
void Range::CheckNodeBA(Node* n, ExceptionState& exception_state) const { … }
Range* Range::cloneRange() const { … }
void Range::setStartAfter(Node* ref_node, ExceptionState& exception_state) { … }
void Range::setEndBefore(Node* ref_node, ExceptionState& exception_state) { … }
void Range::setEndAfter(Node* ref_node, ExceptionState& exception_state) { … }
void Range::selectNode(Node* ref_node, ExceptionState& exception_state) { … }
void Range::selectNodeContents(Node* ref_node,
ExceptionState& exception_state) { … }
bool Range::selectNodeContents(Node* ref_node, Position& start, Position& end) { … }
void Range::surroundContents(Node* new_parent,
ExceptionState& exception_state) { … }
void Range::setStartBefore(Node* ref_node, ExceptionState& exception_state) { … }
void Range::CheckExtractPrecondition(ExceptionState& exception_state) { … }
Node* Range::FirstNode() const { … }
Node* Range::PastLastNode() const { … }
gfx::Rect Range::BoundingBox() const { … }
bool AreRangesEqual(const Range* a, const Range* b) { … }
static inline void BoundaryNodeChildrenWillBeRemoved(
RangeBoundaryPoint& boundary,
ContainerNode& container) { … }
static void BoundaryShadowNodeChildrenWillBeRemoved(
RangeBoundaryPoint& boundary,
ContainerNode& container) { … }
void Range::NodeChildrenWillBeRemoved(ContainerNode& container) { … }
void Range::FixupRemovedChildrenAcrossShadowBoundary(ContainerNode& container) { … }
static inline bool BoundaryNodeWillBeRemoved(RangeBoundaryPoint& boundary,
Node& node_to_be_removed) { … }
static inline void BoundaryShadowNodeWillBeRemoved(RangeBoundaryPoint& boundary,
Node& node_to_be_removed) { … }
void Range::NodeWillBeRemoved(Node& node) { … }
void Range::FixupRemovedNodeAcrossShadowBoundary(Node& node) { … }
static inline void BoundaryTextInserted(RangeBoundaryPoint& boundary,
const CharacterData& text,
unsigned offset,
unsigned length) { … }
void Range::DidInsertText(const CharacterData& text,
unsigned offset,
unsigned length) { … }
static inline void BoundaryTextRemoved(RangeBoundaryPoint& boundary,
const CharacterData& text,
unsigned offset,
unsigned length) { … }
void Range::DidRemoveText(const CharacterData& text,
unsigned offset,
unsigned length) { … }
static inline void BoundaryTextNodesMerged(RangeBoundaryPoint& boundary,
const NodeWithIndex& old_node,
unsigned offset) { … }
void Range::DidMergeTextNodes(const NodeWithIndex& old_node, unsigned offset) { … }
void Range::UpdateOwnerDocumentIfNeeded() { … }
static inline void BoundaryTextNodeSplit(RangeBoundaryPoint& boundary,
const Text& old_node) { … }
void Range::DidSplitTextNode(const Text& old_node) { … }
void Range::expand(const String& unit, ExceptionState& exception_state) { … }
DOMRectList* Range::getClientRects() const { … }
DOMRect* Range::getBoundingClientRect() const { … }
static Vector<gfx::QuadF> ComputeTextQuads(const Document& owner_document,
const LayoutText& layout_text,
unsigned start_offset,
unsigned end_offset) { … }
void Range::GetBorderAndTextQuads(Vector<gfx::QuadF>& quads) const { … }
gfx::RectF Range::BoundingRect() const { … }
void Range::UpdateSelectionIfAddedToSelection() { … }
void Range::ScheduleVisualUpdateIfInRegisteredHighlight(Document& document) { … }
void Range::RemoveFromSelectionIfInDifferentRoot(Document& old_document) { … }
void Range::Trace(Visitor* visitor) const { … }
}
#if DCHECK_IS_ON()
void ShowTree(const blink::Range* range) { … }
#endif