Граф коммитов

39 Коммитов

Автор SHA1 Сообщение Дата
Chris Peterson 2d4ca059e8 Bug 1691889 - Replace MOZ_MUST_USE with [[nodiscard]] in dom/. r=peterv
The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). Now that we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute.

The [[nodiscard]] attribute must precede a function declaration's declaration specifiers (like static, extern, inline, or virtual). The __attribute__((warn_unused_result)) attribute does not have this order restriction.

Differential Revision: https://phabricator.services.mozilla.com/D107355
2021-03-10 08:19:25 +00:00
Emilio Cobos Álvarez e2c6f319f3 Bug 1694393 - Make it easy to enable nsIContent::List() in opt builds. r=smaug
By using a separate define than DEBUG.

Differential Revision: https://phabricator.services.mozilla.com/D106137
2021-02-23 20:08:13 +00:00
Simon Giesecke f15895390e Bug 1673931 - Avoid including Element.h from header files.
Differential Revision: https://phabricator.services.mozilla.com/D96535

Depends on D96534
2020-11-23 16:08:40 +00:00
Simon Giesecke fbfebfdada Bug 1673931 - Resolve Document/Element cycle. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95045

Depends on D94869
2020-11-23 16:07:21 +00:00
Brian Grinstead 8e592888cb Bug 1593119 - clang-format the files affected by the MOZ_XBL unifdef r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D52057

--HG--
extra : moz-landing-system : lando
2019-11-07 00:35:25 +00:00
Brian Grinstead f19f38776b 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

--HG--
extra : moz-landing-system : lando
2019-11-07 00:35:13 +00:00
Brendan Dahl c68cd30ef2 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

--HG--
extra : moz-landing-system : lando
2019-10-08 23:52:14 +00:00
Masayuki Nakano 3102de8053 Bug 1548389 - part 3: Make editor mark text node in password field as "maybe masked" r=smaug
With the previous patches, editor has stopped masking characters in password
field.  Instead, layout code needs to handle it.  However, layout code
especially around `nsTextFrame` is performance critical area.  Therefore,
layout code requires a quick way to check whether a text node in password
field or not.

This patch creates new flag for `CharacterData` node and marks all text nodes
whose characters should be masked with the flag when `EditorBase` or
`nsTextControlFrame` creates them.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:54:16 +00:00
Emilio Cobos Álvarez 6917a38081 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 ff732c2cdf 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

--HG--
extra : moz-landing-system : lando
2019-05-28 22:47:08 +00:00
Cameron McCormack e82b3826f9 Bug 1553378 - Devirtualize calls to GetText() / TextLength() when we know we have a Text node. r=smaug,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D32100
2019-05-22 15:18:48 +10:00
Boris Zbarsky 053194d8bd Bug 1530208. Fix isEqualNode to not do a bunch of string-copying. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D21824

--HG--
extra : moz-landing-system : lando
2019-03-04 19:43:47 +00:00
Andreea Pavel 1fa9697217 Backed out changeset cc4b2dbdfd83 (bug 1530208) for failing dom/base/test/unit/test_isequalnode.js on a CLOSED TREE 2019-03-04 21:00:27 +02:00
Boris Zbarsky e7d965a976 Bug 1530208. Fix isEqualNode to not do a bunch of string-copying. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D21824

--HG--
extra : moz-landing-system : lando
2019-03-04 18:00:27 +00:00
longsonr 1fdb590a11 Bug 1522650 - Rename all remaining nsSMIL classes and types as SMIL and ensure they are in the mozilla namespace. r=birtles
--HG--
rename : dom/smil/nsISMILAttr.h => dom/smil/SMILAttr.h
2019-01-25 03:24:01 +00:00
Emilio Cobos Álvarez d2ed260822 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 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Nathan Froyd 846d8789ee 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 1fbd784d00 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

--HG--
extra : moz-landing-system : lando
2018-08-08 23:58:44 +00:00
Olli Pettay 5a669d2747 Bug 1469521 - Change storage of previous and next children in nsINode, r=bz
--HG--
extra : rebase_source : 4cb50889c2cfc788cab7037d26d114e35205e998
2018-08-06 22:29:27 +03:00
Emilio Cobos Álvarez 8f34c12e14 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
Emilio Cobos Álvarez d042e82e85 Bug 1472529: Cleanup CharacterData, and add a non-virtual function to get the text fragment. r=smaug
I'm going to use that from nsFind.

MozReview-Commit-ID: EhkNQ3BFTvX
2018-07-03 02:06:21 +02:00
catalin.badea392@gmail.com 9c36800bd7 Bug 1469385 - Remove InsertChildAt_Deprecated and RemoveChildAt_Deprecated, r=bz,smaug 2018-06-19 12:21:18 +03:00
Emilio Cobos Álvarez fe09ffd3af Bug 1465478: Introduce Element::FromNode. r=smaug
And use it in a couple places I noticed.

MozReview-Commit-ID: 8baSMrbdEbF
2018-05-31 02:46:10 +02:00
Boris Zbarsky c43dfe1ad8 Bug 1449404 part 5. Move the cycle collected refcount on content nodes up to nsIContent. r=smaug 2018-03-28 18:07:40 -04:00
Boris Zbarsky 0aa422913e Bug 1449404 part 4. Get rid of a few virtual nsIContent methods. r=mccr8
The HasTextForTranslation implementation was just moved, with the nodetype
check up front dropped because that's enforced statically now.
2018-03-28 18:01:47 -04:00
Boris Zbarsky 4370006c40 Bug 1449404 part 3. Get rid of nsIContent::AppendTextTo. r=mccr8 2018-03-28 18:01:47 -04:00
Boris Zbarsky cd4761ffdb Bug 1449404 part 2. Get rid of nsIContent::AppendText. r=mccr8 2018-03-28 18:01:46 -04:00
Boris Zbarsky 693169e324 Bug 1449404 part 1. Get rid of nsIContent::SetText. r=mccr8 2018-03-28 18:01:46 -04:00
Boris Zbarsky 258352c8a8 Bug 1447098 part 2. Rename the NS_IMPL_FROMCONTENT macros to NS_IMPL_FROMNODE. r=mystor 2018-03-21 17:39:04 -04:00
Boris Zbarsky 9ae8969557 Bug 1446530. Change CloneDataNode to return already_AddRefed<CharacterData>. r=mystor
MozReview-Commit-ID: 1Clh4fG3GAq
2018-03-19 15:50:16 -04:00
Boris Zbarsky d243dbaa39 Bug 1446533 part 9. Remove nsIDOMCharacterData::ReplaceData. r=mystor
MozReview-Commit-ID: Lei6xZ2rw2K
2018-03-19 15:45:34 -04:00
Boris Zbarsky e7e7401bc3 Bug 1446533 part 8. Remove nsIDOMCharacterData::DeleteData. r=mystor
MozReview-Commit-ID: 7100YyU5jOG
2018-03-19 15:45:31 -04:00
Boris Zbarsky 5475554b91 Bug 1446533 part 7. Remove nsIDOMCharacterData::InsertData. r=mystor
MozReview-Commit-ID: 48XZ2J9ewHP
2018-03-19 15:38:04 -04:00
Boris Zbarsky 4d10a59d53 Bug 1446533 part 6. Remove nsIDOMCharacterData::GetLength r=mystor
MozReview-Commit-ID: FCBGyqPfC4B
2018-03-19 15:33:28 -04:00
Boris Zbarsky bed3a0dde1 Bug 1446533 part 5. Remove nsIDOMCharacterData::AppendData. r=mystor
MozReview-Commit-ID: JP809oJeQiX
2018-03-19 15:33:25 -04:00
Boris Zbarsky 0678b901b6 Bug 1446533 part 4. Remove nsIDOMCharacterData::SubstringData. r=mystor
FromContent will be renamed to FromNode in bug 1447098.

MozReview-Commit-ID: DhiN6mCOb34
2018-03-19 15:18:07 -04:00
Boris Zbarsky 000840f44a Bug 1446533 part 3. Remove nsIDOMCharacterData::Get/SetData. r=mystor
MozReview-Commit-ID: 5YeaCPwvIJH
2018-03-19 15:18:07 -04:00
Boris Zbarsky 971ee6f9cb Bug 1446533 part 2. Rename nsGenericDOMDataNode.{h,cpp} to CharacterData. r=mystor
The DOMMatrix.cpp changes are because it was sneaking in headers via another
unified file.

MozReview-Commit-ID: GPp9WOywI5D

--HG--
rename : dom/base/nsGenericDOMDataNode.cpp => dom/base/CharacterData.cpp
rename : dom/base/nsGenericDOMDataNode.h => dom/base/CharacterData.h
2018-03-19 15:18:07 -04:00