blob: dd0f528d75ce9483b1747ea98555f1a08d3bd730 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// 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.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_ABSTRACT_INLINE_TEXT_BOX_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_ABSTRACT_INLINE_TEXT_BOX_H_
#include "third_party/blink/renderer/core/layout/line/abstract_inline_text_box.h"
namespace blink {
class NGFragmentItem;
class NGInlineCursor;
class NGPaintFragment;
// The implementation of |AbstractInlineTextBox| for LayoutNG.
// See also |LegacyAbstractInlineTextBox| for legacy layout.
class CORE_EXPORT NGAbstractInlineTextBox final : public AbstractInlineTextBox {
private:
// Returns existing or newly created |NGAbstractInlineTextBox|.
// * |cursor| should be attached to |NGPhysicalTextFragment|.
static scoped_refptr<AbstractInlineTextBox> GetOrCreate(
const NGInlineCursor& cursor);
static void WillDestroy(const NGInlineCursor& cursor);
static void WillDestroy(const NGPaintFragment* fragment);
friend class LayoutText;
public:
NGAbstractInlineTextBox(LineLayoutText line_layout_item,
const NGPaintFragment& fragment);
NGAbstractInlineTextBox(LineLayoutText line_layout_item,
const NGFragmentItem& fragment);
~NGAbstractInlineTextBox() final;
private:
NGInlineCursor GetCursor() const;
NGInlineCursor GetCursorOnLine() const;
String GetTextContent() const;
// Implementations of AbstractInlineTextBox member functions.
void Detach() final;
scoped_refptr<AbstractInlineTextBox> NextInlineTextBox() const final;
LayoutRect LocalBounds() const final;
unsigned Len() const final;
unsigned TextOffsetInFormattingContext(unsigned offset) const final;
Direction GetDirection() const final;
void CharacterWidths(Vector<float>&) const final;
String GetText() const final;
bool IsFirst() const final;
bool IsLast() const final;
scoped_refptr<AbstractInlineTextBox> NextOnLine() const final;
scoped_refptr<AbstractInlineTextBox> PreviousOnLine() const final;
bool IsLineBreak() const final;
bool NeedsTrailingSpace() const final;
union {
const NGPaintFragment* fragment_;
const NGFragmentItem* fragment_item_;
};
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_ABSTRACT_INLINE_TEXT_BOX_H_
|