Bug 1109860 - getBBox incorrect with bidirectional text character. r=heycam

This commit is contained in:
Robert Longson 2015-01-02 16:47:47 +00:00
parent 7736642ce0
commit 8ca2cf34a7
3 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,9 @@
<text id="tspan">
<tspan x="20" y="20">b</tspan>
</text>
<text id="text" x="20" y="60">text</text>
<!-- &#8206; is the same as the HTML &lrm; -->
<text id="lrmText" x="20" y="60">&#8206;text</text>
<g id="v">
<circle cx="100" cy="50" r="5"/>
<path d="M 100,100 L 100,200"/>

Before

Width:  |  Height:  |  Size: 933 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -58,6 +58,7 @@ function run()
compareBBoxHeight("a", "b");
compareBBoxHeight("a", "y");
compareBBox("b", "tspan");
compareBBoxHeight("text", "lrmText");
checkBBox("v", 95, 45, 10, 155, 0.001);
checkBBox("h", 195, 45, 105, 55, 0.001);
checkBBox("e", 95, 95, 10, 10, 0.001);

View File

@ -900,6 +900,9 @@ TextRenderedRun::GetRunUserSpaceRect(nsPresContext* aContext,
uint32_t offset, length;
ConvertOriginalToSkipped(it, mTextFrameContentOffset, mTextFrameContentLength,
offset, length);
if (length == 0) {
return r;
}
// Measure that range.
gfxTextRun::Metrics metrics =
@ -947,6 +950,7 @@ TextRenderedRun::GetRunUserSpaceRect(nsPresContext* aContext,
// Include the stroke if requested.
if ((aFlags & eIncludeStroke) &&
!fill.IsEmpty() &&
nsSVGUtils::GetStrokeWidth(mFrame) > 0) {
r.UnionEdges(nsSVGUtils::PathExtentsToMaxStrokeExtents(fill, mFrame,
gfxMatrix()));