summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/editing/ng_flat_tree_shorthands.cc
blob: 77e7ff4f619785d164107c3e4b0656bd013e14cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2018 The Chromium Authors. All rights reserved.
// 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/editing/ng_flat_tree_shorthands.h"

#include "third_party/blink/renderer/core/editing/local_caret_rect.h"
#include "third_party/blink/renderer/core/editing/position.h"
#include "third_party/blink/renderer/core/editing/position_with_affinity.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_line_utils.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h"

namespace blink {

const LayoutBlockFlow* NGInlineFormattingContextOf(
    const PositionInFlatTree& position) {
  return NGInlineFormattingContextOf(ToPositionInDOMTree(position));
}

NGCaretPosition ComputeNGCaretPosition(
    const PositionInFlatTreeWithAffinity& position) {
  return ComputeNGCaretPosition(ToPositionInDOMTreeWithAffinity(position));
}

LocalCaretRect ComputeNGLocalCaretRect(
    const PositionInFlatTreeWithAffinity& position) {
  return ComputeNGLocalCaretRect(ToPositionInDOMTreeWithAffinity(position));
}

LocalCaretRect ComputeNGLocalSelectionRect(
    const PositionInFlatTreeWithAffinity& position) {
  return ComputeNGLocalSelectionRect(ToPositionInDOMTreeWithAffinity(position));
}

bool InSameNGLineBox(const PositionInFlatTreeWithAffinity& position1,
                     const PositionInFlatTreeWithAffinity& position2) {
  return InSameNGLineBox(ToPositionInDOMTreeWithAffinity(position1),
                         ToPositionInDOMTreeWithAffinity(position2));
}

}  // namespace blink