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

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

Issue 16051006: ui/gfx: Use base::string16 now that string16 was moved into base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « ui/gfx/platform_font_win.cc ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // visual layout. Support is built in for a cursor, a selection, simple styling, 117 // visual layout. Support is built in for a cursor, a selection, simple styling,
118 // complex scripts, and bi-directional text. Implementations provide mechanisms 118 // complex scripts, and bi-directional text. Implementations provide mechanisms
119 // for rendering and translation between logical and visual data. 119 // for rendering and translation between logical and visual data.
120 class UI_EXPORT RenderText { 120 class UI_EXPORT RenderText {
121 public: 121 public:
122 virtual ~RenderText(); 122 virtual ~RenderText();
123 123
124 // Creates a platform-specific RenderText instance. 124 // Creates a platform-specific RenderText instance.
125 static RenderText* CreateInstance(); 125 static RenderText* CreateInstance();
126 126
127 const string16& text() const { return text_; } 127 const base::string16& text() const { return text_; }
128 void SetText(const string16& text); 128 void SetText(const base::string16& text);
129 129
130 HorizontalAlignment horizontal_alignment() const { 130 HorizontalAlignment horizontal_alignment() const {
131 return horizontal_alignment_; 131 return horizontal_alignment_;
132 } 132 }
133 void SetHorizontalAlignment(HorizontalAlignment alignment); 133 void SetHorizontalAlignment(HorizontalAlignment alignment);
134 134
135 VerticalAlignment vertical_alignment() const { 135 VerticalAlignment vertical_alignment() const {
136 return vertical_alignment_; 136 return vertical_alignment_;
137 } 137 }
138 void SetVerticalAlignment(VerticalAlignment alignment); 138 void SetVerticalAlignment(VerticalAlignment alignment);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // Reset the layout to be invalid. 402 // Reset the layout to be invalid.
403 virtual void ResetLayout() = 0; 403 virtual void ResetLayout() = 0;
404 404
405 // Ensure the text is laid out. 405 // Ensure the text is laid out.
406 virtual void EnsureLayout() = 0; 406 virtual void EnsureLayout() = 0;
407 407
408 // Draw the text. 408 // Draw the text.
409 virtual void DrawVisualText(Canvas* canvas) = 0; 409 virtual void DrawVisualText(Canvas* canvas) = 0;
410 410
411 // Returns the text used for layout, which may be |obscured_text_|. 411 // Returns the text used for layout, which may be |obscured_text_|.
412 const string16& GetLayoutText() const; 412 const base::string16& GetLayoutText() const;
413 413
414 // Apply (and undo) temporary composition underlines and selection colors. 414 // Apply (and undo) temporary composition underlines and selection colors.
415 void ApplyCompositionAndSelectionStyles(); 415 void ApplyCompositionAndSelectionStyles();
416 void UndoCompositionAndSelectionStyles(); 416 void UndoCompositionAndSelectionStyles();
417 417
418 // Returns the text offset from the origin after applying text alignment and 418 // Returns the text offset from the origin after applying text alignment and
419 // display offset. 419 // display offset.
420 Vector2d GetTextOffset(); 420 Vector2d GetTextOffset();
421 421
422 // Convert points from the text space to the view space and back. 422 // Convert points from the text space to the view space and back.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 void UpdateObscuredText(); 463 void UpdateObscuredText();
464 464
465 // Update the cached bounds and display offset to ensure that the current 465 // Update the cached bounds and display offset to ensure that the current
466 // cursor is within the visible display area. 466 // cursor is within the visible display area.
467 void UpdateCachedBoundsAndOffset(); 467 void UpdateCachedBoundsAndOffset();
468 468
469 // Draw the selection. 469 // Draw the selection.
470 void DrawSelection(Canvas* canvas); 470 void DrawSelection(Canvas* canvas);
471 471
472 // Logical UTF-16 string data to be drawn. 472 // Logical UTF-16 string data to be drawn.
473 string16 text_; 473 base::string16 text_;
474 474
475 // Horizontal alignment of the text with respect to |display_rect_|. The 475 // Horizontal alignment of the text with respect to |display_rect_|. The
476 // default is to align left if the application UI is LTR and right if RTL. 476 // default is to align left if the application UI is LTR and right if RTL.
477 HorizontalAlignment horizontal_alignment_; 477 HorizontalAlignment horizontal_alignment_;
478 478
479 // Vertical alignment of the text with respect to |display_rect_|. The 479 // Vertical alignment of the text with respect to |display_rect_|. The
480 // default is to align vertically centered. 480 // default is to align vertically centered.
481 VerticalAlignment vertical_alignment_; 481 VerticalAlignment vertical_alignment_;
482 482
483 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. 483 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 std::vector<BreakList<bool> > styles_; 529 std::vector<BreakList<bool> > styles_;
530 530
531 // Breaks saved without temporary composition and selection styling. 531 // Breaks saved without temporary composition and selection styling.
532 BreakList<SkColor> saved_colors_; 532 BreakList<SkColor> saved_colors_;
533 BreakList<bool> saved_underlines_; 533 BreakList<bool> saved_underlines_;
534 bool composition_and_selection_styles_applied_; 534 bool composition_and_selection_styles_applied_;
535 535
536 // A flag and the text to display for obscured (password) fields. 536 // A flag and the text to display for obscured (password) fields.
537 // Asterisks are used instead of the actual text glyphs when true. 537 // Asterisks are used instead of the actual text glyphs when true.
538 bool obscured_; 538 bool obscured_;
539 string16 obscured_text_; 539 base::string16 obscured_text_;
540 540
541 // The index at which the char should be revealed in the obscured text. 541 // The index at which the char should be revealed in the obscured text.
542 int obscured_reveal_index_; 542 int obscured_reveal_index_;
543 543
544 // Fade text head and/or tail, if text doesn't fit into |display_rect_|. 544 // Fade text head and/or tail, if text doesn't fit into |display_rect_|.
545 bool fade_head_; 545 bool fade_head_;
546 bool fade_tail_; 546 bool fade_tail_;
547 547
548 // Is the background transparent (either partially or fully)? 548 // Is the background transparent (either partially or fully)?
549 bool background_is_transparent_; 549 bool background_is_transparent_;
(...skipping 17 matching lines...) Expand all
567 567
568 // Text shadows to be drawn. 568 // Text shadows to be drawn.
569 ShadowValues text_shadows_; 569 ShadowValues text_shadows_;
570 570
571 DISALLOW_COPY_AND_ASSIGN(RenderText); 571 DISALLOW_COPY_AND_ASSIGN(RenderText);
572 }; 572 };
573 573
574 } // namespace gfx 574 } // namespace gfx
575 575
576 #endif // UI_GFX_RENDER_TEXT_H_ 576 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_win.cc ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698