Commit Graph

87 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
1f9ea567b5 Bug 1715841 - Make nsContentList::ContentAppended faster in some cases. r=smaug
Two tweaks:

  * Remove useless count > 0 check. We're in ContentAppended and have
    checked for NAC before, so this condition is just useless. This
    should be mostly irrelevant.

  * If the container is our root node, then we're necessarily appending,
    so no need to check CompareDocumentPosition. This improves
    performance in cases like the test-case above, with lots of children
    and some text nodes in between.

Differential Revision: https://phabricator.services.mozilla.com/D118032
2021-06-17 11:14:54 +00:00
Simon Giesecke
d9ad6f7529 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in dom/base. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D63102
2020-02-21 10:41:47 +00:00
Nathan Froyd
c0d849b425 Bug 1573646 - avoid nsCOMPtr temporary in nsContentList::PopulateSelf; r=mccr8
Due to C++ rules about how the ternary `?:` operator works, the third
operand here was getting coerced to an `nsCOMPtr`, which was then
immediately destroyed.  We can avoid the refcounting traffic by making
the type of both operands match.

Differential Revision: https://phabricator.services.mozilla.com/D41831
2019-08-13 20:33:21 +00:00
Ehsan Akhgari
498e2df734 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset
2019-01-18 10:16:18 +01:00
Masayuki Nakano
67508411d2 Bug 181137 - part 8: Make ContentIteratorBase and its subclasses non-refcountable r=smaug
This patch makes ContentIteratorBase, PostContentIterator, PreContentIterator
and ContentSubtreeIterator classes non-refcountable because most users can
create their instances in stack and such users may be in a hot path.  So,
we can save a lot of cost of instantiation.

Unfortunately, only ScriptableContentIterator creates one of the concrete
classes and needs to destroy it properly.  Therefore, its
EnsureContentIterator(), destructor, traverse and unlink code becomes messy.
However, ScriptableContentIterator was designed for automated tests and we
need to maintain it not so many times.  Therefore, improvement of other
users must be worthwhiler than this demerit.

Differential Revision: https://phabricator.services.mozilla.com/D15928
2019-01-11 01:52:26 +00:00
Masayuki Nakano
3ef3eaf11b Bug 181137 - part 4: Make all users of PreContentIterator treat it directly rather than via nsIContentIterator r=smaug
Now, all users of PreContentIterator can access it directly.  This patch makes
them use the concrete class directly.

Differential Revision: https://phabricator.services.mozilla.com/D15922
2019-01-11 01:49:36 +00:00
Csoregi Natalia
ec11d4a214 Backed out 8 changesets (bug 181137) for bustage on FragmentOrElement.cpp:1751. CLOSED TREE
Backed out changeset 99a977d519a0 (bug 181137)
Backed out changeset 65a4b245e851 (bug 181137)
Backed out changeset 5385d5fd9b8b (bug 181137)
Backed out changeset 83bec02c21d9 (bug 181137)
Backed out changeset b7ab59bf545e (bug 181137)
Backed out changeset b6fc7a332db7 (bug 181137)
Backed out changeset 654fdbad67db (bug 181137)
Backed out changeset 90a1ff49b6b1 (bug 181137)
2019-01-10 11:42:27 +02:00
Masayuki Nakano
e3bc6266ea Bug 181137 - part 8: Make ContentIteratorBase and its subclasses non-refcountable r=smaug
This patch makes ContentIteratorBase, PostContentIterator, PreContentIterator
and ContentSubtreeIterator classes non-refcountable because most users can
create their instances in stack and such users may be in a hot path.  So,
we can save a lot of cost of instantiation.

Unfortunately, only ScriptableContentIterator creates one of the concrete
classes and needs to destroy it properly.  Therefore, its
EnsureContentIterator(), destructor, traverse and unlink code becomes messy.
However, ScriptableContentIterator was designed for automated tests and we
need to maintain it not so many times.  Therefore, improvement of other
users must be worthwhiler than this demerit.

Differential Revision: https://phabricator.services.mozilla.com/D15928
2019-01-10 08:50:41 +00:00
Masayuki Nakano
bdda093c32 Bug 181137 - part 4: Make all users of PreContentIterator treat it directly rather than via nsIContentIterator r=smaug
Now, all users of PreContentIterator can access it directly.  This patch makes
them use the concrete class directly.

Differential Revision: https://phabricator.services.mozilla.com/D15922
2019-01-10 08:46:25 +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
Eric Rahm
e2299e49a5 Bug 1491151 - Part 5: Convert content list to use MRU cache. r=smaug 2018-09-12 18:10:08 -07:00
Boris Zbarsky
0558566d7e Bug 1487237. Add some content lists stored in DOM slots to memory reporting. r=smaug
This reports the memory as part of element-nodes, but I think that's OK for
now.  If we want to, we can try to add more nsWindowSizes buckets for this stuff.

Differential Revision: https://phabricator.services.mozilla.com/D4811
2018-09-01 14:55:47 +00:00
Jeff Gilbert
70a22b2878 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Olli Pettay
d3519f75d4 Bug 1462746, ensure SubtreeRoot always returns non-null value, r=mrbkap 2018-06-01 00:11:45 +03:00
Boris Zbarsky
86d99155db Bug 1455676 part 14. Remove most use of nsIDOMNode in dom/. r=qdot 2018-05-29 22:58:49 -04:00
Chris Peterson
5d6b16ea3b Bug 1457813 - Part 2: Replace non-asserting NS_PRECONDITIONs with MOZ_ASSERTs. r=froydnj
s/NS_PRECONDITION/MOZ_ASSERT/ and reindent

MozReview-Commit-ID: KuUsnVe2h8L
2018-04-28 12:50:58 -07:00
Adrian Wielgosik
38f9a663ce Bug 1447389 - Remove nsIDOMNodeList. r=bz
MozReview-Commit-ID: 11szZP6dS6V
2018-04-25 23:01:30 +02:00
Emilio Cobos Álvarez
bf14ceaba3 Bug 1454233: Remove nsINode::eDOCUMENT. r=bz
MozReview-Commit-ID: ItjdI79zme7
2018-04-20 01:30:11 +02:00
Boris Zbarsky
152cd3ba6e Bug 1447098 part 1. Rename FromContent on various DOM classes to FromNode. r=mystor
MozReview-Commit-ID: 202nkbmkwfR
2018-03-21 17:39:04 -04:00
Adrian Wielgosik
d8fb7c72ec Bug 1447392 - Remove all members from nsIDOMNodeList. r=bz
MozReview-Commit-ID: 68xF7CTMpKB
2018-03-20 19:02:08 +01:00
Boris Zbarsky
b754251396 Bug 1415588 part 2. Move the .images, .embeds, .plugins, .forms, .scripts, .applets getters from HTMLDocument to Document. r=mystor
MozReview-Commit-ID: Db7iazZUz8g
2018-03-12 21:44:56 -04:00
Emilio Cobos Álvarez
0ff849122a Bug 1442207: Remove unneeded arguments to nsIMutationObserver. r=smaug
aDocument is always content->OwnerDoc().
aContainer is always content->GetParent().

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

MozReview-Commit-ID: 4xwPCOnhyIL
2018-03-01 22:45:17 +01:00
Adrian Wielgosik
b3471f9af4 Bug 1440741 - Remove all members from nsIDOMHTMLFormElement. r=qdot
MozReview-Commit-ID: 2UcUy4MkVsM
2018-02-23 19:28:08 +01:00
Boris Zbarsky
a86373f271 Bug 1418076 part 11. Eliminate the nsIDOMHTMLDocument interface. r=mystor
MozReview-Commit-ID: 4lEcUeenbg3
2018-01-26 01:03:25 -05:00
Emilio Cobos Álvarez
8a71d3197b Bug 1423990: Move the last few attribute-related methods outside of nsIContent. r=bz
MozReview-Commit-ID: 8JZuS6O8f8W
2017-12-25 17:50:10 +01:00
Emilio Cobos Álvarez
ecd202d763 Backout changeset e43f568b3e9a (bug 1423990) because some OSX-only code still doesn't build. r=me 2017-12-25 12:55:45 +01:00
Emilio Cobos Álvarez
b3956b6171 Bug 1423990: Move the last few attribute-related methods outside of nsIContent. r=bz
MozReview-Commit-ID: 8JZuS6O8f8W
2017-12-07 19:13:50 +01:00
Boris Zbarsky
035ea3c391 Bug 1415677 part 6. Remove nsIDOMHTMLCollection. r=qdot
MozReview-Commit-ID: E8P9o0bv63L
2017-11-13 10:41:33 -05:00
Boris Zbarsky
ff3eab73d6 Bug 1415677 part 2. Remove nsIDOMHTMLCollection::Item. r=qdot
MozReview-Commit-ID: AQUjBQhXLHE
2017-11-13 10:39:02 -05:00
Boris Zbarsky
e76fe87c40 Bug 1415677 part 1. Remove nsIDOMHTMLCollection::NamedItem. r=qdot
MozReview-Commit-ID: EppP6KSYSn6
2017-11-13 10:38:59 -05: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
Catalin Badea
fc6ab5f0ea Bug 651120 - Remove index argument from content removed/appended/inserted notifications. r=peterv 2017-10-03 11:09:08 +01:00
Nicholas Nethercote
9fda5528d2 Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ
2017-09-26 08:33:21 +10:00
John Dai
9350c0701c Bug 1401726 - Fix crash in nsLabelsNodeList::PopulateSelf. r=smaug 2017-09-21 02:06:00 -04:00
Andrew McCreight
84ee98de3c Bug 1391005 - Eliminate NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED. r=peterv
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.

MozReview-Commit-ID: 5agRGFyUry1
2017-08-29 16:02:48 -07:00
Ehsan Akhgari
abd565a9c8 Bug 1392891 - Part 1: Make it possible to create nsContentList objects that don't observe DOM mutations; r=smaug 2017-08-29 07:30:22 -04:00
Kyle Machulis
74bf40ac81 Bug 1279218 - Additional applet tag logic removal; r=bz
I've been having problems with interdiffs on mozreview lately, so for
ease of review, this patch is being submitted as a seperate patch for
review. Once it is r+'d, it will be folded into the first patch in
this set before landing.

MozReview-Commit-ID: CS9MngaXlBd
2017-07-28 16:44:39 -07:00
Jessica Jong
c8a9b64795 Bug 1376695 - Part 2: Avoid rebuilding the list returned by getElementsByName when not needed. r=ehsan
The list returned by getElementsByName is cached, however, it's rebuilt
frequently due to content mutations. We can avoid rebuilding the list when
the attribute changed is not the name attribute. We can also speed up the
name matching process by skipping the elements that do not have a name
attribute.

MozReview-Commit-ID: 9TUPaQonjHz
2017-07-26 02:34:00 -04:00
Catalin Badea
057d11aabc Bug 1375050 - Fix crash in nsLabelsNodeList::MaybeResetRoot r=jdai 2017-07-13 13:58:04 +01:00
Sylvestre Ledru
9d4a84d778 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG
2017-07-06 14:00:35 +02:00
Olli Pettay
55487ada31 Bug 1376936 - nsContentLists should stop observing mutations when their refcnt drops to 0, r=ehsan 2017-06-29 13:25:15 +03:00
John Dai
95546cdb0c Bug 556743 - Implement the labels attribute. r=smaug 2017-06-15 20:04:00 -04:00
Boris Zbarsky
33b60b6ff4 Bug 1332322 part 2. Rename nsWrapperCache::IsBlack to nsWrapperCache::HasKnownLiveWrapper. r=mccr8 2017-01-24 20:38:58 -05:00
Cameron McCormack
5f9911da79 Bug 1328832 - Part 2: Rename mozFlushType to mozilla::FlushType and make it an enum class. r=bzbarsky
MozReview-Commit-ID: D3fIngSHSsl
2017-01-05 15:31:56 +08:00
Olli Pettay
3898f7d882 Bug 1326507, remove NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS, r=mccr8 2017-01-03 21:47:55 +02:00
Boris Zbarsky
79a0215206 Bug 1270349 part 5. Use LegacyUnenumerableNamedProperties instead of passing flags to GetSupportedNames to determine whether named props on DOM proxies should be reflected in ownPropertyKeys. r=peterv 2016-05-09 22:25:40 -04:00
Nicholas Nethercote
7f7c26ed62 Bug 1260871 - Remove do_GetAtom() and rename NS_NewAtom() as NS_Atomize(). r=erahm.
do_GetAtom() is currently just a synonym for NS_NewAtom().
2016-03-29 10:09:43 +11:00
Nicholas Nethercote
53a4e4a5b5 Bug 1253085 - Remove the |PLDHashTable*| argument from PLDHash{HashKey,MatchEntry}. r=froydnj.
This is easy because it's never needed.
2016-03-16 15:33:44 +11:00
Birunthan Mohanathas
bfee0fb40c Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-02-02 17:36:30 +02:00