Commit Graph

376 Commits

Author SHA1 Message Date
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
606f8a8fbc Bug 1614654 - Simplify property handling during adoption. r=smaug
We don't need to transfer all properties after adopt. Collecting all the nodes
with properties during adopt was needed because there used to be clone and adopt
user-data callbacks, see https://bugzilla.mozilla.org/show_bug.cgi?id=347524.

This ensures that NodeInfoChanged and similar callbacks can tweak node
properties, which is needed for bug 1542784.

Also simplify surrounding code. As far as I can tell we should always have
different documents if we get a NodeInfoManager object.

Differential Revision: https://phabricator.services.mozilla.com/D62439
2020-02-11 16:38:18 +00:00
Emilio Cobos Álvarez
fea80addd7 Bug 1613349 - Rename nsINode::DeleteProperty to RemoveProperty. r=smaug
And the related methods as well.

Differential Revision: https://phabricator.services.mozilla.com/D61768
2020-02-06 16:06:49 +00:00
Emilio Cobos Álvarez
4714f59f93 Bug 1613349 - Rename nsINode::UnsetProperty to nsINode::TakeProperty. r=smaug
For consistency with the previous change for layout.

Depends on D61755

Differential Revision: https://phabricator.services.mozilla.com/D61756
2020-02-05 22:26:20 +00:00
Boris Zbarsky
68a972f25b Bug 1612213 part 1. Switch most consumers of ThrowDOMException to the new methods. r=smaug,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D61267
2020-02-03 20:19:11 +00:00
Mirko Brodesser
25cd1fd155 Bug 1609662: part 16) Move nsRange::IsNodeSelected to nsINode::IsSelected. r=smaug
Make it const-correct too.

Differential Revision: https://phabricator.services.mozilla.com/D60643
2020-01-27 09:25:00 +00:00
Gabriele Svelto
eb403b8785 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
2019-12-06 09:24:56 +00:00
Dorel Luca
67889e1013 Backed out changeset f6e53d1c6518 (bug 1600545) for Android build bustage. CLOSED TREE 2019-12-04 17:32:27 +02:00
Gabriele Svelto
dc6fa2e86c 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
2019-12-04 15:01:19 +00:00
Sylvestre Ledru
0f8c6db00f Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D54686
2019-11-26 14:35:02 +00:00
Emilio Cobos Álvarez
7816f654e9 Bug 1597123 - Remove NODE_IS_ANONYMOUS_ROOT. r=smaug
We no longer have multiple kinds of anonymous subtrees, so we can get back one
node bit.

Differential Revision: https://phabricator.services.mozilla.com/D53344
2019-11-18 08:49:27 +00:00
Emilio Cobos Álvarez
87b1e5bf4d Bug 1596209 - Remove nsIContent::GetBindingParent. r=smaug
It's unused after all the previous patches.

Differential Revision: https://phabricator.services.mozilla.com/D53217
2019-11-15 18:19:37 +00:00
Sebastian Hengst
3f8b7d41c8 Backed out changeset 0478d1bf6e32 (bug 1596209) on request from emilio. CLOSED TREE 2019-11-15 19:11:06 +01:00
Emilio Cobos Álvarez
a97037f571 Bug 1596209 - Remove nsIContent::GetBindingParent. r=smaug
It's unused after all the previous patches.

Differential Revision: https://phabricator.services.mozilla.com/D53217
2019-11-15 16:46:29 +00:00
Emilio Cobos Álvarez
cbaa2caa8c Bug 1596768 - Remove GetBindingParent usage in GetRootForContentSubtree. r=smaug
Shadow DOM is handled above.

And do some minor drive-by cleanups. Unclear why we have both this and the
RangeUtils version.

Depends on D53194

Differential Revision: https://phabricator.services.mozilla.com/D53195
2019-11-15 16:53:19 +00:00
Emilio Cobos Álvarez
370105085d Bug 1596465 - Remove GetBindingParent() usage from nsINode::Contains. r=smaug
And make ShadowRoot.contains() and checking nodes from different shadow trees
faster.

Differential Revision: https://phabricator.services.mozilla.com/D53037
2019-11-15 12:32:37 +00:00
Emilio Cobos Álvarez
e9ad71d0d9 Bug 1596445 - Add some supporting code to nsINode to deal with NAC and shadow DOM separately. r=bzbarsky
We'll use these to remove GetBindingParent.

Differential Revision: https://phabricator.services.mozilla.com/D53029
2019-11-15 15:10:45 +00:00
Emilio Cobos Álvarez
430d23209f Bug 1596455 - Simplify nsIContent::IsInAnonymousSubtree. r=bzbarsky
Now that XBL is gone, the only anonymous subtrees are NAC.

I'd prefer to defer the removal of IsInAnonymousSubtree if possible, as there's
a bunch of patches coming on top of this one :)

Differential Revision: https://phabricator.services.mozilla.com/D53033
2019-11-14 23:09:03 +00:00
Emilio Cobos Álvarez
d3b86f48ae Bug 1596391 - Remove NODE_MAY_BE_IN_BINDING_MNGR. r=smaug
Never set anymore.

Depends on D52993

Differential Revision: https://phabricator.services.mozilla.com/D52994
2019-11-14 12:54:00 +00:00
Brian Grinstead
5c162e767e Bug 1593119 - unifdef MOZ_XBL r=bzbarsky
This was generated with:

```
rg -l -g '*.{cpp,h}' MOZ_XBL . | while read FILE ; do
   echo $FILE
   unifdef -m -UMOZ_XBL $FILE
done
```

After this, I manually removed the directive in nsContentUtils.cpp due to:

  unifdef: ./dom/base/nsContentUtils.cpp: 4630: Unterminated string literal
  unifdef: Output may be truncated

Differential Revision: https://phabricator.services.mozilla.com/D51337
2019-11-07 00:35:13 +00:00
Mirko Brodesser
8462bc2a30 Bug 1593222: part 12) Rename "nsNodeUtils.*" to "MutationObservers.*". r=smaug
Depends on D51827

Differential Revision: https://phabricator.services.mozilla.com/D51828
2019-11-06 09:08:06 +00:00
Mirko Brodesser
0ce85ec381 Bug 1593222: part 9) Move non-animation notification methods from nsNodeUtils to MutationObservers. r=smaug
The remaining notification methods are moved in a separate commit. The
files are renamed to `MutationObservers.*` in a follow-up commit.

Depends on D51824

Differential Revision: https://phabricator.services.mozilla.com/D51825
2019-11-05 21:32:53 +00:00
Mirko Brodesser
6c635b3550 Bug 1593222: part 8) Move nsNodeUtils::CloneAndAdopt to nsINode. r=smaug
Depends on D51823

Differential Revision: https://phabricator.services.mozilla.com/D51824
2019-11-05 21:13:45 +00:00
Mirko Brodesser
6866559dfe Bug 1593222: part 7) Move nsNodeUtils::Adopt to nsINode. r=smaug
Depends on D51821

Differential Revision: https://phabricator.services.mozilla.com/D51823
2019-11-05 20:53:00 +00:00
Mirko Brodesser
603f162c3a Bug 1593222: part 6) Move nsINodeUtils::Clone to nsINode::Clone. r=smaug
Makes `nsNodeUtils::CloneAndAdopt` temporarily public. Will be hidden
again in a follow-up commit.

Depends on D51820

Differential Revision: https://phabricator.services.mozilla.com/D51821
2019-11-05 20:43:53 +00:00
Mirko Brodesser
e2e878dab7 Bug 1593222: part 5) Merge nsNodeUtils::CloneNodeImpl into its only caller. r=smaug
Depends on D51609

Differential Revision: https://phabricator.services.mozilla.com/D51820
2019-11-05 20:25:58 +00:00
Mirko Brodesser
0fbfa6a2bc Bug 1593222: part 4) Move nsNodeUtils::LastRelease to nsINode. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D51609
2019-11-05 14:06:13 +00:00
Mirko Brodesser
212ddebc86 Bug 1593222: part 3) Move nsNodeUtils::GetFirstChildOfTemplateOrNode to nsINode. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D51608
2019-11-05 14:06:05 +00:00
Brendan Dahl
bf272a3bca Bug 1510785 - Only build XBL related code when MOZ_XBL is defined. r=bzbarsky
When XBL is disabled, no code in dom/xbl will be built. Also, adds ifdefs
to remove any of the XBL related code elsewhere. There's definitely more
that can be done here, but I think it's better to wait to do the rest of
the cleanup when we actually remove the code.

Depends on D45612

Differential Revision: https://phabricator.services.mozilla.com/D45613
2019-10-08 23:52:14 +00:00
Boris Zbarsky
dbe73fe0d2 Bug 1581315 part 3. Add MOZ_MUST_RETURN_FROM_CALLER_IF_THIS_IS_ARG to more ErrorResult methods. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D46107
2019-09-20 02:19:18 +00:00
Nicholas Nethercote
c4aacd8403 Bug 1563139 - Remove StaticPrefs.h. r=glandium
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

Differential Revision: https://phabricator.services.mozilla.com/D39138
2019-07-26 01:10:23 +00:00
Mirko Brodesser
a70fbb65b5 Bug 1566046: move nsContentUtils::ContentIsShadowIncludingDescendantOf to nsINode::IsShadowIncludingInclusiveDescendantOf. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D38079
2019-07-16 09:25:02 +02:00
Mirko Brodesser
23b4c95157 Bug 1566046: rename GetParentOrHostNode to GetParentOrShadowHostNode. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D38078
2019-07-16 09:25:02 +02:00
Noemi Erli
481ed55c7b Merge mozilla-central to autoland. a=merge CLOSED TREE 2019-07-16 00:48:17 +03:00
Mirko Brodesser
090d7efc5e Bug 1565584: move nsIContentUtils::ContentIsDescendantOf to nsINode::IsInclusiveDescendantOf. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37880
2019-07-15 10:02:21 +02:00
Boris Zbarsky
5dfb6ce034 Bug 1565767 part 3. Remove some unnecesary refcounting at nsINode::GetBaseURI callsites. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D37971
2019-07-15 17:46:43 +00:00
Boris Zbarsky
1b21e3069f Bug 1565767 part 1. Stop returning addrefed URIs from GetBaseURI(). r=peterv
We only needed this for xml:base.

Differential Revision: https://phabricator.services.mozilla.com/D37969
2019-07-15 17:22:30 +00:00
Emilio Cobos Álvarez
9b6e807979 Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful.

Differential Revision: https://phabricator.services.mozilla.com/D37406
2019-07-09 23:08:05 +02:00
Dorel Luca
7a5944a08d Backed out 5 changesets (bug 1218456) for Crashtest failures on dom/l10n/tests/mochitest/dom_localization/test_overlay.html. CLOSED TREE
Backed out changeset 31afe89c2d42 (bug 1218456)
Backed out changeset 8bd57ebc4528 (bug 1218456)
Backed out changeset e5d37afff36a (bug 1218456)
Backed out changeset e3da86278ecf (bug 1218456)
Backed out changeset 343046089f8e (bug 1218456)
2019-07-09 22:04:13 +03:00
Emilio Cobos Álvarez
19f9994690 Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful.

Differential Revision: https://phabricator.services.mozilla.com/D37406
2019-07-09 16:17:47 +00:00
Mirko Brodesser
904e7e7b99 Bug 1551425: Part 2) Change reference to parent in nsAttrChildContentList from non-owning to RefPtr. r=smaug
With a non-owning reference, a JS reference to the NodeList didn't keep its
items alive. With this change, the NodeList keeps the parent node (which keeps
its children alive) alive.

Differential Revision: https://phabricator.services.mozilla.com/D34151
2019-06-25 06:56:23 +00:00
Zibi Braniecki
64a0cda64c Bug 1552714 - Remove dom::l10n namespace and unify class naming. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D33739
2019-06-06 16:32:58 +00:00
Neil Deakin
8a103f89a4 Bug 1519948, remove XUL box objects, r=bzbarsky 2019-06-04 12:45:55 -04: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
Christoph Kerschbaumer
29451e9f5e Bug 965637: Move CSP from Principal into Client, part 1: backend changes. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D27654
2019-05-21 23:14:27 +00:00
Andrea Marchesini
dfeacd64f2 Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - layout.css.getBoxQuads.enabled, r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D29517
2019-05-01 21:09:58 +00:00
Masayuki Nakano
cf345a4a71 Bug 1547618 - Make dom use mozilla::PresShell rather than via nsIPresShell r=smaug
Additionally, this patch makes `nsContentUtils::DispatchXULCommand()` because
it guarantees the lifetime of **only** `PresShell` in it.  So, we need to check
the lifetime of each argument at each caller here.

Differential Revision: https://phabricator.services.mozilla.com/D29199
2019-04-30 01:35:30 +00:00
Daniel Holbert
e22755d7ab Bug 1547374: Give nsINode.cpp an include for DocumentInlines.h (to provide e.g. inline definition for GetPresContext()). r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D29067
2019-04-26 20:25:46 +00:00
Zibi Braniecki
1a08c2cb39 Bug 1544118 - Move nsINode::localize to use DocumentL10n::TranslateFragment. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D28269
2019-04-24 10:35:37 +00:00
Zibi Braniecki
e7d3e82d3c Bug 1503657 - Migrate nsINode::localize and DOMLocalization.jsm to use DOMOverlays C++. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27201
2019-04-24 05:05:15 +00:00