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

13 Коммитов

Автор SHA1 Сообщение Дата
Simon Giesecke 5bfbb2a572 Bug 1673931 - Avoid including Document.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95046

Depends on D95045
2020-11-23 16:07:43 +00:00
Masayuki Nakano cf058a67c2 Bug 1615131 - Make `StaticRange` instances reused as far as possible like `nsRange` r=smaug
When we support `InputEvent.getTargetRanges()`, editor needs to create
`StaticRange` instances at starting to handle every edit operations/commands.
Therefore, we need a hack for saving allocation cost like `nsRange`.

This patch moves `nsRange::MaybeCacheToReuse()` and `nsRange::Shutdown()` to
`AbstractRange` to reduce copy&paste same code into `nsRange` and `StaticRange`.
However, `Create(nsINode*)` and `Release()` are duplicated unfortunately.

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

--HG--
extra : moz-landing-system : lando
2020-02-14 15:02:43 +00:00
Masayuki Nakano 62286452d2 Bug 1612085 - part 2: Make `nsRange` instances reused r=smaug
This patch makes `nsRange::Create()` reuse its instances automatically.
It's difficult to consider the limit of cache since `nsRange` instance is
created not so many in most cases, but only Find and Spellchecker sometimes
create too many instances.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 17:10:59 +00:00
Mirko Brodesser 3375237ea1 Bug 1609662: part 19) Change `Selection::EqualsRangeAtPoint` to `HasEqualRangeBoundariesAt`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60950

--HG--
extra : moz-landing-system : lando
2020-01-24 14:40:35 +00:00
Mirko Brodesser efd738af5b Bug 1608071: part 2) Rename `nsContentUtils::GetCommonAncestor` and related methods. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59319

--HG--
extra : moz-landing-system : lando
2020-01-13 10:29:44 +00:00
Mirko Brodesser e25dbd58f9 Bug 1587433: part 7.1) Adapt callers of `RangeBoundaryBase::Offset()`. r=smaug
Calls around `nsContentUtils::ComparePoints` will be cleaned-up in a
separate commit.

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

--HG--
extra : moz-landing-system : lando
2019-12-16 11:31:30 +00:00
Mirko Brodesser 67423194d4 Bug 1587433: part 3) Strengthen conditions for `AbstractRange::mIsPositioned`. r=smaug
Makes it less mysterious.

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

--HG--
extra : moz-landing-system : lando
2019-12-16 11:31:39 +00:00
Csoregi Natalia 2bfeaf7cb5 Backed out 11 changesets (bug 1587433) for bustages on RangeBoundary.h. CLOSED TREE
Backed out changeset 18f8d61039b0 (bug 1587433)
Backed out changeset 69ad70a4f85e (bug 1587433)
Backed out changeset 79ec11ba7fde (bug 1587433)
Backed out changeset f8a7e23843b8 (bug 1587433)
Backed out changeset f9255884980f (bug 1587433)
Backed out changeset 50a798e664a1 (bug 1587433)
Backed out changeset b225586edea6 (bug 1587433)
Backed out changeset b1d9e55ece86 (bug 1587433)
Backed out changeset 7ebbcb2da488 (bug 1587433)
Backed out changeset 4032df295a67 (bug 1587433)
Backed out changeset 0e1577031add (bug 1587433)
2019-12-16 13:25:51 +02:00
Mirko Brodesser f1c8587c4b Bug 1587433: part 7.1) Adapt callers of `RangeBoundaryBase::Offset()`. r=smaug
Calls around `nsContentUtils::ComparePoints` will be cleaned-up in a
separate commit.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 12:25:03 +00:00
Mirko Brodesser ba20ab29fa Bug 1587433: part 3) Strengthen conditions for `AbstractRange::mIsPositioned`. r=smaug
Makes it less mysterious.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 12:24:28 +00:00
Mirko Brodesser 33d1bf6efc Bug 1564140: add comment to `AbstractRange::mIsPositioned`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37277
2019-07-09 09:06:55 +02:00
Makoto Kato c2694625b5 Bug 1444847 - part 4: Implement `mozilla::dom::StaticRange` and static factory methods r=smaug
This patch is based on Makoto Kato-san's patch.

This patch implements `mozilla::dom::StaticRange` class and creating some
static factory methods.

Then, makes `AbstractRange` has a utility method of `SetStartAndEnd()`
method of `nsRange` and `StaticRange` for sharing same logic in one place.
However, there are some additional work is required only in `nsRange`, e.g.,
`nsRange` needs to start observing mutation of the range, but `StaticRange`
does not it.  Therefore, it's implemented as a template method which takes
`nsRange*` or `StaticRange*` as a parameter.  Then, each `DoSetRange()`
method of them can do different things without virtual calls.

Note that `StaticRange` does not have any properties, methods nor constructor.
Therefore, we need additional API to test it.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:48:52 +00:00
Makoto Kato 5f9abd3366 Bug 1444847 - part 1: Create `mozilla::dom::AbstractRange` r=smaug
This patch is based on the patch created by Makoto Kato-san.

`Range` and `StaticRange` have common base interface, `AbstractRange`.
https://dom.spec.whatwg.org/#abstractrange

This interface has simply returns `startContainer`, `endContainer`,
`startOffset`, `endOffset` and `collapsed`.

Different from the original patch's approach, this patch moves related
members in `nsRange` to `AbstractRange` since this approach avoids
virtual call cost.  Additionally, this patch makes them not throw as
declared by the spec.  As far as I know, the destruction cost of
`ErrorResult` may appear in profile so that we should avoid creating
the instance if we can avoid it.

Unfortunately, the instance size of `nsRange` becomes larger with this
patch.  The size is changed from 176 to 184.  I.e., now, `nsRange`
requires bigger chunk.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:46:35 +00:00