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

Unified Diff: ui/gfx/render_text.h

Issue 1020853018: DNCI [RenderText] Added font size options in RenderText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some debug code Created 5 years, 9 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
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index c21a15fe722f6fa87c96295e3121a479ea74e191..bd8d9a977cbd9a3aadf6ba2c4d18a653614c3033 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -112,12 +112,14 @@ class GFX_EXPORT SkiaTextRenderer {
// Internal helper class used to iterate colors, baselines, and styles.
msw 2015/03/30 21:14:35 nit: "used to iterate ranged style values."
class StyleIterator {
public:
- StyleIterator(const BreakList<SkColor>& colors,
+ StyleIterator(const BreakList<uint32_t>& font_sizes,
+ const BreakList<SkColor>& colors,
const BreakList<BaselineStyle>& baselines,
const std::vector<BreakList<bool>>& styles);
~StyleIterator();
// Get the colors and styles at the current iterator position.
msw 2015/03/30 21:14:35 nit: "Get the ranged style values at the"
+ uint32_t font_size() const { return font_size_->second; }
SkColor color() const { return color_->second; }
BaselineStyle baseline() const { return baseline_->second; }
bool style(TextStyle s) const { return style_[s]->second; }
@@ -129,10 +131,12 @@ class StyleIterator {
void UpdatePosition(size_t position);
private:
+ BreakList<uint32_t> font_sizes_;
BreakList<SkColor> colors_;
BreakList<BaselineStyle> baselines_;
std::vector<BreakList<bool> > styles_;
+ BreakList<uint32_t>::const_iterator font_size_;
BreakList<SkColor>::const_iterator color_;
BreakList<BaselineStyle>::const_iterator baseline_;
std::vector<BreakList<bool>::const_iterator> style_;
@@ -341,6 +345,12 @@ class GFX_EXPORT RenderText {
const Range& GetCompositionRange() const;
void SetCompositionRange(const Range& composition_range);
+ // Set the font size over the entire text or a logical character range.
+ // The |range| should be valid, non-reversed, and within [0, text().length()].
+ // A |value| of zero will expand to the default font size.
msw 2015/03/30 21:14:35 I believe that font size literal values (15pt, 17p
+ void SetFontSize(uint32_t value);
+ void ApplyFontSize(uint32_t value, const Range& range);
+
// Set the text color over the entire text or a logical character range.
// The |range| should be valid, non-reversed, and within [0, text().length()].
void SetColor(SkColor value);
@@ -478,6 +488,7 @@ class GFX_EXPORT RenderText {
const base::string16& display_text() const { return display_text_; }
bool text_elided() const { return text_elided_; }
+ const BreakList<uint32_t>& font_sizes() const { return font_sizes_; }
const BreakList<SkColor>& colors() const { return colors_; }
const BreakList<BaselineStyle>& baselines() const { return baselines_; }
const std::vector<BreakList<bool> >& styles() const { return styles_; }
@@ -626,6 +637,7 @@ class GFX_EXPORT RenderText {
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, RevealObscuredText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ElidedText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ElidedObscuredText);
+ FRIEND_TEST_ALL_PREFIXES(RenderTextTest, FontSize);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedObscuredText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions);
@@ -729,6 +741,7 @@ class GFX_EXPORT RenderText {
// Color, baseline, and style breaks, used to modify ranges of text.
msw 2015/03/30 21:14:35 "Text styling breaks"
// BreakList positions are stored with text indices, not display indices.
+ BreakList<uint32_t> font_sizes_;
msw 2015/03/30 21:14:35 nit: sizes_ or size_deltas_ might be cleaner.
// TODO(msw): Expand to support cursor, selection, background, etc. colors.
BreakList<SkColor> colors_;
BreakList<BaselineStyle> baselines_;
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698