#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include <unicode/utf16.h>
#include "build/build_config.h"
#include "third_party/blink/renderer/core/core_export.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/shadow_root.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/position.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_view.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_legend_element.h"
#include "third_party/blink/renderer/core/html/forms/html_opt_group_element.h"
#include "third_party/blink/renderer/core/html/forms/html_option_element.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_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/html/html_meter_element.h"
#include "third_party/blink/renderer/core/html/html_progress_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/layout/table/layout_table.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_cell.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_row.h"
#include "third_party/blink/renderer/platform/fonts/font.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink {
FormControlType;
namespace {
template <typename Strategy>
TextIteratorBehavior AdjustBehaviorFlags(const TextIteratorBehavior&);
template <>
TextIteratorBehavior AdjustBehaviorFlags<EditingStrategy>(
const TextIteratorBehavior& behavior) { … }
template <>
TextIteratorBehavior AdjustBehaviorFlags<EditingInFlatTreeStrategy>(
const TextIteratorBehavior& behavior) { … }
static inline bool HasDisplayContents(const Node& node) { … }
static bool NotSkipping(const Node& node) { … }
template <typename Strategy>
const Node* StartNode(const Node* start_container, unsigned start_offset) { … }
template <typename Strategy>
const Node* EndNode(const Node& end_container, unsigned end_offset) { … }
template <typename Strategy>
const Node* PastLastNode(const Node& range_end_container,
unsigned range_end_offset) { … }
template <typename Strategy>
unsigned ShadowDepthOf(const Node& start_container, const Node& end_container);
template <>
unsigned ShadowDepthOf<EditingStrategy>(const Node& start_container,
const Node& end_container) { … }
template <>
unsigned ShadowDepthOf<EditingInFlatTreeStrategy>(const Node& start_container,
const Node& end_container) { … }
bool IsRenderedAsTable(const Node* node) { … }
bool ShouldHandleChildren(const Node& node,
const TextIteratorBehavior& behavior) { … }
}
template <typename Strategy>
TextIteratorAlgorithm<Strategy>::TextIteratorAlgorithm(
const EphemeralRangeTemplate<Strategy>& range,
const TextIteratorBehavior& behavior)
: … { … }
template <typename Strategy>
TextIteratorAlgorithm<Strategy>::TextIteratorAlgorithm(
const PositionTemplate<Strategy>& start,
const PositionTemplate<Strategy>& end,
const TextIteratorBehavior& behavior)
: … { … }
template <typename Strategy>
TextIteratorAlgorithm<Strategy>::~TextIteratorAlgorithm() { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::IsInsideAtomicInlineElement() const { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::HandleRememberedProgress() { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::Advance() { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::HandleTextNode() { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::SupportsAltText(const Node& node) { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::HandleReplacedElement() { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::ShouldEmitTabBeforeNode(
const Node& node) { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::ShouldEmitNewlineForNode(
const Node& node,
bool emits_original_text) { … }
static bool ShouldEmitNewlinesBeforeAndAfterNode(const Node& node) { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::ShouldEmitNewlineAfterNode(
const Node& node) { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::ShouldEmitNewlineBeforeNode(
const Node& node) { … }
static bool ShouldEmitExtraNewlineForNode(const Node* node) { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::ShouldRepresentNodeOffsetZero() { … }
template <typename Strategy>
bool TextIteratorAlgorithm<Strategy>::ShouldEmitSpaceBeforeAndAfterNode(
const Node& node) { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::RepresentNodeOffsetZero() { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::HandleNonTextNode() { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::ExitNode() { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::EmitChar16AfterNode(UChar code_unit,
const Node& node) { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::EmitChar16AsNode(UChar code_unit,
const Node& node) { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::EmitChar16BeforeNode(UChar code_unit,
const Node& node) { … }
template <typename Strategy>
EphemeralRangeTemplate<Strategy> TextIteratorAlgorithm<Strategy>::Range()
const { … }
template <typename Strategy>
const Document& TextIteratorAlgorithm<Strategy>::OwnerDocument() const { … }
template <typename Strategy>
const Node* TextIteratorAlgorithm<Strategy>::GetNode() const { … }
template <typename Strategy>
int TextIteratorAlgorithm<Strategy>::StartOffsetInCurrentContainer() const { … }
template <typename Strategy>
int TextIteratorAlgorithm<Strategy>::EndOffsetInCurrentContainer() const { … }
template <typename Strategy>
const Node& TextIteratorAlgorithm<Strategy>::CurrentContainer() const { … }
template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::EnsurePositionContainer() const { … }
template <typename Strategy>
PositionTemplate<Strategy> TextIteratorAlgorithm<Strategy>::GetPositionBefore(
int char16_offset) const { … }
template <typename Strategy>
PositionTemplate<Strategy> TextIteratorAlgorithm<Strategy>::GetPositionAfter(
int char16_offset) const { … }
template <typename Strategy>
PositionTemplate<Strategy>
TextIteratorAlgorithm<Strategy>::StartPositionInCurrentContainer() const { … }
template <typename Strategy>
PositionTemplate<Strategy>
TextIteratorAlgorithm<Strategy>::EndPositionInCurrentContainer() const { … }
template <typename Strategy>
int TextIteratorAlgorithm<Strategy>::RangeLength(
const PositionTemplate<Strategy>& start,
const PositionTemplate<Strategy>& end,
const TextIteratorBehavior& behavior) { … }
template <typename Strategy>
int TextIteratorAlgorithm<Strategy>::RangeLength(
const EphemeralRangeTemplate<Strategy>& range,
const TextIteratorBehavior& behavior) { … }
template <typename Strategy>
static String CreatePlainText(const EphemeralRangeTemplate<Strategy>& range,
const TextIteratorBehavior& behavior) { … }
String PlainText(const EphemeralRange& range,
const TextIteratorBehavior& behavior) { … }
String PlainText(const EphemeralRangeInFlatTree& range,
const TextIteratorBehavior& behavior) { … }
template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>;
template class CORE_TEMPLATE_EXPORT
TextIteratorAlgorithm<EditingInFlatTreeStrategy>;
}