| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 static ResolvedUnderlinePosition ResolveUnderlinePosition( | 192 static ResolvedUnderlinePosition ResolveUnderlinePosition( |
| 193 const ComputedStyle& style, | 193 const ComputedStyle& style, |
| 194 FontBaseline baseline_type) { | 194 FontBaseline baseline_type) { |
| 195 // |auto| should resolve to |under| to avoid drawing through glyphs in | 195 // |auto| should resolve to |under| to avoid drawing through glyphs in |
| 196 // scripts where it would not be appropriate (e.g., ideographs.) | 196 // scripts where it would not be appropriate (e.g., ideographs.) |
| 197 // However, this has performance implications. For now, we only work with | 197 // However, this has performance implications. For now, we only work with |
| 198 // vertical text. | 198 // vertical text. |
| 199 switch (baseline_type) { | 199 switch (baseline_type) { |
| 200 case kAlphabeticBaseline: | 200 case kAlphabeticBaseline: |
| 201 switch (style.GetTextUnderlinePosition()) { | 201 switch (style.GetTextUnderlinePosition()) { |
| 202 case kTextUnderlinePositionAuto: | 202 case TextUnderlinePosition::kAuto: |
| 203 return ResolvedUnderlinePosition::kRoman; | 203 return ResolvedUnderlinePosition::kRoman; |
| 204 case kTextUnderlinePositionUnder: | 204 case TextUnderlinePosition::kUnder: |
| 205 return ResolvedUnderlinePosition::kUnder; | 205 return ResolvedUnderlinePosition::kUnder; |
| 206 } | 206 } |
| 207 break; | 207 break; |
| 208 case kIdeographicBaseline: | 208 case kIdeographicBaseline: |
| 209 // Compute language-appropriate default underline position. | 209 // Compute language-appropriate default underline position. |
| 210 // https://drafts.csswg.org/css-text-decor-3/#default-stylesheet | 210 // https://drafts.csswg.org/css-text-decor-3/#default-stylesheet |
| 211 UScriptCode script = style.GetFontDescription().GetScript(); | 211 UScriptCode script = style.GetFontDescription().GetScript(); |
| 212 if (script == USCRIPT_KATAKANA_OR_HIRAGANA || script == USCRIPT_HANGUL) | 212 if (script == USCRIPT_KATAKANA_OR_HIRAGANA || script == USCRIPT_HANGUL) |
| 213 return ResolvedUnderlinePosition::kOver; | 213 return ResolvedUnderlinePosition::kOver; |
| 214 return ResolvedUnderlinePosition::kUnder; | 214 return ResolvedUnderlinePosition::kUnder; |
| (...skipping 74 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 |