Incorrect line breaks introduced into Thai text in notifications
Reported by
geo...@onesignal.com,
Oct 7 2016
|
||||||||||
Issue descriptionUserAgent: 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
,
Oct 19 2016
+msw@
,
Oct 19 2016
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)
,
Dec 28 2016
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.
,
Jan 4 2017
+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?
,
Jan 23 2017
assigning to sky for triage
,
Aug 29 2017
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()?
,
Aug 29 2017
Sorry, I'm not a good owner for this code either. Maybe asvitkine@ can help?
,
Aug 29 2017
Sorry, I don't work on this anymore. :( Not sure if msw@ is the right owner, but I can't think of anyone better.
,
Aug 29 2017
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)
,
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 :(
,
Aug 31 2017
Issue 566186 has been merged into this issue.
,
Sep 24
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 |
||||||||||
Comment 1 by peter@chromium.org
, Oct 19 2016Components: -Blink>PushAPI UI>Notifications