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

135 Коммитов

Автор SHA1 Сообщение Дата
Jan-Niklas Jaeschke ebf3cd6240 Bug 1808565, part 1: Adapt `Selection` to support `StaticRange`s. r=webidl,saschanaz,masayuki,smaug
This change is necessary to support the [CSS Highlight API](https://drafts.csswg.org/css-highlight-api-1/),
which uses `Selection` internally.

To replace `nsRange` with `AbstractRange`, some sections needed to be
adapted since `nsRange`-specific features were used.
Therefore, some methods (such as `GetRangeAt()`) may only be called if
the `Selection` is *not* of type `SelectionType::eHighlight`,
as it (per spec) returns an `nsRange`.
These methods will now `MOZ_ASSERT` if called for a highlight selection.
Additional methods are implemented which return `AbstractRange`
instead and are safe to be called for every selection type.

This commit also improves support of highlight features:
- Invalidation of highlight ranges: adding/removing Ranges in-place instead of
  removing and re-adding the Selection object associated with the highlight.
- Ranges are only associated with the Selection that shares the same Document
- Fixed minor IDL issue

Differential Revision: https://phabricator.services.mozilla.com/D170582
2023-03-03 14:59:47 +00:00
Jan-Niklas Jaeschke 2243494a74 Bug 1810403: Allow `nsRange`s to be in multiple `Selection`s. r=masayuki
The Custom Highlight API allows a use case where a `Range` of a `Highlight`
is also used as `Selection`. Due to the decision to use the `Selection` mechanism
to display `Highlight`s, a `Range` can be part of several `Selection`s.
Since the `Range` has a pointer to its associated `Selection`
to notify about changes, this must be adapted to allow several `Selections`.

As a tradeoff of performance and memory usage, the `Selection`s are stored
as `mozilla::LinkedList`. A helper class `mozilla::SelectionListWrapper`
was implemented to allow `Selection`s to be in multiple of these lists
and without having to be derived from `LinkedListElement<T>`.

To simplify usage of the list, the use case  "does this range belong to Selection x?"
is wrapped into the convenience method`IsInSelection(Selection&)`;
The method previously named like this was renamed to `IsInAnySelection()`
to be named more precisely.

Registering and unregistering of the closest common inclusive ancestor
of the `Range` is done when the first `Selection` is registered and
the last `Selection` is unregistered.

Differential Revision: https://phabricator.services.mozilla.com/D169597
2023-02-21 12:25:28 +00:00
Jan-Niklas Jaeschke fa75d3a60f Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-27 11:42:18 +00:00
Sandor Molnar 4c4d29b581 Backed out changeset d7f27aa40260 (bug 1803355) for causing win build bustage. 2023-01-24 18:07:50 +02:00
Jan-Niklas Jaeschke 1b3bff372b Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 11:46:28 +00:00
Sandor Molnar a610ef723a Backed out changeset 54771a1963b6 (bug 1803355) for causing win build bustage. CLOSED TREE 2023-01-24 12:17:49 +02:00
Jan-Niklas Jaeschke 99eb703228 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 07:36:13 +00:00
Noemi Erli aec839cbc8 Backed out changeset 759d4948ed8b (bug 1803355) for causing build bustages CLOSED TREE 2023-01-22 05:03:04 +02:00
Jan-Niklas Jaeschke 0a52844148 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-22 02:04:43 +00:00
Martin Robinson 281ff8ade5 Bug 1791759 - Add support for `content-visibility: auto` r=emilio
This change adds support for `content-visibilty: auto` as well as
showing and hiding content based on the relevancy of the content as
defined in the specification. Changes to relevancy are handled by
triggering updates in a set of `content-visibility: auto` frames stored
in PresShell at the appropriate time in the document lifecycle.

Some tests are now failing due to this feature exposing the failures,
but they will be fixed in later changes.

This change is a reland of an earlier version that properly updates
intrinsic sizes and triggers an update of remembered size for the
purposes of contain-intrinsic-size when content relevancy changes.

Co-authored-by: Jihye Hong <jihye@igalia.com>

Differential Revision: https://phabricator.services.mozilla.com/D159693
2022-11-30 18:00:27 +00:00
Marian-Vasile Laza f4d4ce0e21 Backed out changeset c428c3ad7725 (bug 1791759) for causing wpt failures on auto-012.html. CLOSED TREE 2022-11-28 13:31:05 +02:00
Martin Robinson e26b2a32b9 Bug 1791759 - Add support for `content-visibility: auto` r=emilio
This change adds support for `content-visibilty: auto` as well as
showing and hiding content based on the relevancy of the content as
defined in the specification. Changes to relevancy are handled by
triggering updates in a set of `content-visibility: auto` frames stored
in PresShell at the appropriate time in the document lifecycle.

Some tests are now failing due to this feature exposing the failures,
but they will be fixed in later changes.

Co-authored-by: Jihye Hong <jihye@igalia.com>

Differential Revision: https://phabricator.services.mozilla.com/D159693
2022-11-28 09:53:06 +00:00
Kagami Sascha Rosylight 86a6ba4bda Bug 1723050 - Part 2: Replace typedef by using in dom/base/ r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D121294
2021-08-02 14:40:41 +00:00
Edgar Chen 23e74541e1 Bug 1685421 - Part 3: Stop using NS_ERROR_DOM_HIERARCHY_REQUEST_ERR in nsRange; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113345
2021-06-02 13:43:39 +00:00
Simon Giesecke 4803e61816 Bug 708901 - Migrate to nsTHashSet in dom/base. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108593
2021-03-24 17:56:46 +00:00
Csoregi Natalia f54ee076ae Backed out 13 changesets (bug 708901, bug 1184468) for causing build bustage on GeckoViewHistory.cpp. CLOSED TREE
Backed out changeset b1e4c01e63b8 (bug 708901)
Backed out changeset 37b52cce83c0 (bug 708901)
Backed out changeset eee75f33f060 (bug 708901)
Backed out changeset 479bf64c7986 (bug 708901)
Backed out changeset 15a8fb94d15d (bug 708901)
Backed out changeset be31ccd9a61d (bug 708901)
Backed out changeset fc54f4eaedd5 (bug 708901)
Backed out changeset 03c3a56c3d13 (bug 708901)
Backed out changeset 73f11d3c1298 (bug 708901)
Backed out changeset aed22fd80893 (bug 708901)
Backed out changeset 74d8249fbe7e (bug 708901)
Backed out changeset acb725eb3c1d (bug 1184468)
Backed out changeset 70f3ea6efec4 (bug 1184468)
2021-03-24 19:26:20 +02:00
Simon Giesecke 82e566bfca Bug 708901 - Migrate to nsTHashSet in dom/base. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108593
2021-03-24 16:58:58 +00:00
Masayuki Nakano eea4b0b7bf Bug 1669342 - part 2: Make mutation observer of `nsRange` check the relation between range root and start/end boundaries when it does not modify them r=smaug
With this change, at least in `CharacterDataChanged` and `ContentRemoved`
causes hitting this assertion:
```
MOZ_ASSERT(aStartBoundary.Container()->IsInclusiveDescendantOf(aRootNode));
```

The reason is, they call it with `mRoot`, but the range has already been
disconnected from `mRoot`.  The following patch fixes this.

Differential Revision: https://phabricator.services.mozilla.com/D108398
2021-03-16 21:43:40 +00:00
Simon Giesecke 971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Botond Ballo 01b3c7969d Bug 1667594 - Move nsLayoutUtils::RectCallback to namespace scope. r=emilio,jgilbert
This allows it to be forward-declared (while a nested class cannot be),
such that headers files that use RectCallback by pointer or reference
do not need to include nsLayoutUtils.h.

This avoids including nsLayoutUtils.h in nsRange.h.

Differential Revision: https://phabricator.services.mozilla.com/D91685
2020-09-30 21:06:47 +00:00
Nathan Froyd e3ebda1914 Bug 1223932 - delete guard object uses from the tree; r=jwalden
CLOSED TREE

We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Mihai Alexandru Michis a911a108d0 Backed out changeset ac9c811bc427 (bug 1223932) for causing spidermonkey rust failures.
CLOSED TREE
2020-07-30 18:23:21 +03:00
Nathan Froyd bec9f9b93a Bug 1223932 - delete guard object uses from the tree; r=jwalden
We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Emilio Cobos Álvarez ff61891772 Bug 1653011 - Simplify and make WeakPtr<Derived> usable and compact. r=froydnj,sg,geckoview-reviewers,jgilbert,kvark,snorp
Having two classes in the inheritance chain inherit from SupportsWeakPtr
now won't compile, but you can use WeakPtr<Derived> when any base class
inherits from SupportsWeakPtr.

Differential Revision: https://phabricator.services.mozilla.com/D83674
2020-07-23 14:51:46 +00:00
Kagami Sascha Rosylight 8cf4dcb090 Bug 1640276 - Part 10: Mark nsINode as const in IsPointInRange() r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80176
2020-06-19 00:58:12 +00:00
Kagami Sascha Rosylight 5dfce22c12 Bug 1640276 - Part 9: Mark nsINode as const in CompareBoundaryPoints() r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80175
2020-06-19 00:57:55 +00:00
Kagami Sascha Rosylight eb37b889da Bug 1640276 - Part 8: Mark nsINode as const in ComparePoint() r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80174
2020-06-19 00:57:27 +00:00
Mirko Brodesser b880ce0b21 Bug 1634663: part 2) Declare callers of `GetRangeAt` around `EditorBase` `const`. r=masayuki
Depends on D73444

Differential Revision: https://phabricator.services.mozilla.com/D73445
2020-05-02 23:44:46 +00:00
Mirko Brodesser d3d7707457 Bug 1624633: part 6) Annotate `nsRange::RegisterSelection` with `MOZ_CAN_RUN_SCRIPT`. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D68222

--HG--
extra : moz-landing-system : lando
2020-03-27 11:11:02 +00:00
Mirko Brodesser 86eec2f9fe Bug 1623040: split `nsRange::SetSelection` into `RegisterSelection` and `UnregisterSelection`. r=smaug
The name "SetSelection" was misleading, because it did more than a
setter.

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

--HG--
extra : moz-landing-system : lando
2020-03-18 09:06:10 +00:00
Mirko Brodesser 4be580237d Bug 1619617: part 1) Annotate `RemoveRangeAndUnselectFramesAndNotifyListeners` with `MOZ_CAN_RUN_SCRIPT`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D65511

--HG--
extra : moz-landing-system : lando
2020-03-06 12:03:23 +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
Eric Rahm 7b7fc1c992 Bug 1610387 - Remove nsAutoPtr usage from layout/. r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D60455

--HG--
extra : moz-landing-system : lando
2020-02-01 09:40:36 +00:00
Masayuki Nakano 083d7d9809 Bug 1612085 - part 3: Remove dirty hack of `Selection::mCachedRange` r=smaug
Previously, I added `Selection::mCachedRange` to save allocation cost of
`nsRange`.  However, with the previous patch, we don't need the hack anymore
since ranges removed by `Selection::RemoveAllRanges()` are always kept in
the global cache of `nsRange`.  Therefore, we can remove the ugly hack right
now.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 12:44:33 +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
Masayuki Nakano 450b71f763 Bug 1612085 - part 1: Hide constructor of `nsRange` r=smaug
`nsRange` instances are allocated a lot in the heap especially by editor and
spellchecker.  The allocation cost is too bad for benchmarks.  Therefore,
we should reuse released instances as far as possible.  For managing it in
static factory methods of `nsRange`, we need to hide `nsRange` constructor.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 13:23:35 +00:00
Mirko Brodesser 2abd6d5a82 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

--HG--
extra : moz-landing-system : lando
2020-01-27 09:25:00 +00:00
Mirko Brodesser 6ae59766f6 Bug 1608850: remove `nsRange::IsNodeInSortedRanges` which doesn't have a definition. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59723

--HG--
extra : moz-landing-system : lando
2020-01-13 15:54:11 +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 6ade70f373 Bug 1608071: part 1) Rename common ancestor to closest common inclusive ancestor around `nsRange`. r=smaug
It's more precise and enables one to reason more clearly about related
code.

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

--HG--
extra : moz-landing-system : lando
2020-01-13 10:29:31 +00:00
Mirko Brodesser 8cffae0b13 Bug 1607783: check precondition in `nsRange::IsNodeSelected`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59284

--HG--
extra : moz-landing-system : lando
2020-01-09 11:53:52 +00:00
Mirko Brodesser b15995b5d5 Bug 1587433: part 6) Create `RawRangeBoundary` in `nsRange::ComparePoints` only after checking the offset is valid. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D54457

--HG--
extra : moz-landing-system : lando
2019-12-16 11:31:32 +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 58e0fcd8c5 Bug 1587433: part 6) Create `RawRangeBoundary` in `nsRange::ComparePoints` only after checking the offset is valid. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D54457

--HG--
extra : moz-landing-system : lando
2019-12-11 12:24:55 +00:00
Mirko Brodesser dc1dc0f9f0 Bug 1587433: part 2) Correct some comments and declare some variables const. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D50607

--HG--
extra : moz-landing-system : lando
2019-10-28 08:45:33 +00:00
Mirko Brodesser 3682e4b36b Bug 1587433: part 1) Slightly refactor `nsRange::CharacterDataChanged` in order to make it understanable. r=smaug
The method performed too many tasks. Now, some of the tasks are
abstracted away, simplifying reasoning about it.

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

--HG--
extra : moz-landing-system : lando
2019-10-28 08:44:29 +00:00
Mirko Brodesser 52a6a9821a Bug 1563450: rename `Selection::AddItem` to `Selection::AddRangesForSelectableNodes`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D36881
2019-07-04 16:36:01 +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
Masayuki Nakano da61ea3112 Bug 1444847 - part 3: Create `RangeUtils` to place public static methods of `nsRange` r=smaug
Some `nsRange` static methods are useful in `StaticRange` and some of them
are used in a lot of places but not related to `nsRange` directly.  This
patch moves them into new static method only class, `mozilla::RangeUtils`.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:48:07 +00:00
Masayuki Nakano 2a450c5196 Bug 1444847 - part 2: Sort out basic API of `nsRange` for consistency with coming `StaticRange` r=smaug
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
2019-06-28 07:47:29 +00:00