| 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 #include "core/paint/TextPainter.h" | 5 #include "core/paint/TextPainter.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
| 10 #include "core/layout/LayoutTextCombine.h" | 10 #include "core/layout/LayoutTextCombine.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const LayoutPoint& textOrigin, | 29 const LayoutPoint& textOrigin, |
| 30 const LayoutRect& textBounds, | 30 const LayoutRect& textBounds, |
| 31 bool horizontal) | 31 bool horizontal) |
| 32 : m_graphicsContext(context), | 32 : m_graphicsContext(context), |
| 33 m_font(font), | 33 m_font(font), |
| 34 m_run(run), | 34 m_run(run), |
| 35 m_textOrigin(textOrigin), | 35 m_textOrigin(textOrigin), |
| 36 m_textBounds(textBounds), | 36 m_textBounds(textBounds), |
| 37 m_horizontal(horizontal), | 37 m_horizontal(horizontal), |
| 38 m_emphasisMarkOffset(0), | 38 m_emphasisMarkOffset(0), |
| 39 m_combinedText(0) {} | 39 m_combinedText(0), |
| 40 m_ellipsisOffset(0) {} |
| 40 | 41 |
| 41 TextPainter::~TextPainter() {} | 42 TextPainter::~TextPainter() {} |
| 42 | 43 |
| 43 void TextPainter::setEmphasisMark(const AtomicString& emphasisMark, | 44 void TextPainter::setEmphasisMark(const AtomicString& emphasisMark, |
| 44 TextEmphasisPosition position) { | 45 TextEmphasisPosition position) { |
| 45 m_emphasisMark = emphasisMark; | 46 m_emphasisMark = emphasisMark; |
| 46 const SimpleFontData* fontData = m_font.primaryFont(); | 47 const SimpleFontData* fontData = m_font.primaryFont(); |
| 47 DCHECK(fontData); | 48 DCHECK(fontData); |
| 48 | 49 |
| 49 if (!fontData || emphasisMark.isNull()) { | 50 if (!fontData || emphasisMark.isNull()) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 unsigned truncationPoint, | 241 unsigned truncationPoint, |
| 241 TextBlobPtr* cachedTextBlob) { | 242 TextBlobPtr* cachedTextBlob) { |
| 242 TextRunPaintInfo textRunPaintInfo(m_run); | 243 TextRunPaintInfo textRunPaintInfo(m_run); |
| 243 textRunPaintInfo.bounds = FloatRect(m_textBounds); | 244 textRunPaintInfo.bounds = FloatRect(m_textBounds); |
| 244 if (startOffset <= endOffset) { | 245 if (startOffset <= endOffset) { |
| 245 // FIXME: We should be able to use cachedTextBlob in more cases. | 246 // FIXME: We should be able to use cachedTextBlob in more cases. |
| 246 textRunPaintInfo.cachedTextBlob = cachedTextBlob; | 247 textRunPaintInfo.cachedTextBlob = cachedTextBlob; |
| 247 paintInternalRun<Step>(textRunPaintInfo, startOffset, endOffset); | 248 paintInternalRun<Step>(textRunPaintInfo, startOffset, endOffset); |
| 248 } else { | 249 } else { |
| 249 if (endOffset > 0) | 250 if (endOffset > 0) |
| 250 paintInternalRun<Step>(textRunPaintInfo, 0, endOffset); | 251 paintInternalRun<Step>(textRunPaintInfo, m_ellipsisOffset, endOffset); |
| 251 if (startOffset < truncationPoint) | 252 if (startOffset < truncationPoint) |
| 252 paintInternalRun<Step>(textRunPaintInfo, startOffset, truncationPoint); | 253 paintInternalRun<Step>(textRunPaintInfo, startOffset, truncationPoint); |
| 253 } | 254 } |
| 254 } | 255 } |
| 255 | 256 |
| 256 void TextPainter::clipDecorationsStripe(float upper, | 257 void TextPainter::clipDecorationsStripe(float upper, |
| 257 float stripeWidth, | 258 float stripeWidth, |
| 258 float dilation) { | 259 float dilation) { |
| 259 TextRunPaintInfo textRunPaintInfo(m_run); | 260 TextRunPaintInfo textRunPaintInfo(m_run); |
| 260 | 261 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); | 301 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); |
| 301 textRunPaintInfo.bounds = FloatRect(m_textBounds); | 302 textRunPaintInfo.bounds = FloatRect(m_textBounds); |
| 302 m_graphicsContext.concatCTM(rotation(m_textBounds, Clockwise)); | 303 m_graphicsContext.concatCTM(rotation(m_textBounds, Clockwise)); |
| 303 m_graphicsContext.drawEmphasisMarks(m_combinedText->originalFont(), | 304 m_graphicsContext.drawEmphasisMarks(m_combinedText->originalFont(), |
| 304 textRunPaintInfo, m_emphasisMark, | 305 textRunPaintInfo, m_emphasisMark, |
| 305 emphasisMarkTextOrigin); | 306 emphasisMarkTextOrigin); |
| 306 m_graphicsContext.concatCTM(rotation(m_textBounds, Counterclockwise)); | 307 m_graphicsContext.concatCTM(rotation(m_textBounds, Counterclockwise)); |
| 307 } | 308 } |
| 308 | 309 |
| 309 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |