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

Unified Diff: ui/gfx/render_text.cc

Issue 631363002: Truncate RenderText widths before comparing against bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index bf98bc0cde55524f3fba35a8657a9f3bf99e8600..d5d4011d8c08bd7dc86eb9d1f943cba32d79df52 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -1093,7 +1093,8 @@ Vector2d RenderText::GetAlignmentOffset(size_t line_number) {
void RenderText::ApplyFadeEffects(internal::SkiaTextRenderer* renderer) {
const int width = display_rect().width();
- if (multiline() || elide_behavior_ != FADE_TAIL || GetContentWidth() <= width)
+ if (multiline() || elide_behavior_ != FADE_TAIL ||
+ static_cast<int>(GetContentWidth()) <= width)
return;
const int gradient_width = CalculateFadeGradientWidth(font_list(), width);
@@ -1198,8 +1199,10 @@ void RenderText::UpdateLayoutText() {
}
}
- if (elide_behavior_ != NO_ELIDE && elide_behavior_ != FADE_TAIL &&
- !layout_text_.empty() && GetContentWidth() > display_rect_.width()) {
+ if (elide_behavior_ != NO_ELIDE &&
+ elide_behavior_ != FADE_TAIL &&
+ !layout_text_.empty() &&
+ static_cast<int>(GetContentWidth()) > display_rect_.width()) {
// This doesn't trim styles so ellipsis may get rendered as a different
// style than the preceding text. See crbug.com/327850.
layout_text_.assign(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698