Closed Bug 1109860 Opened 10 years ago Closed 9 years ago

SVG `getBBox` dimensions include hidden characters pertaining to bidirectional text

Categories

(Core :: SVG, defect)

27 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: matt, Assigned: longsonr)

References

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20141210004006

Steps to reproduce:

1. Generate string with left-to-right mark (\u200E, although other characters such as \u202A cause the same problem) prepended.
2. Add aforementioned string to an SVG text node.
3. Call text node's `getBBox` method.


Actual results:

Different `x`, `y`, `height`, and `width` values are returned than the same node without the prepended bidirectional mark(s). A working example can be found at http://jsfiddle.net/mwistrand/aph95n4s/


Expected results:

The `x`, `y`, `height`, and `width` values returned by `getBBox` should be calculated as if the bidirectional mark(s) were not present.
Component: Untriaged → SVG
Product: Firefox → Core
Regression range:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e85b0372cece&tochange=3ad5ecf34c9e

Robert Longson — Bug 919900 - Correct bounding box calculations for empty text elements with svg.text.css-frames.enabled. r=heycam
Blocks: 919900
Keywords: regression
Version: 36 Branch → 27 Branch
Did we really get it right before bug 919900 or did we get both cases identically wrong at that time?
Flags: needinfo?(epinal99-bugzilla2)
Attached patch lrm.txt (obsolete) — Splinter Review
Assignee: nobody → longsonr
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #8535069 - Flags: review?(cam)
FWIW the !r.IsEmpty() is the fix (length == 0 is an optimisation)
(In reply to Robert Longson from comment #2)
> Did we really get it right before bug 919900 or did we get both cases
> identically wrong at that time?

Yes, it was right before bug 919900, same values in both cases (from the reporter's testcase).
Flags: needinfo?(epinal99-bugzilla2)
Before bug 919900 in both cases:
    x: 30
    y: 16.399999618530273
    width: 166.61666870117188
    height: 17.600000381469727
Should we instead be checking !fill.IsEmpty()?  Otherwise, if we have some real text and aFlags == eIncludeStroke, we'll end up returning an empty bbox rather than the bbox that just takes into account the stroke.
Attachment #8535069 - Attachment is obsolete: true
Attachment #8535069 - Flags: review?(cam)
Attachment #8543232 - Flags: review?(cam)
Attachment #8543232 - Flags: review?(cam) → review+
https://hg.mozilla.org/mozilla-central/rev/35141bed8113
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: