Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index 508f50ce21e4d6f33b3fd30cf3f7829d65a78d8e..c6ad07f84f178d143b06b2a760369d69e0c8bc0d 100644 |
| --- a/ui/gfx/render_text.h |
| +++ b/ui/gfx/render_text.h |
| @@ -63,24 +63,12 @@ class GFX_EXPORT SkiaTextRenderer { |
| void SetTextSize(SkScalar size); |
| void SetForegroundColor(SkColor foreground); |
| void SetShader(std::unique_ptr<cc::PaintShader> shader); |
| - // Sets underline metrics to use if the text will be drawn with an underline. |
| - // If not set, default values based on the size of the text will be used. The |
| - // two metrics must be set together. |
| - void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
| void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
| virtual void DrawPosText(const SkPoint* pos, |
| const uint16_t* glyphs, |
| size_t glyph_count); |
| - // Draw underline and strike-through text decorations. |
| - // Based on |SkCanvas::DrawTextDecorations()| and constants from: |
| - // third_party/skia/src/core/SkTextFormatParams.h |
| - virtual void DrawDecorations(int x, |
| - int y, |
| - int width, |
| - bool underline, |
| - bool strike); |
| void DrawUnderline(int x, int y, int width); |
| - void DrawStrike(int x, int y, int width) const; |
| + void DrawStrike(int x, int y, int width, SkScalar thickness_factor); |
| private: |
| friend class test::RenderTextTestApi; |
| @@ -88,8 +76,6 @@ class GFX_EXPORT SkiaTextRenderer { |
| Canvas* canvas_; |
| cc::PaintCanvas* canvas_skia_; |
| cc::PaintFlags flags_; |
| - SkScalar underline_thickness_; |
| - SkScalar underline_position_; |
| DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); |
| }; |
| @@ -500,6 +486,11 @@ class GFX_EXPORT RenderText { |
| // Retrieves the text in the given |range|. |
| base::string16 GetTextFromRange(const Range& range) const; |
| + // Sets the ratio of strike-through line thickness to text height. |
|
msw
2017/07/05 19:55:00
optional nit: comment not needed on simple setter.
cjgrant
2017/07/05 20:44:43
Done. I was concerned about explaining what the ra
|
| + void set_strike_thickness_factor(SkScalar f) { |
| + strike_thickness_factor_ = f; |
|
msw
2017/07/05 19:55:00
nit: fits on line above with semi removed:
void
cjgrant
2017/07/05 20:44:43
Done.
|
| + }; |
|
msw
2017/07/05 19:55:00
nit: no semi after function body
cjgrant
2017/07/05 20:44:43
Done. Oops!
|
| + |
| protected: |
| RenderText(); |
| @@ -513,6 +504,7 @@ class GFX_EXPORT RenderText { |
| const BreakList<BaselineStyle>& baselines() const { return baselines_; } |
| const BreakList<Font::Weight>& weights() const { return weights_; } |
| const std::vector<BreakList<bool> >& styles() const { return styles_; } |
| + SkScalar strike_thickness_factor() const { return strike_thickness_factor_; } |
| const std::vector<internal::Line>& lines() const { return lines_; } |
| void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } |
| @@ -835,6 +827,9 @@ class GFX_EXPORT RenderText { |
| // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| std::vector<internal::Line> lines_; |
| + // The ratio of strike-through line thickness to text height. |
| + SkScalar strike_thickness_factor_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(RenderText); |
| }; |