Closed Bug 1060020 Opened 11 years ago Closed 11 years ago

font_size_utils.js: whitespace before/after header.textContent reduces size of text

Categories

(Firefox OS Graveyard :: Gaia, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jrburke, Assigned: jrburke)

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
vingtetun
: review+
Details | Review
In current gaia master, email shows an unread count in the header. This is accomplished by using a flexbox layout. When font_size_utils autoResizeElement asks for element.textContent, there is whitespace on either side of the content. This whitespace is apparently factored in to the size of the font that is available. This results in a 21px size of text used, where 23px, the largest size can easily be used. By trimming the textContent, the larger size is chosen. I believe this should be the standard behavior since this whitespace is collapsed anyway for HTML purposes. I tried this change, and it seemed enough for email: diff --git a/shared/js/font_size_utils.js b/shared/js/font_size_utils.js index 52a72f1..7958712 100644 --- a/shared/js/font_size_utils.js +++ b/shared/js/font_size_utils.js @@ -289,7 +289,7 @@ getComputedStyle(element).fontFamily; var info = this.getMaxFontSizeInfo( - element.textContent, + element.textContent.trim(), allowedSizes, fontFamily, contentWidth I will work up a pull request, but want to file this bug to start tracking the issue, and to also gather feedback in case this is not the desired way to fix this.
Attached file GitHub pull request
Trims the content before determining the best size, includes test. Chose :vingtetun for review since he seemed to be reviewer on some of the other changes to this file, but happy to point the review elsewhere if that is more appropriate.
Assignee: nobody → jrburke
Status: NEW → ASSIGNED
Attachment #8480941 - Flags: review?(21)
Comment on attachment 8480941 [details] [review] GitHub pull request Makes sense to me.
Attachment #8480941 - Flags: review?(21) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: