Use the computed style to determine inline vs block elements in the TranslationsDocument
Categories
(Firefox :: Translations, enhancement, P3)
Tracking
()
People
(Reporter: gregtatum, Assigned: gregtatum)
References
Details
Attachments
(1 file, 2 obsolete files)
Right now there is a bunch of complicated heuristic-based code to determine if elements are block elements, or inline elements. This is something the browser engine can provide with the computed style. This would mean that we could simplify the code, and provide higher quality translations.
These heuristics are easy to get wrong, since it's ultimately the style, not the tag type, that determines if an element is block or inline. I'm not sure the overall cost for computing the style for each element we walk, but it's something that is worth experimenting with and measuring to see if it's feasible to do.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
I just wrote a really bad version of this to measure the performance, and on elpais.com getComputedStyle
was called 551 times, and it didn't show up in the profile, so it should be fast.
Assignee | ||
Updated•1 years ago
|
Comment 2•1 years ago
|
||
(In reply to Greg Tatum [:gregtatum] from comment #1)
I just wrote a really bad version of this to measure the performance, and on elpais.com
getComputedStyle
was called 551 times, and it didn't show up in the profile, so it should be fast.
Could you attach the patch here if it is not too dirty so somebody else could finish it up?
Comment 3•1 years ago
|
||
Removing from blocking bug 1838721, since it is already blocking bug 1837421, which in turn blocks bug 1838721.
Assignee | ||
Comment 4•1 year ago
|
||
Assignee | ||
Comment 5•1 year ago
|
||
I can't find the patch I wrote, I must have deleted it. It was a pretty small one, something like this.
Assignee | ||
Comment 6•1 year ago
|
||
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 7•1 year ago
|
||
getIsInline took 15ms and nodeNeedsSubdividing took 20ms on a very heavy page with lots of nodes: https://share.firefox.dev/3RDIClz
On the main branch nodeNeedsSubdividing took 13ms took https://share.firefox.dev/48c8sTb
It's a very minimal impact for the benefit it brings.
Assignee | ||
Comment 8•1 year ago
|
||
It had no real impact on my benchmark: https://gregtatum.github.io/taskcluster-tools/benchmark.html
Updated•1 year ago
|
Comment 10•1 year ago
|
||
bugherder |
Assignee | ||
Comment 11•1 year ago
|
||
Release Note Request
[Why is this notable]:
This improved the translations algorithm in a way that closed 12 bugs about broken translations. The results were really noticeably better.
[Suggested wording]:
The translations feature received an improvement to the quality of translated webpages. The results should be much more stable. This fixes issues where the content of a page could disappear when translated, or interactive widgets could break.
[Links (documentation, blog post, etc)]:
The translation feature is documented here: https://support.mozilla.org/en-US/kb/website-translation
Comment 12•1 year ago
|
||
Thanks, added to the Fx122 nightly release notes, please allow 30 minutes for the site to update.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx122 release notes
Updated•1 year ago
|
Comment 14•1 year ago
|
||
(In reply to Greg Tatum [:gregtatum] from comment #11)
This improved the translations algorithm in a way that closed 12 bugs about broken translations. The results were really noticeably better.
13 ;)
Description
•