chromium/third_party/blink/renderer/core/fragment_directive/text_fragment_selector_generator.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/fragment_directive/text_fragment_selector_generator.h"

#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/default_tick_clock.h"
#include "components/shared_highlighting/core/common/shared_highlighting_features.h"
#include "third_party/abseil-cpp/absl/base/macros.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/interface_registry.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/finder/find_buffer.h"
#include "third_party/blink/renderer/core/editing/iterators/character_iterator.h"
#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include "third_party/blink/renderer/core/editing/range_in_flat_tree.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_anchor_metrics.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_finder.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_selector.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/platform/text/text_boundaries.h"
#include "third_party/blink/renderer/platform/wtf/text/unicode.h"

LinkGenerationError;
LinkGenerationStatus;

namespace blink {

namespace {

// Returns true if text from beginning of |node| until |pos_offset| can be
// considered empty. Otherwise, return false.
bool IsFirstVisiblePosition(Node* node, unsigned pos_offset) {}

// Returns true if text from |pos_offset| until end of |node| can be considered
// empty. Otherwise, return false.
bool IsLastVisiblePosition(Node* node, unsigned pos_offset) {}

struct ForwardDirection {};

struct BackwardDirection {};

template <class Direction>
Node* NextNonEmptyVisibleTextNode(Node* start_node) {}

// Returns the next/previous visible node to |start_node|.
Node* FirstNonEmptyVisibleTextNode(Node* start_node) {}

Node* BackwardNonEmptyVisibleTextNode(Node* start_node) {}

// For Element-based Position returns the node that its pointing to, otherwise
// returns the container node.
Node* ResolvePositionToNode(const PositionInFlatTree& position) {}

}  // namespace

constexpr int kExactTextMaxChars =;
constexpr int kNoContextMinChars =;
constexpr int kMaxContextWords =;
constexpr int kMaxRangeWords =;
constexpr int kMaxIterationCountToRecord =;
constexpr int kMinWordCount =;

std::optional<int> g_exactTextMaxCharsOverride;

TextFragmentSelectorGenerator::TextFragmentSelectorGenerator(
    LocalFrame* main_frame)
    :{}

void TextFragmentSelectorGenerator::Generate(const RangeInFlatTree& range,
                                             GenerateCallback callback) {}

void TextFragmentSelectorGenerator::Reset() {}

void TextFragmentSelectorGenerator::Trace(Visitor* visitor) const {}

void TextFragmentSelectorGenerator::RecordSelectorStateUma() const {}

String TextFragmentSelectorGenerator::GetSelectorTargetText() const {}

void TextFragmentSelectorGenerator::DidFindMatch(const RangeInFlatTree& match,
                                                 bool is_unique) {}

void TextFragmentSelectorGenerator::NoMatchFound() {}

void TextFragmentSelectorGenerator::AdjustSelection() {}

void TextFragmentSelectorGenerator::StartGeneration() {}

void TextFragmentSelectorGenerator::GenerateSelectorCandidate() {}

void TextFragmentSelectorGenerator::ResolveSelectorState() {}

void TextFragmentSelectorGenerator::RunTextFinder() {}

PositionInFlatTree TextFragmentSelectorGenerator::GetPreviousTextEndPosition(
    const PositionInFlatTree& position) {}

PositionInFlatTree TextFragmentSelectorGenerator::GetNextTextStartPosition(
    const PositionInFlatTree& position) {}

void TextFragmentSelectorGenerator::GenerateExactSelector() {}

void TextFragmentSelectorGenerator::ExtendRangeSelector() {}

void TextFragmentSelectorGenerator::ExtendContext() {}

void TextFragmentSelectorGenerator::RecordAllMetrics(
    const TextFragmentSelector& selector) {}

void TextFragmentSelectorGenerator::OnSelectorReady(
    const TextFragmentSelector& selector) {}

// static
void TextFragmentSelectorGenerator::OverrideExactTextMaxCharsForTesting(
    int value) {}

unsigned TextFragmentSelectorGenerator::GetExactTextMaxChars() {}

}  // namespace blink