Commit Graph

1005 Commits

Author SHA1 Message Date
CanadaHonk
aa654b839c Bug 1622090 - Implement loading=lazy for <iframe> r=emilio
Initial implementation for <iframe loading=lazy>

Also cleaned up some image lazy loading to be generalised
(sharing an intersection observer and some enums/funcs in Element).

Unimplemented details:
 - Window load should not wait for in view lazy loading iframes.
   Unplanned for this patch and ship for now.
   (Chromium fail, WebKit pass)

We also pass some other WPTs other engines do not too already too.
Also added a WPT to ensure using parse-time base URI for lazy -> eager iframes.

Differential Revision: https://phabricator.services.mozilla.com/D190662
2023-10-18 14:13:29 +00:00
Jan Varga
272327b326 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Valentin Gosu
cdd5195292 Bug 1848694 - Remove/avoid global references to nsIIOService r=mccr8,necko-reviewers,kershaw
This patch removes the static pointer to nsIIOService in nsContentUtils,
replacing it to calls to mozilla::components::IO::Service.

It also makes nsScriptSecurityManager::sIOService a StaticRefPtr.

Differential Revision: https://phabricator.services.mozilla.com/D188714
2023-09-22 12:49:44 +00:00
Sandor Molnar
a8db14100e Backed out changeset b858a0740582 (bug 1848694) for causing build bustages on dom/base/Element.cpp CLOSED TREE 2023-09-21 16:45:57 +03:00
Valentin Gosu
e058782d44 Bug 1848694 - Remove/avoid global references to nsIIOService r=mccr8,necko-reviewers,kershaw
This patch removes the static pointer to nsIIOService in nsContentUtils,
replacing it to calls to mozilla::components::IO::Service.

It also makes nsScriptSecurityManager::sIOService a StaticRefPtr.

Differential Revision: https://phabricator.services.mozilla.com/D188714
2023-09-21 12:39:20 +00:00
Markus Stange
fd848139b8 Bug 1852866 - Make LifecycleCallbackArgs::mName a RefPtr<nsAtom>. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D188100
2023-09-13 18:15:02 +00:00
Markus Stange
60a2550611 Bug 1843949 - Preallocate attribute array with the known size from parsing. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183809
2023-09-02 18:46:30 +00:00
Emilio Cobos Álvarez
d16387d4ae Bug 1850161 - Remove the concept of intrinsic states and related code. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D187109
2023-08-31 09:20:40 +00:00
Cristina Horotan
c37791a4a6 Backed out 3 changesets (bug 1850238, bug 1850161) for causing multiple failures at Element.cpp CLOSED TREE
Backed out changeset 30526c800ca7 (bug 1850161)
Backed out changeset ebc81e5e7750 (bug 1850161)
Backed out changeset e66a62c2f8c5 (bug 1850238)
2023-08-31 12:12:05 +03:00
Emilio Cobos Álvarez
2e483535e5 Bug 1850161 - Remove the concept of intrinsic states and related code. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D187109
2023-08-31 07:46:24 +00:00
Emilio Cobos Álvarez
18854ff8b5 Bug 1850238 - Make Link states not intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D186877
2023-08-30 09:18:32 +00:00
Emilio Cobos Álvarez
3e9e56e2c8 Bug 1850293 - Make editable states not intrinsic. r=smaug,masayuki
This one is tricky because form controls, though I think I got it right...

This fixes a pre-existing bug where we're not following the spec for readonly
inside content-editable.

I filed this as bug 1850390 but other browsers match the spec so add a test and
fix it while at it. This allows cheaper checks for readonlyness in a couple
places.

Differential Revision: https://phabricator.services.mozilla.com/D186896
2023-08-30 09:18:31 +00:00
Olli Pettay
22262b6f58 Bug 1843473 - Don't dispatch DOMActivate if there are no listeners for it, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D186473
2023-08-18 06:01:16 +00:00
Markus Stange
8f723e6f67 Bug 1843946 - Use an atom for the full class attribute value, to reduce string hash key cost during the AtomArrayCache lookup. r=emilio
This generalizes the previous "set single class from parser" fast-path to
also apply when there are multiple classes in the class attribute.

The main benefit is the cheaper cache lookup.
Another benefit is that this avoids a string copy (the same copy that the original
"set single class from parser" optimization avoided).

We now always atomize the full class attribute value before parsing it,
e.g. when somebody uses setAttribute. In the common case of a single class,
this atomization cost would have been paid anyway.

Before: https://share.firefox.dev/4576ulw
After: https://share.firefox.dev/3rNGBsH (though this is not the full story
because the atomization work is moved outside of nsHtml5TreeOperation::SetHTMLElementAttributes)

Differential Revision: https://phabricator.services.mozilla.com/D183813
2023-08-17 19:02:40 +00:00
CanadaHonk
5cb777c583 Bug 1824121 - Implement the <search> element r=hsivonen,Jamie,emilio
Implemented the new <search> HTML element.
All WPT tests for it now pass (except one for iso-8859-8, not done generally).

A11y role uses just landmark as recommended instead of a new search role (for now).

Co-authored-by: Henri Sivonen <hsivonen@mozilla.com>

Differential Revision: https://phabricator.services.mozilla.com/D176967
2023-08-07 22:11:05 +00:00
Stanca Serban
923687f881 Backed out 3 changesets (bug 1824121) for causing wpt failures in html5lib_search-element.html. CLOSED TREE
Backed out changeset e3aec91d79e4 (bug 1824121)
Backed out changeset e3a3324b1732 (bug 1824121)
Backed out changeset 6ff5c272ab8e (bug 1824121)
2023-08-07 21:20:18 +03:00
CanadaHonk
656774ad42 Bug 1824121 - Implement the <search> element r=hsivonen,Jamie,emilio
Implemented the new <search> HTML element.
All WPT tests for it now pass (except one for iso-8859-8, not done generally).

A11y role uses just landmark as recommended instead of a new search role (for now).

Co-authored-by: Henri Sivonen <hsivonen@mozilla.com>

Differential Revision: https://phabricator.services.mozilla.com/D176967
2023-08-07 14:05:32 +00:00
Cosmin Sabou
9b0941d691 Backed out changeset c309e9b48aec (bug 1824121) for causing element related mochitest failures. CLOSED TREE 2023-08-07 16:05:13 +03:00
CanadaHonk
7063dd9162 Bug 1824121 - Implement the <search> element r=hsivonen,Jamie,emilio
Implemented the new <search> HTML element.
All WPT tests for it now pass (except one for iso-8859-8, not done generally).

A11y role uses just landmark as recommended instead of a new search role (for now).

Co-authored-by: Henri Sivonen <hsivonen@mozilla.com>

Differential Revision: https://phabricator.services.mozilla.com/D176967
2023-08-07 12:30:50 +00:00
David Shin
4fe5a9c651 Bug 1845744: Move selector-specific node flags to a separate field. r=emilio
Upcoming :has invalidation (Bug 1792501) requires 4 more flags, and we're out of space.
This change consumes the remaining 32-bit hole in `nsINode` to migrate selector-specific
node flags.
This has implications on 32-bit platforms, specifically on text nodes.

Differential Revision: https://phabricator.services.mozilla.com/D184718
2023-08-01 00:29:56 +00:00
Mathew Hodson
28aa899942 Bug 1564391 - Rename internal uses of mozInputSource. r=emilio,pip-reviewers,tabbrowser-reviewers,dao,kpatenio
This allows us to deprecate `mozInputSource` for the Web while
avoiding console warnings for internal uses, which now use the
ChromeOnly `inputSource` attribute.

Differential Revision: https://phabricator.services.mozilla.com/D183643
2023-07-26 09:27:45 +00:00
Sandor Molnar
24e7457734 Backed out 2 changesets (bug 1843035) for causing assertion failures in dom/html/nsGenericHTMLElement.cpp CLOSED TREE
Backed out changeset d44bf85938f0 (bug 1843035)
Backed out changeset 238e99b4449c (bug 1843035)
2023-07-18 17:30:09 +03:00
Mirko Brodesser
0f87fa519a Bug 1843035: part 2) Assert correctness of popover attribute state at all relevant callers of GetPopoverAttributeState(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183477
2023-07-18 08:57:26 +00:00
Vincent Hilla
64645ecc84 Bug 1814310 - Improve runtime of nsGenericHTMLFormElement::UpdateFormOwner. r=smaug
Avoid intermediate DOMString in GetAttr, optimize calls to GetFormInternal.

Differential Revision: https://phabricator.services.mozilla.com/D182789
2023-07-17 13:35:34 +00:00
Mirko Brodesser
5beede8d62 Bug 1841505: postpone setting the popover invoker in the "show popover" algo. r=emilio
See
<https://github.com/whatwg/html/issues/9383#issuecomment-1602227494>.

Differential Revision: https://phabricator.services.mozilla.com/D182709
2023-07-12 10:12:23 +00:00
Razvan Cojocaru
c449c830ae Bug 1842072 - Prevent IntCoordTyped's constructor from accepting non-integral parameters. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D182936
2023-07-08 07:45:44 +00:00
Emilio Cobos Álvarez
529c9ee321 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
a1007b18c6 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
f54a728824 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
a28183ac0e 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
6649b9354c Bug 1838415 - Use RFPTarget::PointerEvents for Set/ReleasePointerCapture. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D180954
2023-06-21 07:01:23 +00:00
Emilio Cobos Álvarez
bf865088ae Bug 1839485 - Minor string improvements in custom element reactions. r=edgar
We're atomizing to turn into a string again which is wasteful.

Differential Revision: https://phabricator.services.mozilla.com/D181552
2023-06-20 19:11:18 +00:00
Emilio Cobos Álvarez
041813713e Bug 1839255 - Clean up a bit the mapped attribute set-up. r=smaug
This doesn't change behavior on its own. It could be split up a bit more
if needed though over all it shouldn't be hard to follow.

Unify nsHTMLStyleSheet and nsHTMLCSSStyleSheet into AttributeStyles
because the fact that we have two right now is pretty silly. They are
also not stylesheets (they used to be pre-stylo).

Differential Revision: https://phabricator.services.mozilla.com/D181414
2023-06-20 10:02:44 +00:00
Kershaw Chang
86ab7691ee Bug 1543990 - Simplify nsISpeculativeConnect API, r=necko-reviewers,geckoview-reviewers,search-reviewers,valentin,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D179066
2023-06-01 09:46:12 +00:00
Tom Schuster
f33200529a 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
Ziran Sun
0b8aa324eb Bug 1833570 - Change popover invoker type from boolean to Element. r=emilio
The invoker type is currently implemented as boolean as suggested at
https://github.com/whatwg/html/issues/9168. This issue is now closed and
has been fixed at https://github.com/whatwg/html/pull/9171.

This patch is to be follow above discussions and implement popover invoker
type as element.

Differential Revision: https://phabricator.services.mozilla.com/D178287
2023-05-31 08:59:10 +00:00
Jan-Niklas Jaeschke
d34befcb48 Bug 1828469, part 2: Moved some logic from nsRange to AbstractRange to support StaticRanges in custom highlights. r=masayuki
With this change, Selections are also registered into StaticRanges,
ultimately making them visible to `nsINode::IsSelected()`,
which is necessary to paint them.

Differential Revision: https://phabricator.services.mozilla.com/D175784
2023-05-31 08:23:45 +00:00
Cosmin Sabou
aa1153360b Backed out changeset 934b572f87f7 (bug 1833570) for causing build bustages on PopoverData.h. 2023-05-29 19:27:18 +03:00
Ziran Sun
964c1fd534 Bug 1833570 - Change popover invoker type from boolean to Element. r=emilio
The invoker type is currently implemented as boolean as suggested at
https://github.com/whatwg/html/issues/9168. This issue is now closed and
has been fixed at https://github.com/whatwg/html/pull/9171.

This patch is to be follow above discussions and implement popover invoker
type as element.

Differential Revision: https://phabricator.services.mozilla.com/D178287
2023-05-29 15:08:47 +00:00
Cosmin Sabou
19f22176f6 Backed out changeset 31915ad32476 (bug 1833570) for causing build bustages on PopoverData.h. CLOSED TREE 2023-05-29 11:06:57 +03:00
Ziran Sun
1202bb6338 Bug 1833570 - Change popover invoker type from boolean to Element. r=emilio
The invoker type is currently implemented as boolean as suggested at
https://github.com/whatwg/html/issues/9168. This issue is now closed and
has been fixed at https://github.com/whatwg/html/pull/9171.

This patch is to be follow above discussions and implement popover invoker
type as element.

Differential Revision: https://phabricator.services.mozilla.com/D178287
2023-05-29 07:21:22 +00:00
Mirko Brodesser
896dabd637 Bug 1834493: part 1) Rename PopoverState to PopoverAttributeState. r=emilio
Less confusing.

Differential Revision: https://phabricator.services.mozilla.com/D178770
2023-05-24 10:48:04 +00:00
Noemi Erli
9a6edab85a Backed out 3 changesets (bug 1828469) for causing assertion in RangeBoundary.h
Backed out changeset ab92a12ba6ea (bug 1828469)
Backed out changeset 217801294c41 (bug 1828469)
Backed out changeset c78c717e4ec9 (bug 1828469)
2023-05-23 12:10:12 +03:00
Jan-Niklas Jaeschke
654b508a08 Bug 1828469, part 2: Moved some logic from nsRange to AbstractRange to support StaticRanges in custom highlights. r=masayuki
With this change, Selections are also registered into StaticRanges,
ultimately making them visible to `nsINode::IsSelected()`,
which is necessary to paint them.

Differential Revision: https://phabricator.services.mozilla.com/D175784
2023-05-23 06:53:32 +00:00
Masayuki Nakano
d8b4f4d3a2 Bug 1829570 - part 1: Create a static method version of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176486
2023-05-15 01:07:29 +00:00
Emilio Cobos Álvarez
79e2754796 Bug 1831539 - Remove HasBoxFFI. r=boris
HasBoxFFI and HasArcFFI aren't great, see bug 1831242 as for examples of
why.

HasArcFFI requires a bit more care, but HasBoxFFI doesn't give us much
benefit. Instead use the same type in the FFI boundary.

Differential Revision: https://phabricator.services.mozilla.com/D177252
2023-05-09 11:07:26 +00:00
Boris Chiou
b0d23e1251 Bug 1677844 - Let getAnimations() return scroll animations with null timeline. r=webidl,smaug,emilio
This is a tentative way to avoid any timeout in WPT because other
brower vendors may expect getAnimations() works for scroll animations.

The original implementation is error-prone because the user can use the
declarative way to create a CSS animation associated with the document-timeline,
and then changes animation-timeline property to any other scroll-timeline.
If the user calls getAnimations() before changing its style, we still expose
the Animation objects in JS and may crash or have other unexpected bahaviors
if the user tries to access Animation.timeline.

Besides, another benefit of this patch is that we can use other Web Animation
APIs for scroll animations in WPT, e.g. Animation.ready.

Differential Revision: https://phabricator.services.mozilla.com/D176966
2023-05-03 22:49:21 +00:00
Emilio Cobos Álvarez
c1c1e7460b Bug 1829225 - Make BeforeSetAttr take the parsed nsAttrValue. r=smaug
ParseAttribute ideally would be const (see bug 1829138), but the SVG and
SMIL code is rather messy. Still, now that BeforeSetAttr can't really
fail, swapping the order of ParseAttribute and BeforeSetAttr shouldn't
really change behavior.

Sorry for the extra `virtual` keyword removal and such. I had to do this
one by hand unlike the dependent bugs, and I went a bit drive-by, lmk if
you want me to split those changes.

Differential Revision: https://phabricator.services.mozilla.com/D176086
2023-04-21 09:25:17 +00:00
Emilio Cobos Álvarez
ded1458b5b Bug 1829189 - Make OnAttrSetButNotChanged and AfterSetAttr infallible. r=smaug
Same rg + sed shenanigans as the first patch.

There were two that could fail, both due to OOM:

 * HTMLInputElement::AfterSetAttr: If we fail (only in the type=range
   case) we end up with an old value without it being clamped by
   min/max/step.

 * HTMLBodyElement::AfterSetAttr: If we fail we won't peek up the
   DocShell's frame margins and styling could be incorrect.

That seems better than having to deal with broken states after we've
already set the attribute.

Depends on D176069

Differential Revision: https://phabricator.services.mozilla.com/D176070
2023-04-21 08:56:27 +00:00
Emilio Cobos Álvarez
c881eb2941 Bug 1829189 - Make BeforeSetAttr infallible. r=smaug
rg BeforeSetAttr -l | xargs sed -i 's/nsresult BeforeSetAttr/void BeforeSetAttr/g'
  rg ::BeforeSetAttr -l | xargs sed -i 's/nsresult \(.*\)::BeforeSetAttr/void \1::BeforeSetAttr/g'

Plus trivial fixes, plus clang-format.

The only meaningful changes are in nsXULElement::BeforeSetAttr. Two
things could fail:

chromemargin: I removed it because we don't use the parsed attribute any
other place than here:

  https://searchfox.org/mozilla-central/rev/31f5847a4494b3646edabbdd7ea39cb88509afe2/dom/xul/ChromeObserver.cpp#136

And that deals just fine with it not being parsed.

usercontextid: We have a debug assertion that we don't dynamically change it.
I kept it but I don't think it's worth failing to set the attribute on release for that

Differential Revision: https://phabricator.services.mozilla.com/D176069
2023-04-21 08:56:27 +00:00