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

Unified Diff: ui/gfx/render_text.h

Issue 2541313002: RenderTextHarfBuzz: Add support for multi line text selection. (Closed)
Patch Set: --- Created 4 years 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 7e0b48310116e1fa2cf8ac004389c6bae197a084..ecbb26c20da16cda9808b5443bacaea9595b465d 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -209,14 +209,19 @@ void ApplyRenderParams(const FontRenderParams& params,
// for rendering and translation between logical and visual data.
class GFX_EXPORT RenderText {
public:
-// The character used for displaying obscured text.
-// TODO(benrg): GTK uses the first of U+25CF, U+2022, U+2731, U+273A, '*'
-// that's available in the font (find_invisible_char() in gtkentry.c).
-// Use a bullet character on Mac.
#if defined(OS_MACOSX)
+ // The character used for displaying obscured text.
+ // TODO(benrg): GTK uses the first of U+25CF, U+2022, U+2731, U+273A, '*'
msw 2016/12/07 20:20:35 nit: you can remove this TODO
karandeepb 2016/12/12 10:36:18 Done.
+ // that's available in the font (find_invisible_char() in gtkentry.c).
+ // Use a bullet character on Mac.
static constexpr base::char16 kPasswordReplacementChar = 0x2022;
+
+ // On Mac, while selecting text if the cursor is outside the vertical text
+ // bounds, drag to the end of the text.
+ static constexpr bool kDragToEndIfOutsideVerticalBounds = true;
#else
static constexpr base::char16 kPasswordReplacementChar = '*';
+ static constexpr bool kDragToEndIfOutsideVerticalBounds = false;
#endif
virtual ~RenderText();
@@ -412,10 +417,11 @@ class GFX_EXPORT RenderText {
}
base::i18n::TextDirection GetDisplayTextDirection();
- // Returns the visual movement direction corresponding to the logical end
- // of the text, considering only the dominant direction returned by
- // |GetDisplayTextDirection()|, not the direction of a particular run.
+ // Returns the visual movement direction corresponding to the logical
+ // end/beginning of the text, considering only the dominant direction returned
+ // by |GetDisplayTextDirection()|, not the direction of a particular run.
VisualCursorDirection GetVisualDirectionOfLogicalEnd();
+ VisualCursorDirection GetVisualDirectionOfLogicalBeginning();
// Returns the text used to display, which may be obscured, truncated or
// elided. The subclass may compute elided text on the fly, or use
@@ -473,6 +479,7 @@ class GFX_EXPORT RenderText {
// is longer than the textfield. Subsequent text, cursor, or bounds changes
// may invalidate returned values. Note that |caret| must be placed at
// grapheme boundary, i.e. caret.caret_pos() must be a cursorable position.
+ // Note: This function does not support multiline currently.
msw 2016/12/07 20:20:35 nit: rephrase as a TODO; cite a bug if appropriate
karandeepb 2016/12/12 10:36:18 Done.
Rect GetCursorBounds(const SelectionModel& caret, bool insert_mode);
// Compute the current cursor bounds, panning the text to show the cursor in
@@ -595,6 +602,12 @@ class GFX_EXPORT RenderText {
// The returned value represents a cursor/caret position without a selection.
SelectionModel EdgeSelectionModel(VisualCursorDirection direction);
+ // Get the selection model corresponding to visual text ends for the given
msw 2016/12/07 20:20:35 optional nit: "Get the selection model correspondi
karandeepb 2016/12/12 10:36:18 Done.
+ // |line|.
+ // The returned value represents a cursor/caret position without a selection.
+ SelectionModel LineSelectionModel(const internal::Line& line,
+ gfx::VisualCursorDirection direction);
+
// Sets the selection model, the argument is assumed to be valid.
virtual void SetSelectionModel(const SelectionModel& model);
@@ -640,14 +653,10 @@ class GFX_EXPORT RenderText {
void ApplyCompositionAndSelectionStyles();
void UndoCompositionAndSelectionStyles();
- // Convert points from the text space to the view space and back. Handles the
- // display area, display offset, application LTR/RTL mode and multiline.
- Point ToTextPoint(const Point& point);
+ // Convert points from the text space to the view space. Handles the display
+ // area, display offset, application LTR/RTL mode and multiline.
Point ToViewPoint(const Point& point);
- // Convert a text space x-coordinate range to rects in view space.
- std::vector<Rect> TextBoundsToViewBounds(const Range& x);
-
// Get the alignment, resolving ALIGN_TO_HEAD with the current text direction.
HorizontalAlignment GetCurrentHorizontalAlignment();
« 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