зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1753105 - Deal with negative letter-spacing in SVGTextFrame. r=jfkthame
Otherwise we can end up with a rect with negative width, bad stuff to follow. Differential Revision: https://phabricator.services.mozilla.com/D137881
This commit is contained in:
Родитель
8185be07ba
Коммит
739ada1351
|
@ -855,6 +855,10 @@ SVGBBox TextRenderedRun::GetRunUserSpaceRect(nsPresContext* aContext,
|
|||
if (aFlags & eNoHorizontalOverflow) {
|
||||
x = 0.0;
|
||||
width = textRun->GetAdvanceWidth(range, &provider);
|
||||
if (width < 0.0) {
|
||||
x = width;
|
||||
width = -width;
|
||||
}
|
||||
} else {
|
||||
x = metrics.mBoundingBox.x;
|
||||
width = metrics.mBoundingBox.width;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg")
|
||||
const text = document.createElementNS("http://www.w3.org/2000/svg", "text")
|
||||
text.setAttribute("letter-spacing", "-37vw")
|
||||
const node = document.createTextNode("\n\n\r7%٠\0ó …§ð†ªã€€&**=🯚ð¯‚ï¸¡ó ”©Û¹â€Ùªv*/ð¯„𖹧åžçº¶*;{0ð–£”9̆뢻\r\n^掶𩹺*|\r\n🩂٫ð‡½ë«»e犮㇆á²ð¡‡‚\u2028ᨲâ¤\rv+🧌8שּׁ\nð¯Žè›¥ó „ˆêº¡\nâ’ð±’٠۹𖯸0ó ¤™/ᾂ𫞾99 a&=ð‰‚۹𯩒゙2ó ¥µ^0ê’‹ð—»ð…»\0X%+0*/镳 ٪ȺXá©¿L2⼤𛪈Âðª¸ð›‰")
|
||||
text.appendChild(node)
|
||||
svg.appendChild(text)
|
||||
document.documentElement.appendChild(svg)
|
||||
const rect = document.documentElement.getBoundingClientRect()
|
||||
node.convertRectFromNode(rect, svg, {})
|
||||
})
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче