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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
// Copyright 2015 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 LineLayoutText_h
#define LineLayoutText_h
#include "core/layout/LayoutText.h"
#include "core/layout/api/LineLayoutItem.h"
#include "platform/LayoutUnit.h"
#include "wtf/Forward.h"
namespace blink {
class LayoutText;
class LineLayoutText : public LineLayoutItem {
public:
explicit LineLayoutText(LayoutText* layoutObject)
: LineLayoutItem(layoutObject) {}
explicit LineLayoutText(const LineLayoutItem& item) : LineLayoutItem(item) {
SECURITY_DCHECK(!item || item.isText());
}
explicit LineLayoutText(std::nullptr_t) : LineLayoutItem(nullptr) {}
LineLayoutText() {}
InlineTextBox* firstTextBox() const { return toText()->firstTextBox(); }
InlineTextBox* lastTextBox() const { return toText()->lastTextBox(); }
InlineTextBox* createInlineTextBox(int start, unsigned short length) {
return toText()->createInlineTextBox(start, length);
}
void extractTextBox(InlineTextBox* inlineTextBox) {
toText()->extractTextBox(inlineTextBox);
}
void attachTextBox(InlineTextBox* inlineTextBox) {
toText()->attachTextBox(inlineTextBox);
}
void removeTextBox(InlineTextBox* inlineTextBox) {
toText()->removeTextBox(inlineTextBox);
}
bool isWordBreak() const { return toText()->isWordBreak(); }
bool isAllCollapsibleWhitespace() const {
return toText()->isAllCollapsibleWhitespace();
}
UChar characterAt(unsigned offset) const {
return toText()->characterAt(offset);
}
UChar uncheckedCharacterAt(unsigned offset) const {
return toText()->uncheckedCharacterAt(offset);
}
UChar32 codepointAt(unsigned offset) const {
return toText()->codepointAt(offset);
}
bool is8Bit() const { return toText()->is8Bit(); }
const LChar* characters8() const { return toText()->characters8(); }
const UChar* characters16() const { return toText()->characters16(); }
bool hasEmptyText() const { return toText()->hasEmptyText(); }
unsigned textLength() const { return toText()->textLength(); }
unsigned resolvedTextLength() const { return toText()->resolvedTextLength(); }
const String& text() const { return toText()->text(); }
bool containsOnlyWhitespace(unsigned from, unsigned len) const {
return toText()->containsOnlyWhitespace(from, len);
}
float width(unsigned from,
unsigned len,
const Font& font,
LayoutUnit xPos,
TextDirection textDirection,
HashSet<const SimpleFontData*>* fallbackFonts,
FloatRect* glyphBounds) const {
return toText()->width(from, len, font, xPos, textDirection, fallbackFonts,
glyphBounds);
}
float width(unsigned from,
unsigned len,
LayoutUnit xPos,
TextDirection textDirection,
bool firstLine,
HashSet<const SimpleFontData*>* fallbackFonts = nullptr,
FloatRect* glyphBounds = nullptr) const {
return toText()->width(from, len, xPos, textDirection, firstLine,
fallbackFonts, glyphBounds);
}
float hyphenWidth(const Font& font, TextDirection textDirection) {
return toText()->hyphenWidth(font, textDirection);
}
void selectionStartEnd(int& spos, int& epos) const {
return toText()->selectionStartEnd(spos, epos);
}
unsigned textStartOffset() const { return toText()->textStartOffset(); }
float minLogicalWidth() const { return toText()->minLogicalWidth(); }
private:
LayoutText* toText() { return toLayoutText(layoutObject()); }
const LayoutText* toText() const { return toLayoutText(layoutObject()); }
};
} // namespace blink
#endif // LineLayoutText_h
|