For avoiding confusion between API of `nsRange` and `StaticRange`, I'd like to
rename `nsRange::CreateRange()` to `nsRange::Create()` because
`StaticRange::CreateStaticRange()` is too long name and
`StaticRange::CreateRange()` sounds odd. This patch renames it and changes
related methods to template methods to avoid runtime cost of temporary
`RawRangeBoundary` instance creation.
Differential Revision: https://phabricator.services.mozilla.com/D35141
--HG--
extra : moz-landing-system : lando
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
--HG--
extra : moz-landing-system : lando
Now, nobody requires nsIContentIterator interface. So, we can get rid of it.
Unfortunately, there is no macro to keep the inherited class,
ContentSubtreeIterator, in the cycle collection to make it keep managing
ContentSubtreeIterator::mRange without nsISupports interface. Therefore, this
patch moves it into ContentIteratorBase temporarily. Anyway, the following
patch makes those classes not refcountable. At that time, this issue will be
fixed.
Differential Revision: https://phabricator.services.mozilla.com/D15927
--HG--
extra : moz-landing-system : lando
Currently, ContentIterator is created with a bool flag to decide whether the
instance lists up post-order or pre-order. However, this is not clear. For
example:
nsCOMPtr<nsIContentIterator> preOrderIter = new ContentIterator(false);
This is not clear whether this does right thing or not.
This patch makes any users can create PostContentIterator for post-order
iterator, and creates PreContentIterator for pre-order iterator. So, now,
each creator needs to writhe above as:
nsCOMPtr<nsIContentIterator> preOrderIter = new PreContentIterator();
or
nsCOMPtr<nsIContentIterator> postOrderIter = new PostContentIterator();
Additionally, with this change, if each user starts to use concrete classes
directly, compiler can stop using virtual calls because of all concrete
classes are now marked as "final".
Differential Revision: https://phabricator.services.mozilla.com/D15918
--HG--
extra : moz-landing-system : lando
First, we should move nsContentIterator and nsContentSubtreeIterator into
mozilla namespace and then, remove "ns" prefix.
Additionally, this patch separates the definition of the classes into
ContentIterator.h and exposes it as "mozilla/ContentIterator.h". This allows
everybody access those concrete classes.
Differential Revision: https://phabricator.services.mozilla.com/D15917
--HG--
rename : dom/base/nsContentIterator.cpp => dom/base/ContentIterator.cpp
rename : dom/base/nsContentIterator.cpp => dom/base/ContentIterator.h
extra : moz-landing-system : lando
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
--HG--
extra : moz-landing-system : lando
Now, nobody requires nsIContentIterator interface. So, we can get rid of it.
Unfortunately, there is no macro to keep the inherited class,
ContentSubtreeIterator, in the cycle collection to make it keep managing
ContentSubtreeIterator::mRange without nsISupports interface. Therefore, this
patch moves it into ContentIteratorBase temporarily. Anyway, the following
patch makes those classes not refcountable. At that time, this issue will be
fixed.
Differential Revision: https://phabricator.services.mozilla.com/D15927
--HG--
extra : moz-landing-system : lando
Currently, ContentIterator is created with a bool flag to decide whether the
instance lists up post-order or pre-order. However, this is not clear. For
example:
nsCOMPtr<nsIContentIterator> preOrderIter = new ContentIterator(false);
This is not clear whether this does right thing or not.
This patch makes any users can create PostContentIterator for post-order
iterator, and creates PreContentIterator for pre-order iterator. So, now,
each creator needs to writhe above as:
nsCOMPtr<nsIContentIterator> preOrderIter = new PreContentIterator();
or
nsCOMPtr<nsIContentIterator> postOrderIter = new PostContentIterator();
Additionally, with this change, if each user starts to use concrete classes
directly, compiler can stop using virtual calls because of all concrete
classes are now marked as "final".
Differential Revision: https://phabricator.services.mozilla.com/D15918
--HG--
extra : moz-landing-system : lando
First, we should move nsContentIterator and nsContentSubtreeIterator into
mozilla namespace and then, remove "ns" prefix.
Additionally, this patch separates the definition of the classes into
ContentIterator.h and exposes it as "mozilla/ContentIterator.h". This allows
everybody access those concrete classes.
Differential Revision: https://phabricator.services.mozilla.com/D15917
--HG--
rename : dom/base/nsContentIterator.cpp => dom/base/ContentIterator.cpp
rename : dom/base/nsContentIterator.cpp => dom/base/ContentIterator.h
extra : moz-landing-system : lando