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/TextPainterBase.h" | 5 #include "core/paint/TextPainterBase.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/paint/AppliedDecorationPainter.h" | 8 #include "core/paint/AppliedDecorationPainter.h" |
9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
10 #include "core/paint/PaintInfo.h" | 10 #include "core/paint/PaintInfo.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 TextPainterBase::~TextPainterBase() {} | 34 TextPainterBase::~TextPainterBase() {} |
35 | 35 |
36 void TextPainterBase::SetEmphasisMark(const AtomicString& emphasis_mark, | 36 void TextPainterBase::SetEmphasisMark(const AtomicString& emphasis_mark, |
37 TextEmphasisPosition position) { | 37 TextEmphasisPosition position) { |
38 emphasis_mark_ = emphasis_mark; | 38 emphasis_mark_ = emphasis_mark; |
39 const SimpleFontData* font_data = font_.PrimaryFont(); | 39 const SimpleFontData* font_data = font_.PrimaryFont(); |
40 DCHECK(font_data); | 40 DCHECK(font_data); |
41 | 41 |
42 if (!font_data || emphasis_mark.IsNull()) { | 42 if (!font_data || emphasis_mark.IsNull()) { |
43 emphasis_mark_offset_ = 0; | 43 emphasis_mark_offset_ = 0; |
44 } else if (position == kTextEmphasisPositionOver) { | 44 } else if (position == TextEmphasisPosition::kOver) { |
45 emphasis_mark_offset_ = -font_data->GetFontMetrics().Ascent() - | 45 emphasis_mark_offset_ = -font_data->GetFontMetrics().Ascent() - |
46 font_.EmphasisMarkDescent(emphasis_mark); | 46 font_.EmphasisMarkDescent(emphasis_mark); |
47 } else { | 47 } else { |
48 DCHECK(position == kTextEmphasisPositionUnder); | 48 DCHECK(position == TextEmphasisPosition::kUnder); |
49 emphasis_mark_offset_ = font_data->GetFontMetrics().Descent() + | 49 emphasis_mark_offset_ = font_data->GetFontMetrics().Descent() + |
50 font_.EmphasisMarkAscent(emphasis_mark); | 50 font_.EmphasisMarkAscent(emphasis_mark); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 // static | 54 // static |
55 void TextPainterBase::UpdateGraphicsContext( | 55 void TextPainterBase::UpdateGraphicsContext( |
56 GraphicsContext& context, | 56 GraphicsContext& context, |
57 const Style& text_style, | 57 const Style& text_style, |
58 bool horizontal, | 58 bool horizontal, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 decoration_info.thickness = ComputeDecorationThickness( | 289 decoration_info.thickness = ComputeDecorationThickness( |
290 decoration_info.style, decoration_info.font_data); | 290 decoration_info.style, decoration_info.font_data); |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 // Offset between lines - always non-zero, so lines never cross each other. | 294 // Offset between lines - always non-zero, so lines never cross each other. |
295 decoration_info.double_offset = decoration_info.thickness + 1.f; | 295 decoration_info.double_offset = decoration_info.thickness + 1.f; |
296 } | 296 } |
297 | 297 |
298 } // namespace blink | 298 } // namespace blink |
OLD | NEW |