Closed Bug 1570363 Opened 6 years ago Closed 6 years ago

transform-origin incorrectly calculated for fill boxes that have zero width or height

Categories

(Core :: Layout, defect, P2)

68 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- wontfix
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- wontfix
firefox71 --- wontfix
firefox72 --- wontfix
firefox73 --- wontfix
firefox74 --- fixed

People

(Reporter: paul.lebeau, Assigned: mikokm)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [layout:backlog:quality])

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

If an element's bounding box has zero width or height, then the transform origin is incorrect for transform-box: fill-box.

Try this test case: https://jsfiddle.net/17ym4zev/

<svg width="500" height="500">
<g class="small">
<path d="M 0,250 L 500,250" style="stroke: red"/>
</g>
<g class="small">
<path d="M 0,250 L 500,250.1" style="stroke: green"/>
</g>

<g class="small">
<path d="M 250,0 L 250,500" style="stroke: red"/>
</g>
<g class="small">
<path d="M 250,0 L 250.1,500" style="stroke: green"/>
</g>
</svg>

path {
stroke: black;
stroke-width: 8;
}

.small {
transform: scale(0.25, 0.25);
transform-origin: 50% 50%;
transform-box: fill-box;
}

Actual results:

The red lines show the incorrect behaviour. The green lines have been given a tiny width (or height) of 0.1 to show where they out to be.

It's as if the origin is being calculated as (width/2) instead of (x + width/2).

Expected results:

The red lines should be centred in the SVG. They should be where the green lines are.

Tested as working correctly on Chrome and Safari.

Added screenshot.

Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a675c5d7eb76887a3e4b24548d621c9cc05a1545&tochange=22caf5b03354b71c909e67ec6bc71133494d3137

Suspect: e7732e4cb0c9abe6823f4f02313b0557ed33feab Matt Woodrow — Bug 1456111 - Make sure an empty pixel rectangle gets converted to an empty app unit rectangle, regardless of scale factor. r=tnikkel

Matt, Your patch seems to cause the problem. Can you please look into this?

Status: UNCONFIRMED → NEW
Component: Untriaged → Layout
Ever confirmed: true
Flags: needinfo?(matt.woodrow)
Keywords: regression
Product: Firefox → Core
Regressed by: 1456111

Hey Sean, Can we get a priority on this one? (regression triage)

Flags: needinfo?(svoisen)

Looks like we run into this since aRect.IsEmpty() will be true for 0 width OR height ... I'll mark as P2, but unsure how common the use case is to have 0 width or height bounding box with a transform. I suppose we mostly see this for SVG.

Matt, thoughts here?

Flags: needinfo?(svoisen)
Priority: -- → P2

It's a significant problem for SVG, because vertical or horizontal lines are common. And they have zero-width or height bounding boxes. Even if the stroke width is large.

Is it possible to get a reason why this is a "won't fix" please? The current behaviour is counterintuitive and deviates from the behaviour of other browsers.

It's wontfix for Firefox 69 only which is going to ship on Tuesday, there is no reasonable path to fixing this on a release coming out in 6 days. It's just a way for release drivers to track bugs.

Thanks. Sorry I didn't realise how the flags worked. I do now.

Following up in email with Sean and Matt since this missed the 70 train as well.
We could still take a patch for 71/72.

Marking as fix-optional for 71 in case a patch materializes before RC week.

Whiteboard: [layout:triage-discuss]

Likely too late for 72 at this point but we could still get a fix in for 73.

Following up in email, this clearly slipped into the backlog.

Yes, this slipped. Getting it into our quality backlog.

Hey Jessie — Might we be able to get help from your team on this? (I think MattW is swamped at the moment.) The regressing patch is related to a web painting optimization where an empty gfx rect gets converted to an empty app rect, but looks like we can't always do that.

Flags: needinfo?(jbonisteel)
Whiteboard: [layout:triage-discuss] → [layout:backlog:quality]

Miko - would you be able to take a look?

Flags: needinfo?(jbonisteel) → needinfo?(mikokm)
Attached file 1570363.html

Simplified testcase, with an additional path that Chrome and Safari render differently.

Flags: needinfo?(mikokm)
Assignee: nobody → mikokm
Status: NEW → ASSIGNED
Pushed by mikokm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/6fcfdbf5137c Do not discard width and height for empty SVG reference rects r=mattwoodrow
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: