OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TextPainter_h | 5 #ifndef TextPainter_h |
6 #define TextPainter_h | 6 #define TextPainter_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/style/ComputedStyleConstants.h" | 9 #include "core/style/ComputedStyleConstants.h" |
10 #include "platform/fonts/TextBlob.h" | 10 #include "platform/fonts/TextBlob.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 const TextRun&, | 40 const TextRun&, |
41 const LayoutPoint& textOrigin, | 41 const LayoutPoint& textOrigin, |
42 const LayoutRect& textBounds, | 42 const LayoutRect& textBounds, |
43 bool horizontal); | 43 bool horizontal); |
44 ~TextPainter(); | 44 ~TextPainter(); |
45 | 45 |
46 void setEmphasisMark(const AtomicString&, TextEmphasisPosition); | 46 void setEmphasisMark(const AtomicString&, TextEmphasisPosition); |
47 void setCombinedText(LayoutTextCombine* combinedText) { | 47 void setCombinedText(LayoutTextCombine* combinedText) { |
48 m_combinedText = combinedText; | 48 m_combinedText = combinedText; |
49 } | 49 } |
| 50 void setEllipsisOffset(int offset) { m_ellipsisOffset = offset; } |
50 | 51 |
51 static void updateGraphicsContext(GraphicsContext&, | 52 static void updateGraphicsContext(GraphicsContext&, |
52 const Style&, | 53 const Style&, |
53 bool horizontal, | 54 bool horizontal, |
54 GraphicsContextStateSaver&); | 55 GraphicsContextStateSaver&); |
55 | 56 |
56 void clipDecorationsStripe(float upper, float stripeWidth, float dilation); | 57 void clipDecorationsStripe(float upper, float stripeWidth, float dilation); |
57 void paint(unsigned startOffset, | 58 void paint(unsigned startOffset, |
58 unsigned endOffset, | 59 unsigned endOffset, |
59 unsigned length, | 60 unsigned length, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 GraphicsContext& m_graphicsContext; | 112 GraphicsContext& m_graphicsContext; |
112 const Font& m_font; | 113 const Font& m_font; |
113 const TextRun& m_run; | 114 const TextRun& m_run; |
114 LayoutPoint m_textOrigin; | 115 LayoutPoint m_textOrigin; |
115 LayoutRect m_textBounds; | 116 LayoutRect m_textBounds; |
116 bool m_horizontal; | 117 bool m_horizontal; |
117 AtomicString m_emphasisMark; | 118 AtomicString m_emphasisMark; |
118 int m_emphasisMarkOffset; | 119 int m_emphasisMarkOffset; |
119 LayoutTextCombine* m_combinedText; | 120 LayoutTextCombine* m_combinedText; |
| 121 int m_ellipsisOffset; |
120 }; | 122 }; |
121 | 123 |
122 inline AffineTransform TextPainter::rotation( | 124 inline AffineTransform TextPainter::rotation( |
123 const LayoutRect& boxRect, | 125 const LayoutRect& boxRect, |
124 RotationDirection rotationDirection) { | 126 RotationDirection rotationDirection) { |
125 // Why this matrix is correct: consider the case of a clockwise rotation. | 127 // Why this matrix is correct: consider the case of a clockwise rotation. |
126 | 128 |
127 // Let the corner points that define |boxRect| be ABCD, where A is top-left | 129 // Let the corner points that define |boxRect| be ABCD, where A is top-left |
128 // and B is bottom-left. | 130 // and B is bottom-left. |
129 | 131 |
(...skipping 10 matching lines...) Expand all Loading... |
140 return rotationDirection == Clockwise | 142 return rotationDirection == Clockwise |
141 ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), | 143 ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), |
142 boxRect.y() - boxRect.x()) | 144 boxRect.y() - boxRect.x()) |
143 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), | 145 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), |
144 boxRect.x() + boxRect.maxY()); | 146 boxRect.x() + boxRect.maxY()); |
145 } | 147 } |
146 | 148 |
147 } // namespace blink | 149 } // namespace blink |
148 | 150 |
149 #endif // TextPainter_h | 151 #endif // TextPainter_h |
OLD | NEW |