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

Side by Side Diff: ui/gfx/render_text.h

Issue 177683005: Clip Views textfield drag images to selected text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Support transparency in ChromeOS. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_RENDER_TEXT_H_ 5 #ifndef UI_GFX_RENDER_TEXT_H_
6 #define UI_GFX_RENDER_TEXT_H_ 6 #define UI_GFX_RENDER_TEXT_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // offset from the top of |display_rect_| to the text baseline, in pixels. 342 // offset from the top of |display_rect_| to the text baseline, in pixels.
343 // The baseline is determined from the font list and display rect, and does 343 // The baseline is determined from the font list and display rect, and does
344 // not depend on the text. 344 // not depend on the text.
345 int GetBaseline(); 345 int GetBaseline();
346 346
347 void Draw(Canvas* canvas); 347 void Draw(Canvas* canvas);
348 348
349 // Draws a cursor at |position|. 349 // Draws a cursor at |position|.
350 void DrawCursor(Canvas* canvas, const SelectionModel& position); 350 void DrawCursor(Canvas* canvas, const SelectionModel& position);
351 351
352 // Draw the selected text without a cursor or selection highlight. Subpixel
353 // antialiasing is disabled and foreground color is forced to black.
354 void DrawSelectedTextForDrag(Canvas* canvas);
355
356 // Gets the SelectionModel from a visual point in local coordinates. 352 // Gets the SelectionModel from a visual point in local coordinates.
357 virtual SelectionModel FindCursorPosition(const Point& point) = 0; 353 virtual SelectionModel FindCursorPosition(const Point& point) = 0;
358 354
359 // Return true if cursor can appear in front of the character at |position|, 355 // Return true if cursor can appear in front of the character at |position|,
360 // which means it is a grapheme boundary or the first character in the text. 356 // which means it is a grapheme boundary or the first character in the text.
361 virtual bool IsCursorablePosition(size_t position) = 0; 357 virtual bool IsCursorablePosition(size_t position) = 0;
362 358
363 // Get the visual bounds of a cursor at |caret|. These bounds typically 359 // Get the visual bounds of a cursor at |caret|. These bounds typically
364 // represent a vertical line if |insert_mode| is true. Pass false for 360 // represent a vertical line if |insert_mode| is true. Pass false for
365 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds 361 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 // Lines computed by EnsureLayout. These should be invalidated with 680 // Lines computed by EnsureLayout. These should be invalidated with
685 // ResetLayout and on |display_rect_| changes. 681 // ResetLayout and on |display_rect_| changes.
686 std::vector<internal::Line> lines_; 682 std::vector<internal::Line> lines_;
687 683
688 DISALLOW_COPY_AND_ASSIGN(RenderText); 684 DISALLOW_COPY_AND_ASSIGN(RenderText);
689 }; 685 };
690 686
691 } // namespace gfx 687 } // namespace gfx
692 688
693 #endif // UI_GFX_RENDER_TEXT_H_ 689 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698