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

Unified Diff: ui/gfx/render_text.h

Issue 2969623004: RenderText: Allow strike-through line thickness to be customized. (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 508f50ce21e4d6f33b3fd30cf3f7829d65a78d8e..9f494095307a09635b264653559c7c47cdd24e80 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -63,10 +63,8 @@ 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);
+ // Sets the ratio of strike-through line thickness to text height.
+ void SetStrikeThicknessFactor(SkScalar factor);
void DrawSelection(const std::vector<Rect>& selection, SkColor color);
virtual void DrawPosText(const SkPoint* pos,
const uint16_t* glyphs,
@@ -90,6 +88,7 @@ class GFX_EXPORT SkiaTextRenderer {
cc::PaintFlags flags_;
SkScalar underline_thickness_;
msw 2017/06/30 20:51:23 Please also remove these two underline_* customiza
cjgrant 2017/07/05 16:16:48 Done.
SkScalar underline_position_;
+ SkScalar strike_thickness_factor_;
DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer);
};
@@ -500,6 +499,9 @@ 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.
+ void SetStrikeThicknessFactor(SkScalar factor);
+
protected:
RenderText();
@@ -835,6 +837,8 @@ class GFX_EXPORT RenderText {
// OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
std::vector<internal::Line> lines_;
+ SkScalar strike_thickness_factor_;
msw 2017/06/30 20:51:23 nit: comment like "The ratio of strike-through lin
cjgrant 2017/07/05 16:16:48 Done. Agreed.
+
DISALLOW_COPY_AND_ASSIGN(RenderText);
};

Powered by Google App Engine
This is Rietveld 408576698