New issue
Advanced search Search tips

Issue 625950 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Sep 13
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug

Blocking:
issue 625977



Sign in to add a comment

Text elided with gfx::ElideText doesn't fit available_pixel_width

Project Member Reported by tmonius...@opera.com, Jul 6 2016

Issue description

Text returned from gfx::ElideText may be wider than requested |available_pixel_width|.

This simple test fails.

TEST(TextEliderTest, ElideTextFitAvailableWidth) {
  const base::string16 kTestText = ASCIIToUTF16("Test");
  const FontList font_list;
  const float kTestWidth = GetStringWidthF(kTestText, font_list) - 0.001f;
  base::string16 elided_text =
      ElideText(kTestText, font_list, kTestWidth, ELIDE_TAIL);
  EXPECT_LE(GetStringWidthF(elided_text, font_list), kTestWidth);
}
 
Labels: -OS-All OS-Chrome OS-Linux OS-Mac OS-Windows
The root cause is that gfx::ElideText() does std::ceil(available_pixel_width) internally which increases the display rect passed to RenderText. As a quick test, I tried to replace Rect with RectF for RenderTest::display_rect_ (and remove std::ceil() call from ElideText() ofc.). It solves the issue but there are many dependencies that expect Rect. In particular Canvas operates on Rect. I'm not sure if it's the right solution.
Blocking: 625977
Cc: -msw@chromium.org
Owner: msw@chromium.org
Status: Assigned (was: Untriaged)
msw@, can you take a look? You are an OWNER of //gfx.

Comment 4 by msw@chromium.org, Sep 14 2016

Cc: msw@chromium.org
Owner: ----
Status: Available (was: Assigned)
Sorry, I'm not actively working in this area.

Comment 5 by asanka@chromium.org, Jan 10 2017

 Issue 625977  has been merged into this issue.
Components: UI>GFX
Status: Archived (was: Available)
Archiving old bugs that haven't been actively assigned in over 180 days.

If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!
Archiving old bugs that haven't been actively assigned in over 180 days.

If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!
Archiving old bugs that haven't been actively assigned in over 180 days.

If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!
Archiving old bugs that haven't been actively assigned in over 180 days.

If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!

Sign in to add a comment