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

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

Issue 1018463004: Fix focus rectangle for label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GetFocusBounds Created 5 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
« no previous file with comments | « no previous file | 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 // Gets the horizontal bounds (relative to the left of the text, not the view) 455 // Gets the horizontal bounds (relative to the left of the text, not the view)
456 // of the glyph starting at |index|. If the glyph is RTL then the returned 456 // of the glyph starting at |index|. If the glyph is RTL then the returned
457 // Range will have is_reversed() true. (This does not return a Rect because a 457 // Range will have is_reversed() true. (This does not return a Rect because a
458 // Rect can't have a negative width.) 458 // Rect can't have a negative width.)
459 virtual Range GetGlyphBounds(size_t index) = 0; 459 virtual Range GetGlyphBounds(size_t index) = 0;
460 460
461 const Vector2d& GetUpdatedDisplayOffset(); 461 const Vector2d& GetUpdatedDisplayOffset();
462 void SetDisplayOffset(int horizontal_offset); 462 void SetDisplayOffset(int horizontal_offset);
463 463
464 // Returns the line offset from the origin after applying the text alignment
465 // and the display offset.
466 Vector2d GetLineOffset(size_t line_number);
467
464 protected: 468 protected:
465 RenderText(); 469 RenderText();
466 470
467 // NOTE: The value of these accessors may be stale. Please make sure 471 // NOTE: The value of these accessors may be stale. Please make sure
468 // that these fields are up-to-date before accessing them. 472 // that these fields are up-to-date before accessing them.
469 const base::string16& layout_text() const { return layout_text_; } 473 const base::string16& layout_text() const { return layout_text_; }
470 const base::string16& display_text() const { return display_text_; } 474 const base::string16& display_text() const { return display_text_; }
471 bool text_elided() const { return text_elided_; } 475 bool text_elided() const { return text_elided_; }
472 476
473 const BreakList<SkColor>& colors() const { return colors_; } 477 const BreakList<SkColor>& colors() const { return colors_; }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // Update the display text. 566 // Update the display text.
563 void UpdateDisplayText(float text_width); 567 void UpdateDisplayText(float text_width);
564 568
565 // Returns display text positions that are suitable for breaking lines. 569 // Returns display text positions that are suitable for breaking lines.
566 const BreakList<size_t>& GetLineBreaks(); 570 const BreakList<size_t>& GetLineBreaks();
567 571
568 // Apply (and undo) temporary composition underlines and selection colors. 572 // Apply (and undo) temporary composition underlines and selection colors.
569 void ApplyCompositionAndSelectionStyles(); 573 void ApplyCompositionAndSelectionStyles();
570 void UndoCompositionAndSelectionStyles(); 574 void UndoCompositionAndSelectionStyles();
571 575
572 // Returns the line offset from the origin after applying the text alignment
573 // and the display offset.
574 Vector2d GetLineOffset(size_t line_number);
575
576 // Convert points from the text space to the view space and back. Handles the 576 // Convert points from the text space to the view space and back. Handles the
577 // display area, display offset, application LTR/RTL mode and multiline. 577 // display area, display offset, application LTR/RTL mode and multiline.
578 Point ToTextPoint(const Point& point); 578 Point ToTextPoint(const Point& point);
579 Point ToViewPoint(const Point& point); 579 Point ToViewPoint(const Point& point);
580 580
581 // Convert a text space x-coordinate range to rects in view space. 581 // Convert a text space x-coordinate range to rects in view space.
582 std::vector<Rect> TextBoundsToViewBounds(const Range& x); 582 std::vector<Rect> TextBoundsToViewBounds(const Range& x);
583 583
584 // Get the alignment, resolving ALIGN_TO_HEAD with the current text direction. 584 // Get the alignment, resolving ALIGN_TO_HEAD with the current text direction.
585 HorizontalAlignment GetCurrentHorizontalAlignment(); 585 HorizontalAlignment GetCurrentHorizontalAlignment();
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 // Lines computed by EnsureLayout. These should be invalidated upon 795 // Lines computed by EnsureLayout. These should be invalidated upon
796 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 796 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
797 std::vector<internal::Line> lines_; 797 std::vector<internal::Line> lines_;
798 798
799 DISALLOW_COPY_AND_ASSIGN(RenderText); 799 DISALLOW_COPY_AND_ASSIGN(RenderText);
800 }; 800 };
801 801
802 } // namespace gfx 802 } // namespace gfx
803 803
804 #endif // UI_GFX_RENDER_TEXT_H_ 804 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698