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; } | |
51 | 50 |
52 static void updateGraphicsContext(GraphicsContext&, | 51 static void updateGraphicsContext(GraphicsContext&, |
53 const Style&, | 52 const Style&, |
54 bool horizontal, | 53 bool horizontal, |
55 GraphicsContextStateSaver&); | 54 GraphicsContextStateSaver&); |
56 | 55 |
57 void clipDecorationsStripe(float upper, float stripeWidth, float dilation); | 56 void clipDecorationsStripe(float upper, float stripeWidth, float dilation); |
58 void paint(unsigned startOffset, | 57 void paint(unsigned startOffset, |
59 unsigned endOffset, | 58 unsigned endOffset, |
60 unsigned length, | 59 unsigned length, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 110 |
112 GraphicsContext& m_graphicsContext; | 111 GraphicsContext& m_graphicsContext; |
113 const Font& m_font; | 112 const Font& m_font; |
114 const TextRun& m_run; | 113 const TextRun& m_run; |
115 LayoutPoint m_textOrigin; | 114 LayoutPoint m_textOrigin; |
116 LayoutRect m_textBounds; | 115 LayoutRect m_textBounds; |
117 bool m_horizontal; | 116 bool m_horizontal; |
118 AtomicString m_emphasisMark; | 117 AtomicString m_emphasisMark; |
119 int m_emphasisMarkOffset; | 118 int m_emphasisMarkOffset; |
120 LayoutTextCombine* m_combinedText; | 119 LayoutTextCombine* m_combinedText; |
121 int m_ellipsisOffset; | |
122 }; | 120 }; |
123 | 121 |
124 inline AffineTransform TextPainter::rotation( | 122 inline AffineTransform TextPainter::rotation( |
125 const LayoutRect& boxRect, | 123 const LayoutRect& boxRect, |
126 RotationDirection rotationDirection) { | 124 RotationDirection rotationDirection) { |
127 // Why this matrix is correct: consider the case of a clockwise rotation. | 125 // Why this matrix is correct: consider the case of a clockwise rotation. |
128 | 126 |
129 // Let the corner points that define |boxRect| be ABCD, where A is top-left | 127 // Let the corner points that define |boxRect| be ABCD, where A is top-left |
130 // and B is bottom-left. | 128 // and B is bottom-left. |
131 | 129 |
(...skipping 10 matching lines...) Expand all Loading... |
142 return rotationDirection == Clockwise | 140 return rotationDirection == Clockwise |
143 ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), | 141 ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), |
144 boxRect.y() - boxRect.x()) | 142 boxRect.y() - boxRect.x()) |
145 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), | 143 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), |
146 boxRect.x() + boxRect.maxY()); | 144 boxRect.x() + boxRect.maxY()); |
147 } | 145 } |
148 | 146 |
149 } // namespace blink | 147 } // namespace blink |
150 | 148 |
151 #endif // TextPainter_h | 149 #endif // TextPainter_h |
OLD | NEW |