summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text.h
diff options
context:
space:
mode:
authorckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 12:50:42 +0000
committerckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 12:50:42 +0000
commit1e12a30519a4c92b00a9b0d4539659755f83dcc3 (patch)
tree38a95a188c011dca592cd0487cc354c5e222b273 /ui/gfx/render_text.h
parent9354a6c2c69ea4ec178d32ee1acafcaa757d6af9 (diff)
downloadchromium_src-1e12a30519a4c92b00a9b0d4539659755f83dcc3.zip
chromium_src-1e12a30519a4c92b00a9b0d4539659755f83dcc3.tar.gz
chromium_src-1e12a30519a4c92b00a9b0d4539659755f83dcc3.tar.bz2
Re-land: NativeTextfieldViews: Show the drop cursor when dragging text
First landed as r193674, reverted due to breaking tests skipped by the try bots. This CL fixes the breakage too. NativeTextfieldViews: Show the drop cursor when dragging text. Enables RenderText users to draw cursors at specified positions through RenderText::DrawCursor. Uses this method to implement the drop cursor in NativeTextfieldViews. BUG=229661 TEST=Use Views Textfield; select text in omnibox; drag it around the omnibox; a cursor should be displayed at where the text will be dropped Review URL: https://chromiumcodereview.appspot.com/14264004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text.h')
-rw-r--r--ui/gfx/render_text.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 018f7d3..a7ea9e6 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -275,6 +275,9 @@ class UI_EXPORT RenderText {
void Draw(Canvas* canvas);
+ // Draws a cursor at |position|.
+ void DrawCursor(Canvas* canvas, const SelectionModel& position);
+
// Draw the selected text without a cursor or selection highlight.
void DrawSelectedText(Canvas* canvas);
@@ -316,6 +319,12 @@ class UI_EXPORT RenderText {
// chosen.
virtual std::vector<FontSpan> GetFontSpansForTesting() = 0;
+ // A convenience function to check whether the glyph attached to the caret
+ // is within the given range.
+ static bool RangeContainsCaret(const ui::Range& range,
+ size_t caret_pos,
+ LogicalCursorDirection caret_affinity);
+
protected:
RenderText();
@@ -419,12 +428,6 @@ class UI_EXPORT RenderText {
// Applies text shadows to |renderer|.
void ApplyTextShadows(internal::SkiaTextRenderer* renderer);
- // A convenience function to check whether the glyph attached to the caret
- // is within the given range.
- static bool RangeContainsCaret(const ui::Range& range,
- size_t caret_pos,
- LogicalCursorDirection caret_affinity);
-
private:
friend class RenderTextTest;
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle);
@@ -449,9 +452,8 @@ class UI_EXPORT RenderText {
// cursor is within the visible display area.
void UpdateCachedBoundsAndOffset();
- // Draw the selection and cursor.
+ // Draw the selection.
void DrawSelection(Canvas* canvas);
- void DrawCursor(Canvas* canvas);
// Logical UTF-16 string data to be drawn.
string16 text_;