Commit Graph
74 Commits
Author SHA1 Message Date
Daniel Holbert 648f3a95c5 Bug 2044510: Pass already_AddRefed types by-value instead of by rvalue reference, in dom/html. r=dom-core-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D304360
2026-06-05 21:06:40 +00:00
Keith Cirkel 4517bc15ec Bug 1974383 - Implement headingoffset r=dom-core,accessibility-platform-reviewers,webidl,firefox-style-system-reviewers,smaug,emilio,Jamie,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D255837
2026-05-21 22:31:44 +00:00
Serban Stanca 7e965b9c73 Revert "Bug 1974383 - Implement headingoffset r=dom-core,accessibility-platform-reviewers,webidl,firefox-style-system-reviewers,smaug,emilio,Jamie,saschanaz" for causing non-unified build bustages in nsINode.h.
This reverts commit 1b706d0c7c.
2026-05-21 15:10:51 +00:00
Keith Cirkel 1b706d0c7c Bug 1974383 - Implement headingoffset r=dom-core,accessibility-platform-reviewers,webidl,firefox-style-system-reviewers,smaug,emilio,Jamie,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D255837
2026-05-21 14:08:16 +00:00
Serban Stanca 641847c817 Revert "Bug 1974383 - Implement headingoffset r=dom-core,accessibility-platform-reviewers,webidl,firefox-style-system-reviewers,smaug,emilio,Jamie,saschanaz" for causing build bustages in RemoteAccessible.cpp.
This reverts commit 01c40e5a58.
2026-05-21 09:39:07 +00:00
Keith Cirkel 01c40e5a58 Bug 1974383 - Implement headingoffset r=dom-core,accessibility-platform-reviewers,webidl,firefox-style-system-reviewers,smaug,emilio,Jamie,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D255837
2026-05-21 09:04:53 +00:00
Vincent Hilla cced3864f3 Bug 2015010 - Reset dir=auto elements if a slot descendant is removed. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D282352
2026-04-13 06:45:31 +00:00
Jan-Niklas Jaeschke 00b1b0666c Bug 2014596 - Fix manual slot reassignment across different shadow roots. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D282015
2026-03-30 11:28:49 +00:00
Emilio Cobos Álvarez 5a68a62e93 Bug 2024654 - Simplify ShadowRoot::InvalidateStyleAndLayoutOnSubtree. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D288958
2026-03-24 13:32:10 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Sandor Molnar f72b160909 Revert "Bug 2015010 - Reset dir=auto elements if a slot descendant is removed. r=dom-core,smaug" for causing crashes @ mozilla::dom::Element::State
This reverts commit f320ddc6fb.
2026-02-27 18:02:05 +00:00
Vincent Hilla f320ddc6fb Bug 2015010 - Reset dir=auto elements if a slot descendant is removed. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D282352
2026-02-27 16:25:20 +00:00
Emilio Cobos Álvarez 5a4023b87b Bug 2018012 - Don't try to unassign from the wrong slot when using manual assignment. r=dom-core,farre
When calling HTMLSlotElement.assign(), we might end up removing the
manual assignment from an earlier slot.

That was unconditionally calling RemoveAssignedSlot tho, even if we
weren't in a manually-assigned shadow tree, causing the flat tree to end
up in an inconsistent state.

Differential Revision: https://phabricator.services.mozilla.com/D284171
2026-02-20 08:23:34 +00:00
Emilio Cobos Álvarez 2a3733e687 Bug 2006613 - Optimize front-removal of various tree-ordered-arrays. r=smaug
The previous approach wasn't quite sound, because it makes the frame
constructor receive the WillBeRemoved after the flat tree has already
changed.

Instead, what do you think about something like this? This creates a
very simple wrapper over an array, but special-cases removals from the
front, and uses it for TreeOrderedArray and also AssignedNodes...

It could be polished (in particular there are a few places where an
Span::IndexOf operator could be beneficial and so).

Differential Revision: https://phabricator.services.mozilla.com/D277301
2025-12-22 21:03:58 +00:00
Norisz Fay ac500ea570 Revert "Bug 2006613 - Optimize front-removal of various tree-ordered-arrays. r=smaug" for causing multiple failures and bustages
This reverts commit 4d02f992d0.
2025-12-22 19:45:18 +00:00
Emilio Cobos Álvarez 4d02f992d0 Bug 2006613 - Optimize front-removal of various tree-ordered-arrays. r=smaug
The previous approach wasn't quite sound, because it makes the frame
constructor receive the WillBeRemoved after the flat tree has already
changed.

Instead, what do you think about something like this? This creates a
very simple wrapper over an array, but special-cases removals from the
front, and uses it for TreeOrderedArray and also AssignedNodes...

It could be polished (in particular there are a few places where an
Span::IndexOf operator could be beneficial and so).

Differential Revision: https://phabricator.services.mozilla.com/D277301
2025-12-22 18:35:29 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Keith Cirkel ad1d0fba6e Bug 1942520 - Make :has-slotted apply to flattened nodes r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D234801
2025-01-20 12:44:22 +00:00
Butkovits Atila ec15f930fd Backed out changeset 812dd19d804a (bug 1942520) foe causing linting failures. CLOSED TREE 2025-01-20 10:07:54 +02:00
Keith Cirkel d41c0fbcec Bug 1942520 - Make :has-slotted apply to flattened nodes r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D234801
2025-01-20 07:38:19 +00:00
Peter Van der Beken e893266a0e Bug 1926226 - Use only one reserved slot for reflected attributes returning a FrozenArray. r=edgar
HTML reflected IDL attributes that return a FrozenArray<T>? need to cache the
FrozenArray. This switches them from using a reserved slot on the JS object
per attribute to using an array of values for all of these types of attributes
for a particular interface, which is then stored in one reserved slot on the JS
object. This reduces the memory reserved for these attributes if they're not
actually used.

Differential Revision: https://phabricator.services.mozilla.com/D228797
2024-11-18 16:03:39 +00:00
keithamus 0c13b39944 Bug 1921747 - Implement :has-slotted pseudo r=emilio
https://drafts.csswg.org/css-scoping-1/#the-has-slotted-pseudo

Differential Revision: https://phabricator.services.mozilla.com/D224227
2024-10-11 23:49:01 +00:00
Vincent Hilla be572d5a4c Bug 1876163 - Part 3: Track whether node affects assigned dir=auto slot of ancestor. r=emilio,smaug
Along the parent chain of a node, multiple ancestors can be assigned to dir=auto slots that the element then impacts. The flag NodeAncestorHasDirAuto is therefore not sufficient anymore.

Depends on D208338

Differential Revision: https://phabricator.services.mozilla.com/D209704
2024-07-09 08:00:34 +00:00
Emilio Cobos Álvarez 7506fc5879 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
Markus Stange 70bd936589 Bug 1843484 - Use EventTarget* instead of nsISupports* for the event target parameter of the nsContentUtils::Dispatch methods. r=smaug
This saves a few queryInterface calls on the hot path.

Differential Revision: https://phabricator.services.mozilla.com/D186976
2023-08-28 23:38:42 +00:00
Gregory Pappas 032c41bdb2 Bug 1849674 - Remove dom.shadowdom.slot.assign.enabled pref r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D186675
2023-08-23 02:16:48 +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
Jens Stutte 237f5e836a Bug 1797688 - Part 3: Bail out from HTMLSlotElement::EnqueueSlotChangeEvent InOrBeyond(XPCOMShutdownThreads). r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D160621
2022-11-01 14:08:43 +00:00
Emilio Cobos Álvarez b5402b54a2 Bug 1752694 - Invalidate layout before moving out of mAssignedNodes. r=sefeng
Otherwise we won't clear frames / style data from the assigned nodes.
I'm surprised there's no existing test catching this.

Differential Revision: https://phabricator.services.mozilla.com/D137662
2022-02-03 21:52:20 +00:00
Sean Feng 77b0fcd5d6 Bug 1705141 - Implement imperative slotting API r=smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D119444
2021-07-20 18:06:25 +00:00
Sean Feng e9b2edcf31 Bug 1705141 - Move the usage of SlotAssignedNodeChanged into (Insert|Append|Remove)AssignedNode functions r=smaug
According to our current usage, I don't see a case where we need to call
SlotAssignedNodeChanged without acutally moving the node. So this patch
just simpifies that behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D119443
2021-07-20 18:06:25 +00:00
Simon Giesecke 46908cfb51 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 68b806d604 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 a6e7dcc53f Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru 8f709b39e8 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
Simon Giesecke a69d79b6db 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
Simon Giesecke c60d689f7c Bug 1626570 - Improve handling of copying arrays in dom/html/. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D73647
2020-05-07 08:09:51 +00:00
Sean Feng e2b8b11349 Bug 1377999 - Make HTML Element to adapt the DOMArena changes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D57699
2020-03-17 14:53:08 +00:00
Simon Giesecke 9bcfd47601 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-13 14:38:48 +00:00
shindli 6bb3487209 Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke d45525793f Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-12 17:24:41 +00:00
Emilio Cobos Álvarez 6a1b8b7f27 Bug 1554498 - Don't use nsIMutationObserver for ShadowRoot. r=smaug
This penalizes a bit non-shadow-DOM content, in exchange of making Shadow DOM
slightly faster as well.

The biggest advantage of this is that all ContentRemoved notifications would see
the flattened tree before the changes, which is something a11y needs to be
correct.

XBL would still not be handled right by a11y, but that's not new and content
cannot do random stuff with XBL so it's not too bad.

Differential Revision: https://phabricator.services.mozilla.com/D32639
2019-08-27 22:10:46 +00:00
Emilio Cobos Álvarez a3b32df884 Bug 1555216 - Change the signature of BindToTree to be (BindContext&, nsINode& aParentNode). r=bzbarsky
BindContext was going to have way more information at first, but then I realized
that most of the things I wanted to know were basically a flag away using the
parent node.

Still I think it's worth it, now experimenting with BindToTree will only mean
adding a field to a struct that's included from a couple cpp files, instead of a
massive pain.

I also think this is clearer, and doing this highlights quite a few
inconsistencies in our code which I've left untouched, but commented with
FIXMEs.

Steps are:

$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsresult BindToTree(Document\* aDocument, nsIContent\* aParent,#nsresult BindToTree(BindContext\&, nsINode\& aParent)#g' $file; done
$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#                      nsIContent\* aBindingParent) override#override#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(Document\* aDocument, nsIContent\* aParent,#::BindToTree(BindContext\& aContext, nsINode\& aParent)#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsIContent\* aBindingParent)##g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(aDocument, aParent, aBindingParent)#::BindToTree(aContext, aParent)#g' $file; done
$ ./mach clang-format

Then manual fixups.

Depends on D32948

Differential Revision: https://phabricator.services.mozilla.com/D32949
2019-05-31 23:31:52 +02:00
Emilio Cobos Álvarez 9160cd2967 Bug 1555143 - Remove unused aDeep argument from UnbindFromTree. r=bzbarsky
$ for file in $(rg UnbindFromTree | cut -d : -f 1 | sort | uniq); do sed -i 's#UnbindFromTree(bool aDeep = true,#UnbindFromTree(#g' $file; done
$ for file in $(rg UnbindFromTree | cut -d : -f 1 | sort | uniq); do sed -i 's#UnbindFromTree(bool aDeep,#UnbindFromTree(#g' $file; done
$ for file in $(rg UnbindFromTree | cut -d : -f 1 | sort | uniq); do sed -i 's#UnbindFromTree(aDeep,#UnbindFromTree(#g' $file; done
$ ./mach clang-format

And fix the two callers and little use of the aDeep argument (see the "Manual
changes" patch attached to bug).

Differential Revision: https://phabricator.services.mozilla.com/D32898
2019-05-28 22:47:08 +00:00
Edgar Chen c2387a86e0 Bug 1425685 - Implement HTMLSlotElement.assignedElements(); r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D15653
2019-01-03 19:14:12 +00:00
Emilio Cobos Álvarez dc336a73ba Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Emilio Cobos Álvarez e461afa617 Bug 1516853 - Merge nsIDocument and nsDocument. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D15498
2018-12-31 14:10:19 +00:00
Sylvestre Ledru e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00