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

51 Коммитов

Автор SHA1 Сообщение Дата
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
Carsten "Tomcat" Book 0f88d840e4 Backed out changeset 27b1dd843116 (bug 1281793) 2016-06-28 17:04:49 +02:00
Andrea Marchesini 430a14cd11 Bug 1281793 - Remove some non-used telemetry IDs - part 4 - random things (2), r=chutten 2016-06-28 16:44:42 +02:00
Mats Palmgren f3949ab1d3 Bug 1216001 part 1 - Optimize nsRange::IsNodeSelected. r=bz 2016-02-13 18:40:23 +01:00
Phil Ringnalda 9d0e08b626 Back out 3 changesets (bug 1216001) for Win8 reftest failures in 1193519-sideways-lr-3.html and 1193519-sideways-lr-4.html and intermittent OS X failures in font-display-2.html
CLOSED TREE

Backed out changeset dbadb8fe5803 (bug 1216001)
Backed out changeset a30593ebd58e (bug 1216001)
Backed out changeset c1646ffa71b4 (bug 1216001)
2016-02-11 20:43:41 -08:00
Mats Palmgren a3c53b91a3 Bug 1216001 part 1 - Optimize nsRange::IsNodeSelected. r=bz 2016-02-12 02:13:57 +01:00
Robert O'Callahan 7c373233ed Bug 264412. Implement HTMLElement.innerText. r=smaug,mats
--HG--
extra : commitid : KjCvQzulwP3
extra : rebase_source : 01aae50d1ee8304e56d3d1e21a7c65c2f9060a72
2015-10-30 18:37:03 +13:00
Robert O'Callahan 0e2b65352f Revert incorrectly committed changes ab657569f554 and a396f4262479
--HG--
extra : commitid : IHQ60dccnSZ
extra : amend_source : 9302339fd951446a37909b31a1ccb56aff470325
2015-10-24 22:38:22 +13:00
Robert O'Callahan b09242d6c1 Bug 264412. Implement HTMLElement.innerText. r=smaug,mats
--HG--
extra : commitid : LLiSI8usEMT
extra : rebase_source : 928b4fd451c28b57a43a873f05b7bf030ba13083
2015-10-21 10:23:17 +13:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Michael Layzell fe31896607 Bug 571294 - Part 1: Implement selection events behind the dom.select_events.enabled pref, r=smaug 2015-09-12 17:56:44 -04:00
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Andrew McCreight 9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Andrea Marchesini e6f385fb3d Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
Ehsan Akhgari 883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Boris Zbarsky dc24477d79 Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp.  The
rest of this diff was generated by running the following commands:

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 10:13:33 -04:00
Mats Palmgren e0d89578ed Bug 1135413 - Use one bit per bool member to save a few bytes in nsRange objects. r=smaug 2015-02-24 18:35:30 +00:00
Mats Palmgren bd4f1d7ffe Bug 1129078 - part 3, Add a mIsGenerated bit to ranges that ExcludeNonSelectableNodes created due to user-select:none. Also, return the index to the range we want to be the new mAnchorFocusRange, based on the Selection direction. r=smaug 2015-02-21 04:27:59 +00:00
Wes Kocher 88f34ca973 Backed out 8 changesets (bug 1129078, bug 1128722) for mochitest-5 failures
Backed out changeset f7eff607655a (bug 1128722)
Backed out changeset 801b3abc0de8 (bug 1128722)
Backed out changeset 275d27c2dba0 (bug 1129078)
Backed out changeset 9830ab1a2028 (bug 1129078)
Backed out changeset ce5cb876af9a (bug 1129078)
Backed out changeset c199ff86c77f (bug 1129078)
Backed out changeset 38b1b039f14d (bug 1129078)
Backed out changeset c8a99ee97313 (bug 1129078)
2015-02-20 12:24:25 -08:00
Mats Palmgren a895b6ecaf Bug 1129078 - part 3, Add a mIsGenerated bit to ranges that ExcludeNonSelectableNodes created due to user-select:none. Also, return the index to the range we want to be the new mAnchorFocusRange, based on the Selection direction. r=smaug 2015-02-20 17:34:21 +00:00