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

Unified Diff: ui/gfx/render_text.h

Issue 924543004: adding baseline options for super/sub scripting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved RestoreBreakList to file local function Created 5 years, 10 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.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 5a1825351bdf5c8bc97b7b754e1d3be3f7c2b7ea..273d31104518a0f2936fbb8cbade1319d03c457d 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -109,15 +109,17 @@ class SkiaTextRenderer {
DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer);
};
-// Internal helper class used by derived classes to iterate colors and styles.
+// Internal helper class used to iterate colors, baselines, and styles.
class StyleIterator {
public:
StyleIterator(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.
SkColor color() const { return color_->second; }
+ BaselineStyle baseline() const { return baseline_->second; }
bool style(TextStyle s) const { return style_[s]->second; }
// Get the intersecting range of the current iterator set.
@@ -128,9 +130,11 @@ class StyleIterator {
private:
BreakList<SkColor> colors_;
+ BreakList<BaselineStyle> baselines_;
std::vector<BreakList<bool> > styles_;
BreakList<SkColor>::const_iterator color_;
+ BreakList<BaselineStyle>::const_iterator baseline_;
std::vector<BreakList<bool>::const_iterator> style_;
DISALLOW_COPY_AND_ASSIGN(StyleIterator);
@@ -330,6 +334,11 @@ class GFX_EXPORT RenderText {
void SetColor(SkColor value);
void ApplyColor(SkColor value, const Range& range);
+ // Set the baseline style over the entire text or a logical character range.
+ // The |range| should be valid, non-reversed, and within [0, text().length()].
+ void SetBaselineStyle(BaselineStyle value);
+ void ApplyBaselineStyle(BaselineStyle value, const Range& range);
+
// Set various text styles over the entire text or a logical character range.
// The respective |style| is applied if |value| is true, or removed if false.
// The |range| should be valid, non-reversed, and within [0, text().length()].
@@ -454,6 +463,7 @@ class GFX_EXPORT RenderText {
bool text_elided() const { return text_elided_; }
const BreakList<SkColor>& colors() const { return colors_; }
+ const BreakList<BaselineStyle>& baselines() const { return baselines_; }
const std::vector<BreakList<bool> >& styles() const { return styles_; }
const std::vector<internal::Line>& lines() const { return lines_; }
@@ -690,10 +700,11 @@ class GFX_EXPORT RenderText {
// Composition text range.
Range composition_range_;
- // Color and style breaks, used to color and stylize ranges of text.
+ // Color, baseline, and style breaks, used to modify ranges of text.
// BreakList positions are stored with text indices, not display indices.
// TODO(msw): Expand to support cursor, selection, background, etc. colors.
BreakList<SkColor> colors_;
+ BreakList<BaselineStyle> baselines_;
std::vector<BreakList<bool> > styles_;
// Breaks saved without temporary composition and selection styling.
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698