chromium/third_party/blink/renderer/core/editing/position_iterator.cc

/*
 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/editing/position_iterator.h"

#include "base/numerics/safe_conversions.h"
#include "third_party/blink/renderer/core/core_export.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/position.h"

namespace blink {

namespace {

// TODO(editing-dev): We should replace usages of |hasChildren()| in
// |PositionIterator| to |shouldTraverseChildren()|.
template <typename Strategy>
bool ShouldTraverseChildren(const Node& node) {}

template <typename Strategy>
int LastOffsetForPositionIterator(const Node* node) {}

// TODO(editing-dev): We should replace usages of |parent()| in
// |PositionIterator| to |selectableParentOf()|.
template <typename Strategy>
ContainerNode* SelectableParentOf(const Node& node) {}

}  // namespace

static constexpr int kInvalidOffset =;

template <typename Strategy>
SlowPositionIteratorAlgorithm<Strategy>::SlowPositionIteratorAlgorithm(
    const PositionTemplate<Strategy>& pos) {}

template <typename Strategy>
PositionTemplate<Strategy>
SlowPositionIteratorAlgorithm<Strategy>::DeprecatedComputePosition() const {}

template <typename Strategy>
PositionTemplate<Strategy>
SlowPositionIteratorAlgorithm<Strategy>::ComputePosition() const {}

template <typename Strategy>
void SlowPositionIteratorAlgorithm<Strategy>::Increment() {}

template <typename Strategy>
void SlowPositionIteratorAlgorithm<Strategy>::Decrement() {}

template <typename Strategy>
bool SlowPositionIteratorAlgorithm<Strategy>::AtStart() const {}

template <typename Strategy>
bool SlowPositionIteratorAlgorithm<Strategy>::AtEnd() const {}

template <typename Strategy>
bool SlowPositionIteratorAlgorithm<Strategy>::AtStartOfNode() const {}

template <typename Strategy>
bool SlowPositionIteratorAlgorithm<Strategy>::AtEndOfNode() const {}

template class CORE_TEMPLATE_EXPORT
    SlowPositionIteratorAlgorithm<EditingStrategy>;
template class CORE_TEMPLATE_EXPORT
    SlowPositionIteratorAlgorithm<EditingInFlatTreeStrategy>;

// ---

// static
template <typename Strategy>
typename FastPositionIteratorAlgorithm<Strategy>::ContainerType
FastPositionIteratorAlgorithm<Strategy>::ContainerToContainerType(
    const Node* node) {}

template <typename Strategy>
FastPositionIteratorAlgorithm<Strategy>::FastPositionIteratorAlgorithm(
    const PositionType& position) {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::Initialize(
    const PositionType& position) {}

template <typename Strategy>
FastPositionIteratorAlgorithm<Strategy>::FastPositionIteratorAlgorithm() =
    default;

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::AssertOffsetInContainerIsValid()
    const {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::AssertOffsetStackIsValid() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::IsValid() const {}

template <typename Strategy>
Node* FastPositionIteratorAlgorithm<Strategy>::ChildAfterPosition() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::HasChildren() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::IgnoresChildren() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::IsUserSelectContain() const {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::Decrement() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::Increment() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::DecrementInternal() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::IncrementInternal() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::MoveToNextContainer() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::MoveToNextSkippingChildren() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::MoveToPreviousContainer() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::MoveToPreviousSkippingChildren() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<
    Strategy>::SetChildBeforePositionToPreviosuSigblingOf(const Node& node) {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::SetContainer(Node* node) {}

template <typename Strategy>
PositionTemplate<Strategy>
FastPositionIteratorAlgorithm<Strategy>::BeforeOrAfterPosition() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::IsBeforePosition() const {}

template <typename Strategy>
PositionTemplate<Strategy>
FastPositionIteratorAlgorithm<Strategy>::DeprecatedComputePosition() const {}

template <typename Strategy>
PositionTemplate<Strategy>
FastPositionIteratorAlgorithm<Strategy>::ComputePosition() const {}

template <typename Strategy>
int FastPositionIteratorAlgorithm<Strategy>::OffsetInTextNode() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::AtStart() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::AtEnd() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::AtStartOfNode() const {}

template <typename Strategy>
bool FastPositionIteratorAlgorithm<Strategy>::AtEndOfNode() const {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::EnsureOffsetInContainer() const {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::MoveOffsetInContainerBy(
    int delta) {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::PopOffsetStack() {}

template <typename Strategy>
void FastPositionIteratorAlgorithm<Strategy>::PushThenSetOffset(
    unsigned offset_in_container) {}

template class CORE_TEMPLATE_EXPORT
    FastPositionIteratorAlgorithm<EditingStrategy>;
template class CORE_TEMPLATE_EXPORT
    FastPositionIteratorAlgorithm<EditingInFlatTreeStrategy>;

// ---

template <typename Strategy>
PositionIteratorAlgorithm<Strategy>::PositionIteratorAlgorithm(
    const PositionTemplate<Strategy>& position)
    :{}

template <typename Strategy>
PositionIteratorAlgorithm<Strategy>::PositionIteratorAlgorithm(
    const PositionIteratorAlgorithm& other)
    :{}

template <typename Strategy>
PositionIteratorAlgorithm<Strategy>&
PositionIteratorAlgorithm<Strategy>::operator=(
    const PositionIteratorAlgorithm& other) {}

template <typename Strategy>
PositionTemplate<Strategy>
PositionIteratorAlgorithm<Strategy>::DeprecatedComputePosition() const {}

template <typename Strategy>
PositionTemplate<Strategy>
PositionIteratorAlgorithm<Strategy>::ComputePosition() const {}

template <typename Strategy>
void PositionIteratorAlgorithm<Strategy>::Decrement() {}

template <typename Strategy>
void PositionIteratorAlgorithm<Strategy>::Increment() {}

template <typename Strategy>
Node* PositionIteratorAlgorithm<Strategy>::GetNode() const {}

template <typename Strategy>
int PositionIteratorAlgorithm<Strategy>::OffsetInTextNode() const {}

template <typename Strategy>
bool PositionIteratorAlgorithm<Strategy>::AtStart() const {}

template <typename Strategy>
bool PositionIteratorAlgorithm<Strategy>::AtEnd() const {}

template <typename Strategy>
bool PositionIteratorAlgorithm<Strategy>::AtStartOfNode() const {}

template <typename Strategy>
bool PositionIteratorAlgorithm<Strategy>::AtEndOfNode() const {}

template class CORE_TEMPLATE_EXPORT PositionIteratorAlgorithm<EditingStrategy>;
template class CORE_TEMPLATE_EXPORT
    PositionIteratorAlgorithm<EditingInFlatTreeStrategy>;

}  // namespace blink