OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 const String& text() const { return m_text; } | 60 const String& text() const { return m_text; } |
61 virtual unsigned textStartOffset() const { return 0; } | 61 virtual unsigned textStartOffset() const { return 0; } |
62 String plainText() const; | 62 String plainText() const; |
63 | 63 |
64 InlineTextBox* createInlineTextBox(int start, unsigned short length); | 64 InlineTextBox* createInlineTextBox(int start, unsigned short length); |
65 void dirtyOrDeleteLineBoxesIfNeeded(bool fullLayout); | 65 void dirtyOrDeleteLineBoxesIfNeeded(bool fullLayout); |
66 void dirtyLineBoxes(); | 66 void dirtyLineBoxes(); |
67 | 67 |
68 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const override final; | 68 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const override final; |
69 void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsig
ned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0); | 69 void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsig
ned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = nullp
tr); |
70 | 70 |
71 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid
e final; | 71 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid
e final; |
72 void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, uns
igned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0); | 72 void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, uns
igned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = nul
lptr); |
73 | 73 |
74 enum ClippingOption { NoClipping, ClipToEllipsis }; | 74 enum ClippingOption { NoClipping, ClipToEllipsis }; |
75 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed = 0, ClippingOption =
NoClipping) const; | 75 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed = nullptr, ClippingOpt
ion = NoClipping) const; |
76 | 76 |
77 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) override; | 77 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) override; |
78 | 78 |
79 bool is8Bit() const { return m_text.is8Bit(); } | 79 bool is8Bit() const { return m_text.is8Bit(); } |
80 const LChar* characters8() const { return m_text.impl()->characters8(); } | 80 const LChar* characters8() const { return m_text.impl()->characters8(); } |
81 const UChar* characters16() const { return m_text.impl()->characters16(); } | 81 const UChar* characters16() const { return m_text.impl()->characters16(); } |
82 bool hasEmptyText() const { return m_text.isEmpty(); } | 82 bool hasEmptyText() const { return m_text.isEmpty(); } |
83 UChar characterAt(unsigned) const; | 83 UChar characterAt(unsigned) const; |
84 UChar uncheckedCharacterAt(unsigned) const; | 84 UChar uncheckedCharacterAt(unsigned) const; |
85 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } | 85 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } |
86 unsigned textLength() const { return m_text.length(); } // non virtual imple
mentation of length() | 86 unsigned textLength() const { return m_text.length(); } // non virtual imple
mentation of length() |
87 void positionLineBox(InlineBox*); | 87 void positionLineBox(InlineBox*); |
88 | 88 |
89 virtual float width(unsigned from, unsigned len, const Font&, LayoutUnit xPo
s, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverfl
ow* = 0) const; | 89 virtual float width(unsigned from, unsigned len, const Font&, LayoutUnit xPo
s, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts = nullptr, Glyph
Overflow* = nullptr) const; |
90 virtual float width(unsigned from, unsigned len, LayoutUnit xPos, TextDirect
ion, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0,
GlyphOverflow* = 0) const; | 90 virtual float width(unsigned from, unsigned len, LayoutUnit xPos, TextDirect
ion, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = nul
lptr, GlyphOverflow* = nullptr) const; |
91 | 91 |
92 float minLogicalWidth() const; | 92 float minLogicalWidth() const; |
93 float maxLogicalWidth() const; | 93 float maxLogicalWidth() const; |
94 | 94 |
95 void trimmedPrefWidths(LayoutUnit leadWidth, | 95 void trimmedPrefWidths(LayoutUnit leadWidth, |
96 LayoutUnit& firstLineMinWidth, bool& hasBreakableStart, | 96 LayoutUnit& firstLineMinWidth, bool& hasBreakableStart, |
97 LayoutUnit& lastLineMinWidth, bool& hasBreakableEnd, | 97 LayoutUnit& lastLineMinWidth, bool& hasBreakableEnd, |
98 bool& hasBreakableChar, bool& hasBreak, | 98 bool& hasBreakableChar, bool& hasBreak, |
99 LayoutUnit& firstLineMaxWidth, LayoutUnit& lastLineMaxWidth, | 99 LayoutUnit& firstLineMaxWidth, LayoutUnit& lastLineMaxWidth, |
100 LayoutUnit& minWidth, LayoutUnit& maxWidth, bool& stripFrontSpaces, | 100 LayoutUnit& minWidth, LayoutUnit& maxWidth, bool& stripFrontSpaces, |
101 TextDirection); | 101 TextDirection); |
102 | 102 |
103 virtual IntRect linesBoundingBox() const; | 103 virtual IntRect linesBoundingBox() const; |
104 LayoutRect linesVisualOverflowBoundingBox() const; | 104 LayoutRect linesVisualOverflowBoundingBox() const; |
105 | 105 |
106 FloatPoint firstRunOrigin() const; | 106 FloatPoint firstRunOrigin() const; |
107 float firstRunX() const; | 107 float firstRunX() const; |
108 float firstRunY() const; | 108 float firstRunY() const; |
109 | 109 |
110 virtual void setText(PassRefPtr<StringImpl>, bool force = false); | 110 virtual void setText(PassRefPtr<StringImpl>, bool force = false); |
111 void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len
, bool force = false); | 111 void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len
, bool force = false); |
112 | 112 |
113 virtual void transformText(); | 113 virtual void transformText(); |
114 | 114 |
115 virtual bool canBeSelectionLeaf() const override { return true; } | 115 virtual bool canBeSelectionLeaf() const override { return true; } |
116 virtual void setSelectionState(SelectionState) override final; | 116 virtual void setSelectionState(SelectionState) override final; |
117 virtual LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObj
ect* paintInvalidationContainer) const override; | 117 virtual LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObj
ect* paintInvalidationContainer) const override; |
118 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e
xtraWidthToEndOfLine = 0) override; | 118 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e
xtraWidthToEndOfLine = nullptr) override; |
119 | 119 |
120 InlineTextBox* firstTextBox() const { return m_firstTextBox; } | 120 InlineTextBox* firstTextBox() const { return m_firstTextBox; } |
121 InlineTextBox* lastTextBox() const { return m_lastTextBox; } | 121 InlineTextBox* lastTextBox() const { return m_lastTextBox; } |
122 | 122 |
123 virtual int caretMinOffset() const override; | 123 virtual int caretMinOffset() const override; |
124 virtual int caretMaxOffset() const override; | 124 virtual int caretMaxOffset() const override; |
125 unsigned resolvedTextLength() const; | 125 unsigned resolvedTextLength() const; |
126 | 126 |
127 virtual int previousOffset(int current) const override final; | 127 virtual int previousOffset(int current) const override final; |
128 virtual int previousOffsetForBackwardDeletion(int current) const override fi
nal; | 128 virtual int previousOffsetForBackwardDeletion(int current) const override fi
nal; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation&, const Layou
tPoint&, HitTestAction) override final { ASSERT_NOT_REACHED(); return false; } | 172 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation&, const Layou
tPoint&, HitTestAction) override final { ASSERT_NOT_REACHED(); return false; } |
173 | 173 |
174 void deleteTextBoxes(); | 174 void deleteTextBoxes(); |
175 bool containsOnlyWhitespace(unsigned from, unsigned len) const; | 175 bool containsOnlyWhitespace(unsigned from, unsigned len) const; |
176 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect
ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; | 176 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect
ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; |
177 | 177 |
178 void secureText(UChar mask); | 178 void secureText(UChar mask); |
179 | 179 |
180 bool isText() const = delete; // This will catch anyone doing an unnecessary
check. | 180 bool isText() const = delete; // This will catch anyone doing an unnecessary
check. |
181 | 181 |
182 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer, const PaintInvalidationState* = 0) const
override; | 182 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr)
const override; |
183 | 183 |
184 void checkConsistency() const; | 184 void checkConsistency() const; |
185 | 185 |
186 // We put the bitfield first to minimize padding on 64-bit. | 186 // We put the bitfield first to minimize padding on 64-bit. |
187 bool m_hasBreakableChar : 1; // Whether or not we can be broken into multipl
e lines. | 187 bool m_hasBreakableChar : 1; // Whether or not we can be broken into multipl
e lines. |
188 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit
h '\n'). | 188 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit
h '\n'). |
189 bool m_hasTab : 1; // Whether or not we have a variable width tab character
(e.g., <pre> with '\t'). | 189 bool m_hasTab : 1; // Whether or not we have a variable width tab character
(e.g., <pre> with '\t'). |
190 bool m_hasBreakableStart : 1; | 190 bool m_hasBreakableStart : 1; |
191 bool m_hasBreakableEnd : 1; | 191 bool m_hasBreakableEnd : 1; |
192 bool m_hasEndWhiteSpace : 1; | 192 bool m_hasEndWhiteSpace : 1; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 inline LayoutText* Text::layoutObject() const | 235 inline LayoutText* Text::layoutObject() const |
236 { | 236 { |
237 return toLayoutText(CharacterData::layoutObject()); | 237 return toLayoutText(CharacterData::layoutObject()); |
238 } | 238 } |
239 | 239 |
240 void applyTextTransform(const ComputedStyle*, String&, UChar); | 240 void applyTextTransform(const ComputedStyle*, String&, UChar); |
241 | 241 |
242 } // namespace blink | 242 } // namespace blink |
243 | 243 |
244 #endif // LayoutText_h | 244 #endif // LayoutText_h |
OLD | NEW |