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

Unified Diff: ui/gfx/render_text.h

Issue 8536047: Separate selection highlight from pango layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: address comments Created 9 years, 1 month 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_linux.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.h
===================================================================
--- ui/gfx/render_text.h (revision 112051)
+++ ui/gfx/render_text.h (working copy)
@@ -21,9 +21,6 @@
namespace gfx {
-// Strike line width.
-const int kStrikeWidth = 2;
-
// Color settings for text, backgrounds and cursor.
// These are tentative, and should be derived from theme, system
// settings and current settings.
@@ -172,7 +169,7 @@
// may be outside the visible region if the text is longer than the textfield.
// Subsequent text, cursor, or bounds changes may invalidate returned values.
virtual Rect GetCursorBounds(const SelectionModel& selection,
- bool insert_mode);
+ bool insert_mode) = 0;
// Compute the current cursor bounds, panning the text to show the cursor in
// the display rect if necessary. These bounds are in local coordinates.
@@ -209,25 +206,36 @@
virtual SelectionModel LeftEndSelectionModel();
virtual SelectionModel RightEndSelectionModel();
- // Get the logical index of the grapheme preceeding the argument |position|.
- virtual size_t GetIndexOfPreviousGrapheme(size_t position);
+ // Sets the selection model, the argument is assumed to be valid.
+ virtual void SetSelectionModel(const SelectionModel& model);
// Get the visual bounds containing the logical substring within |from| to
- // |to|. These bounds could be visually discontinuous if the substring is
- // split by a LTR/RTL level change. These bounds are in local coordinates, but
- // may be outside the visible region if the text is longer than the textfield.
- // Subsequent text, cursor, or bounds changes may invalidate returned values.
- // TODO(msw) Re-evaluate this function's necessity and signature.
- virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to);
+ // |to| into |bounds|. These bounds could be visually discontinuous if the
+ // substring is split by a LTR/RTL level change. These bounds are in local
+ // coordinates, but may be outside the visible region if the text is longer
+ // than the textfield. Subsequent text, cursor, or bounds changes may
+ // invalidate returned values.
+ virtual void GetSubstringBounds(size_t from,
+ size_t to,
+ std::vector<Rect>* bounds) = 0;
// Return true if cursor can appear in front of the character at |position|,
// which means it is a grapheme boundary or the first character in the text.
virtual bool IsCursorablePosition(size_t position) = 0;
- // Updates the layout so that the next draw request can correctly
+ // Update the layout so that the next draw request can correctly
// render the text and its attributes.
virtual void UpdateLayout() = 0;
+ // Ensure the text is laid out.
+ virtual void EnsureLayout() = 0;
+
+ // Draw the text.
+ virtual void DrawVisualText(Canvas* canvas) = 0;
+
+ // Get the logical index of the grapheme preceding the argument |position|.
+ size_t GetIndexOfPreviousGrapheme(size_t position);
+
// Apply composition style (underline) to composition range and selection
// style (foreground) to selection range.
void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const;
@@ -249,9 +257,6 @@
// The return value is bounded by 0 and the text length, inclusive.
virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) = 0;
- // Sets the selection model, the argument is assumed to be valid.
- void SetSelectionModel(const SelectionModel& selection_model);
-
// Set the cursor to |position|, with the caret trailing the previous
// grapheme, or if there is no previous grapheme, leading the cursor position.
// If |select| is false, the selection start is moved to the same position.
@@ -263,6 +268,10 @@
// cursor is within the visible display area.
void UpdateCachedBoundsAndOffset();
+ // Draw the selection and cursor.
+ void DrawSelection(Canvas* canvas);
+ void DrawCursor(Canvas* canvas);
+
// Logical UTF-16 string data to be drawn.
string16 text_;
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698