chromium/chrome/renderer/accessibility/read_aloud_traversal_utils.cc

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

#include "chrome/renderer/accessibility/read_aloud_traversal_utils.h"

#include "ui/accessibility/ax_text_utils.h"

namespace a11y {

ReadAloudCurrentGranularity::ReadAloudCurrentGranularity() = default;

ReadAloudCurrentGranularity::ReadAloudCurrentGranularity(
    const ReadAloudCurrentGranularity& other) = default;

ReadAloudCurrentGranularity::~ReadAloudCurrentGranularity() = default;

void ReadAloudCurrentGranularity::AddText(ui::AXNodeID id,
                                          int text_start,
                                          int text_end,
                                          const std::u16string& text_to_add) {}

std::vector<ReadAloudTextSegment>
ReadAloudCurrentGranularity::GetSegmentsForRange(int start_index,
                                                 int end_index) {}

}  // namespace a11y

namespace {

// Returns the index of the next granularity of the given text, such that the
// next granularity is equivalent to text.substr(0, <returned_index>).
int GetNextGranularity(const std::u16string& text,
                       ax::mojom::TextBoundary boundary) {}

}  // namespace

int GetNextSentence(const std::u16string& text, bool is_pdf) {}

int GetNextWord(const std::u16string& text) {}

bool ArePositionsEqual(const ui::AXNodePosition::AXPositionInstance& position,
                       const ui::AXNodePosition::AXPositionInstance& other) {}

ui::AXNode* GetAnchorNode(
    const ui::AXNodePosition::AXPositionInstance& position) {}

// Returns either the node or the lowest platform ancestor of the node, if it's
// a leaf.
ui::AXNode* GetNextNodeFromPosition(
    const ui::AXNodePosition::AXPositionInstance& ax_position) {}

// TODO(crbug.com/40927698): See if we can use string util here.
// https://source.chromium.org/chromium/chromium/src/+/main:base/strings/string_util.h;l=448?q=string_util%20punctuation&ss=chromium
bool IsOpeningPunctuation(char& c) {}

// We should split the current utterance at a paragraph boundary if the
// AXPosition is at the start of a paragraph and we already have nodes in
// our current granularity segment.
bool ShouldSplitAtParagraph(
    const ui::AXNodePosition::AXPositionInstance& position,
    const a11y::ReadAloudCurrentGranularity current_granularity) {}