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

245 Коммитов

Автор SHA1 Сообщение Дата
longsonr f88e9107e1 Bug 1579186 - element.innerText should work with SVG text and foreignObject text r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D80376
2020-06-22 18:46:35 +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
Simon Giesecke c0341c3791 Bug 1628715 - Part 10: Activate nodiscard attributes on AppendElement(s). r=xpcom-reviewers,nika,peterv
Differential Revision: https://phabricator.services.mozilla.com/D70834
2020-04-24 14:34:15 +00:00
Mirko Brodesser 8c66344a6d Bug 1623858: part 1) Rename `nsINode::IsSelectionDescendant` to `nsINode::IsMaybeSelected`. r=smaug
More accurate.

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

--HG--
extra : moz-landing-system : lando
2020-03-20 14:27:39 +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
Sean Feng 8af0b53201 Bug 1377999 - Make DocumentFragment to adapt the DOMArena changes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D57707

--HG--
extra : moz-landing-system : lando
2020-03-17 14:53:46 +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
Simon Giesecke d94419173b Bug 1613985 - Use default for equivalent-to-default constructors/destructors in dom/base. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D63102

--HG--
extra : moz-landing-system : lando
2020-02-21 10:41:47 +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
Mirko Brodesser 79b875cc33 Bug 1615226: avoid heap allocating `ContentSubtreeIterator` in `RangeSubtreeIterator`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62716

--HG--
extra : moz-landing-system : lando
2020-02-13 13:36:11 +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 527d1bcaed Bug 1608071: part 5) Remove superfluous code in `nsRange::IsNodeSelected`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59337

--HG--
extra : moz-landing-system : lando
2020-01-13 10:30:07 +00:00
Mirko Brodesser 9003171261 Bug 1608071: part 4) Rename `GetNextRangeCommonAncestor`. r=smaug
The old name was misleading.

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

--HG--
extra : moz-landing-system : lando
2020-01-13 10:30:04 +00:00
Mirko Brodesser 0be35ca14f Bug 1608071: part 3) Rename `nsSlots::mCommonAncestorRanges` to `nsSlots::mClosestCommonInclusiveAncestorRanges`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59329

--HG--
extra : moz-landing-system : lando
2020-01-13 10:29:56 +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 67d6b2b072 Bug 1600267: part 9) Call `ComparePoints` instead of `ComparePoints_Deprecated` in parts of `nsRange`. r=smaug
The remaining callers of `ComparePoints_Deprecated` in `nsRange`
presumably require changing the semantics of `ComparePoints` to support
comparison across Shadow DOM boundary.

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

--HG--
extra : moz-landing-system : lando
2020-01-06 14:35:27 +00:00
Mirko Brodesser b8bb35cc69 Bug 1600267: part 1) Rename `nsContentUtils::ComparePoints` to `ComparePoints_Deprecated`. r=smaug
In a follow-up commit a new `ComparePoints` method with cleaner
arguments and return value will be added.

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

--HG--
extra : moz-landing-system : lando
2019-12-19 13:27:08 +00:00
Mirko Brodesser 06368d19e3 Bug 1587433: part 7.4) Adapt callers of `RangeBoundaryBase::Offset()`. r=smaug
Calls around nsContentUtils::ComparePoint might be strengthened to
retrieve only valid offsets in a separate commit.

The change in `nsRange::CloneContents` is according to
https://dom.spec.whatwg.org/#concept-range-clone.

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

--HG--
extra : moz-landing-system : lando
2019-12-16 11:31:48 +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
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 8e27b5e829 Bug 1587433: part 7.4) Adapt callers of `RangeBoundaryBase::Offset()`. r=smaug
Calls around nsContentUtils::ComparePoint might be strengthened to
retrieve only valid offsets in a separate commit.

The change in `nsRange::CloneContents` is according to
https://dom.spec.whatwg.org/#concept-range-clone.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 12:26:08 +00: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 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
Sylvestre Ledru 8d2f0d1b1f Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-11-26 14:35:02 +00:00
Emilio Cobos Álvarez 30420940bd Bug 1596768 - Remove GetBindingParent usage in nsRange assertions. r=smaug
They want to check that the root is correct, do so explicitly.

Depends on D53197

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

--HG--
extra : moz-landing-system : lando
2019-11-15 16:17:46 +00:00
Mirko Brodesser fbb6f94a0b Bug 1596680: remove superfluous `IsValidOffset` function. r=smaug
`RangeBoundaryBase` accepts a `uint32_t` offset, hence not needed anymore.

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

--HG--
extra : moz-landing-system : lando
2019-11-15 15:22:49 +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 e1b9454134 Bug 1587716: change `RangeBoundaryBase`'s offset argument to `uint32_t`. r=smaug
`uint32_t`, because `nsRange::ComparePoints` requires it -- by webidl
interface -- to be unsigned long.

Moreover it makes `RangeBoundaryBase`'s interface cleaner, because it
already exposes the offset as a `uint32_t`.

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

--HG--
extra : moz-landing-system : lando
2019-10-23 08:22:36 +00:00
Mirko Brodesser b761e516f6 Bug 1587746: remove `RangeBoundaryBase::Set` and use constructor instead. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D48826

--HG--
extra : moz-landing-system : lando
2019-10-11 12:43:57 +00:00
Mirko Brodesser 7ab5217f00 Bug 1587370: remove `RangeBoundaryBase::SetAfterRef` and use constructor instead. r=smaug
Simpler.

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

--HG--
extra : moz-landing-system : lando
2019-10-10 16:13:47 +00:00
Brad Werth a99718cb94 Bug 1548188 Part 1: Make nsRange::GetPartialTextRect use IsInlineReversed to determine whether start is before end. r=bzbarsky
The existing logic uses RightToLeft as a determinator of whether or not the start point is above-and-to-the-left of the end point. We can get that directly (and correctly) with IsInlineReversed.

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

--HG--
extra : moz-landing-system : lando
2019-09-04 19:53:42 +00:00
L. David Baron 5afb94be01 Bug 1571249 - Remove BCTableCell as a distinct frame type. r=TYLin
There are two existing callers of IsTableCellFrame that both appear to want to
include BCTableCell frames, but don't.  A patch in bug 1547759 will add a
third that wants the same.

The existing users of frame types all have to work around it being a distinct
type, and none appear to want the distinction.  This removes that complexity.

If any callers want to make the distinction, they could implement QueryFrame
for BCTableCellFrame and use it.  (It's not implemented now, though!)

In a little more detail, prior to this patch (in my debug build, at least):
  * nsQueryFrame::ClassID::nsMathMLmtdFrame_id was 46
  * nsQueryFrame::ClassID::nsTableCellFrame_id was 47
  * nsQueryFrame::ClassID::nsBCTableCellFrame_id was 65
and entries 46 and 47 in sLayoutFrameTypes were
mozilla::LayoutFrameType::TableCell while entry 65 was
mozilla::LayoutFrameType::BCTableCell.

With this patch:
  * nsQueryFrame::ClassID::nsBCTableCellFrame_id is 40
  * nsQueryFrame::ClassID::nsMathMLmtdFrame_id is 41
  * nsQueryFrame::ClassID::nsTableCellFrame_id is 42
and entries 40 through 42 in sLayoutFrameTypes are
mozilla::LayoutFrameType::TableCell.

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

--HG--
extra : moz-landing-system : lando
2019-08-08 19:48:10 +00:00
Mirko Brodesser 2f40f072ab Bug 1565584: move `nsIContentUtils::ContentIsDescendantOf` to `nsINode::IsInclusiveDescendantOf`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37880
2019-07-15 10:02:21 +02:00
Mirko Brodesser 6b67de025f Bug 1562876: rename `Selection::RemoveRange` to `Selection::RemoveRangeAndUnselectFramesAndNotifyListeners`. r=smaug
The name of the corresponding webidl interface of course remains unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D36607
2019-07-03 13:26:14 +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
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
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
Sylvestre Ledru 96da5036ad Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-28 09:30:05 +00:00
Emilio Cobos Álvarez 11ea945833 Bug 1546697 - Use a consistent style for enum classes in layout. r=dholbert
Per the discussion in:

  https://groups.google.com/d/msg/mozilla.dev.platform/P79pwa9z5m8/iPYPAWPHCAAJ

They should be CamelCase, and that's what most of them already do. This converts
the rest, which are a few.

For the ones that already used `e` or `k` prefixes, I've mostly done:

 for file in $(rg Type::e layout | cut -d : -f 1 | sort | uniq); do sed -i 's#Type::e#Type::#g' $file; done

For the ones that used uppercase, I've removed the prefix if it was already in
the type name, and turn them into CamelCase.

Depends on D28680

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

--HG--
extra : moz-landing-system : lando
2019-04-25 23:03:04 +00:00