Closed Bug 1142982 Opened 7 years ago Closed 7 years ago
Value "middle" of SVG attribute dominant-baseline is treated as "central"
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20150305021524 Steps to reproduce: Set SVG attribute dominant-baseline to "middle". Actual results: Text position as dominant-baseline has value "central", the distance between middle baseline and alphabetic baseline equals to 0.5em. Expected results: Value middle "identifies a baseline that is offset from the alphabetic baseline in the shift-direction by 1/2 the value of the x-height font characteristic". So the distance between middle baseline and alphabetic baseline must be equal to 0.5ex. Google Chrome 38 does so, but not the Firefox.
Component: Untriaged → SVG
Product: Firefox → Core
We should be able to handle mapping middle internally to a vertical-align:0.5ex value. ConvertSVGDominantBaselineToVerticalAlign in nsFrame.cpp will need to return an nsStyleCoord rather than a uint8_t.
Actually, we already map dominant-baseline:middle to vertical-align:middle, which does shift things by 0.5ex (see where NS_STYLE_VERTICAL_ALIGN_MIDDLE is mentioned in nsLineLayout::VerticalAlignFrames) -- I wonder why isn't that enough?
Oh, I think it is GetBaselinePosition in SVGTextFrame.cpp that needs updating.
Attachment #8588653 - Flags: review?(cam)
Comment on attachment 8588653 [details] [diff] [review] baseline.txt Review of attachment 8588653 [details] [diff] [review]: ----------------------------------------------------------------- Looks good! Please add a test too, something along the lines of comparing <text dominant-baseline="middle">abc</text> to <text dy="0.5ex">abc</text>.
Attachment #8588653 - Flags: review?(cam) → review+
For some reason it just doesn't work quite right. Presumably the units conversion is wrong somehow.
worth another review since I clearly didn't get the units right last time.
Assignee: nobody → longsonr
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #8589216 - Flags: review?(cam)
Attachment #8588653 - Attachment is obsolete: true
Attachment #8589216 - Flags: review?(cam) → review+
You need to log in before you can comment on or make changes to this bug.