Commit Graph
64 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
Jan-Niklas Jaeschke 64079ed7ab Bug 1974784 - Customizable Select: Support options inside wrapper elements. r=emilio
Extends the option list, disabled state, and optgroup notification logic to
handle options nested inside wrapper elements (e.g. <div> inside <select>),
per the spec's "list of options" and "concept-option-disabled" algorithms.

Differential Revision: https://phabricator.services.mozilla.com/D290555
2026-06-03 19:06:13 +00:00
Jan-Niklas Jaeschke 03b7ff43b3 Bug 2038588 - Customizable Select: Implement selectedcontent update machinery. r=emilio
Implements the algorithms that keep <selectedcontent> elements in sync with
the selected <option>: RunSelectednessSettingAlgorithm (replaces
CheckSelectSomething), ScheduleSelectedContentUpdate /
UpdateDescendantSelectedContentElements (microtask-based), per-element
CloneOptionIntoSelectedContent, and HTMLSelectedContentElement BindToTree
disabled computation per PR #12263.

Differential Revision: https://phabricator.services.mozilla.com/D290554
2026-06-03 19:06:11 +00:00
Alexandru Marc 244264d460 Revert (Bug 1974784, Bug 2038588) for causing wpt failures @ options-length-too-large.html
This reverts commit f8f9651896.

Revert "Bug 2038588 - Customizable Select: Implement selectedcontent update machinery. r=emilio"

This reverts commit 0d1eba0a10.
2026-06-02 15:29:25 +00:00
Jan-Niklas Jaeschke f8f9651896 Bug 1974784 - Customizable Select: Support options inside wrapper elements. r=emilio
Extends the option list, disabled state, and optgroup notification logic to
handle options nested inside wrapper elements (e.g. <div> inside <select>),
per the spec's "list of options" and "concept-option-disabled" algorithms.

Differential Revision: https://phabricator.services.mozilla.com/D290555
2026-06-01 12:55:52 +00:00
Jan-Niklas Jaeschke 0d1eba0a10 Bug 2038588 - Customizable Select: Implement selectedcontent update machinery. r=emilio
Implements the algorithms that keep <selectedcontent> elements in sync with
the selected <option>: RunSelectednessSettingAlgorithm (replaces
CheckSelectSomething), ScheduleSelectedContentUpdate /
UpdateDescendantSelectedContentElements (microtask-based), per-element
CloneOptionIntoSelectedContent, and HTMLSelectedContentElement BindToTree
disabled computation per PR #12263.

Differential Revision: https://phabricator.services.mozilla.com/D290554
2026-06-01 12:55:50 +00:00
Emilio Cobos Álvarez b9a0d71900 Bug 2034055 - Make HTMLOptionsCollection use nsContentList. r=dom-core,smaug
Make nsIHTMLCollection the first base for nsContentList and co, since
it's needed for WebIDL bindings to work properly and shouldn't change
behavior in practice.

Move the handling of selected option and validity to HTMLSelectElement's
mutation observer.

Differential Revision: https://phabricator.services.mozilla.com/D295818
2026-04-28 07:38:24 +00:00
agoloman 8d40053465 Revert "Bug 2034055 - Make HTMLOptionsCollection use nsContentList. r=dom-core,smaug" for causing failures @nsContentList.cpp.
This reverts commit fd37a5a8cb.
2026-04-28 06:17:53 +00:00
Emilio Cobos Álvarez fd37a5a8cb Bug 2034055 - Make HTMLOptionsCollection use nsContentList. r=dom-core,smaug
Make nsIHTMLCollection the first base for nsContentList and co, since
it's needed for WebIDL bindings to work properly and shouldn't change
behavior in practice.

Move the handling of selected option and validity to HTMLSelectElement's
mutation observer.

Differential Revision: https://phabricator.services.mozilla.com/D295818
2026-04-27 23:07:56 +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
serge-sans-paille a10c90dafb Bug 2009953 - Do not use reserved identifiers for macro guard in dom r=media-playback-reviewers,dom-storage-reviewers,dom-worker-reviewers,dom-core,smaug,edenchuang,padenot
Differential Revision: https://phabricator.services.mozilla.com/D278786
2026-01-14 21:29:17 +00:00
Alice Boxhall d5493de262 Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug
This change adds attr-associated element observers, which observe changes in the element associated with a single-element attribute.
For example, if an element has an attribute |attr| with a value |value|, and an AttrTargetObserver has been added for |attr| on that element, the observer would fire if an element with an ID matching |value| was added to the element's document or shadow root.

Attr-associated element observers are tracked in mAttrElementObserverMap in an element's nsExtendedDOMSlots.

An attr-associated element can change in multiple ways:
- The attribute value changes;
- An element matching the content attribute value is added or removed from the element's document or shadow root;
- The explicitly-set attr element is added or removed from the element's document or shadow root;
- The resolved reference target for the explicitly set attr-element or the element whose ID matches the string value of the attribute changes.

The resolved reference target can likewise change in multiple ways:
- The referenceTarget property of the element's shadow root is added, changed or removed;
- An element whose ID matches the element's shadow root's referenceTarget value is added or removed from the shadow root;
- The resolved reference target of the element whose ID matches the shadow root's referenceTarget value changes.

These changes are tracked via reference target change observers, which observe changes to an element's resolved reference target.
Reference target change observers are added on the host element's document or shadow root, and fired when one of the above circumstances occurs.

Differential Revision: https://phabricator.services.mozilla.com/D261367
2026-01-14 18:03:46 +00:00
Sandor Molnar 8faede9a1f Revert "Bug 1981349 - Add referenceTarget support for label/for, label wrapped and output/for. r=credential-management-reviewers,webidl,dimi,Jamie,smaug" for causing accessibility crashes (bug 2008970)
This reverts commit d46abe6d76.

Revert "Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug"

This reverts commit df11a4666d.

Revert "Bug 1981345 - Implement referenceTarget support for multiple element attributes. r=dom-core,Jamie,smaug"

This reverts commit 89cc779f5e.

Revert "Bug 1984685 - Refactor: consistently return Maybe<nsTArray<RefPtr<Element>>> when getting attr-associated elements, and key AttrRelProviders on nsAtom rather than nsString. r=dom-core,morgan,Jamie,smaug"

This reverts commit 33130e712d.

Revert "Bug 1981344 - Implement referenceTarget support for single-element attributes. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,emilio,keithamus,smaug,mtigley"

This reverts commit d6440c4cae.

Revert "Bug 1983766 - Split single element attribute getters into bindings/internals versions. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,smaug,keithamus,jwatt,mtigley"

This reverts commit 83b70e0645.

Revert "Bug 1989323 - Make `referenceTarget` IDL attributes on ShadowRoot, HTMLTemplateElement and ShadowRootInit nullable. r=dom-core,webidl,saschanaz,smaug"

This reverts commit 3a0b29121e.
2026-01-07 16:08:51 +00:00
Alice Boxhall df11a4666d Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug
This change adds attr-associated element observers, which observe changes in the element associated with a single-element attribute.
For example, if an element has an attribute |attr| with a value |value|, and an AttrTargetObserver has been added for |attr| on that element, the observer would fire if an element with an ID matching |value| was added to the element's document or shadow root.

Attr-associated element observers are tracked in mAttrElementObserverMap in an element's nsExtendedDOMSlots.

An attr-associated element can change in multiple ways:
- The attribute value changes;
- An element matching the content attribute value is added or removed from the element's document or shadow root;
- The explicitly-set attr element is added or removed from the element's document or shadow root;
- The resolved reference target for the explicitly set attr-element or the element whose ID matches the string value of the attribute changes.

The resolved reference target can likewise change in multiple ways:
- The referenceTarget property of the element's shadow root is added, changed or removed;
- An element whose ID matches the element's shadow root's referenceTarget value is added or removed from the shadow root;
- The resolved reference target of the element whose ID matches the shadow root's referenceTarget value changes.

These changes are tracked via reference target change observers, which observe changes to an element's resolved reference target.
Reference target change observers are added on the host element's document or shadow root, and fired when one of the above circumstances occurs.

Differential Revision: https://phabricator.services.mozilla.com/D261367
2026-01-06 16:16:26 +00:00
iulian moraru e162366a25 Revert "Bug 1981349, Bug 1981346, Bug 1981345, Bug 1984685, Bug 1981344, Bug 1983766, Bug 1989323 - Add referenceTarget support for label/for, label wrapped and output/for. r=credential-management-reviewers,webidl,dimi,Jamie,smaug" for causing android build bustages.
This reverts commit 1b5cf4cdf8.

Revert "Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug"

This reverts commit 2394d9205a.

Revert "Bug 1981345 - Implement referenceTarget support for multiple element attributes. r=dom-core,Jamie,smaug"

This reverts commit 571a17ff82.

Revert "Bug 1984685 - Refactor: consistently return Maybe<nsTArray<RefPtr<Element>>> when getting attr-associated elements, and key AttrRelProviders on nsAtom rather than nsString. r=dom-core,morgan,Jamie,smaug"

This reverts commit 3b389fdd62.

Revert "Bug 1981344 - Implement referenceTarget support for single-element attributes. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,emilio,keithamus,smaug,mtigley"

This reverts commit 5cc2a12756.

Revert "Bug 1983766 - Split single element attribute getters into bindings/internals versions. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,smaug,keithamus,jwatt,mtigley"

This reverts commit 68e2d26aa9.

Revert "Bug 1989323 - Make `referenceTarget` IDL attributes on ShadowRoot, HTMLTemplateElement and ShadowRootInit nullable. r=dom-core,webidl,saschanaz,smaug"

This reverts commit 1234b31599.
2025-12-24 15:16:52 +00:00
Alice Boxhall 2394d9205a Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug
This change adds attr-associated element observers, which observe changes in the element associated with a single-element attribute.
For example, if an element has an attribute |attr| with a value |value|, and an AttrTargetObserver has been added for |attr| on that element, the observer would fire if an element with an ID matching |value| was added to the element's document or shadow root.

Attr-associated element observers are tracked in mAttrElementObserverMap in an element's nsExtendedDOMSlots.

An attr-associated element can change in multiple ways:
- The attribute value changes;
- An element matching the content attribute value is added or removed from the element's document or shadow root;
- The explicitly-set attr element is added or removed from the element's document or shadow root;
- The resolved reference target for the explicitly set attr-element or the element whose ID matches the string value of the attribute changes.

The resolved reference target can likewise change in multiple ways:
- The referenceTarget property of the element's shadow root is added, changed or removed;
- An element whose ID matches the element's shadow root's referenceTarget value is added or removed from the shadow root;
- The resolved reference target of the element whose ID matches the shadow root's referenceTarget value changes.

These changes are tracked via reference target change observers, which observe changes to an element's resolved reference target.
Reference target change observers are added on the host element's document or shadow root, and fired when one of the above circumstances occurs.

Differential Revision: https://phabricator.services.mozilla.com/D261367
2025-12-24 13:41:54 +00:00
serge-sans-paille 1f953987a5 Bug 1993127 - Remove unused inclusion of Attributes.h from dom/* r=emilio,media-playback-reviewers,webrtc-reviewers,firefox-svg-reviewers,mjf,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D269713
2025-10-24 08:54:35 +00:00
Jan-Niklas Jaeschke 3c4c3d7c9a Bug 1951607 - nsFind should find <options> inside an <optgroup>. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D269163
2025-10-19 17:58:48 +00:00
Masayuki Nakano b2e5258254 Bug 769207 - part 5: Make Element::GetAttributeChangeHit() use AttrModType r=smaug,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D263056
2025-09-08 00:27:48 +00:00
Jan-Niklas Jaeschke cb161a6f96 Bug 1949053, part 3 - Rename nsIContent::GetText() to GetCharacterDataBuffer(). r=masayuki,layout-reviewers,emilio
This patch renames the `nsIContent` interface that returns a `CharacterDataBuffer`
and also renames the variables its result is assigned to at the call sites.

Differential Revision: https://phabricator.services.mozilla.com/D259934
2025-08-06 08:48:05 +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
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
Emilio Cobos Álvarez 76e9b5e83c Bug 1850293 - Make CHECKED/DEFAULT states not intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D186933
2023-08-30 09:18:31 +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 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
Emilio Cobos Álvarez 1c58e2a928 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Kagami Sascha Rosylight ece003e2d3 Bug 1768189 - Part 13: Apply modernize-concat-nested-namespaces to dom/html/HTMLIFrameElement.h ... r=andi
Depends on D145746

Differential Revision: https://phabricator.services.mozilla.com/D145747
2022-05-09 20:41:08 +00:00
Emilio Cobos Álvarez 18ac57750d Bug 1744009 - Accessibility fixes for new combobox layout code. r=eeejay
In terms of the C++ code, this patch does basically one thing, which is
allowing creating option / optgroup accessibles without a frame for
comboboxes, and tracking mutations like layout does.

It seems this should be straight-forward, but handling mutations got a
bit complicated. We don't want to forcibly re-create accessibles, so we
want to re-use the PruneOrInsertSubtree logic that ContentInserted uses.

But determining whether we need to create the accessible requires
having flushed styles, so I added a ScheduleAccessibilitySubtreeUpdate
API to trigger that from WillRefresh once style and layout are
up-to-date.

The rest of the test updates should be sort of straight-forward. They
reflect two changes:

 * <option> accessibles are leaves now (so they don't have text
   children). Note that we still have the right native name and so on,
   using the same logic we use to render the label.

 * In 1proc tests, the focus no longer goes to the <option>, and uses
   the same code-path that e10s does (moving focus to a <menulist> in
   the parent process). Since that wasn't easy to test for (afaict) and
   we have browser tests to cover that
   (browser_treeupdate_select_dropdown.js, etc), I've decided to just
   remove the tests that relied on the previous code-path, as they were
   testing for a codepath that users weren't hitting anyways.

I've tested this with JAWS and Orca and behavior seems unchanged to my
knowledge.

Differential Revision: https://phabricator.services.mozilla.com/D133098
2022-01-17 11:10:05 +00:00
Marian-Vasile Laza 84e23c5194 Backed out 2 changesets (bug 1744009) for causing reftest failures on select-3.html.
Backed out changeset 3e44e31d3d12 (bug 1744009)
Backed out changeset 619389788775 (bug 1744009)
2022-01-17 11:14:27 +02:00
Emilio Cobos Álvarez 00074abb69 Bug 1744009 - Accessibility fixes for new combobox layout code. r=eeejay
In terms of the C++ code, this patch does basically one thing, which is
allowing creating option / optgroup accessibles without a frame for
comboboxes, and tracking mutations like layout does.

It seems this should be straight-forward, but handling mutations got a
bit complicated. We don't want to forcibly re-create accessibles, so we
want to re-use the PruneOrInsertSubtree logic that ContentInserted uses.

But determining whether we need to create the accessible requires
having flushed styles, so I added a ScheduleAccessibilitySubtreeUpdate
API to trigger that from WillRefresh once style and layout are
up-to-date.

The rest of the test updates should be sort of straight-forward. They
reflect two changes:

 * <option> accessibles are leaves now (so they don't have text
   children). Note that we still have the right native name and so on,
   using the same logic we use to render the label.

 * In 1proc tests, the focus no longer goes to the <option>, and uses
   the same code-path that e10s does (moving focus to a <menulist> in
   the parent process). Since that wasn't easy to test for (afaict) and
   we have browser tests to cover that
   (browser_treeupdate_select_dropdown.js, etc), I've decided to just
   remove the tests that relied on the previous code-path, as they were
   testing for a codepath that users weren't hitting anyways.

I've tested this with JAWS and Orca and behavior seems unchanged to my
knowledge.

Differential Revision: https://phabricator.services.mozilla.com/D133098
2022-01-16 23:31:23 +00:00
Emilio Cobos Álvarez 6483b32fe7 Bug 40545 - Fix the empty-label attribute case in the select popup. r=chutten
And rename GetRenderLabel to GetRenderedLabel, as it's a slightly more
descriptive name IMHO.

Differential Revision: https://phabricator.services.mozilla.com/D69837
2020-04-06 16:43:17 +00:00
Chris H-C bd97e241a8 Bug 40545 - Options to use label attribute when present r=emilio,jfkthame,mats
According to spec, option elements with label attributes should show and use
those labels rather than their element text. So let's do that.

Requires some trickery because the option element is a block element (so it
lays out its width based on its text content) so we put its label (if it has
one) in its ::before and skip frame generation so it measures the text of its
label, not of its text node children.

Differential Revision: https://phabricator.services.mozilla.com/D63545
2020-04-06 16:06:36 +00:00
Gurzau Raul 7488b7888f Backed out changeset 813e1405e501 (bug 40545) for Android failures at test_bug659596.html on a CLOSED TREE. 2020-04-01 19:35:32 +03:00
Chris H-C b9fca9539f Bug 40545 - Options to use label attribute when present r=emilio,jfkthame,mats
According to spec, option elements with label attributes should show and use
those labels rather than their element text. So let's do that.

Requires some trickery because the option element is a block element (so it
lays out its width based on its text content) so we put its label (if it has
one) in its ::before and skip frame generation so it measures the text of its
label, not of its text node children.

Differential Revision: https://phabricator.services.mozilla.com/D63545
2020-04-01 09:20:21 +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
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
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
Nathan Froyd f93834868a Bug 1492894 - part 1 - make the node hierarchy consistently constructed with NodeInfo&&; r=mccr8
Various places in dom/ use the pattern:

  already_AddRefed<NodeInfo> ni = ...;

which is supposed to be disallowed by our static analysis code, but
isn't, for whatever reason.  To fix our static analysis code, we need to
eliminate instances of the above pattern.

Unfortunately, eliminating this pattern requires restructuring how Nodes
are created.  Most Node subclasses take `already_AddRefed<NodeInfo>&` in
their constructors, and a few accept `already_AddRefed<NodeInfo>&&`.  We
need to enforce the latter pattern consistently, which requires changing
dozens of source files.
2018-09-21 16:45:49 -04:00
Emilio Cobos Álvarez 693b3d3877 Bug 1481601 - Remove now-useless aPreallocateChildren from nsINode::Clone() and friends. r=bzbarsky
Since sed on multiple lines ended up being such a pain and I didn't end up
writing a script for this because I didn't think it'd end up being so boring, I
may have made a couple cleanups here and there as well...

Differential Revision: https://phabricator.services.mozilla.com/D2887
2018-08-08 23:58:44 +00:00
Emilio Cobos Álvarez bc847c0eef Bug 1479860: Remove unused aCompileEventHandlers argument from BindToTree. r=bz
Mostly automatic via sed. Only parts which I touched manually (apart from a
couple ones where I fixed indentation or which had mispelled arguments) are the
callers. I may have removed a couple redundant `virtual` keywords as well when
I started to do it manually, I can revert those if wanted.

Most of them are just removing the argument, but in Element.cpp I also added an
assertion for GetBindingParent when binding the ShadowRoot's kids (the binding
parent is set from the ShadowRoot constructor, and I don't think we bind a
shadow tree during unlink or what not which could cause a behavior difference).

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

MozReview-Commit-ID: 2oIgatty2HU
2018-08-01 10:42:54 +02:00
Boris Zbarsky da3d4d37a5 Bug 1449404 part 1. Get rid of nsIContent::SetText. r=mccr8 2018-03-28 18:01:46 -04:00
Boris Zbarsky 6ea42abd76 Bug 1447098 part 2. Rename the NS_IMPL_FROMCONTENT macros to NS_IMPL_FROMNODE. r=mystor 2018-03-21 17:39:04 -04:00
Emilio Cobos Álvarez 3d1dcd443d Bug 1405087: Make nsGenericHTMLElement::IsDisabled not virtual. r=bz
The state bit is never added to object / output anyway (see the CanBeDisabled
check).

MozReview-Commit-ID: DBPpaHA2tME
2018-02-15 21:49:00 +01:00
Boris Zbarsky be90e72263 Bug 1436902 part 3. Replace usage of NS_IMPL_ISUPPORTS_INHERITED0 with NS_INLINE_DECL_REFCOUNTING_INHERITED when possible. r=mccr8
The change to RootAccessible.cpp fixes an obvious bug introduced in bug 741707.

The visibility changes in gfx/thebes are because NS_DECL_ISUPPORTS has a
trailing "public:" that those classes were relying on to have public
constructors.

MozReview-Commit-ID: IeB8KIJCGhU
2018-02-12 15:44:40 -05:00
Kyle Machulis f535f1d0dd Bug 1415716 - Remove nsIDOMHTMLOptionElement; r=bz
MozReview-Commit-ID: JGxQxeFBQlO
2017-11-08 17:43:09 -08:00
Kris Maglione 5f00cf0c65 Bug 1406278: Part 1 - Pass subject principal to SetAttribute and friends. r=bz
In order to tailor certain security checks to the caller that is attempting to
load a particular piece of content, we need to be able to attach an
appropriate triggering principal to the corresponding requests. Since most
HTML content is loaded based on attribute values, that means capturing the
subject principal of the caller who sets those attributes, which means making
it available to AfterSetAttr hooks.

MozReview-Commit-ID: BMDL2Uepg0X
2017-10-09 14:33:38 -07:00
Nicholas Nethercote 7dbfdaf890 Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP
2017-10-03 09:05:19 +11:00