Commit graph

152 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
d39e78a02e Bug 1883435 - Don't include GleanMetrics.h from Document.h. r=chutten,necko-reviewers,valentin
In bug 1883435 comment 2 chutten mentions that including
nsGlobalWindowInner.h from GleanMetrics.h causes a stylo build failure.

This is because nsGlobalWindowInner.h itself brings a bunch of DOM
bindings template soup that bindgen isn't great at dealing with.

That can be fixed in various ways. However, there is a simpler fix,
which is not including GleanMetrics at all.

It's trivial to do, and given it's a massive autogenerated file, and
Document.h is a very common header, it's worth doing this if only for
build times.

Fix a bunch of unused includes while at it.

Differential Revision: https://phabricator.services.mozilla.com/D203625
2024-03-05 17:54:14 +00:00
Emilio Cobos Álvarez
8925ee2d3d Bug 1881011 - Refactor UnbindFromTree to take a context argument. r=smaug
Much like BindToTree.

This will be useful because I need to pass more information through
UnbindFromTree() to speed up dir=auto for bug 1874040.

Differential Revision: https://phabricator.services.mozilla.com/D202215
2024-02-20 15:05:40 +00:00
Karl Tomlinson
e01e8e4950 Bug 1863846 change VideoInfo::Rotation to non-nested enum class VideoRotation so that it can be forward declared r=aosmond,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D193163
2023-11-29 01:44:45 +00:00
Emilio Cobos Álvarez
d7b9e936c7 Bug 1858977 - Remove dead code to lock orientation on video controls. r=smaug,webidl,reusable-components-reviewers,mconley,hjones
mozLockOrientation etc haven't done anything for a while.

Depends on D193212

Differential Revision: https://phabricator.services.mozilla.com/D193213
2023-11-10 09:29:14 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Emilio Cobos Álvarez
660e1cc638 Bug 1856628 - Remove WakeLock::IsDocumentInvisible and related code. r=pip-reviewers,mhowell
This was added for bug 1659060 and bug 1679314, but it is effectively
superseded by bug 1755748, which makes document.hidden false if PiP is
used.

Covered by toolkit/content/tests/browser/browser_media_wakelock_PIP.js

Differential Revision: https://phabricator.services.mozilla.com/D189940
2023-10-03 16:08:59 +00:00
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Emilio Cobos Álvarez
7bddcf9e5a Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 17:22:03 +00:00
Cristian Tuns
6957543e5e Backed out changeset a3e55d5f9f13 (bug 1839223) for causing multiple failures in Document.cpp CLOSED TREE 2023-06-22 11:34:15 -04:00
Emilio Cobos Álvarez
2c6de5f038 Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 14:31:16 +00:00
Tom Schuster
2554bd9b9a Bug 1838415 - Add explicit targets for HTMLVideoElement metadata. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D180937
2023-06-21 07:01:22 +00:00
Tom Schuster
b4c6e62b3c Bug 1834737 - Make RFPTarget parameter of Document::ShouldResistFingerprinting non-optional. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D178925
2023-05-31 09:46:54 +00:00
Karl Tomlinson
fb0873a1d5 Bug 1832479 use types for decoder owner Invalidate() boolean parameters r=pehrsons
for safety and readability.

Differential Revision: https://phabricator.services.mozilla.com/D177983
2023-05-16 21:30:29 +00:00
Masayuki Nakano
e16a783838 Bug 1829570 - part 2: Add an overload of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176488
2023-05-15 01:07:29 +00:00
Andreas Pehrson
04a96f5896 Bug 1807215 - Take video element intrinsic dimensions from VideoFrameContainer instead of ImageContainer. r=padenot
VideoFrameContainer already knows a frame's intrinsic size. The same intrinsic
size that drives media element invalidation.

ImageContainer just handles images and they don't have a notion of intrinsic
dimensions.

Differential Revision: https://phabricator.services.mozilla.com/D174085
2023-04-03 08:36:40 +00:00
Andreas Pehrson
6524982237 Bug 1807215 - Make the intrinsic size arg in MediaDecoderOwner::Invalidate a const ref. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D174083
2023-04-03 08:36:39 +00:00
alwu
772b7e4585 Bug 1820723 - do not create wakelock if XPCOM has started shutdown. r=media-playback-reviewers,jolin
Differential Revision: https://phabricator.services.mozilla.com/D172031
2023-03-09 18:08:43 +00:00
alwu
c74a2f66c2 Bug 1804770 - add a pref to control video wakelock. r=azebrowski
Differential Revision: https://phabricator.services.mozilla.com/D165324
2022-12-22 19:19:15 +00:00
alwu
2a156f31ff Bug 1803834 - part2 : pause/resume non-audible autoplay video when its visibility changes. r=media-playback-reviewers,padenot
https://html.spec.whatwg.org/multipage/media.html#ready-states:eligible-for-autoplay-2

Depends on D163741

Differential Revision: https://phabricator.services.mozilla.com/D163742
2022-12-06 18:21:39 +00:00
Emilio Cobos Álvarez
44ef3b8685 Bug 1799435 - Make RFP checks faster. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161447
2022-11-08 02:36:25 +00:00
Sandor Molnar
7a39c6eef3 Backed out changeset c7f5349824c4 (bug 1799435) for causing crashes in mozilla::dom::HTMLImageElement::LoadSelectedImage CLOSED TREE 2022-11-08 02:39:14 +02:00
Emilio Cobos Álvarez
68c342910f Bug 1799435 - Make RFP checks faster. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161447
2022-11-07 22:23:50 +00:00
Iulian Moraru
2f0dd0e293 Backed out changeset 44cb21194dc0 (bug 1799435) for causing multiple resist fingerprint related failures. CLOSED TREE 2022-11-07 18:42:11 +02:00
Emilio Cobos Álvarez
bac0597c49 Bug 1799435 - Make RFP checks faster. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161447
2022-11-07 14:40:57 +00:00
Paul Adenot
3037980689 Bug 1757637 - Use the ImageContainer to determine video{Width,Height} instead of passing through the state machine. r=alwu
This means there is significantly less chance of desynchronization between the
actual size of the image and the reported size of the image.

Differential Revision: https://phabricator.services.mozilla.com/D149150
2022-07-11 13:32:40 +00:00
Norisz Fay
c72cec6d46 Backed out changeset 817af8f5f831 (bug 1757637) for causing reftest failures on incorrect_display_in_bytestream_vp8.html CLOSED TREE 2022-06-29 14:25:07 +03:00
Paul Adenot
9753a1bd35 Bug 1757637 - Use the ImageContainer to determine video{Width,Height} instead of passing through the state machine. r=alwu
This means there is significantly less chance of desynchronization between the
actual size of the image and the reported size of the image.

Differential Revision: https://phabricator.services.mozilla.com/D149150
2022-06-29 10:01:34 +00:00
Jeff Muizelaar
a4c8bf3727 Bug 1762966 - Add a pref to force the number of dropped frames to 0. r=alwu
I want to use this to help debug resolution changes caused by frame
drops.

Differential Revision: https://phabricator.services.mozilla.com/D142870
2022-04-05 21:02:53 +00:00
Emilio Cobos Álvarez
7f5364389c Bug 1700640 - Map width and height to aspect-ratio in <canvas>, <input type=image>, and <video>. r=boris
As per https://html.spec.whatwg.org/#attributes-for-embedded-content-and-images:

> The width and height attributes map to the aspect-ratio property on
> img, canvas, and video elements, and input elements with a type
> attribute in the Image Button state.

See https://github.com/whatwg/html/issues/6527 for the parsing issue
with canvas and zero. For now allow both behaviors in the tests.

We also remove the width-and-height-map-to-aspect-ratio pref, as it is
true everywhere and has been for a while.

Differential Revision: https://phabricator.services.mozilla.com/D109618
2021-03-24 22:18:55 +00:00
alwu
abfb3825ba Bug 1685399 - part7 : implement a helper class to accumulate and report the telemetry probe. r=padenot,bryce
In this patch, we move the responsibility of accumulating time and report the telemetry to `TelemetryProbesReporter`.

There are some differences between new telemetry report and the old one.
1. more accuracy on knowing if element is visible
2. more accuracy on determining when it should start accumulating visible & invisible play time
3. being able to report the correct result when element encounts an error or changes to a new resource
4. report result whenever MediaDecoder stops working

Here is the explanation [1] describing why our previous method was not able to achieve those advantages.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1685399#c13

Differential Revision: https://phabricator.services.mozilla.com/D101112
2021-01-19 17:34:47 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Sylvestre Ledru
fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila
964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Ting-Yu Lin
2f869ac046 Bug 1674863 Part 1 - Improve type safety for APIs computing video's intrinsic size and ratio. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95577
2020-11-03 19:54:41 +00:00
alwu
06a43c8cd0 Bug 1659060 - part1 : treat lock visible if corresponding document has in use picture-in-picture element. r=bryce,smaug
When a tab is in the background, its document visibility would become invisible even if a tab owns a video which is visible because of being used in picture in picture mode.

When a document changes its visibility, the wakelock would change its lockstate from `lock-foreground` to `lock-background`. For `video-playing` wakelock topic, we would only request a real platform lock for `lock-foreground` because we don't want to prevent screen from sleeping if the video is invisible.

Therefore, considering if video is being used in picture in picture mode, when determining the wakelock's visible state. If video is still being used in picture in picture mode, then we would treat wakelock as if it's in foreground in order to keep a screen lock.

Differential Revision: https://phabricator.services.mozilla.com/D90781
2020-09-23 23:34:12 +00:00
Andreas Pehrson
a04205e495 Bug 1592539 - Use a MediaStreamRenderer to render video tracks into a secondary container. r=jib,mconley
This re-uses MediaStreamRenderer to render video into a secondary container, to
get identical logic for the clone target as for the clone source. The
MediaStreamRenderer can handle audio, currentTime and more as well, but those
are not used here.

Differential Revision: https://phabricator.services.mozilla.com/D87139
2020-08-26 14:25:40 +00:00
Andreas Pehrson
0bb8c3dc1d Bug 1592539 - Move the FirstFrameListener handling to MediaStreamRenderer. r=jib
This unclutters HTMLMediaElement somewhat by putting away the logic for handling
the FirstFrameListener into MediaStreamRenderer, which is better suited for the
task.

This will allow us to use a second MediaStreamRenderer to properly track video
tracks for a secondary VideoFrameContainer.

Differential Revision: https://phabricator.services.mozilla.com/D87134
2020-08-26 14:24:55 +00:00
Simon Giesecke
cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Jan-Ivar Bruaroey
036ac85331 Bug 1434601 - Do screen wakelock even without audio if video element is sourced by a media stream. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D74129
2020-05-07 21:35:37 +00:00
Jonathan Watt
468b918bcd Bug 1634474. Make dom/html/ buildable outside of unified-build environment. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D73309
2020-05-04 14:29:02 +00:00
Timothy Gu
6407f13ce3 Bug 1628500 - Remove aIgnoreTabindex argument from Element::IsInteractiveHTMLContent(). r=edgar
This argument is set to true everywhere, and soon HTML will no longer consider
tabindex for interactive content: https://github.com/whatwg/html/pull/5457.

Differential Revision: https://phabricator.services.mozilla.com/D72568
2020-04-28 11:22:32 +00:00
alwu
09a518586f Bug 1623486 - part4 : update Picture-in-Picture mode status from media element. r=chunmin,padenot
Video element can start the Picture-in-Picture mode **BEFORE** or **AFTER** we start the listener for the media cotrol, so we have to ensure we always propagate this information to the chrome process via `ContentMediaAgent`.

Differential Revision: https://phabricator.services.mozilla.com/D67712

--HG--
extra : moz-landing-system : lando
2020-04-01 23:04:58 +00:00
alwu
7db6ce8171 Bug 1621166 - part2 : do not stop media control for media being used in PIP mode. r=MeFisto94
The media element being used in the PIP mode would always display on the screen even if the the tab it belongs to is in the background, so users would have high chance to interact with it again. Therefore, we don't want to start a stop-timer to cancel media control for that element.

Differential Revision: https://phabricator.services.mozilla.com/D67381

--HG--
extra : moz-landing-system : lando
2020-03-19 18:15:33 +00:00
Sean Feng
2d1f2db82e Bug 1377999 - Make HTML Element to adapt the DOMArena changes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D57699

--HG--
extra : moz-landing-system : lando
2020-03-17 14:53:08 +00:00
Alastor Wu
47d2457f3e Bug 1602163 - part2 : remove 'corruptedFrames' from 'VideoPlaybackQuality' r=bzbarsky
According to [1], we're going to deprecate this attribute.

[1] https://github.com/w3c/media-playback-quality/pull/20

Differential Revision: https://phabricator.services.mozilla.com/D56621

--HG--
extra : moz-landing-system : lando
2019-12-11 07:19:15 +00:00
Gabriele Svelto
ace6d1063f Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-06 09:24:56 +00:00
Dorel Luca
a381d5c96d Backed out changeset f6e53d1c6518 (bug 1600545) for Android build bustage. CLOSED TREE 2019-12-04 17:32:27 +02:00
Gabriele Svelto
bc9290f767 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-04 15:01:19 +00:00
Andreas Pehrson
3c385b4b80 Bug 1536156 - Stop doing EndCloningVisually in Unlink. r=mconley
Unlink must not cause an AddRef on the unlinked object, or it is at risk of
leaking. See 1593739 for an example of where this happens.

EndCloningVisually is dangerous in that it tries to do more than just unlink the
video element. It does AddRef in NotifyUAWidgetSetupOrChange, so that must be
avoided.

Previous patches to this bug make sure that MediaDecoder shutdown takes care of
clearing the secondary video container in the MediaDecoder stack, so this is not
actually necessary anymore.

Differential Revision: https://phabricator.services.mozilla.com/D53832

--HG--
extra : moz-landing-system : lando
2019-11-22 12:52:48 +00:00