1405747.html is kind of same issue. But when editing 1405747.html, the crash doesn't occur. So I keep original HTML by jsfuzzy.
MozReview-Commit-ID: 9BcUkWeBlr5
--HG--
extra : rebase_source : 1bac60293d3b4997a380cf625c6492db22f60160
extra : histedit_source : eae38e2d69e0705545acf1ef1f2d04e7977b8899
GetNodesForOperation returns node array from current selection. So some nodes in this array might have no parent node. We should ignore such as orphans.
MozReview-Commit-ID: 3OK0CUv5QOe
--HG--
extra : rebase_source : 59636177113ad5d3f9789ca22a6a96938e4cf486
extra : histedit_source : fd4fd140a24a8dc5a63fceeb25faba827c317683%2C6ed479239be0a9043d05170231c6613b04cb0d26
(Path is actually r=froydnj.)
Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.
MozReview-Commit-ID: 91U22X2NydP
--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
Starting from bug 1297414, HTMLEditor treats <div> container as same as <p>
container at inserting a line break. This new behavior is check in WPT.
So, it's better to use the new behavior for compatibility with other browsers.
However, we're still using <br> as default paragraph separator for backward
compatibility even though this is non-standard behavior.
So, although, the old behavior is odd, we should keep treating them differently
in the backward compatibility mode. Actually, this behavior change causes
an incompatibility problem in Gmail, and may be in other web apps.
MozReview-Commit-ID: INCihKYmcPd
--HG--
extra : rebase_source : 874e41ddf7bbedbea2c7af79285ea79fbc48f0f2
This patch adds an overload to nsIContentIterator::Init which accepts
RangeBoundary objects, and modifies the codepath to avoid using the offset of
the start or end nodes to construct the nsIContentIterator.
MozReview-Commit-ID: 5ZqKeiUunoN
This might be regression by bug 1319340, but there is crash signature from old version. We should check whether focus node and anchor node aren't null.
MozReview-Commit-ID: J7npxN5kC9G
--HG--
extra : rebase_source : e2f19690d529abc1a8e2852a5ed826b0caa39244
This is a typo bug of Bug 1053779 Part 2. ConvertListType might return NS_OK
even if ReplaceContainer doesn't return valid value.
So, to clean up code, we should return Element instead of nsresult since out
parameter of this function is Element only.
MozReview-Commit-ID: 44UHETzcdGy
--HG--
extra : rebase_source : ab76486505cb4e7caea3fb99e11fccd606878f02
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.
These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.
- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>
- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
- Count() --> Length()
- ObjectAt() --> ElementAt()
- AppendObject() --> AppendElement()
- RemoveObjectAt() --> RemoveElementAt()
- ns*Hashtable<nsISupportsHashKey, ...> -->
ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>
- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
- This requires adding a Get() method to nsRefPtrHashtable that it lacks but
nsInterfaceHashtable has.
- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
- nsArrayBase::Create() --> nsTArray()
- GetLength() --> Length()
- do_QueryElementAt() --> operator[]
The patch also has some changes to Rust code that manipulates nsIAtom.
MozReview-Commit-ID: DykOl8aEnUJ
--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
Removes the nsIDOMHTMLObjectElement XPCOM interface, replacing it with
HTMLObjectElement and FromContent conversion usage.
MozReview-Commit-ID: dmsjSO97uh
--HG--
extra : rebase_source : 9b2c25b8681f754bc34233afccdb6fc5d38f0804
It a stateless wrapper around static methods in nsHTMLTags and nsHTMLElement,
and hence an unnecessary layer of indirection that just adds complexity and
slowness. This patch removes it, cutting almost 300 lines of code.
This requires making nsElementTable.h an exported header, to expose the
nsHTMLElement methods.
--HG--
extra : rebase_source : abbcb8e5001389affbf717092213b898673db07f
Its return value is never used, and most implementations return nullptr anyway.
MozReview-Commit-ID: 8rxC053mmE8
--HG--
extra : rebase_source : 61a0b8b1373396182efd27d3c01b96e5e5541364
After applying part 1 fix, it doesn't pass test_bug430392.html like the following..
1. content is <span contenteditable=false>A</span>[caret] ;
2. [VK_RETURN]
3. content is <span contenteditable=false>A</span><br>; <- whitespace is removed
Since we started to treat readonly text nodes as WSType::special with previous patch, WSRunObject::InsertBreak doesn't convert space (after caret) to NBSP because WSRunObject::InsertBreak does it only when inserted position isn't first text run object.
So even if this is first text run object, space after caret should be converted to NBSP.
MozReview-Commit-ID: Hj0i3wm45c3
--HG--
extra : rebase_source : 2d0ae7c47c6187e56d6c29e8eb48974f7ab7ff72
This bug occurs that WSRunObject::PrepareToDeleteRangePriv() calls WSRunObject::ConvertToNBSP for non-editable text node.
Actually, even if text node isn't editable, WSFragment::mType becomes WSType::text now. So, whitespace only node at the end of contenteditable=false is treated as WSType::normalWS, i.e., treated as editable.
So text node in contenteditable=false should treated as WSType::special which means a non-editable inline object. Then, WSRunObject won't create object chunk of WSType::normalWS for text node in contenteditable=false.
MozReview-Commit-ID: GOjxax8KvDD
--HG--
extra : rebase_source : e5fff30a2710c2021d59ce88bf2698ce4ebe2dfc
With previous change, KeyboardEvent is dispatched even when invisible window
has focus. However, nsRootWindow::GetControllerForCommand() returns controller
for focused window even when the window is invisible because it uses
nsFocusManager::GetFocusedDescendant() to retrieve focused window.
Perhaps, we can assume that users won't expect to do something with invisible
window when they type some keys. Then, nsRootWindow::GetControllerForCommand()
should return controller for visible ancestor window if focused window is
invisible.
This patch makes nsFocusManager::GetFocusedDescendant() can return only visible
descendants. However, it already has a bool argument. Therefore, it should
have a flag instead of adding new flag. Most changes of this patch is replacing
its callers.
Then, nsRootWindow::GetControllerForCommand() and nsRootWindow::GetControllers()
should have a bool flag if it should return controller(s) for visible window.
This patch adds a bool flag for it. Fortunately, the interface isn't scriptable.
Finally, this patch makes nsXBLPrototypeHandler::DispatchXBLCommand() and
EventStateManager::DoContentCommandEvent() retrieve controller for visible
window since they are always handles user input.
MozReview-Commit-ID: GygttTHuKRm
--HG--
extra : rebase_source : 1341273c4606298cb9b890b9312d9f5c8a75d144
Skip tests that are expected to fail in both Stylo and Gecko modes. They would unexpectedly "pass" in styloVsGecko mode when comparing the two failures, which is not a useful result.
MozReview-Commit-ID: 3mOpjU225Q1
--HG--
extra : rebase_source : 22bb5d4e3c5138ef832995eaf5716824f4707ffe
extra : source : d40fb20c9a49d0797c0eeae613a04912b12a28f7
As written, these functions will leak if they are passed strings that don't
match static atoms. In practice, all strings passed *do* match static atoms,
but let's fix it anyway in case that changes in the future.
--HG--
extra : rebase_source : 01685428e7dfc577e63bb6423382817359623151
Skip tests that are expected to fail in both Stylo and Gecko modes. They would unexpectedly "pass" in styloVsGecko mode when comparing the two failures, which is not a useful result.
MozReview-Commit-ID: 3mOpjU225Q1
--HG--
extra : rebase_source : 0c307639c3626af3b6b43e05d3ee73d08b3f47ce
In the old design, EditorBase::mRootElement is initialized when
nsIEditor::GetRootElement() is called. Therefore, EditorBase::GetRoot()
calls if mRootElement is nullptr.
However, mRootElement is now initialized when EditorBase::UpdateRootElement()
is called and it's always initialized when EditorBase::Init() is called.
So, EditorBase::GetRoot() doesn't need to call nsIEditor::GetRootElement()
anymore.
MozReview-Commit-ID: 6dNEJaGNMZe
--HG--
extra : rebase_source : ed29488cfd1434fb200387706ca5a96cb2185090
When using contenteditable with spellchecker (it is by default), spellchecker will be initialized by mozilla::EditorEventListener::Focus. This method will call nsEditorSpellCheck::UpdateCurrentDictionary, but this method seems to be slow.
DictionaryFetcher::Fetch gets nsIContentPrefService2 that is implemented by JavaScript, so we should create nsIContentPrefService2 out of Fetch method.
MozReview-Commit-ID: 1fxug0sqD72
--HG--
extra : rebase_source : c46a54f9fc811aace20c54c4a3e468a83c2530d2
It's a bit strange for the editor to distrust the parser service in this way.
The double-checking seems unnecessary, especially given that it is *buggy*: it
incorrectly includes `col`, `colgroup`, and `legend` as block elements, but
excludes `pre`. (It must only be called in situations where these
incorrectly-classified elements are not passed in, otherwise it would have
triggered by now.) So this patch removes it.
The patch also removes `li` and `pre` from the IsAnyOfHTMLElements() test in
HTMLEditor::NodeIsBlockStatic. Contrary to what the comment in
NodeIsBlockStatic() says, they *are* identified as block elements by the parser
service.
--HG--
extra : rebase_source : c9bb3c9e07320fafed17942229c316f41ac2a0a6
editor/reftests/input-text-onfocus-reframe-ref.html is sometimes failed due to "image comparison, max difference: 1, number of differing pixels: 1".
As long as I check both images, I don't know why focus ring is different. But this is 1 pixel only diff, so we should use fuzz-if.
MozReview-Commit-ID: 5SrjorXEBW
--HG--
extra : rebase_source : d6fbb2f3a5ea2bff5ee6c2b39909831830f5d47c
EditorBase::EndPlaceholderTransaction() has hidden caret. However, it doesn't
do it anymore. However, bug 805697 didn't remove unnecessary code that
retrieves and hold nsIPresShell and nsCaret. This patch removes them.
MozReview-Commit-ID: Eh9pbf8p2bZ
--HG--
extra : rebase_source : e766906089af1cd3c6efa95b82e3b126ae097ab2
GetFirstSelectedCell and GetNextSelectedCell allow that 1st parameter is nullptr when current range is unnecessary. So we should use nullptr when it is unused.
MozReview-Commit-ID: BuI7ds47h0U
--HG--
extra : rebase_source : 4cb67aa15c5b5a7692c7e5eb43976c8e7a7884e4
Except to nsTextServicesDocument.cpp, we replace nsIDOMRange::GetStartContainer and nsIDOMRange::GetEndContainer with nsRange::GetStartContainer and nsRange::GetEndContainer.
Since nsTextServicesDocument.cpp still uses a lot of nsIDOMNode, I will change it by new bug.
MozReview-Commit-ID: 9x1oajmabca
--HG--
extra : rebase_source : c22072a39c907df631025a423c6302df2047e824
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.
MozReview-Commit-ID: 5agRGFyUry1
--HG--
extra : rebase_source : 5388c56b2f6905c6ef969150f0c5b77bf247624d
nsIHTMLEditor's addDefaultProperty(), removeDefaultProperty(),
removeAllDefaultProperties() methods are never used -- not from C++ code or
script, in either mozilla-central or comm-central.
So this patch removes them. This means that HMLTEditor::mDefaultStyles is never
used, so the patch removes it and all the code that manipulates it as well.
--HG--
extra : rebase_source : 76634ce2bb2d94534b8d7f299c4ebd6a83b66637
HTMLEditRules::NormalizeSelection uses nsIDOMNode for node handling, so we replace with nsINode, then use Selection::Extend and Selection::Collapse.
MozReview-Commit-ID: 6Ijo19vTwRi
--HG--
extra : rebase_source : 3171ed5808d9045b268cc76989c7d06ea220d393
extra : histedit_source : f3a1af1f84cceb80200a3965385dfb1d036c9e60
Except to HTMLEditRules::NormalizeSelection, I replace nsISelection::Extend with Selection::Extend.
MozReview-Commit-ID: H83zpvAo5Xa
--HG--
extra : rebase_source : b217dd1d506229d848126b9c2494d1b4f9dc3a35
extra : histedit_source : 8999bc5b1b1edfe7e48a432d52640b8181490624
I would like to remove more dependency of old nsISelection interface from editor if possible. So we can replace nsISelection::GetRangeCount with Selection::RangeCount.
MozReview-Commit-ID: 2Mh5ceQI2om
--HG--
extra : rebase_source : 03c8a5b49e2929b0ce6c6af8b78c9677a55a14c4
extra : histedit_source : ca7741379c7cc5b7b938aad22a57f419a2442fd3
nsISelectionController::SELECTION_* are declared as bit-mask. However, no
methods of nsISelectionController treat them as bit-mask and these
values need a switch statement in nsFrameSelection to convert SelectionType to
array index of nsFrameSelection::mDOMSelections because it's too big to create
an array to do it. Additionally, this conversion appears profile of
attachment 8848015.
So, now, we should declare these values as sequential integer values.
However, only nsTextFrame uses these values as bit-mask. Therefore, this patch
adds new type, SelectionTypeMask and creates new inline method,
ToSelectionTypeMask(SelectionType), to retrieve mask value for a SelectionType.
MozReview-Commit-ID: 5Za8mA6iu4
--HG--
extra : rebase_source : 86617c1f5fa23166458f4353cb834f9e7c5b131b
nsIHTMLEditor has several scriptable methods (addDefaultProperty(),
removeDefaultProperty(), etc.) that have nsIAtom parameters. We're in the
process of deCOMtaminating nsIAtom (bug 1392883) so these methods need to be
changed.
This patch does the following.
- It changes those methods to take an AString instead of an nsIAtom.
- For each existing method, it adds to HTMLEditor a new C++ method of the same
name that takes an nsIAtom parameter.
- It updates TextEditorTest.cpp to use strings instead of atoms, in order to
keep using the XPIDL methods.
- It updates test_bug1140105.html to pass strings instead of atoms to
getInlineProperty(). This removes the use of nsIAtomService.
--HG--
extra : rebase_source : e005c3b5a08207b3d5d5fb55c47c8bc475b33453
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
nsComposerCommands uses some simple getter methods. They can be simpler non-virtual methods. So, we should do it.
Note that this changes that EditorBase::GetIsSelectionEditable() won't return error. However, it has returned error only when selection controller isn't available. That means that the selection controller has been destroyed and the editor will be destroyed. So, this must not be problem since it returns false (non-editable) instead and won't break any behavior since the editor won't be editable by users nor JS anymore.
MozReview-Commit-ID: E9ccFspG6na
--HG--
extra : rebase_source : bcd1314cb386fcaf175adabfefde5885decd87c0
Compiler may can optimize to call virtual methods at build time if we call them with concrete classes because some of them may have final keyword.
Even if not so, we can optimize some methods with creating non-virtual methods.
MozReview-Commit-ID: K3bRlc0URml
--HG--
extra : rebase_source : 4a76635c7aed29501f71ae74f3f73e2b22ca219e
All SetState() methods in nsComposerCommands require HTMLEditor. So, it should take HTMLEditor* rather than nsIEditor*.
MozReview-Commit-ID: AVbnRsMsmeY
--HG--
extra : rebase_source : 23bcc585a045a39620102c4fef9c1a9e12b9ea37
Similar to GetCurrentState(), all ToggleState() methods require HTMLEditor. So, they should take HTMLEditor* instead of nsIEditor*.
MozReview-Commit-ID: BwM6WRKFn6Q
--HG--
extra : rebase_source : 425b7b405b5881b97e8113c3ab88e9d0514b6a07
All GetCurrentState() methods in nsComposerCommands require HTMLEditor but its argument is nsIEditor*. So, it should take HTMLEditor* and it shouldn't be called if given editor isn't HTMLEditor since it's virtual method.
MozReview-Commit-ID: HsvYJN8hIxN
--HG--
extra : rebase_source : f8f9c8de902af5311771b71a96c76d63325970a5
nsIEditor is still first contact with editor class for some modules. They should be accessible to the concrete classes without QI. Therefore, nsIEditor should have As*Editor() methods.
Additionally, this adds AsEditorBase(). That is always implemented but it might be necessary for some files for minimizing its include files.
MozReview-Commit-ID: 8WqkDJLiVDs
--HG--
extra : rebase_source : e51282df244efad62bc6fe04ab449e3beab440f9
CompositionTransaction forgets to call EndBatchChanges when GetSelectionController returns error, so we should use RAII class instead.
MozReview-Commit-ID: HI9kutRVzx6
--HG--
extra : rebase_source : d276f4349c5a64d4610581ae1a76d160841f7d7b
If we make nsIEditor a builtin class, that means that its instance can be only TextEditor or HTMLEditor. Then, users of nsIEditor can use concrete classes such as EditorBase, TextEditor or HTMLEditor instead. Then, the users can reduce unnecessary QI and a lot of virtual calls if we'll create non-virtual methods.
So, let's make editor related interfaces builtin classes.
MozReview-Commit-ID: 93WfsSDuJiJ
--HG--
extra : rebase_source : 39151eb4ffaaf195fec57234ea84c9f4066c58d1
nsXPIDLStrings are marked as VOIDED upon initialization. Most of these local
nsXPIDLString variables are immediately set via getter_Copies(), which will
either assign a string value (using Adopt()) or do SetIsVoid(). These can be
trivially converted to nsString, which will get the same treatment.
The patch suitably converts the remaining nsXPIDLString local variable as well.
--HG--
extra : rebase_source : 5fff9f2c6844559198f601853f8db08564add7d5
CreateAnonymousElement still uses nsIDOMNode, but we should use nsIContent for it.
MozReview-Commit-ID: 2xgzlE6NVra
--HG--
extra : rebase_source : c93a9acb230604da391f705b0038e3cf7fbd4f23
This method can be extremely hot, so we need to remove all sources of XPCOM
overhead from it. This includes the usages of weak pointers (thanks to the
previous parts), refcounting, and QueryInterface.
I kept the callers hold the selection controller alive by assigning the
return value to an nsCOMPtr in places where the methods called on it could
have a remote chance of messing with the lifetime of objects.
Besides some unnecessary copying and malloc overhead that this removes, it
also removes a call to dom::Text::GetData() which we used to only make to
get the old length of the text node before modifying it. Turns out that
this old length was already obtained once in SetTextImpl().