If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Value "middle" of SVG attribute dominant-baseline is treated as "central"

RESOLVED FIXED in Firefox 40

Status

()

Core
SVG
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: Oleg Torbasow, Assigned: Robert Longson)

Tracking

36 Branch
mozilla40
x86_64
Windows 7
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

3 years ago
Created attachment 8577236 [details]
middle.svg

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.
(Reporter)

Updated

3 years ago
Whiteboard: SVG
(Assignee)

Updated

3 years ago
Component: Untriaged → SVG
Product: Firefox → Core
Whiteboard: SVG
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.
(Assignee)

Comment 4

3 years ago
Created attachment 8588653 [details] [diff] [review]
baseline.txt

Like this?
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+
(Assignee)

Comment 6

3 years ago
For some reason it just doesn't work quite right. Presumably the units conversion is wrong somehow.
(Assignee)

Comment 7

3 years ago
Created attachment 8589216 [details] [diff] [review]
baseline.txt

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)
(Assignee)

Updated

3 years ago
Attachment #8588653 - Attachment is obsolete: true
Attachment #8589216 - Flags: review?(cam) → review+
(Assignee)

Comment 8

3 years ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e0ea57133f02
Comment hidden (obsolete)
(Assignee)

Comment 10

3 years ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e91b500ca39c
(Assignee)

Comment 11

3 years ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=375abe9704ee
(Assignee)

Comment 12

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/efa8f733c5a4
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/efa8f733c5a4
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox40: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.