3993 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
4414d74633 Bug 1779598 - Stop passing around Maybe<SVGImageContext>. r=aosmond
All its members are optional, so we can just use it as a plain struct
rather than Maybe<> all around, which simplifies the code and prevents
silly bugs like bug 1779592.

Mostly automatic via:

  rg -l 'SVGImageContext' . | xargs sed -i 's/Maybe<SVGImageContext>/SVGImageContext/g'

With trivial build fixes.

Not intended to change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151846
2022-07-14 16:03:25 +00:00
Robert Longson
6d40e0c47b Bug 1531888 - ignore invalid clip-path references when hit testing r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D151811
2022-07-14 15:39:27 +00:00
Emilio Cobos Álvarez
64e4056cb8 Bug 1779457 - Make prefers-color-scheme of SVG images match embedder on content too. r=aosmond
As per discussion in https://github.com/w3c/csswg-drafts/issues/7213.

Differential Revision: https://phabricator.services.mozilla.com/D151751
2022-07-14 10:04:38 +00:00
Emilio Cobos Álvarez
bc6e066129 Bug 1778718 - Make filters on the root work when using fallback drawing. r=tnikkel
This code-path will be hit with the next patch.

Depends on D151473

Differential Revision: https://phabricator.services.mozilla.com/D151474
2022-07-12 09:46:01 +00:00
Robert Longson
18bbb02fab Bug 1778298 - gradient href should ignore base tag if local r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D151130
2022-07-06 17:12:23 +00:00
Robert Longson
4bcc81eaf7 Bug 1777671 - Account for glyph orientations when returning rotation of character r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D150858
2022-07-06 06:01:22 +00:00
Daniel Holbert
fc3b960a74 Bug 1774879 part 4: Use const ComputedStyle* arg in nsCSSRendering::PaintStyleImageLayerWithSC, and update several callsites now that they can pass const variables. r=emilio
This patch doesn't change behavior; it's just a const-correctness fix.

Thanks to previous patches in this series, PaintStyleImageLayerWithSC's arg can
become const, so let's make that change and opportunistically make the same
change to the variables that callers pass in, where possible.

Differential Revision: https://phabricator.services.mozilla.com/D149677
2022-06-18 00:45:20 +00:00
Razvan Cojocaru
f0ceea18e4 Bug 1767127 - Change the types of FilterInstance::m[UserSpaceToFilter|FilterSpaceToUser]SpaceScale to MatrixScalesDouble. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D148138
2022-06-03 19:55:30 +00:00
Miko Mynttinen
d4e8fb352d Bug 1764936 - Apply empty clip if clip-path creation fails r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D148134
2022-06-02 19:32:28 +00:00
Jonathan Kew
ef035224b2 Bug 1769965 - Convert stroke properties (width, dashes) to device pixels when passing them to the gfxContext. r=emilio
This makes the context-value option for stroke width and dash properties in SVG glyphs work
consistently in non-1.0 devicePixelRatio situations (e.g. browser zoom, high-dpi displays).

Differential Revision: https://phabricator.services.mozilla.com/D146886
2022-05-21 15:42:16 +00:00
Glenn Watson
cebe610723 Bug 1768983 - Add prim flag for checkerboarding backgrounds r=gfx-reviewers,lsalzman
Although not needed right now (checkerboarding backgrounds get
a slice anyway due to being a different scroll root), this will
be important for the upcoming work to make backdrop filter
roots implicit. This allows WR to know when slicing up a content
slice if the prim is relevant to the backdrop root.

Differential Revision: https://phabricator.services.mozilla.com/D146145
2022-05-15 21:54:25 +00:00
Emilio Cobos Álvarez
5302cc0936 Bug 1423746 - Filter on root should not establish containing block for fixedpos elements. r=mstange
Teach nsDisplay{Filters,BackdropFilters} to use a style that doesn't
belong to mFrame for the root frame, and use it as needed.

Remove the BackdropFilters::CanCreateWebrenderCommands call because it
was testing for StyleSVGEffects::mFilters rather than mBackdropFilters,
so it was doing nothing.

Differential Revision: https://phabricator.services.mozilla.com/D146188
2022-05-13 10:02:58 +00:00
Jonathan Kew
65fe462eef Bug 1765093 - patch 3 - Also use the new gfxTextRun::GetLineHeightMetrics to optimize GetAscentAndDescentInAppUnits. r=emilio
This accelerates web-exposed SVG APIs such as getExtentOfChar() by avoiding the expensive
MeasureText() call when we're just getting the line-height metrics.

Differential Revision: https://phabricator.services.mozilla.com/D145717
2022-05-07 13:12:00 +00:00
Jonathan Kew
f4644e4220 Bug 1765093 - patch 1 - Avoid measuring entire textrun in SVGTextFrame's GetBaselinePosition function. r=dholbert
This aims to prevent an O(n^2) performance situation when per-glyph
positioning is in use.

This reduces the time to load the testcase here from around 70s to 17s
in my local build. Still not great, but at least it's less of a disaster.

Differential Revision: https://phabricator.services.mozilla.com/D145631
2022-05-07 13:11:59 +00:00
Cristian Tuns
f1a3cc8348 Backed out 4 changesets (bug 1765093) for causing web-platform-test failures on boundary-shaping-010.html CLOSED TREE
Backed out changeset 4f24833ac254 (bug 1765093)
Backed out changeset 6e5b336588d1 (bug 1765093)
Backed out changeset 17d5218d84b7 (bug 1765093)
Backed out changeset bbc194412080 (bug 1765093)
2022-05-06 17:08:52 -04:00
Jonathan Kew
e7bef911d2 Bug 1765093 - patch 3 - Also use the new gfxTextRun::GetLineHeightMetrics to optimize GetAscentAndDescentInAppUnits. r=emilio
This accelerates web-exposed SVG APIs such as getExtentOfChar() by avoiding the expensive
MeasureText() call when we're just getting the line-height metrics.

Differential Revision: https://phabricator.services.mozilla.com/D145717
2022-05-06 17:47:23 +00:00
Jonathan Kew
a29c0bcdbe Bug 1765093 - patch 1 - Avoid measuring entire textrun in SVGTextFrame's GetBaselinePosition function. r=dholbert
This aims to prevent an O(n^2) performance situation when per-glyph
positioning is in use.

This reduces the time to load the testcase here from around 70s to 17s
in my local build. Still not great, but at least it's less of a disaster.

Differential Revision: https://phabricator.services.mozilla.com/D145631
2022-05-06 17:47:22 +00:00
Dan Robertson
47b6f96706 Bug 1676299 Part 4: Modify BaseMatrix::ScaleFactors() to return a ScaleFactors2D. r=botond
This changes BaseMatrix::ScaleFactors() to return a ScaleFactors2D instead of
a SizeTyped.

Depends on D145041

Differential Revision: https://phabricator.services.mozilla.com/D144666
2022-04-30 01:35:24 +00:00
Dan Robertson
abf76f9787 Bug 1676299 Part 3: Limit early return from PaintFilteredFrame. r=botond
Only return early from PaintFilteredFrame if the scale matrix determinant will
be zero. This should only occur if either the height or width of the context
matrix scale factors are zero.

Depends on D144669

Differential Revision: https://phabricator.services.mozilla.com/D145041
2022-04-30 01:35:24 +00:00
Jeff Muizelaar
f4c31e97d8 Bug 1764943. Add null check on path. r=mstange
This problem was introduced by bug 1756197. The old code checked
for null before setting the path that was implicitly used by the fill.
This null check is retained at the other usage of
CreateClipPathForFrame()

Differential Revision: https://phabricator.services.mozilla.com/D144477
2022-04-22 20:16:30 +00:00
David Shin
ec93876623 Bug 1755565 - Implement contain: inline-size. r=emilio,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D143501
2022-04-19 17:44:16 +00:00
Emilio Cobos Álvarez
20b8aec4d5 Bug 1764354 - Propagate color-scheme preference to SVG images on chrome documents. r=aosmond
This allows favicons to respect the user theme even when it doesn't
match the content theme.

Differential Revision: https://phabricator.services.mozilla.com/D143639
2022-04-17 20:38:01 +00:00
Emilio Cobos Álvarez
881f8f938a Bug 1762109 - Make the XLink setup a bit saner. r=smaug
Make Link and SVGAElement agree on XLink handling, and make it more
explicit that SVGAElement needs to be a bit more special for SMIL.

Remove dead MathML XLink code.

Differential Revision: https://phabricator.services.mozilla.com/D142546
2022-03-31 14:33:57 +00:00
Andreea Pavel
0fb4d3993c Bug 1642198 - update linux condition and disable test_filter_crossorigin.html on win10_2004 r=intermittent-reviewers,jmaher DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D142295
2022-03-30 06:05:01 +00:00
David Shin
093b63fe3c Bug 1755770 - Ensure TextRenderedRun::GetRunUserSpaceRect casts float to int without invoking Undefined Behavior r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D142223
2022-03-28 21:07:58 +00:00
Nicolas Silva
6019443efe Bug 1761002 - Restore the clip rect in webrenderized images. r=mstange
In bug 1758942 there was a bit of clipping logic for webrenderized svg images that was removed because we didn't know what it was useful for.

I still don't quite know, other than that it caused layout/reftests/svg/image/image-preserveAspectRatio-01-raster.svg and layout/reftests/svg/image/image-preserveAspectRatio-02-raster.svg to start failing when the gfx.webrender.svg-images pref is enabled, so let's revert it.

Depends on D141847

Differential Revision: https://phabricator.services.mozilla.com/D141848
2022-03-23 20:28:55 +00:00
Nicolas Silva
b0457b9551 Bug 1761007 - Fix sizing of WebRenderized SVG images. r=gfx-reviewers,aosmond
The missing line is consistently called after ImageContainer::GetWidth/GetHeight (see TransformContextForPainting for example which would be the equivalent code path for the non-webrenderized case).

This fixes the wptest /density-size-correction/density-corrected-image-svg.html when active svg images are enabled.

Depends on D141846

Differential Revision: https://phabricator.services.mozilla.com/D141847
2022-03-23 20:28:55 +00:00
Nicolas Silva
ecf93a5a7b Bug 1758942 - Change the way solid rect bounds are computed. r=mstange
I wrote the previous code via trial and error by copying similar code without understanding much what the different values represent.
The result looks about right but I suspect it may be only right because of simplifying assumptions.

Differential Revision: https://phabricator.services.mozilla.com/D140726
2022-03-17 11:07:13 +00:00
Mathew Hodson
34da4aaf3e Bug 1751107 Part 3 - Clamp current time for SVG elements. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D140449
2022-03-11 18:13:07 +00:00
Nicolas Silva
fe3175568a Bug 1757396 - Prevent SVG geometry with markers from being active. r=gfx-reviewers,lsalzman
We don't currently check whether the geometry has markers, nor do we try to render them properly with WebRender display items.

This is caught by the reftest paint-order-001.svg when active SVG images and rects are enabled.

Differential Revision: https://phabricator.services.mozilla.com/D140808
2022-03-11 13:00:54 +00:00
Daniel Holbert
9f74bc949f Bug 1758029: Gracefully bail out of canvas SVG-filter invalidation codepath, if the canvas has been unlinked due to cycle collection. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D140419
2022-03-08 23:08:32 +00:00
Emilio Cobos Álvarez
d85e707e95 Bug 1751108 - Deal with nan context scale in SVGTextFrame::UpdateFontSizeScaleFactor. r=layout-reviewers,jfkthame
Depends on D139936

Differential Revision: https://phabricator.services.mozilla.com/D139937
2022-03-01 14:35:36 +00:00
Emilio Cobos Álvarez
89a8d46834 Bug 1757230 - Add missing includes elsewhere to unbust hybrid builds.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2022-02-26 01:08:16 +01:00
Emilio Cobos Álvarez
9bf0b6e440 Bug 1736243 - Make SVGObserverUtils::GetAndObserveTextPathsPath not observe on continuations. r=longsonr
Differential Revision: https://phabricator.services.mozilla.com/D139485
2022-02-25 16:55:05 +00:00
Jeff Muizelaar
29ee522959 Bug 1757045. Image elements with fill-opacity == 0 are visible. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D139673
2022-02-25 03:53:10 +00:00
Jeff Muizelaar
ee8edce30e Bug 1755975 - Pass rect or path directly to Clip() instead of manually creating a path. r=gfx-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D139038
2022-02-24 14:42:35 +00:00
Jeff Muizelaar
be058f2f87 Bug 1752348. Adjust transform on maskTarget instead of ctx. r=nical
Previously, if ctx->GetDrawTarget() != maskTarget we end up adjusting the
matrix on ctx and not on the maskTarget.

Also, now that we're doing the correct adjustment of the maskTarget transform
we can remove code to set maskTarget's transform to identity.

Differential Revision: https://phabricator.services.mozilla.com/D139133
2022-02-23 22:21:18 +00:00
Jeff Muizelaar
adafdb308e Bug 1756197. Avoid clipping if we're just going to fill the path. r=gfx-reviewers,nical
This avoids having to rasterize the path twice. Once for the clip path and once for
the fill. It will also give us correct antialiasing on the edges.

Differential Revision: https://phabricator.services.mozilla.com/D139137
2022-02-23 16:19:07 +00:00
Jeff Muizelaar
e78ea43b78 Bug 1756197. Separate out CreateClipPathForFrame. r=gfx-reviewers,aosmond
We'll use this to draw path directly instead of using clipping to it.

Differential Revision: https://phabricator.services.mozilla.com/D139136
2022-02-23 16:19:07 +00:00
Nicolas Silva
50ca258be2 Bug 1755747 - Add support for antialiased non-snapped rectangles. r=gfx-reviewers,aosmond
We need them for SVG primitives.

This patch adds a bit of plumbing to disable snapping some of the primitives and forcing the antialiasing shader feature where needed, and uses it for SVG solid rectangles and images.

Differential Revision: https://phabricator.services.mozilla.com/D139024
2022-02-23 13:37:39 +00:00
Nicolas Silva
79a89e87c2 Bug 1753986 - Allow some SVG solid rects to be active. r=jrmuizel
Currently disabled by default, behind the gfx.webrender.svg-image pref.

Differential Revision: https://phabricator.services.mozilla.com/D138015
2022-02-23 13:37:39 +00:00
Miko Mynttinen
ddec6eef59 Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 23:42:18 +00:00
Jeff Muizelaar
66243c7954 Bug 1756220 - Always paint the the extra mask with an identity transform. r=gfx-reviewers,nical,bradwerth
Previously, we mostly went to the effort of setting the extra tranform to the
inverse of the context transform except for a case in PaintMask which really
didn't make any sense.

Differential Revision: https://phabricator.services.mozilla.com/D139148
2022-02-22 21:16:29 +00:00
Jeff Muizelaar
d15f962f85 Bug 1756042 - Replace gfxContext parameter with DrawTarget. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139063
2022-02-22 17:11:51 +00:00
Norisz Fay
2121660ce9 Backed out 2 changesets (bug 1714584) per devs request for causing crashes a=backout
Backed out changeset 3baead3e079b (bug 1714584)
Backed out changeset a2da895a58ce (bug 1714584)
2022-02-22 16:41:57 +02:00
Miko Mynttinen
28474c7ad2 Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 00:44:25 +00:00
Nicolas Silva
4824b5ed95 Bug 1753404 - Avoid extra blob tiles from invisible items. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D137862
2022-02-21 21:57:03 +00:00
Norisz Fay
f0dc70995f Backed out changeset f06972b41abe (bug 1755975) for causing multiple reftest failures CLOSED TREE 2022-02-18 04:04:47 +02:00
Jeff Muizelaar
914f0bbdbc Bug 1756035 - Remove unused aMaskSurfaceMatrix parameter. r=gfx-reviewers,aosmond
The use of this parameter was removed by bug 1539702.

Differential Revision: https://phabricator.services.mozilla.com/D139061
2022-02-17 20:53:22 +00:00
Jeff Muizelaar
0cfa7fdb40 Bug 1755975 - Pass rect or path directly to Clip() instead of manually creating a path. r=gfx-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D139038
2022-02-17 20:24:38 +00:00