text-decoration:underline is not positioned correctly in SVG text

RESOLVED FIXED in mozilla29

Status

()

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: balatskova, Assigned: heycam)

Tracking

Trunk
mozilla29
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first verify])

Attachments

(2 attachments)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

Steps to reproduce:

Firefox version 26.0: Text underline is not rendered correctly in svg text element when text is scaled or when text-rendering="geometricPrecision" is used as an attribute.  See attached example.


Actual results:

The underline is misplaced 
- positioned above the text when text has text-rendering="geometricPrecision"
- moves up when text is scaled (see attached example)


Expected results:

The underline should be positioned under the text.
The two lines of the testcase may be different underlying bugs. (I can reproduce both, in Linux nightly).

Note that the issue with scaling (in the second line of the attached testcase), the problem goes away if I remove the  dominant-baseline="text-before-edge" attribute.
OS: Windows 7 → All
Hardware: x86_64 → All
Thank you. I see that removing the dominant-baseline attribute makes the underline to appear in the correct place for both cases, but the text shifts. Using the dominant-baseline attribute is important for our product. If you experiment with dominant-baseline, you will see that the text underline is misplaced for "mathematical", "central", "middle" values as well as for "text-before-edge".
heycam, this seems up your alley -- do you have cycles to take a look at this?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(cam)
Yeah I'll take a look.
Status: NEW → ASSIGNED
Flags: needinfo?(cam)
QA Contact: cam
Assignee: nobody → cam
QA Contact: cam
Posted patch patchSplinter Review
Just like we added GetFontInflationForTextDecorations in nsTextFrame.cpp to wrap the nsLayoutUtils::GetFontInflationInner calls within the decoration painting code so that it can return the SVGTextFrame's font size scale factor, we need to do the same in nsLineLayout's calls to GetFontInflationInner when it is doing vertical alignment.
Attachment #8358198 - Flags: review?(roc)
Comment on attachment 8358198 [details] [diff] [review]
patch

> 
>+static float
>+GetInflationForVerticalAlignment(nsIFrame* aFrame,
>+                                 nscoord aInflationMinFontSize)
>+{
>+  if (aFrame->IsSVGText()) {
>+    const nsIFrame* container = aFrame;
>+    while (container->GetType() != nsGkAtoms::svgTextFrame) {
>+      container = container->GetParent();
>+    }

Use nsLayoutUtils::GetClosestFrameOfType here?
https://hg.mozilla.org/mozilla-central/rev/4e178ae92531
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Whiteboard: [good first verify]
You need to log in before you can comment on or make changes to this bug.