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

7880 Коммитов

Автор SHA1 Сообщение Дата
Wes Kocher 936a9461f6 Merge inbound to m-c a=merge
MozReview-Commit-ID: KRQeIGmhAPA
2017-08-10 18:14:34 -07:00
Sebastian Hengst 51d351f567 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-08-10 17:41:11 +02:00
Ehsan Akhgari 3ab3b25fad Bug 1388917 - Fix moving of SelectionState in PlaceholderTransaction's constructor; r=masayuki 2017-08-10 08:35:19 -04:00
Masayuki Nakano 19dc3194d7 Bug 1319340 - part9: Make nsComposerDocumentCommands use concrete class when calling methods of editor r=m_kato
MozReview-Commit-ID: 15WBfUpfo6L

--HG--
extra : rebase_source : 0e729ea9f2a37555836cca869ea1da4174895960
2017-08-07 18:27:16 +09:00
Masayuki Nakano de893ee82e Bug 1319340 - part8: EditorCommands should use TextEditor instead of nsIEditor, nsIPlaintextEditor and nsIEditorMailSupport r=m_kato
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
2017-08-04 20:41:20 +09:00
Masayuki Nakano 2978474960 Bug 1319340 - part7: Fix some warnings in nsComposerCommands.h r=m_kato
MozReview-Commit-ID: A0KnOCCWqYZ

--HG--
extra : rebase_source : 35f0ad7b68e8c010eb98532e50bfc107abeefb7f
2017-08-04 18:50:26 +09:00
Masayuki Nakano b5b8d1064d Bug 1319340 - part6: Implement some interface methods as non-virtual methods of EditorBase or HTMLEditor r=m_kato
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
2017-08-04 18:30:13 +09:00
Masayuki Nakano efae799abd Bug 1319340 - part5: Make nsComposerCommands use concrete class when calling methods of editor r=m_kato
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
2017-08-04 17:12:01 +09:00
Masayuki Nakano 6b4db6ec7f Bug 1319340 - part4: SetState() of nsComposerCommands should take HTMLEditor* instead of nsIEditor* r=m_kato
All SetState() methods in nsComposerCommands require HTMLEditor.  So, it should take HTMLEditor* rather than nsIEditor*.

MozReview-Commit-ID: AVbnRsMsmeY

--HG--
extra : rebase_source : 23bcc585a045a39620102c4fef9c1a9e12b9ea37
2017-08-04 16:20:56 +09:00
Masayuki Nakano 505c529148 Bug 1319340 - part3: ToggleState() in nsComposerCommands should take HTMLEditor* instead of nsIEditor* r=m_kato
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
2017-08-04 15:57:57 +09:00
Masayuki Nakano cf8f0ec404 Bug 1319340 - part2: GetCurrentState() of the classes in nsComposerCommands should take HTMLEditor instead of nsIEditor r=m_kato
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
2017-08-04 15:41:42 +09:00
Masayuki Nakano 722bf07347 Bug 1319340 - part1 Move AsTextEditor() and AsHTMLEditor() to nsIEditor r=m_kato
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
2017-08-04 15:01:36 +09:00
Makoto Kato b04d5091db Bug 1388638 - Use RAII class for StartBatchChanges/EndBatchChanges. r=masayuki
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
2017-08-09 18:06:36 +09:00
Masayuki Nakano a2333fc4bb Bug 1060051 - Make editor related interfaces builtin classes if it's possible r=Ehsan,smaug
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
2017-08-04 13:57:56 +09:00
Carsten "Tomcat" Book e02df09b7c Merge mozilla-central to mozilla-inbound 2017-08-08 13:23:59 +02:00
Carsten "Tomcat" Book 0f16d437cc merge mozilla-inbound to mozilla-central a=merge 2017-08-08 13:18:14 +02:00
Nicholas Nethercote 1a6f1a62fa Bug 1387381 - Remove nsXPIDLString local variables. r=erahm.
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
2017-08-08 16:07:55 +10:00
Makoto Kato e9bdbc5bb1 Bug 1387945 - Use nsIContent for CreateAnonymousElement. r=masayuki
CreateAnonymousElement still uses nsIDOMNode, but we should use nsIContent for it.

MozReview-Commit-ID: 2xgzlE6NVra

--HG--
extra : rebase_source : c93a9acb230604da391f705b0038e3cf7fbd4f23
2017-08-07 14:09:51 +09:00
Christoph Kerschbaumer 824e01cc12 Bug 1388142 - Convert editor/libeditor/tests/test_CF_HTML_clipboard.html to comply with new data: URI inheritance model. r=smaug 2017-08-07 21:21:59 +02:00
Cameron McCormack 536fe8ffa0 Bug 1387481 - Part 1: Don't eagerly style editor-created NAC if it's appended to an element in a display:none subtree. r=hiro
MozReview-Commit-ID: 7bucY7JKRS0

--HG--
extra : rebase_source : 8a4fd542fe72c6abc0636784841d3851c69b6fb4
2017-08-05 17:36:09 +08:00
Sebastian Hengst 765cc1b925 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: JhesEg4Bxjy
2017-08-04 19:28:27 +02:00
Ehsan Akhgari 4c8d604bfc Bug 1386485 - Part 5: Avoid manipulating the refcount of all visited nodes in CreateBogusNodeIfNeeded(); r=masayuki 2017-08-04 03:47:14 -04:00
Ehsan Akhgari 4018b56c7c Bug 1386485 - Part 4: Devirtualize and inline EditorBase::IsEditable(); r=masayuki 2017-08-04 03:47:14 -04:00
Ehsan Akhgari c6b7fe866d Bug 1386485 - Part 3: Devirtualize EditorBase::AsTextEditor()/AsHTMLEditor(); r=masayuki 2017-08-04 03:47:14 -04:00
Ehsan Akhgari b638df20b4 Bug 1386485 - Part 2: Hoist the body editablity check out of the loop; r=masayuki 2017-08-04 03:47:13 -04:00
Ehsan Akhgari 01af645785 Bug 1386485 - Part 1: Inline EditorBase::IsMozEditorBogusNode(); r=masayuki 2017-08-04 03:47:13 -04:00
Wes Kocher e371c2bbf3 Merge m-c to inbound, a=merge CLOSED TREE
MozReview-Commit-ID: AHCROxMdKPB
2017-08-03 18:13:23 -07:00
Wes Kocher 2196b718d3 Merge inbound to central, a=merge
MozReview-Commit-ID: DlSLhaepjeU
2017-08-03 18:06:53 -07:00
Ehsan Akhgari cf4e6a817c Bug 1386411 - Part 7: Inline EditorBase::GetSelection(); r=masayuki 2017-08-03 17:06:31 -04:00
Ehsan Akhgari ad87011a1d Bug 1386411 - Part 5: Make BaseEditor::GetSelectionController() return nsISelectionController*, and inline it; r=masayuki
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.
2017-08-03 17:05:22 -04:00
Ehsan Akhgari 697fb3f83d Bug 1386411 - Part 4: Don't store the document as a weak reference on EditorBase; r=masayuki
This one also doesn't need to be a weak reference, and can be a strong
reference that the cycle collector knows about instead.
2017-08-03 17:05:21 -04:00
Ehsan Akhgari ace85f9311 Bug 1386411 - Part 1: Don't store the selection controller as a weak reference on EditorBase; r=masayuki
This doesn't need to be a weak reference, and can instead be a simple strong
reference that we introduce to the cycle collector.
2017-08-03 17:05:15 -04:00
Jim Mathies 57d9bf0aee Bug 1360666 - Update IME state when nsObjectLoadingContent content changes type from 'loading' to a valid content type. r=masayuki
MozReview-Commit-ID: JC3YGS75gpN
2017-08-03 14:07:14 -05:00
Geoff Brown d45ed676c8 Bug 1376382 - Skip test_bug586662.html for frequent intermittent failures; r=me,test-only 2017-08-03 09:20:56 -06:00
Ehsan Akhgari 34e6b544eb Bug 1386484 - Remove the SetTextTransaction class and embed its functionality into EditorBase::SetTextImpl(); r=masayuki
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().
2017-08-03 09:54:59 -04:00
Masayuki Nakano e4fb1c57a7 Bug 1385905 - part2: HTMLEditRules::SplitParagraph() should insert normal <br> element rather than moz-<br> element if split element and/or new element is empty r=m_kato
Currently, HTMLEditRules::SplitParagraph() inserts moz-<br> element when split element and/or new element causes empty line.  However, PlaintextSerializer ignores moz-<br> elements.  Therefore, empty lines which are created by SplitParagraph() will be removed when it's converted to plaintext.

So, it should insert normal <br> element for placeholder of empty lines instead.  Note that moz-<br> elements are appeared as normal <br> elements in the result of Element.innerHTML.  Additionally, Chromium always inserts a <br> element for empty block elements which are created by Enter key press.  Therefore, using normal <br> element in this case shouldn't cause any compatibility problems.

MozReview-Commit-ID: FNV41zEFWqQ

--HG--
extra : rebase_source : ece6c2e275e2a75d9d2871d62ed4204115792b99
2017-08-01 22:38:50 +09:00
Masayuki Nakano 5051f16794 Bug 1385905 - part1: Add automated test to check if editor won't create mozBR element when typing Enter before invisible <br> element r=m_kato
MozReview-Commit-ID: AcHnK2LbTs1

--HG--
extra : rebase_source : a7a5ad16da227db53ab3e7324fa920a6b0276369
2017-08-01 18:07:08 +09:00
Wes Kocher baf6cddc4c Merge inbound to central, a=merge
MozReview-Commit-ID: 9NFjSEt96iT
2017-08-02 17:11:51 -07:00
Olli Pettay 1c8b827d25 Bug 1371657 - Ensure editing UI is hidden when disabling editing. r=masayuki
--HG--
extra : rebase_source : cf83e8ac6662d15d15ca986f709d89edc87af28e
2017-08-02 14:04:05 -04:00
Makoto Kato d7503476f0 Bug 699703 - Part 2. SetSelectionAfterTableEdit should check whether editor is destroyed. r=masayuki
After reframe, SetSelectionAfterTableEdit might be called from RAII class, so we should check whether editor is destroyed.

MozReview-Commit-ID: I4r6kvxgRDZ

--HG--
extra : rebase_source : 4bd71775f02f57573af0f0efd5c1946285e4e4f4
2017-08-01 16:34:17 +09:00
Makoto Kato 9b683468d5 Bug 699703 - Need reframe before calling SetSelectionAfterTableEdit. r=masayuki
HTMLEditor::TabInTable inserts row element, then it selects a cell.  But when enabling lazy frame construction for editable node, it selects invalid cell and table.

Because HTMLEditor::SetSelectionAfterTableEdit doesn't select cell correctly on InsertTableRow().

HTMLEditor::SetSelectionAfterTableEdit uses HTMLEditor::GetCellAt, so it depends on frame.  So we need flush frame before calling it.

Also, a comment of HTMLEditor::InsertTableRow is invalid now because we don't use nsresult version of CreateElementWithDefualts.

MozReview-Commit-ID: 698TvmMZgwB

--HG--
extra : rebase_source : 95df12f1f870a2c68d02b24b8758dfe6d381a416
2017-07-14 15:48:40 +09:00
Ehsan Akhgari 22aa56b6cd Bug 1386222 - Ensure that we always respect the undo/redo transaction history when modifying the <xul:textbox>.value dynamically through script; r=bzbarsky 2017-08-01 13:59:45 -04:00
Ehsan Akhgari 30d4df5778 Bug 1385538 - Avoid dynamic memory allocation for EditorBase::mSelState; r=masayuki 2017-07-31 14:13:47 -04:00
Ehsan Akhgari f3a8bf3251 Bug 1385525 - Part 2: Make SetTextTransaction lighter weight by making it a normal C++ class allocated on the stack; r=masayuki
This avoids the cost of allocation on the heap and cycle collection,
and removes some dead code.
2017-07-31 14:12:12 -04:00
Ehsan Akhgari 18170165f0 Bug 1385525 - Part 1: Speed up EditorBase::SetTextImpl() by actually bypassing all of the editor transaction management machinery; r=masayuki 2017-07-31 14:10:50 -04:00
Ehsan Akhgari e64f31b735 Bug 1385514 - Part 2: Replace 'spaz' with 'change' in the editor code 2017-07-31 11:20:38 -04:00
Ehsan Akhgari 5c7a6f8e12 Bug 1385514 - Part 1: Make SetTextTransaction a selection preserving transaction; r=masayuki
This makes the SetTextTransaction transaction behave more similarly to the rest of
the editor transactions, by making sure the inner transactions don't manipulate
the selections themselves and leave it up to the AfterEdit() method to take care of
adjusting the selection when the entire editing operation is finished.
2017-07-31 11:20:38 -04:00
Ehsan Akhgari 1eb17afc4f Bug 1385392 - Avoid needlessly looking up the selection twice when DoTransaction() is called from TextEditRules::WillSetText(); r=masayuki 2017-07-31 10:57:10 -04:00
Ehsan Akhgari 423b388329 Bug 1385384 - Don't store mPlaceholderTransactionWeak as a weak pointer; r=masayuki 2017-07-31 10:55:22 -04:00
Sebastian Hengst 915c63c332 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-07-31 11:28:37 +02:00