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

114 Коммитов

Автор SHA1 Сообщение Дата
Boris Zbarsky f60fd673d6 Bug 1432186 part 19. Remove the nsIDOMNode::*_NODE constants. r=mccr8
MozReview-Commit-ID: KvKjeKIOB9K
2018-01-29 23:10:53 -05:00
Boris Zbarsky 87cd3b385a Bug 1432186 part 14. Remove nsIDOMNode's childNodes attribute. r=mccr8
MozReview-Commit-ID: JyQjEYngKAT
2018-01-29 23:10:51 -05:00
Boris Zbarsky 3b6d43f65c Bug 1432186 part 4. Remove nsIDOMNode's nodeValue attribute. r=mccr8
MozReview-Commit-ID: Aqt4NDjcdKW
2018-01-29 23:10:50 -05:00
Andrea Marchesini b8bb98af8c Bug 1430997 - Rename nsINode::IndexOf to nsINode::ComputeIndexOf, r=catalinb 2018-01-23 14:30:18 +01:00
Andrea Marchesini 43c8e4e21b Bug 1425440 - Get rid of GetChildAt_Deprecated in nsRange, r=catalinb 2018-01-12 15:33:13 +01:00
Cameron McCormack c4663ea0f0 Bug 1427419 - Part 22: Move inIDOMUtils.getUsedFontFaces to InspectorUtils. r=bz
This also changes the function to return a sequence (JS Array) instead of
an nsFontFaceList object, and converts nsFontFace/nsIDOMFontFace into a
Web IDL implemented object too.

MozReview-Commit-ID: 1iAW3DYe5kO

--HG--
rename : layout/inspector/nsFontFace.cpp => layout/inspector/InspectorFontFace.cpp
2018-01-11 12:38:01 +08:00
Andrea Marchesini 00e79ef07b Bug 1425321 - Renaming nsINode::GetChildAt to GetChildAt_Deprecated, r=catalinb
We want to deprecate nsINode::GetChildAt as the first step of removing DOM node
child array storage. See bug 651120.
2018-01-03 13:59:54 +01:00
Adam Gashlin a0a93d0d91 Bug 1424839 - Continue checking selections after a collapsed one r=mats
MozReview-Commit-ID: 4YXtx2bEprU

--HG--
extra : rebase_source : 3c94d78c9865d31f9c87e713b58922164ac6d805
2017-12-14 14:29:59 -06:00
Edgar Chen 5fedbb92b8 Bug 1422197 - Add fast path to get DocGroup in binding code for [CEReactions]; r=smaug
MozReview-Commit-ID: HgbFo9ddr0o

--HG--
extra : rebase_source : 04989782fc7c7ce79e0e65b3dc907c9e174a0809
2017-11-27 16:10:27 +08:00
Masayuki Nakano bab72d08e8 Bug 1423097 - part 2: Add overloads of nsRange::SetStart(), nsRange::SetEnd(), nsRange::IsPointInRange() and nsRange::ComparePoint() to use them with RawRangeBoundary r=smaug
nsRange::SetStart(), nsRange::SetEnd(), nsRange::IsPointInRange() and
nsRange::ComparePoint() take a set of container node and offset in it to
specifying a DOM point.  However, the caller may not have computed the offset
but may know the child node at the point.  In such case, they can avoid
computing the offset with nsINode::IndexOf() if they have overloads which
take RawRangeBoundary.

Therefore, this patch implements the overloads and changes the callers in
editor.

MozReview-Commit-ID: E4DLbAgTTCI

--HG--
extra : rebase_source : 8d1632a030f1e0a0dd2b81c3996c19d427e8b0bd
2017-12-05 17:50:13 +09:00
Adam Gashlin 95018ae790 Bug 1374338 - Search all ranges to avoid filtering r=mats
MozReview-Commit-ID: uu35565lfP

--HG--
extra : rebase_source : e7f885b58f172998533c73fd8dff3d27d58c6dd6
2017-12-01 14:53:20 -08:00
Masayuki Nakano 0b2f749b62 Bug 1422668 - Back out changes of RangeBoundary.h which were added for EditorDOMPoint r=catalinb
EditorDOMPoint was a subclass of RangeBoundary.  Therefore, for heavy
use of it in editor, we've implemented a lot of complicated feature
into RangeBoundary.  However, EditorDOMPoint stopped inheriting
RangeBoundary.  So, we can get simple RangeBoundary implementation
back now.

This patch makes RangeBoundary.h almost same as 3f7cbec2446b except
keeps implementing GetPreviousSiblingOfChildAtOffset() and
GetNextSiblingOfChildAtOffset() because the former is used by
Selection and both of them are simple.  And also keeps making it
a friend of EditorDOMPoint because EditorDOMPoint still needs to
copy to/from RangeBoundary.

MozReview-Commit-ID: Hr5SA52ScK0

--HG--
extra : rebase_source : a00a46ff931a5c4fcabf910510fa448b513f50c5
2017-12-04 16:28:50 +09:00
Masayuki Nakano 45ce515072 Bug 1408544 - part 2: RangeBoundaryBase shouldn't compute mRef when mOffset is specified r=catalinb
RangeBoundaryBase shouldn't compute mRef when it's initialized with offset.
E.g., some users of the template class may initialize it with a container and
offset in it but it may not refer mRef or may refer after modifying offset.

On the other hand, RangeBoundaryBase::InvalidateOffset() is a special method.
It assumes that mRef is always initialized when it's called but can be
invalidate mOffset until retrieved actually.  This is necessary for
nsRange::mStart and nsRange::mEnd since the offset may be changed when
some nodes are inserted before the referring node.

So, now, InvalidateOffset() should be a protected method and make nsRange a
friend class of RangeBoundaryBase.  Then, when nsRange sets mStart and/or mEnd,
nsRange itself should guarantee that their mRefs are initialized.

MozReview-Commit-ID: Alr4YkDXIND

--HG--
extra : rebase_source : 7e6828374db7989ae91b9e485571ec553f7435af
2017-11-02 21:25:14 +09:00
Emilio Cobos Álvarez 75916bf75c Bug 1413361: EnsureFrameForTextNode shouldn't reconstruct synchronously without up-to-date styles. r=bz
MozReview-Commit-ID: IzpcdCdcPjr
2017-11-01 20:06:28 +01:00
Emilio Cobos Álvarez dd634e3981 Bug 1411612: Kill nsINode::eCONTENT. r=bz
MozReview-Commit-ID: ESlOqlwhcHI

--HG--
extra : rebase_source : fe6a02469dca1e50c24ba166e15e39160ab4551b
2017-10-25 17:19:11 +02:00
Boris Zbarsky b980d7ce62 Bug 1408444. Flag a few more ErrorResults as would-report-JS-exceptions. r=peterv
MozReview-Commit-ID: 6kx4TOao7nM
2017-10-23 16:30:18 -04:00
Catalin Badea d059041927 Bug 1402251 - Assert ranges our not added to multiple common ancestor lists. r=smaug 2017-10-10 12:10:00 +01:00
Ehsan Akhgari 646c3c8a8a Bug 1405771 - Run the selection listeners after Range mutation observers have finished running to make sure no stale Ranges are observable from the listeners; r=smaug 2017-10-06 15:54:39 -04:00
Catalin Badea f8162c4bfd Bug 651120 - Remove index argument from content removed/appended/inserted notifications. r=peterv 2017-10-03 11:09:08 +01:00
Nika Layzell 80c94fabbf Bug 1399626 - Part 2: Add overloads of nsRange::{CreateRange, SetStartAndEnd} which take RangeBoundaries, r=masayuki
MozReview-Commit-ID: 3u6jcMh5mni
2017-10-02 11:57:59 -04:00
Michael Layzell 8e30ba31d0 Bug 1384915 - Part 1: Refactor RangeBoundary out of nsRange so it can be used by other classes, r=masayuki 2017-09-25 18:14:42 -04:00
Catalin Badea 98224a4eda Bug 1399091 - Avoid adding the same range to multiple selections. r=mats 2017-09-24 16:44:51 -04:00
Boris Zbarsky 19700317d5 Bug 1396520. Add back in the IsInSelection() check in IsNodeSelected. r=mats
This should really always test true, but apparently sometimes doesn't...
that's quite strange.  Hopefully the diagnostic asserts will help pin down how
it can happen.

MozReview-Commit-ID: 4bxdalIaUnQ
2017-09-13 16:53:45 -04:00
Catalin Badea d952c00aad Bug 1395936 - Avoid child index usage in HTMLEditor::DoContentInserted. r=masayuki 2017-09-06 21:38:43 +01:00
Sebastian Hengst c2f7bd1de9 Backed out changeset dbb4fb7aa5bb (bug 1395936) for assertions and crashes in a11y test, mochitests, reftests, crashtest, ...; r=backout on a CLOSED TREE 2017-09-06 13:25:37 +02:00
Catalin Badea c90d69fac0 Bug 1395936 - Avoid child index usage in HTMLEditor::DoContentInserted. r=masayuki 2017-09-06 11:26:03 +01:00
Boris Zbarsky c73dc94931 Bug 1395701 part 2. Use a linked list, not a hashtable, for registering selection ranges on a node, so the registration will be faster. r=ehsan
Inserting/removing things into a doubly-linked list is much faster than doing
the same with a hashtable.  Selection ranges register themselves on their common
ancestor, but all we do with that in non-debug code is iterate all the ranges
registered.  A doubly-linked list works fine for that.

This adds three words to every range for the LinkedListItem members, but that
should be OK.
2017-09-01 11:13:47 -04:00
Sebastian Hengst 5b321f702f Backed out changeset dd99274926b8 (bug 1395701) for huaf in clipboard suite on Linux x64 asan and M(8), furthermore frequently asserting at LinkedList.h:455. r=backout 2017-09-01 19:29:06 +02:00
Boris Zbarsky dfd04e984c Bug 1395701 part 2. Use a linked list, not a hashtable, for registering selection ranges on a node, so the registration will be faster. r=ehsan
Inserting/removing things into a doubly-linked list is much faster than doing
the same with a hashtable.  Selection ranges register themselves on their common
ancestor, but all we do with that in non-debug code is iterate all the ranges
registered.  A doubly-linked list works fine for that.

This adds three words to every range for the LinkedListItem members, but that
should be OK.
2017-09-01 11:13:47 -04:00
Boris Zbarsky 2bcb5d26b9 Bug 1395701 part 1. Maintain the "registered common ancestor" in a member on selection ranges. r=ehsan
This costs an extra word per range, but ranges aren't that small anyway.  The
benefit is that we don't have to recompute it dynamically when we need it, which
lets us simplify how selection ranges get registered with their common ancestors.
2017-09-01 11:13:25 -04:00
Catalin Badea d074b09d16 Bug 1380367 - Use a node reference as range boundary in nsRange. r=smaug 2017-09-01 11:53:22 +01:00
Masayuki Nakano e3529fd155 Bug 1375502 - part2: Add nsIContentIterator::Init(nsINode*, uint32_t, nsINode*, uint32_t) r=mats
nsIContentIterator::Init() takes nsRange but it's too expensive for some users.
So, there should be another Init() which can be specified a range in DOM tree
with 2 pairs of nsINode* and uint32_t.

MozReview-Commit-ID: 6JXic0KOM2d

--HG--
extra : rebase_source : 28ff355a2aa0dcb5d65495806ef8c67f1da642ea
2017-06-26 17:26:27 +09:00
Masayuki Nakano acde25fb18 Bug 1375502 - part1: ContentEventHandler shouldn't use nsRange for temporary use r=mats
Allocating and initializing nsRange is too expensive especially for temporary
use.  However, ContentEventHandler uses nsRange only for representing two DOM
points.  So, it should use simpler helper class, RawRange, for reducing some
unnecessary runtime cost.

Note that this still uses nsRange for initializing nsIContentIterator.  This
will be fixed by the following patch.

MozReview-Commit-ID: 5TUy6yJf7HA

--HG--
extra : rebase_source : c4eb58e8f37c408c75479e6961ba9225f8bcee77
2017-06-23 13:21:47 +09:00
Olli Pettay aeabc0c261 Bug 1392564 - Use nursery purple buffer for nsRange and RangeItem, r=mccr8
--HG--
extra : rebase_source : 650d101bb0cec4ed21b35945ae1185aca577b120
2017-08-22 17:47:00 +03:00
Wes Kocher 7a772df5bf Merge m-c to inbound, a=merge
MozReview-Commit-ID: BYZASFIrXxp
2017-08-14 17:58:17 -07:00
Milan Sreckovic 8ad3e52a49 Bug 1387514: Upgrade BaseRect (derived classes) width and height direct member variable use to instead use Width()/SetWidth() and Height()/SetHeight() in dom/*. r=overholt
MozReview-Commit-ID: B9YWmM3C1oX

--HG--
extra : rebase_source : d7c27de968295ee13ece8bda23798cb215d60a4b
2017-08-14 08:30:10 -04:00
Ehsan Akhgari 4396fda529 Bug 1385389 - Do not delete the common ancestor ranges hashtable in nsRange::UnregisterCommonAncestor() because chances are we need to recreate it shortly after; r=smaug 2017-08-14 12:31:15 -04:00
Aryeh Gregor ee2971cce8 Bug 1388775 - extractContents should copy nodes in tree order, not backwards; r=smaug
Per spec, Range.prototype.extractNodes() should copy the nodes in tree
order:

https://dom.spec.whatwg.org/#dom-range-extractcontents

Gecko instead copies them in reverse order.  This causes us to fail a
wpt MutationObserver test.

MozReview-Commit-ID: 8MYXGhDsJCd

--HG--
extra : rebase_source : 94fb2e96370e575906ba9927d904561744a1d7bb
2017-08-09 18:40:21 +03:00
Aryeh Gregor be9bccc716 Bug 1388746 - Do not split start/end text nodes in deleteContents/extractContents; r=smaug
If a range endpoint is in the middle of a text node, and you call
deleteContents() or extractContents(), the spec says to delete the data
from the node.  In the case of extractContents(), the new text node
that's inserted into the DocumentFragment is a clone with its data set
to the bit that was deleted.
<https://dom.spec.whatwg.org/#dom-range-deletecontents>
<https://dom.spec.whatwg.org/#dom-range-extractcontents>

We don't do this.  Instead, we split the text node.  Then the bit to
delete is deleted naturally at a later stage together with all the other
nodes.

The result is the same, but on the way there we do a bunch more node
mutations.  This causes extra mutation records, which cause us to fail a
WPT test.  Chrome passes.  Changing to match the spec actually reduces
our lines of code anyway.

MozReview-Commit-ID: FTTV5yNSj71

--HG--
extra : rebase_source : 8d5f36c68c71db0700f0b86d1a73462759f922e8
2017-08-09 17:39:06 +03:00
Ehsan Akhgari 585393f54b Bug 1382914 - Store the hashtable of ancestor ranges in the node slots instead of in a property in order to speed up access to it; r=smaug 2017-07-25 13:01:16 -04:00
Masayuki Nakano 2f92264fb7 Bug 1377978 - Make nsRange use uint32_t to offset r=smaug
DOM Standard defines that offset of Range is unsigned long.  However, nsRange uses int32_t to them.

This patch makes nsRange use uint32_t instead.  However, this patch does NOT allow to set over INT32_MAX as offset values since a lot of users of nsRange cannot treat the values as over INT32_MAX because a lot of internal APIs take int32_t as offsets.

For easier to search such points, this patch adds static_cast<int32_t> to uint32_t variables when they are used for int32_t arguments.

And note that nsContentUtils::ComparePoints() behaves odd.  It accepts negative offset and compares such value with valid offset simply.  This patch still uses int32_t offset variables in nsRange::CompareNodeToRange() even though it may be negative value if nsINode::IndexOf() returns -1 because the caller of it depends on this behavior.

MozReview-Commit-ID: 8RbOgA86JuT

--HG--
extra : rebase_source : 46d526c6d50dfa2f104439b19b8691477b17a4af
2017-07-19 22:49:52 +09:00
Jim Chen 8b6bd21a0b Bug 1351170 - 2. Notify selection listeners after adjusting range offsets; r=smaug
`nsRange` registers mutation observers to adjust the range when content
changes. However, there are some cases where we adjust the start and/or
end offsets but don't notify selection listeners (i.e. we don't call
`nsRange::DoSetRange` to set the new range points, contrary to what the
comment above `nsRange::DoSetRange` says). This patch makes us call
`nsRange::DoSetRange` in those cases. The patch adds a testcase in
test_selectevents.html, and changes a few unexpected-pass cases in
test_composition_text_querycontent.xul that this patch fixed.

MozReview-Commit-ID: 73D8RYMS3MS

--HG--
extra : rebase_source : da0cc3073e4b8ad23c6f6eab42da5aa8b269cae9
2017-07-19 14:29:59 -04:00
Masayuki Nakano 33d778a999 Bug 1377989 - part12: Rename local variables, |endParent| which is set to start container of nsRange to |endContainer| r=smaug
This does NOT change variable names like |endNode| because it's not odd and somebody use it for nsINode and endContent for nsIContent.  So, changing them needs more work.

MozReview-Commit-ID: 22imUltlu5R

--HG--
extra : rebase_source : 6c93069d0586b37c5084eaa71861085c01da7a7d
2017-07-12 00:08:37 +09:00
Masayuki Nakano 3fd54e5d5f Bug 1377989 - part11: Rename local variables, |startParent| which is set to start container of nsRange to |startContainer| r=smaug
This does NOT change variable names like |startNode| because it's not odd and somebody use it for nsINode and startContent for nsIContent.  So, changing them needs more work.

MozReview-Commit-ID: H19pTDprRuT

--HG--
extra : rebase_source : 7a7454ac14da48a597ff19a50c863d04dcaddd6e
2017-07-12 00:02:14 +09:00
Masayuki Nakano b1f8f6d611 Bug 1377989 - part10: Rename local variables, |parent| which is set to container of nsRange to |container| r=smaug
MozReview-Commit-ID: 9w3O7MJEDBS

--HG--
extra : rebase_source : 92194bd18c9e79210c7cb4e9835a528d51e8ba7a
2017-07-11 23:52:39 +09:00
Masayuki Nakano 8ac3f6520d Bug 1377989 - part9: Rename aEndParent and aEndNode related to nsRange to aEndContainer r=smaug
MozReview-Commit-ID: 8XJbHfsg2hu

--HG--
extra : rebase_source : 0ee22f0b0cf5fd8c0a8fea610c54be8492436488
2017-07-12 00:09:37 +09:00
Masayuki Nakano 4af6e5d4a7 Bug 1377989 - part8: Rename aStartParent and aStartNode related to nsRange to aStartContainer r=smaug
MozReview-Commit-ID: H3wzW7eaQBg

--HG--
extra : rebase_source : 90aa8e2a20a0de27a1598925d8c70186463333cf
2017-07-11 23:10:42 +09:00
Masayuki Nakano e756fe8300 Bug 1377989 - part7: Rename aParent, aParentNode and aNode related to nsRange to aContainer r=smaug
MozReview-Commit-ID: K7Lu0U0pdC8

--HG--
extra : rebase_source : 324de9d2927231414395799c0f002889321b7d1e
2017-07-11 23:33:04 +09:00
Masayuki Nakano dd7bcc05ab Bug 1377989 - part6: Rename mEndParent of nsRange and similar members of similar objects to mEndContainer r=smaug
MozReview-Commit-ID: KOcajaTv5ga

--HG--
extra : rebase_source : c1fac0fd8aebf02d0623eb291d914b4ac1fd7065
2017-07-11 22:57:55 +09:00
Masayuki Nakano 4ff0c2334b Bug 1377989 - part5: Rename mStartParent of nsRange and similar members of similar objects to mStartContainer r=smaug
MozReview-Commit-ID: 5QJahMKnKEJ

--HG--
extra : rebase_source : 0b4aee62fcd70574b3dc44e05392b2a8d6ff6ee5
2017-07-11 22:46:11 +09:00