Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: Source/core/paint/TextPainter.cpp

Issue 799123003: text-combine should scale rather than fall back to none when wide (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove one expected.txt and rebase-update (there was a directory rename) Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "core/paint/TextPainter.h" 6 #include "core/paint/TextPainter.h"
7 7
8 #include "core/CSSPropertyNames.h" 8 #include "core/CSSPropertyNames.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/rendering/InlineTextBox.h" 10 #include "core/rendering/InlineTextBox.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } else { 48 } else {
49 ASSERT(position == TextEmphasisPositionUnder); 49 ASSERT(position == TextEmphasisPositionUnder);
50 m_emphasisMarkOffset = m_font.fontMetrics().descent() + m_font.emphasisM arkAscent(emphasisMark); 50 m_emphasisMarkOffset = m_font.fontMetrics().descent() + m_font.emphasisM arkAscent(emphasisMark);
51 } 51 }
52 } 52 }
53 53
54 void TextPainter::paint(int startOffset, int endOffset, int length, const Style& textStyle, TextBlobPtr* cachedTextBlob) 54 void TextPainter::paint(int startOffset, int endOffset, int length, const Style& textStyle, TextBlobPtr* cachedTextBlob)
55 { 55 {
56 GraphicsContextStateSaver stateSaver(*m_graphicsContext, false); 56 GraphicsContextStateSaver stateSaver(*m_graphicsContext, false);
57 updateGraphicsContext(textStyle, stateSaver); 57 updateGraphicsContext(textStyle, stateSaver);
58 paintInternal<PaintText>(startOffset, endOffset, length, cachedTextBlob); 58 if (m_combinedText && m_combinedText->isTransformNeeded()) {
59 m_graphicsContext->save();
60 m_combinedText->transform(*m_graphicsContext, m_textBounds);
61 paintInternal<PaintText>(startOffset, endOffset, length, cachedTextBlob) ;
62 m_graphicsContext->restore();
63 } else {
64 paintInternal<PaintText>(startOffset, endOffset, length, cachedTextBlob) ;
65 }
59 66
60 if (!m_emphasisMark.isEmpty()) { 67 if (!m_emphasisMark.isEmpty()) {
61 if (textStyle.emphasisMarkColor != textStyle.fillColor) 68 if (textStyle.emphasisMarkColor != textStyle.fillColor)
62 m_graphicsContext->setFillColor(textStyle.emphasisMarkColor); 69 m_graphicsContext->setFillColor(textStyle.emphasisMarkColor);
63 70
64 if (m_combinedText) 71 if (m_combinedText)
65 paintEmphasisMarkForCombinedText(); 72 paintEmphasisMarkForCombinedText();
66 else 73 else
67 paintInternal<PaintEmphasisMark>(startOffset, endOffset, length); 74 paintInternal<PaintEmphasisMark>(startOffset, endOffset, length);
68 } 75 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 DEFINE_STATIC_LOCAL(TextRun, placeholderTextRun, (&ideographicFullStop, 1)); 219 DEFINE_STATIC_LOCAL(TextRun, placeholderTextRun, (&ideographicFullStop, 1));
213 FloatPoint emphasisMarkTextOrigin(m_textBounds.x(), m_textBounds.y() + m_fon t.fontMetrics().ascent() + m_emphasisMarkOffset); 220 FloatPoint emphasisMarkTextOrigin(m_textBounds.x(), m_textBounds.y() + m_fon t.fontMetrics().ascent() + m_emphasisMarkOffset);
214 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); 221 TextRunPaintInfo textRunPaintInfo(placeholderTextRun);
215 textRunPaintInfo.bounds = m_textBounds; 222 textRunPaintInfo.bounds = m_textBounds;
216 m_graphicsContext->concatCTM(rotation(m_textBounds, Clockwise)); 223 m_graphicsContext->concatCTM(rotation(m_textBounds, Clockwise));
217 m_graphicsContext->drawEmphasisMarks(m_combinedText->originalFont(), textRun PaintInfo, m_emphasisMark, emphasisMarkTextOrigin); 224 m_graphicsContext->drawEmphasisMarks(m_combinedText->originalFont(), textRun PaintInfo, m_emphasisMark, emphasisMarkTextOrigin);
218 m_graphicsContext->concatCTM(rotation(m_textBounds, Counterclockwise)); 225 m_graphicsContext->concatCTM(rotation(m_textBounds, Counterclockwise));
219 } 226 }
220 227
221 } // namespace blink 228 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.cpp ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698