New issue
Advanced search Search tips

Issue 654077 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: Sep 24
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Incorrect line breaks introduced into Thai text in notifications

Reported by geo...@onesignal.com, Oct 7 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36

Steps to reproduce the problem:
1. On Windows, grant Notification permission (either local notifications or or Push API) to a website. You can use this website for instance: https://gauntface.github.io/simple-push-demo/
2. After granting permission, open the console and run "new Notification("บลจ.แอสเซทพลัส นอขายครั้งแรก(ครั้งเดียว) กองทุนตราสารหนี้เพื่อผู้ลงทุนที่มิใช่รายย่อย")"
3. Observe that the notification shows up with line breaks inserted randomly in the text

This only occurs on Windows. macOS is not affected by this problem.

What is the expected behavior?
The text should not contain line breaks.

What went wrong?
Line breaks are incorrectly introduced into the displayed notification. 

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 53.0.2785.143  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 23.0 r0
 
notification-linebreak-bug.png
10.7 KB View Download

Comment 1 by peter@chromium.org, Oct 19 2016

Cc: js...@chromium.org sadrul@chromium.org
Components: -Blink>PushAPI UI>Notifications
+sadrul, jshin, any idea?

The message of a notification is displayed using a message_center::BoundedLabel that uses a BreakIterator w/ BREAK_LINE. What in this text is causing it to break more often, and is it wrong?

Comment 2 by sadrul@chromium.org, Oct 19 2016

Owner: msw@chromium.org
Status: Assigned (was: Unconfirmed)
+msw@

Comment 3 by msw@chromium.org, Oct 19 2016

Cc: msw@chromium.org
Owner: steve...@chromium.org
msw -> stevenjb for message_center OWNERS triage; this may be a defect in ui/message_center/views/bounded_label.h
(added by dharcourt, reviewed by mukai, neither are currently active on Chrome, and I'm not active in this area)
Cc: jamescook@chromium.org sky@chromium.org
Owner: ----
Status: Untriaged (was: Assigned)
I don't know much about the message center behavior on Windows. Also, I haven't worked on message center code for a while. We should probably find an owner for non-cros message center behavior.

+jamescook@, +sky@ for triage.

+yoshiki

This also affects Chrome OS, so it's probably all views platforms.

Do we have a triage process for message center? Does this component have an owner?

Comment 6 by owe...@chromium.org, Jan 23 2017

Owner: sky@chromium.org
assigning to sky for triage

Comment 7 by peter@chromium.org, Aug 29 2017

Status: Assigned (was: Untriaged)
sky@ - friendly ping

The message center is part of the UI>Notifications label, which is triaged by our team in London.

BoundLabel decides the title's lines by calling gfx::ElideRectangleText() with an |available_pixel_height| of 51. This returns the following two lines:

[
    บลจ.แอสเซทพลัส นอขายครั้ง
    แรก(ครั้งเดียว) กองทุนตราส…
]

The height is then decided through gfx::Canvas::SizeStringInt(), given these two lines joined by a literal newline ("\n") and the following flags:

    - gfx::Canvas::MULTI_LINE
    - gfx::Canvas::CHARACTER_BREAK
    - gfx::Canvas::TEXT_ALIGN_TO_HEAD

Which returns 100. (Accounting for the additional newlines.) The text is then rendered through gfx::Canvas::DrawStringRectWithFlags().

It seems like the gfx::Canvas::* methods are accounting for additional in-text linebreaks, whereas gfx::ElideRectangleText() is not. Is there a function that we should be using instead of gfx::ElideRectangleText()?

Comment 8 by sky@chromium.org, Aug 29 2017

Owner: asvitk...@chromium.org
Sorry, I'm not a good owner for this code either. Maybe asvitkine@ can help?
Cc: tapted@chromium.org asvitk...@chromium.org
Owner: msw@chromium.org
Sorry, I don't work on this anymore. :(

Not sure if msw@ is the right owner, but I can't think of anyone better.

Comment 10 by msw@chromium.org, Aug 29 2017

Cc: peter@chromium.org
Components: Internals>Views
Owner: peter@chromium.org
And around in circles we go!

My best suggestion is to avoid BoundedLabel altogether and remove that code. views::Label has a number of features that should hopefully support message center's use case (and likely do so more efficiently), including SetMaxWidth, SizeToFit, SetMaxLines (brand new with support for tail-eliding for multi-line labels), etc. I'll review any work to extend views::Label support as needed, but this one-off BoundedLabel class probably shouldn't exist.

peter@, since you conducted some investigation, maybe you'd be available for this task?
(I'm not actively working in this area, and probably couldn't address this anytime soon)

Comment 11 by peter@chromium.org, Aug 30 2017

Thanks for the additional info! I'm fine having this on my plate, but it's going to be part of the not-anytime-soon bucket too I'm afraid :(

Comment 12 by peter@chromium.org, Aug 31 2017

 Issue 566186  has been merged into this issue.
Status: Archived (was: Assigned)
Archiving old bugs that have only received trivial updates for some time.

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