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)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jrburke, Assigned: jrburke)
Details
Attachments
(1 file)
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.
| Assignee | ||
Comment 1•11 years ago
|
||
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.
Comment 2•11 years ago
|
||
Comment on attachment 8480941 [details] [review]
GitHub pull request
Makes sense to me.
Attachment #8480941 -
Flags: review?(21) → review+
| Assignee | ||
Comment 3•11 years ago
|
||
Merged in master:
https://github.com/mozilla-b2g/gaia/commit/3b126b449c86a861aada54925df0837ec8552008
from pull request:
https://github.com/mozilla-b2g/gaia/pull/23442
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.
Description
•