Commit graph

3100 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8d73fd209e Bug 1888242 - Simplify viewport handling in RDM. r=bradwerth,devtools-reviewers,ochameau
In particular:

 * Always handle meta viewport in RDM. This fixes bug 1625999 too by
   making touch simulation enabled and disabled consistent.

 * Restore the resolution to 1 when toggling RDM. This is just simpler,
   and we're not keeping around the visual viewport offsets anyways
   so...

 * Deal with the change more easily, at the same point we switch
   scrollbars etc.

Differential Revision: https://phabricator.services.mozilla.com/D206266
2024-04-02 15:21:04 +00:00
sid
cc52f88dc8 Bug 1825386 - Converted LogicalAxis to enum class and type casted where necessary. r=TYLin
LogicalAxis is one of the Logical* enums. Converting it from enum to
enum class increases type safety. To run with the pre-existing code,
type casting was added when needed. Comments have been edited where
needed.

Differential Revision: https://phabricator.services.mozilla.com/D206108
2024-03-30 16:20:37 +00:00
sotaro
9c96712d23 Bug 1887818 - Prevent to call GPUVideoImage::GetAsSourceSurface() in CanvasRenderingContext2D::DrawImage() for RemoteDecoderVideoSubDescriptor::Tnull_t if CanvasTranslator is used r=gfx-reviewers,lsalzman
GPUVideoImage::GetAsSourceSurface() is heavy weight. It seems better to prevent to call it if possible.

The change handles only a case that CanvasTranslator is used, SurfaceDescriptor is RemoteDecoderVideoSubDescriptor::Tnull_t and OptimizeShadow is not used.

DrawTargetRecording::DrawSurfaceDescriptor() also holds layers::Image of SurfaceDescriptor. It is necessary to keep the Image alive in CanvasDrawEventRecorder until end of its usage in CanvasTranslator.

Differential Revision: https://phabricator.services.mozilla.com/D205677
2024-03-28 06:24:41 +00:00
Boris Chiou
c24d2947b3 Bug 1870200 - Break the cyclic dependency if any of the desendants uses non-scaling-stroke. r=emilio
While we are computing the transform-box:stroke-box, for CSS Transforms or
Motion path Transforms, we have to avoid the cyclic dependency not only
for the SVG geometry frame itself, but also for the desendants of
the SVG container frame. Therefore, we just compute its fill-box (i.e.
make |getStroke| be false).

https://github.com/w3c/csswg-drafts/issues/9640

Differential Revision: https://phabricator.services.mozilla.com/D203184
2024-03-04 20:46:05 +00:00
Emilio Cobos Álvarez
a4d842c063 Bug 1879579 - Clean up CompareTreePosition and related code. r=smaug
Make TreeOrderedArray support what the form controls stuff needs, and
use it instead of custom nsContentUtils stuff.

Differential Revision: https://phabricator.services.mozilla.com/D201261
2024-02-12 20:01:36 +00:00
Noemi Erli
f92d721721 Backed out changeset 1acc95286189 (bug 1879579) for causing mass failures CLOSED TREE 2024-02-12 17:25:21 +02:00
Emilio Cobos Álvarez
068080982b Bug 1879579 - Clean up CompareTreePosition and related code. r=smaug
Make TreeOrderedArray support what the form controls stuff needs, and
use it instead of custom nsContentUtils stuff.

Differential Revision: https://phabricator.services.mozilla.com/D201261
2024-02-12 00:01:23 +00:00
Andrew Osmond
209acda515 Bug 1872956 - Avoid copying document URI in nsLayoutUtils::PaintFrame unless logging. r=layout-reviewers,tnikkel
Most of the time, we don't need to call Document::GetDocumentURI in
nsLayoutUtils::PaintFrame, as it is only used when we are logging or
dumping to the console. We should avoid calling it because this might be
quite large in the case of data URIs and result in OOM crashes. This is
most commonly observed with rasterizing SVG images.

Differential Revision: https://phabricator.services.mozilla.com/D197637
2024-01-04 02:54:49 +00:00
Timothy Nikkel
e0604de8f1 Bug 1872443. Fix nsLayoutUtils::GetReferenceFrame to match nsDisplayListBuilder::FindReferenceFrameFor. r=layout-reviewers,emilio
https://hg.mozilla.org/integration/mozilla-inbound/rev/621ab19e86db (bug 1097464) is where the IsPreserve3DLeaf call was added. At that time FindReferenceFrame did exist and did not call IsPreserve3DLeaf.

FindReferenceFrame is used in more places and all the places that one would expect to cause breakage. I searched and I do not see any evidence that preserve3d leaves should be reference frames.

The only case where a frame would be IsPreserve3DLeaf but not transformed is when it has backface hidden. I see no reason by backface hidden would cause a reference frame.

I believe that the way that we handle preserve3d has changed significantly since that patch landed, so if it was correct then, likely to not be correct now.

Differential Revision: https://phabricator.services.mozilla.com/D197439
2023-12-31 09:38:07 +00:00
Timothy Nikkel
3c39e0db98 Bug 1871751. Avoid AsyncPanZoomEnabled call in MaybeCreateDisplayPortInFirstScrollFrameEncountered. r=layout-reviewers,emilio
The return value of nsLayoutUtils::AsyncPanZoomEnabled only changes if we descend into a frame whose display root widget is different. But that is not possible, we do not descend into any frames that are in different widgets.

Differential Revision: https://phabricator.services.mozilla.com/D197237
2023-12-30 10:23:09 +00:00
Robert Longson
0e8866544c Bug 1872241 - Remove svgFloatSize and use gfx::Size instead r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D197371
2023-12-28 12:59:10 +00:00
Emilio Cobos Álvarez
64f95e649a Bug 1871412 - Fix scroll container checks for automatic minimum size and grid stretching checks. r=dholbert
The spec says scroll container, so overflow: visible and clip shouldn't
be different.

Note that the spec here is pending some edits from
https://github.com/w3c/csswg-drafts/issues/7714 tho.

Differential Revision: https://phabricator.services.mozilla.com/D197052
2023-12-26 20:49:16 +00:00
Butkovits Atila
41b6ca07bc Backed out changeset 2feca7f78d58 (bug 1871751) for causing failures at DisplayPortUtils.cpp. CLOSED TREE 2023-12-26 14:12:45 +02:00
Timothy Nikkel
4a9339c873 Bug 1871751. Avoid AsyncPanZoomEnabled call in MaybeCreateDisplayPortInFirstScrollFrameEncountered. r=layout-reviewers,emilio
The return value of nsLayoutUtils::AsyncPanZoomEnabled only changes if we descend into a frame whose display root widget is different. But that is not possible, we do not descend into any frames that are in different widgets.

Differential Revision: https://phabricator.services.mozilla.com/D197237
2023-12-26 11:39:54 +00:00
Zach Hoffman
cd5747dfbf Bug 1846516 - [css-properties-values-api] Introduce AnimatedPropertyID/AnimatedPropertIDSet. r=firefox-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,hiro
This will make possible to animate custom properties on Gecko side. For now, the
animation code keeps only dealing with nsCSSPropertyID, so behavior is unchanged.

Co-authored-by: Frederic Wang <fred.wang@free.fr>

Depends on D190816

Differential Revision: https://phabricator.services.mozilla.com/D191059
2023-12-18 09:24:08 +00:00
Emilio Cobos Álvarez
5730ee0ca5 Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00
Jonathan Watt
15c1a58822 Bug 1866011 p2. Rename nsIDocShell.contentViewer. r=emilio,credential-management-reviewers,devtools-reviewers,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D194370
2023-11-24 09:10:52 +00:00
Jonathan Watt
90bd3e3cec Bug 1865995 p5. Rename GetContentViewerSize to match nsIDocumentViewer's new name. r=emilio,geckoview-reviewers,owlish
Includes the methods on:
 - nsIDOMWindowUtils
 - nsLayoutUtils
 - MVMContext

Differential Revision: https://phabricator.services.mozilla.com/D194339
2023-11-23 21:35:20 +00:00
Jonathan Watt
c96a66c3de Bug 1865480. Rename nsIContentViewer to nsIDocumentViewer. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D193987
2023-11-21 12:45:59 +00:00
Boris Chiou
192403f967 Bug 1852323 - Part 2: Fix the mapping of StyleGeometryBox for mask-clip. r=emilio
Also, drop `nsLayoutUtils::ComputeGeometryBox()` and avoid doing mapping
in `ComputeHTMLReferenceRect()` and `ComputeSVGReferenceRect()`. The
caller should handle it properly because each property uses its own mapping
between CSS box and SVG box.

Note:
1. mask-clip-3.html is copied from mask-clip-1.html but just replace
   css boxes with svg boxes.
2. mask-clip-4.html is copied from mask-clip-2.html but just replace
   svg boxed with css boxes.

Differential Revision: https://phabricator.services.mozilla.com/D188316
2023-10-10 22:00:32 +00:00
Boris Chiou
5213031e3e Bug 1852323 - Part 1: Update the mapping of geometry box for clip-path. r=emilio
It seems mask-origin/mask-clip/clip-path use different mapping for
geometry-box. We should specialize each one. In this patch, we focus on
clip-path.

Differential Revision: https://phabricator.services.mozilla.com/D188146
2023-10-10 22:00:32 +00:00
Boris Chiou
d451ebbc07 Bug 1856471 - Ignore min-x and min-y when computing view-box (so we return origin box). r=dholbert
Per https://github.com/web-platform-tests/interop/issues/509, we update
the coordinate to match the spec, i.e. When the viewBox includes non-zero min-x
or min-y offsets, this origin box does not actually correspond to the visible
region rectangle defined by the viewBox.
https://drafts.csswg.org/css-box-3/#valdef-box-view-box

Also simplify mask-clip-2.html and mask-origin-3.html so that their
viewBox is anchored at the origin so it is the same as the origin box.

Differential Revision: https://phabricator.services.mozilla.com/D190325
2023-10-10 06:26:51 +00:00
Dan Robertson
9aaa529968 Bug 700533 - Use a fallback size for canvas drawImage if the given image has no intrinsic size (e.g. certain SVG images). r=dholbert
When computing the size of an image for CanvasRenderingContext2D.drawImage(),
use the fallback size of 300 x 150 if the image contains no width or
height. This may occur if the SVG contained no width or height attribute.

Depends on D182487

Differential Revision: https://phabricator.services.mozilla.com/D182488
2023-09-25 16:01:34 +00:00
Andrew Osmond
100e56e28e Bug 1854431 - Extract surface format from GPUVideoImage for VideoFrame. r=media-playback-reviewers,chunmin
This patch allows us to extract a VideoPixelFormat for a VideoFrame when
backed by a GPUVideoImage. This in turn is used by SurfaceFromVideoFrame
for canvas drawing. With a concrete surface format, we can avoid
readbacks with WebGL in particular and dramatically improve performance
in existing demos.

Differential Revision: https://phabricator.services.mozilla.com/D188853
2023-09-21 23:45:16 +00:00
Emilio Cobos Álvarez
6cd30b6fe1 Bug 1853392 - Simplify font-size-adjust: from-font handling. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D188355
2023-09-15 22:17:25 +00:00
Markus Stange
d89c20090c Bug 1843484 - Use EventTarget* instead of nsISupports* for the event target parameter of the EventDispatcher::Dispatch methods. r=smaug
This saves a few QueryInterface calls on the hot path.

Differential Revision: https://phabricator.services.mozilla.com/D186977
2023-08-28 23:38:43 +00:00
Robert Longson
4d21d74dc0 Bug 1849130 - clip-path on SVG content should default to using the stroke-box r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D186475
2023-08-20 07:04:23 +00:00
Andrew Osmond
c0bed56904 Bug 1645555 - Ensure we return surfaces with the proper size with canvas and ImageBitmap. r=gfx-reviewers,lsalzman
In general the canvas size and the surface size should match. However if
we are in the process of updating an OffscreenCanvas's size, it is
possible we may return a surface with a different size if an ImageBitmap
is created, or we draw using, the placeholder HTMLCanvasElement. In that
case we should ensure the surface we yield is the same size as the
current intrinsic size of the HTMLCanvasElement.

Differential Revision: https://phabricator.services.mozilla.com/D186376
2023-08-16 21:01:34 +00:00
Emilio Cobos Álvarez
9c4b9bb36d Bug 1847929 - Don't throttle zero-size in-viewport OOP iframes. r=smaug
Use edge-inclusive intersection like IntersectionObserver, to make
zero-size iframes that are in the viewport considered visible. This is
consistent with how we treat zero-sized in-process iframes.

Differential Revision: https://phabricator.services.mozilla.com/D185808
2023-08-10 09:30:02 +00:00
Jonathan Kew
8b2747cfc4 Bug 1708240 - Implement the from-font keyword for CSS font-size-adjust. r=emilio,devtools-reviewers
Depends on D182450

Differential Revision: https://phabricator.services.mozilla.com/D182451
2023-08-01 12:40:31 +00:00
Noemi Erli
1bf4a97b5d Backed out 5 changesets (bug 1708240) for causing failures in test_css-properties-db.js CLOSED TREE
Backed out changeset 695203c0ff61 (bug 1708240)
Backed out changeset e686e061b8b5 (bug 1708240)
Backed out changeset eac4b88ab28d (bug 1708240)
Backed out changeset e766d2a9180e (bug 1708240)
Backed out changeset 79c808970af5 (bug 1708240)
2023-08-01 15:12:46 +03:00
Jonathan Kew
0677b1aa55 Bug 1708240 - Implement the from-font keyword for CSS font-size-adjust. r=emilio
Depends on D182450

Differential Revision: https://phabricator.services.mozilla.com/D182451
2023-08-01 10:49:58 +00:00
Jan-Niklas Jaeschke
c84288a36d Bug 1838262, part 2: Implemented getComputedStyle() for custom highlight api. r=emilio
This patch introduces functional pseudo parameters, i.e. `::highlight(foo)`,
for `getComputedStyle()`. This required adapting the parse algorithm (`nsCSSPseudoElements::ParsePseudoElement()`) and forwarding the functional pseudo parameter into the style engine.

Differential Revision: https://phabricator.services.mozilla.com/D183773
2023-07-31 13:47:54 +00:00
Emilio Cobos Álvarez
9aa60b822a Bug 1844241 - Remove now-dead graphics glass code. r=tnikkel,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D183942
2023-07-19 12:44:34 +00:00
Razvan Cojocaru
23aa72ebf6 Bug 1841478 - Use strongly-typed coordinates in the BaseSize constructor. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D182654
2023-07-10 02:59:01 +00:00
Andrew Osmond
e8d3205ad7 Bug 1781527 - Part 3. Implement support for surfaces requiring scaling/crop rects with canvas. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D182208
2023-07-10 00:26:47 +00:00
Andrew Osmond
ad9ea73131 Bug 1781527 - Part 1. Add nsLayoutUtils::SurfaceFromVideoFrame. r=gfx-reviewers,chunmin,lsalzman
This patch adds a new method to convert from a VideoFrame to a
SurfaceFromElementResult, which is used by canvas, WebGPU and
ImageBitmap to do necessary conversions to a native surface.

Differential Revision: https://phabricator.services.mozilla.com/D181117
2023-07-10 00:26:47 +00:00
Cristian Tuns
982856d479 Backed out 4 changesets (bug 1781527) for causing Assertion failures in ImageBitmap.cpp CLOSED TREE
Backed out changeset d3ca9e70625b (bug 1781527)
Backed out changeset f6c56b5e6450 (bug 1781527)
Backed out changeset 34d140bc5b99 (bug 1781527)
Backed out changeset f7a2f2b89ba8 (bug 1781527)
2023-07-09 18:53:20 -04:00
Andrew Osmond
8d5b297ee9 Bug 1781527 - Part 3. Implement support for surfaces requiring scaling/crop rects with canvas. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D182208
2023-07-09 21:03:46 +00:00
Andrew Osmond
9774da01c8 Bug 1781527 - Part 1. Add nsLayoutUtils::SurfaceFromVideoFrame. r=gfx-reviewers,chunmin,lsalzman
This patch adds a new method to convert from a VideoFrame to a
SurfaceFromElementResult, which is used by canvas, WebGPU and
ImageBitmap to do necessary conversions to a native surface.

Differential Revision: https://phabricator.services.mozilla.com/D181117
2023-07-09 21:03:46 +00:00
Emilio Cobos Álvarez
bd1b363ff9 Bug 1824886 - Rewrite AnonymousContent to use a shadow tree. r=smaug,TYLin,sfoster,devtools-reviewers,nchevobbe
Subtle things:

 * We now have shadow trees in NAC, inception! Only a couple lines of
   code in the style system had to be changed to match :host rules and
   so properly.

 * Had to make highlighters.css contentaccessible, because otherwise we
   can't load it from the shadow tree. I don't think it's a big deal.

 * I removed some of the code from highlighters.css that claimed that
   stuff inherited from the html element. That's just no longer true.

 * Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
   This is needed because CSSOM from chrome code bypasses CSP (as
   AnonymousContent did), but setAttribute() doesn't, see bug 1424474.

Differential Revision: https://phabricator.services.mozilla.com/D173998
2023-07-09 11:34:05 +00:00
Stanca Serban
15c8455338 Backed out changeset 1c835137f532 (bug 1824886) for causing multiple failures. CLOSED TREE 2023-07-06 02:11:59 +03:00
Emilio Cobos Álvarez
3338831b84 Bug 1824886 - Rewrite AnonymousContent to use a shadow tree. r=smaug,TYLin,sfoster,devtools-reviewers,nchevobbe
Subtle things:

 * We now have shadow trees in NAC, inception! Only a couple lines of
   code in the style system had to be changed to match :host rules and
   so properly.

 * Had to make highlighters.css contentaccessible, because otherwise we
   can't load it from the shadow tree. I don't think it's a big deal.

 * I removed some of the code from highlighters.css that claimed that
   stuff inherited from the html element. That's just no longer true.

 * Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
   This is needed because CSSOM from chrome code bypasses CSP (as
   AnonymousContent did), but setAttribute() doesn't, see bug 1424474.

Differential Revision: https://phabricator.services.mozilla.com/D173998
2023-07-05 21:59:44 +00:00
Cosmin Sabou
fb92d5f42f Backed out 2 changesets (bug 1824886) for causing failures on browser_all_files_referenced.js. CLOSED TREE
Backed out changeset 650ef77d1c4d (bug 1824886)
Backed out changeset 1c835137f532 (bug 1824886)
2023-07-06 00:42:53 +03:00
Emilio Cobos Álvarez
454c0b932e Bug 1824886 - Rewrite AnonymousContent to use a shadow tree. r=smaug,TYLin,sfoster,devtools-reviewers,nchevobbe
Subtle things:

 * We now have shadow trees in NAC, inception! Only a couple lines of
   code in the style system had to be changed to match :host rules and
   so properly.

 * Had to make highlighters.css contentaccessible, because otherwise we
   can't load it from the shadow tree. I don't think it's a big deal.

 * I removed some of the code from highlighters.css that claimed that
   stuff inherited from the html element. That's just no longer true.

 * Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
   This is needed because CSSOM from chrome code bypasses CSP (as
   AnonymousContent did), but setAttribute() doesn't, see bug 1424474.

Differential Revision: https://phabricator.services.mozilla.com/D173998
2023-07-05 18:21:31 +00:00
David Shin
ddab4168b8 Bug 1839550 - Back out increased clamping range. r=dholbert
Was introduced in bug 1831148, regresses the behaviour fixed by
bug 1419225.

Differential Revision: https://phabricator.services.mozilla.com/D182346
2023-06-28 14:59:23 +00:00
Razvan Cojocaru
ebe5d60c5d Bug 1838107 - Use strongly-typed coordinates in the BaseMargin constructor. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D180835
2023-06-23 20:24:53 +00:00
Jonathan Kew
7d0978de1e Bug 1839614 - patch 2 - Move the browser.display.auto_quality_min_font_size pref into StaticPrefs. r=gfx-reviewers,lsalzman
No change in behavior here; this is to prepare for offscreen-canvas workers
to be able to access the pref (following patch).

Depends on D181636

Differential Revision: https://phabricator.services.mozilla.com/D181637
2023-06-23 15:12:19 +00:00
Boris Chiou
97e7095dbd Bug 1581237 - Use <coord-box> as the reference box of the containing block for ray(). r=emilio
So now we use <coord-box> to decide which box we should use. Also, we
have to tweak the calculation of path length to take the top left point
into consideration, for padding-box and content-box. border-box is the
default value, so other tests should cover it.

Differential Revision: https://phabricator.services.mozilla.com/D180397
2023-06-16 22:43:34 +00:00
Boris Chiou
09a891ce2c Bug 1820070 - Part 3: Apply "at <position>" and offset-position to ray function. r=emilio
We apply offset-position and "at <position>" to ray function. However,
only use it on the main thread. For compositor animation, we will finish
it in the following patches.

No need to add tests because there are tests in the WPT upstream repo already:
css/motion/offset-path-ray-011.html
css/motion/offset-path-ray-012.html
css/motion/offset-path-ray-013.html
css/motion/offset-path-ray-014.html

Those tests should cover what we do in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D179861
2023-06-06 21:40:52 +00:00