| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 void TextPainterBase::PaintDecorationsOnlyLineThrough( | 169 void TextPainterBase::PaintDecorationsOnlyLineThrough( |
| 170 const DecorationInfo& decoration_info, | 170 const DecorationInfo& decoration_info, |
| 171 const PaintInfo& paint_info, | 171 const PaintInfo& paint_info, |
| 172 const Vector<AppliedTextDecoration>& decorations) { | 172 const Vector<AppliedTextDecoration>& decorations) { |
| 173 GraphicsContext& context = paint_info.context; | 173 GraphicsContext& context = paint_info.context; |
| 174 GraphicsContextStateSaver state_saver(context); | 174 GraphicsContextStateSaver state_saver(context); |
| 175 context.SetStrokeThickness(decoration_info.thickness); | 175 context.SetStrokeThickness(decoration_info.thickness); |
| 176 for (const AppliedTextDecoration& decoration : decorations) { | 176 for (const AppliedTextDecoration& decoration : decorations) { |
| 177 TextDecoration lines = decoration.Lines(); | 177 TextDecoration lines = decoration.Lines(); |
| 178 if (lines & kTextDecorationLineThrough) { | 178 if (EnumHasFlags(lines, TextDecoration::kLineThrough)) { |
| 179 const float line_through_offset = 2 * decoration_info.baseline / 3; | 179 const float line_through_offset = 2 * decoration_info.baseline / 3; |
| 180 AppliedDecorationPainter decoration_painter( | 180 AppliedDecorationPainter decoration_painter( |
| 181 context, decoration_info, line_through_offset, decoration, | 181 context, decoration_info, line_through_offset, decoration, |
| 182 decoration_info.double_offset, 0); | 182 decoration_info.double_offset, 0); |
| 183 // No skip: ink for line-through, | 183 // No skip: ink for line-through, |
| 184 // compare https://github.com/w3c/csswg-drafts/issues/711 | 184 // compare https://github.com/w3c/csswg-drafts/issues/711 |
| 185 decoration_painter.Paint(); | 185 decoration_painter.Paint(); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 } | 188 } |
| (...skipping 100 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 |