Open Bug 1529471 Opened 3 years ago Updated 2 years ago

objectBoundingBox, clip-path behave differently in Chrome and Firefox

Categories

(Core :: SVG, defect, P3)

67 Branch
Unspecified
Linux
defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox67 --- affected

People

(Reporter: karlcow, Unassigned)

References

()

Details

(Whiteboard: [webcompat])

Attachments

(3 files)

Attached file power-svg.html

This was discovered when working on https://webcompat.com/issues/25246

In Chrome, the yellow box covers the full viewport
In Firefox, the yellow box seems to be cut out at 256px by 163.40425531914894px.

Here a simple test case. Also uploaded as an attachment.
https://codepen.io/webcompat/pen/omORVZ

        <svg
          xmlns="http://www.w3.org/2000/svg"
          viewBox="0 0 256 163.40425531914894 "
          clip-path="url(#clip)"
          data-depth="0.02"
          class="first-svg layer"
        >
          <defs>
            <clipPath id="clip" clipPathUnits="objectBoundingBox">
              <rect x="0" y="0" width="10" height="10"></rect>
            </clipPath>
          </defs>
          <rect
            x="0"
            y="0"
            width="256"
            height="163.40425531914894"
            fill="gold"
            class="bg"
          ></rect>
        </svg>

PS: probably needs a better summary.

Flags: webcompat?

Thanks to Brian for investigating with me.

So for this case where we have an objectBoundingBox specifying dimensions greater that 1, it seems like we end up creating a clipping region based on the maximum bounds we determine for the SVG graphic.

If the graphic has a viewBox we use that (as per this test case). Otherwise, if we drop the viewBox in this test case we'll take the bounds of the actual content.

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

Webcompat Priority: ? → P3
You need to log in before you can comment on or make changes to this bug.