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
When we turn on the pref security.data_uri.unique_opaque_origin to make
data URI is unique origin, the following tests will fail because now
data document is treated as cross origin, so we replace data URIs with
seperate files, hence it will still in the same origin.
Add minimal crash test for this. When removing a line, this doesn't occur.
MozReview-Commit-ID: JqS2E8q47ML
--HG--
extra : rebase_source : 322a77cbc49e29bbd6b705650485634dd4801b8b
When using EditAction::insertBreak action, if selection node isn't content, this crash occurs. So we should reject to promote range when it isn't content node.
MozReview-Commit-ID: AJ4oEOmRTgm
--HG--
extra : rebase_source : 04c4e4a2e04a0d0a058eb86fdfde0005edb681a9
GetPromotedPoint still uses nsIDOMNode, so we should use nsINode etc instead for clean up.
MozReview-Commit-ID: 4efe46iU7lC
--HG--
extra : rebase_source : bb13c4531fb76684d4baf13e24dc777d79c2ad61
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
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
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
When setting empty value by input.value, we remove text node and insert bogus node. But creating and removing node are expensive. So we should keep text node for performance if possible.
Now, DocumentIsEmpty only checks bogus node to detect empty. So, keeping text node change causes that document cannot detect as empty. If root has only text node and all is empty, we should detect empty document.
This change should be only plain text editor. HTML editor already allows multiple text nodes, so we should keep old behaviour on HTML editor.
MozReview-Commit-ID: Gt8GmdWAA3E
--HG--
extra : rebase_source : 4c5deba024cab3d7e2e1e2a8ec53a29f2fdf8cd9
All the instances are converted as follows.
- nsAFlatString --> nsString
- nsAFlatCString --> nsCString
--HG--
extra : rebase_source : b37350642c58a85a08363df2e7c610873faa6e41
HTMLEditor inherits some interface classes. Therefore, CachedWeakPtr is confused at ambiguous conversion from HTMLEditor to nsISupports. Therefore, this patch adds second parameter to the template class.
MozReview-Commit-ID: KGSYJHfp1L5
--HG--
extra : rebase_source : 7189372c4c06218c3040701196eac51ded85d3fa
Using concrete class rather than interface classes (nsI*Editor) will allow to reduce QI and some virtual calls. Therefore, Editor classes should be used as concrete class as far as possible.
Unfortunately, if classes referring editor are initialized via scriptable interface, we cannot do this because nsI*Editor is still not marked as builtinclass. Therefore, their editor may be implemented by JS. E.g., inline nsIInlineSpellChecker.init() and nsIDocShell.editor. Such remaining cases should be fixed after nsI*Editor classes are marked as builtinclass.
Note that this patch also creates nsIdentifierMapEntry.h which is separated from nsDocument.h because ShadowRoot.h needs the class but exposing nsDocument.h to the global and includes it causes bustage on Linux and Android. Therefore, for fixing the include hell, this patch touches them and ContentChild.cpp.
MozReview-Commit-ID: i6fLWw6Qeo
--HG--
rename : dom/base/nsDocument.h => dom/base/nsIdentifierMapEntry.h
extra : rebase_source : c57bdfc1c13775acdcfd4732d8157d04d6b6613f
We have a possible loop like this bug. So we should use stack class for loop.
MozReview-Commit-ID: LQb9w8LEtbx
--HG--
extra : rebase_source : 67c40a0f2e3528d58fe7d0ea6ca290bbc136c6d1
This crash occurs that range is nullptr.
DeleteNonTableElements will update selection and range, so we shouldn't use range count before modifying selection. So we should save range data for loop.
MozReview-Commit-ID: C9c4TZqRvUc
--HG--
extra : rebase_source : cbadc6d6d82e1c904c20309f2e82f2b6c2f438e7
Although this crash doesn't occur after landing bug 1369140, we should add this test to crashtest.
MozReview-Commit-ID: mRm4P876zg
--HG--
extra : rebase_source : 9a85c8ba3a5652000512d165b82df9aa2c8176e1