There is no reason that SetTextRangeStyle is defined at nsISelectionPrivate. Also, SetTextRangeStyle isn't scriptable, and is called from CompositionTransaction::SetIMESelection only. So we should move this to Selection.
MozReview-Commit-ID: FCOA6wVhvYZ
--HG--
extra : rebase_source : 64eb9e5fb973195b2c87ab4eb296685c8a4d0319
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
We should not be declaring forward declarations for nsString classes directly,
instead we should use nsStringFwd.h. This will make changing the underlying
types easier.
--HG--
extra : rebase_source : b2c7554e8632f078167ff2f609392e63a136c299
Since we enable lazy frame construction for editable region, whitespace only node might not have frame even if editable. This test has whitespace only node into contenteditable, we need adjust caret operation for this test.
MozReview-Commit-ID: GQfKiYdYOdi
--HG--
extra : rebase_source : 0685d724f6af050d79c1cf007c7ee48c05da14ac
These are all simple cases, with similarities to previous patches in this
series.
--HG--
extra : rebase_source : 6ef36382df9fef217d5cb737e218d65ac062f90a
When parent node of selected node is null, crash might occur in GetCSSBackgroundColorState. So when parent is null, we should return default value. In this situation, Edge and Blink don't throw error, Gecko shouldn't return error too.
MozReview-Commit-ID: 5C6jSAFkCso
--HG--
extra : rebase_source : 0185f9fb5fde92eee5611e6bb95e8676c10b135c
nsTextFrame stores text as single byte character array if all characters are
less than U+0100. Although, this saves footprint, but retrieving and modifying
text needs converting cost. Therefore, if it's created for a text node in
<input> or <textarea>, it should store text as char16_t array.
MozReview-Commit-ID: 9Z82rketT7g
--HG--
extra : rebase_source : 59f59ac1488c21a57d95d253cc794a011d672c95
EditorBase::GetSelection() sometimes appears in profile. So, it shouldn't be
called in nsIEditor::EndOfDocument() if the callers of
nsIEditor::EndOfDocument() has a pointer to Selection.
This patch adds EditorBase::CollapseSelectionToEnd() for the internal method
and make all callers of nsIEditor::EndOfDocument() use it.
MozReview-Commit-ID: 8H4ThxzdKDf
--HG--
extra : rebase_source : 7436d7f286351fa9c91175b40e686f7ca1f3c69f
In most cases, TextEditRules::CollapseSelectionToTrailingBRIfNeeded() doesn't
use the index anymore. Therefore, it should stop using
EditorBase::GetNodeLocation() and use EditorBase::GetChildOffset() only when
the offset is necessary.
MozReview-Commit-ID: 9vGcLnTUnsu
--HG--
extra : rebase_source : af0cdad3a1905bf2e5654a109aa4037ec70b422b
nsINode::GetChildAt() is too expensive if it's used for next sibling of a node.
This patch makes it use nsINode::GetNextSibling() instead.
MozReview-Commit-ID: CAC7gFNo77w
--HG--
extra : rebase_source : 185457b910e2e09c58a6f02525ae61aff149511c
nsINode::IndexOf() is expensive especially when it's in a hot path, it's too
expensive. So, EditorBase::GetChildOffset() and EditorBase::GetNodeLocation()
should check child's siblings first. If some of them are nullptr, it means
that it's first child or last child of the parent.
Note that EditorBase::GetChildOffset() may return wrong index if it's called
while aChild is being removed from aParent or aParent isn't actual parent of
aChild. However, there are MOZ_ASSERTs to ensure value isn't -1. Therefore,
it's safe to assume that aParent is always the parent of aChild and it won't
be called from ContentRemoved() of mutation observers.
MozReview-Commit-ID: 8JdYWuZbHe5
--HG--
extra : rebase_source : 6ded91a3aa8b00ab4d2d544c2c392d88cb769cef
These are all easy cases where an nsXPIDLCString local variable is set via
getter_Copies() and then is only used in ways that nsCStrings can also be used
(i.e. no null checks or implicit conversions to |char*|).
In every case the patch trivially replaces the nsXPIDLCString with an
nsCString. (Also, there are a couple of unused nsXPIDLCString variables that
the patch simply removes.)
test_bug655636.html refers gBrowser, however, it's available only in chrome
process and it's referred only for listening to "pageshow" event instead of
"load" event of the data URI. So, we must be able to use "unload" event of the
previous URL instead.
Although, this testcase (even without this change) won't cause crash even if
backing out the patch for bug 635636 anymore.
MozReview-Commit-ID: B8qOwVZqZQm
--HG--
extra : rebase_source : d383181886152684a8bf9c2caf7248d5f7582c0a
AutoPlaceHolderBatch can take EditorBase class and its inherited class, AutoEditBatch, can be removed if we implement other constructor which doesn't take transaction name.
Additionally, nsIEditor::(Begin|End)PlaceHolderTransaction() are referred only by AutoPlaceHolderBatch. Therefore, they can be non-public methods and removed from nsIEditor interface.
Note that this patch also repalces "PlaceHolder" with "Placeholder" since it's a word.
MozReview-Commit-ID: 5dw3kcX3bOx
--HG--
extra : rebase_source : e926cc1c2ebea70eb08e43778a8b52912b559b7b
nsITableEditor is now a builtin class. So, it's implemented only by HTMLEditor. Therefore, AutoSelectionSetterAfterTableEdit can use HTMLEditor.
Then, nsITableEditor.setSelectionAfterTableEdit() can be removed from nsITableEditor and moved to HTMLEditor as non-virtual method since nobody uses it from JS.
MozReview-Commit-ID: KnN6Fw4TYyn
--HG--
extra : rebase_source : 48412a5f81f30d9ada47550fdb4d1ee0d88de6f4
This test is turned off by bug 1269209 on e10s. But there is no exactly reason why this test on e10s is turned off.
Although I run this test on e10s now, it seems to pass this. So we should turn on this test even if e10s.
MozReview-Commit-ID: JHQP2ZYvsHL
--HG--
extra : rebase_source : 2bc45f0d2b5cc99bad93267f40191866264af414
nsIHTMLDocument::TearingDownEditor() takes nsIEditor as an argument. However, it's not used in it. So, we can remove it.
MozReview-Commit-ID: KUmIsnVGB6H
--HG--
extra : rebase_source : ddd344b9df18e0b33d54d2f99e6335449f55df81
nsEditingSession should treat editor as HTMLEditor in its internal handling.
MozReview-Commit-ID: 51SfY4oeq3p
--HG--
extra : rebase_source : 90535267e62de17755fff9f21b6a0f74244d849a
Some users of HTMLEditor retrieve pointer to editors with nsIEditingSession::GetEditorForWindow() but it returns nsIEditor. So, there should be a method which returns HTMLEditor*.
MozReview-Commit-ID: Bzc1LIlTSDF
--HG--
extra : rebase_source : f6fb3e5852809487883e3e6fedda9580206b2cb5
This matches the spec and Chrome, and seems to bring us closer to Edge
and WebKit as well. It also matches our own behavior for addRange(),
which was changed in bug 1341137.
For collapse and selectAllChildren, we match the tests and browsers, but
the spec is incorrect at the time of this writing:
https://github.com/w3c/selection-api/pull/86
The removeAllRanges test hadn't been updated for the spec change.
MozReview-Commit-ID: DTK8283k5IP
--HG--
extra : rebase_source : 54701e7136c33ebce651d5f74c3dc1d8b944f9a3
Removes nsIDOMHTMLEmbedElement and all references. HTML elements are
now handled by WebIDL. With the deprecation of extensions, XPCOM
interfaces to HTML elements are no longer needed.
MozReview-Commit-ID: DI4XVvdgPDI
--HG--
extra : rebase_source : 74bd92619e3d1db04c3dd40ec3022474fe1d647c
EditorCommands implements common edit commands. So, we can use TextEditor even if the instance is HTMLEditor.
Then, EditorCommands can use non-virtual methods of the concrete classes.
MozReview-Commit-ID: DgKHqC0osRb
--HG--
extra : rebase_source : e9abd7ef8b48cfdc65bbeb56ebe81dc0548005dd