Commit Graph

70 Commits

Author SHA1 Message Date
Boris Zbarsky
a517e45add Bug 1452183 part 4. Remove nsIDOMDocumentFragment. r=mccr8 2018-04-17 21:13:03 -04:00
Boris Zbarsky
f803b0085b Bug 1447889 part 13. Remove unused nsIDOMRange bits. r=mystor
MozReview-Commit-ID: CjtfHTtcviJ
2018-03-27 00:35:22 -04:00
Boris Zbarsky
2367e5d3ff Bug 1447889 part 12. Remove nsIDOMRange::ToString. r=mystor
MozReview-Commit-ID: 8TDYC3f4ENn
2018-03-27 00:35:22 -04:00
Boris Zbarsky
6a7475413e Bug 1447889 part 7. Remove nsIDOMRange::Collapse. r=mystor
MozReview-Commit-ID: LLiXK8IpUdY
2018-03-27 00:35:21 -04:00
Chris Peterson
fe5cd3d5d9 Bug 1436263 - Part 3: Remove virtual from final virtual function declarations. r=froydnj
MozReview-Commit-ID: 8pjYjEvQF42

--HG--
extra : rebase_source : 5eb0bea2ef5f06a811b4f3daf57ce8720f12dd07
2018-02-08 21:22:43 -08:00
Chris Peterson
0129d900f3 Bug 1436263 - Part 2: Replace override final virtual function specifiers with just final. r=froydnj
MozReview-Commit-ID: 70gt5SUu4Dv

--HG--
extra : rebase_source : 71912c6bde22aaed01e70615a4ee794a36e70d0e
extra : source : 1c22d4c65d70b797ee3e963ec426c90e1f89b5e3
2018-02-05 22:50:00 -08:00
Jonathan Kew
7a1f777b90 Bug 1435989 - Add a 'ranges' attribute to the InspectorFontFace object, to expose ranges of text that were rendered with a specific font. r=bz,dholbert 2018-02-15 18:48:22 +00: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
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
Masayuki Nakano
898bbb3137 Bug 1415062 - part 1: Selection should have Collapse(const RawRangeBoundary&) and Collapse(const RawRangeBoundary&, ErrorResult&) for avoiding computing offset of child node in container r=smaug
Selection should have Collapse() methods which take RawRangeBoundary instead of
a set of container and offset in it.  Then, if caller know only child node but
doesn't know offset in the container, neither callers, Selections nor nsRange
needs to compute offset.  This makes them avoid calling expensive method,
nsINode::IndexOf().

MozReview-Commit-ID: 79IRajLe1FE

--HG--
extra : rebase_source : a8ce52ff1654974461d5ecfed98b73d9cca34133
2017-11-07 15:29:15 +09: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
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
615d87dfaf Bug 1384915 - Part 4: Update RawRange to use RangeBoundaries, r=masayuki 2017-09-25 18:14:43 -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
Olli Pettay
51370afb6d Bug 1398153 - Try to Release/AddRef a bit less in nsRange::DoSetRange, r=baku
--HG--
extra : rebase_source : ee4edd8205aceb1a4e52338c4b5f53445c47e0d0
2017-09-08 15:22:05 +01:00
Ehsan Akhgari
233352f9ba Bug 1397576 - Avoid using GetChildAt() in HTMLEditor::GetCellFromRange(); r=smaug 2017-09-07 09:36:07 -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
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
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
Masayuki Nakano
e54f65d40e Bug 1377989 - part4: Rename nsRange::GetParentAndOffsetBefore() to nsRange::GetContainerAndOffsetBefore() r=smaug
MozReview-Commit-ID: 5ihlHifgZMt

--HG--
extra : rebase_source : 443c1d1b64c9acbfd7142b79a22b72a7614b91a6
2017-07-11 21:23:54 +09:00
Masayuki Nakano
fa5e6a171b Bug 1377989 - part3: Rename nsRange::GetParentAndOffsetAfter() to nsRange::GetContainerAndOffsetAfter() r=smaug
MozReview-Commit-ID: LsRjvVmfJmC

--HG--
extra : rebase_source : 32f4ee435dcf9323947f67cb4db70f0db1a4c9c1
2017-07-11 21:17:52 +09:00
Masayuki Nakano
4ee17d1b8c Bug 1377989 - part2: Rename nsRange::GetEndParent() to nsRange::GetEndContainer() r=smaug
MozReview-Commit-ID: K4qPjtZ62yO

--HG--
extra : rebase_source : 8653db98b9bd70c77a6aac8d906f401f0222c58a
2017-07-11 21:11:37 +09:00
Masayuki Nakano
2f2ce53be5 Bug 1377989 - part1: Rename nsRange::GetStartParent() to nsRange::GetStartContainer() r=smaug
Web standards use "Container" instead of "Parent".  So, nsRange shouldn't use "Parent" for its members and methods.

MozReview-Commit-ID: Ho6N0diuWtE

--HG--
extra : rebase_source : ee4eb7068a68b118c7fe98e9e9e7fa9c9e7f13e2
2017-07-11 20:53:04 +09:00
Sylvestre Ledru
4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Mats Palmgren
4773d84ed5 Bug 1375097 - Remove nsRange::SetEnableGravitationOnElementRemoval() since it's now dead code. r=smaug
MozReview-Commit-ID: Er67fFQP5lF
2017-06-23 02:03:09 +02:00
Masayuki Nakano
47fb9898f8 Bug 1367740 Selection::Collapse() should reuse old nsRange instance if it's not referred by anybody r=mats
Selection::Collapse() removes all ranges first, then, adds a collapsed range which is a new instance of nsRange.

However, new nsRange's initialize cost isn't cheap. It needs to add itself to mutation observer and computes common ancestor.  However, Selection::Collapse() doesn't move the range to different document.  If old range is reusable, we can avoid to remove old range from mutation observer and add new range to mutation observer, and also we can avoid to recompute common ancestor if the node is not changed, e.g., only offset is changed in selected node.

MozReview-Commit-ID: BoCBod7WVr5

--HG--
extra : rebase_source : 9ccee28aebba355ebb1137ebc1d02e7d8a30aedf
2017-05-25 18:04:55 +09:00
Masayuki Nakano
61af94acbd Bug 1367683 Optimize initializing nsRange r=smaug
nsRange::DoSetRange() adds/remove its root to/from mutation observer, initializes common ancestor, registers itself to the common ancestor, unregisters itself from old common ancestor, and notifies selection listeners of selection change.

However, those runtime cost is expensive but on the other hand, a lot of callers set both start and end of the range and that causes calling DoSetRange() twice.

This patch renames Set() to SetStartAndEnd() for easier to understand the meaning and make it call DoSetRange() only once.

MozReview-Commit-ID: FRV55tuBAgg

--HG--
extra : rebase_source : 67adf929cf119e2425f7d3741651217522094590
2017-05-30 13:18:25 +09:00
Masayuki Nakano
85f46a7ab4 Bug 1348195 nsRange should set mCalledByJS to false before calling Selection::NotifySelectionListners() because non-*JS() methods may be called during a call of it r=smaug
When nsRange::*JS() is called, mCalledByJS is set to true.  In such case, Selection::NotifySelectionListeners() may move focus or anyway, it calls selection listeners.  Then, they may cause calling non-*JS() methods of the nsRange instance. In this case, nsRange treats the call as called by JS since mCalledByJS is still true.

For preventing this issue, before calling Selection::NotifySelectionListeners(), nsRange should set mCalledByJS to false.

This patch renames AutoCalledByJSSetter to AutoCalledByJSRestore and make it stop setting mCalledByJS automatically.  So, AutoCalledByJSRestore works same as AutoRestore now.

MozReview-Commit-ID: IYsbQTGp3VA

--HG--
extra : rebase_source : 582eb2288c035861f16149dde42c22aba555bb5a
2017-03-17 13:32:51 +09:00
Masayuki Nakano
a959abd5c5 Bug 1318312 part.2 Mark Selection as "called by JS" when every Selection API which may cause changing selection is called by JS r=smaug
Selection needs to be able to distinguish if every selection change is caused by JS (i.e., via Selection API) or the others.

This patch maps some methods of Range and Selection to *JS().  Each of them marks its instance as "used by JS" and calls corresponding method.

With this change, Selection::NotifySelectionListeners() can move focus only when it's caused by Selection API.

MozReview-Commit-ID: 1GoLHiIJ10Y

--HG--
extra : rebase_source : 02d497f9e55b3325a2e01c3041cadb90881dccb8
2017-03-10 16:55:12 +09:00
Brad Werth
f210879e4b Bug 1343978 Part 1: Change ClientRectsAndTexts usage of DOMStringList to Sequence<DOMString>. r=smaug
MozReview-Commit-ID: 8mKxdPTq4Ej

--HG--
extra : rebase_source : bd2fb4e9e9c1962f4a678bbb42816e5cfb738fa0
2017-03-02 13:13:12 -08:00
Brad Werth
112882e6c5 Bug 1314080 Part 3: Add a new ChromeOnly DOM method and wire it to CollectClientRectsAndText. r=smaug
MozReview-Commit-ID: GRM87Pi3g4G

--HG--
extra : rebase_source : e18a1740203cf32be2000a0f6214f4c34a71cd7e
2016-11-02 13:31:06 -07:00
Brad Werth
1e29a9cf1c Bug 1314080 Part 1: Rename CollectClientRects method and add a new parameter for collecting text. r=smaug
MozReview-Commit-ID: KQPky6Fh8sG

--HG--
extra : rebase_source : 33bce65c1752aeb7a2225a981f2dadf7e2ce5916
2016-11-02 13:49:43 -07:00
Andrea Marchesini
163825f4a6 Bug 1281793 - Remove some non-used telemetry IDs - part 4 - random things (2), r=chutten 2016-06-28 19:30:37 +02:00