chromium/third_party/blink/renderer/core/editing/position_with_affinity.h

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

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_POSITION_WITH_AFFINITY_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_POSITION_WITH_AFFINITY_H_

#include <iosfwd>
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/editing/position.h"

namespace blink {

enum class TextAffinity;

template <typename Strategy>
class PositionWithAffinityTemplate {};

extern template class CORE_EXTERN_TEMPLATE_EXPORT
    PositionWithAffinityTemplate<EditingStrategy>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT
    PositionWithAffinityTemplate<EditingInFlatTreeStrategy>;

PositionWithAffinity;
PositionInFlatTreeWithAffinity;

PositionWithAffinity ToPositionInDOMTreeWithAffinity(
    const PositionWithAffinity&);
PositionWithAffinity ToPositionInDOMTreeWithAffinity(
    const PositionInFlatTreeWithAffinity&);
PositionInFlatTreeWithAffinity ToPositionInFlatTreeWithAffinity(
    const PositionWithAffinity&);
PositionInFlatTreeWithAffinity ToPositionInFlatTreeWithAffinity(
    const PositionInFlatTreeWithAffinity&);

template <typename Strategy>
PositionWithAffinityTemplate<Strategy> FromPositionInDOMTree(
    const PositionWithAffinity&);

template <>
inline PositionWithAffinity FromPositionInDOMTree<EditingStrategy>(
    const PositionWithAffinity& position_with_affinity) {}

template <>
inline PositionInFlatTreeWithAffinity
FromPositionInDOMTree<EditingInFlatTreeStrategy>(
    const PositionWithAffinity& position_with_affinity) {}

CORE_EXPORT std::ostream& operator<<(std::ostream&,
                                     const PositionWithAffinity&);
CORE_EXPORT std::ostream& operator<<(std::ostream&,
                                     const PositionInFlatTreeWithAffinity&);

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_POSITION_WITH_AFFINITY_H_