Make StringBuilder keep track of whether all units are in the Latin1 range
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Tracking
()
People
(Reporter: hsivonen, Unassigned)
References
(Blocks 1 open bug)
Details
| Assignee | ||
Updated•7 years ago
|
| Reporter | ||
Updated•7 years ago
|
Updated•3 years ago
|
| Reporter | ||
Comment 1•10 months ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #0)
Attribute values and dynamic atoms need to be checked at the time of generating the Units.
We could do better: The least costly way of finding out that the serialization as a whole is not going to be Latin1 is encountering a non-Latin1 text node.
Let's do this:
Let have a boolean seenUnicode right about here: https://searchfox.org/firefox-main/rev/1c2b83c1fdb8ba523831bcdb63947f5f7a4cfa5e/dom/base/nsContentUtils.cpp#10585
Let's pass a pointer to the boolean down so that if we get to https://searchfox.org/firefox-main/rev/1c2b83c1fdb8ba523831bcdb63947f5f7a4cfa5e/dom/base/nsContentUtils.cpp#10283 or if is2b returns true at https://searchfox.org/firefox-main/rev/1c2b83c1fdb8ba523831bcdb63947f5f7a4cfa5e/dom/base/nsContentUtils.cpp#10618 , set the flag to true.
If before ToString the flag is true, do the same thing we do now.
If not, traverse the non-text-node units to see if there's any non-Latin1. If there is, do the same thing we do now.
If we saw no non-Latin1, run a Latin1-targeting specialization of ToString.
| Reporter | ||
Comment 2•10 months ago
|
||
Hmm. For atoms, we could check staticness in the first pass. Then the second pass would only need to examine attribute values.
Description
•