Commit Graph

8739 Commits

Author SHA1 Message Date
Masayuki Nakano
531991202f Bug 1460509 - part 14: Make HTMLEditRules::WillRelativeChangeZIndex() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 8HEqK3DAPO4

--HG--
extra : rebase_source : bd1e3223b25d72ab0ef7728361fd9a9c3b8b12ab
2018-05-11 19:24:35 +09:00
Masayuki Nakano
285bb617db Bug 1460509 - part 13: Make TextEditRules::WillInsert() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
This patch also makes aCancel of TextEditRules::WillInsert() optional since
a lot of callers need to ignore the result.

MozReview-Commit-ID: JrvycxMQ9Mm

--HG--
extra : rebase_source : 9ecdc0fd363d9da33c12409f2993da9c58553598
2018-05-11 19:06:07 +09:00
Masayuki Nakano
21be173075 Bug 1460509 - part 12: Make TextEditRules::WillInsertBreak() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Ia5MJ465Hdf

--HG--
extra : rebase_source : 15daea3f4c4fe68e0c39e07fa7fdfca8b3ccaee5
2018-05-11 18:49:44 +09:00
Masayuki Nakano
29bc07945c Bug 1460509 - part 11: Make TextEditRules::CollapseSelectionToTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 3ulGUfu1af1

--HG--
extra : rebase_source : 0828f72d3c847d2c989ee8496567293e637ea3f8
2018-05-11 18:40:47 +09:00
Masayuki Nakano
6f6c32762e Bug 1460509 - part 10: Make TextEditRules::WillInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: RT0Bi9TBwt

--HG--
extra : rebase_source : d3c9657649dbce9ab8f872db9748a2d66d876f15
2018-05-11 18:29:54 +09:00
Masayuki Nakano
d43e448993 Bug 1460509 - part 9: Make TextEditRules::WillSetText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 9ksPugTVVqh

--HG--
extra : rebase_source : 25089af1de8fc8429118e773df25ec2788cb75b9
2018-05-11 17:33:55 +09:00
Masayuki Nakano
04fbe5c6c1 Bug 1460509 - part 8: Make TextEditRules::WillDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
This patch creates internal method for it as DeleteSelectionWithTransaction()
because it needs to create SelectionBatcher and destruction of it may cause
destroying the editor.  Therefore, unfortunately, all callers of
DeleteSelectionWithTransaction() needs to check CanHandleEditAction()
manually.  If we could use try-catch, we could make it safer, though.

MozReview-Commit-ID: 13enOQjEzNn

--HG--
extra : rebase_source : 5a902026bcc507fbf9f1949fdcf33a98aabd9a0b
2018-05-11 17:15:53 +09:00
Masayuki Nakano
b2219367ca Bug 1460509 - part 7: Make TextEditRules::DidDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And also this patch removes unnecessary arguments from the method.

MozReview-Commit-ID: UKscK4vFVX

--HG--
extra : rebase_source : 7f6b9405824a3f175f165a2d7d75a293108278f3
2018-05-11 16:48:29 +09:00
Masayuki Nakano
d6057a85d0 Bug 1460509 - part 6: Make TextEditRules::RemoveRedundantTrailingBR() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: HpFo0SiTBWJ

--HG--
extra : rebase_source : 531116b0621557293f026f214601848a60602331
2018-05-11 16:36:07 +09:00
Masayuki Nakano
849d638e49 Bug 1460509 - part 5: Make TextEditRules::CreateTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: CNTgECam862

--HG--
extra : rebase_source : 633d729868f9cb6a287c45f98497e45a08ef2c95
2018-05-11 16:31:53 +09:00
Masayuki Nakano
349bf14f6b Bug 1460509 - part 4: Make TextEditRules::CreateBogusNodeIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
Note that HTMLEditRules::DocumentModifiedWorker() is a runnable method.
So, it cannot return nsresult.  Therefore, it just checks the result
only with NS_WARNING_ASSERTION().

MozReview-Commit-ID: KBSpv5H5KGU

--HG--
extra : rebase_source : b356ab04d0459214df9dbb3dbfb0e3eecc686348
2018-05-11 16:24:15 +09:00
Masayuki Nakano
2d5d9aed52 Bug 1460509 - part 3: Make TextEditRules::HideLastPWInput() return NS_ERROR_EDITOR_DESTROYED when it causes destroying the editor r=m_kato
And also this patch marks it as MOZ_MUST_USE.  All callers have to check if
the result is NS_ERROR_EDITOR_DESTROYED at least.

MozReview-Commit-ID: H4DfU1asPpe

--HG--
extra : rebase_source : c11cc00500aad44bd542147fb971e3cce4d634e2
2018-05-11 16:08:47 +09:00
Masayuki Nakano
b2f86bbbe1 Bug 1460509 - part 2: Make TextEditRules::CreateBR() and TextEditRules::CreateMozBR() return both new <br> element node and error code since if they cause destroying the editor, each caller needs NS_ERROR_EDITOR_DESTROYED result r=m_kato
First, this patch changes TextEditRules::CreateBRInternal() to a private method
for making any callers use CreateBR() or CreateMozBR() instead.

Then, this patch makes TextEditRules::CreateBRInternal() return both nsresult
and created <br> element with CreateElementResult class.

Finally, this patch makes all callers of them check if they don't return an
error code including NS_ERROR_EDITOR_DESTROYED.

MozReview-Commit-ID: 18OvPmbDVHK

--HG--
extra : rebase_source : 328a91146539763cec317105b92aa3ce5d4b8233
2018-05-11 15:52:24 +09:00
Masayuki Nakano
9ac857639c Bug 1460509 - part 1: Declare NS_ERROR_EDITOR_DESTROYED error code and add a check method to TextEditRules whether it can keep handling edit action at a moment r=m_kato
This patch defines NS_ERROR_EDITOR_DESTROYED error code as an editor module
specific error code.

And creates TextEditRules::CanHandleEditAction() to check if the instance
can keep handling edit action.

MozReview-Commit-ID: 4qECwNBO0yz

--HG--
extra : rebase_source : a925a9b6840d4d06e2792b9fe276e062288b0806
2018-04-24 15:23:01 +09:00
Emilio Cobos Álvarez
9bed821e90 Bug 1467722: Don't return null for getComputedStyle when there's no pres shell. r=heycam
We need to deal with this case regardless from getPropertyValue, and this causes
pain and webcompat issues.

MozReview-Commit-ID: Gbpzq0N4O2T
2018-06-19 11:47:16 +02:00
Dorel Luca
dc6d856805 Merge mozilla-inbound to mozilla-central. a=merge 2018-05-23 12:51:22 +03:00
Makoto Kato
cac4fa86ed Bug 1463399 - Remove unused local variable in TextEditor::OutputToString. r=masayuki
Now RulesInfo uses nsAString, but old comment is "XXX Struct should store
a nsAReadable*".  We can remove unnecessary local variable of nsString.

MozReview-Commit-ID: C7gnTG7xTjU

--HG--
extra : rebase_source : e141bbcefd75d90b836668f710350d4362d66c76
2018-05-22 21:07:09 +09:00
Makoto Kato
71b2579c1e Bug 1463330 - Move CanPasteTransferable and PreDestroy to out of nsIEditor. r=masayuki
CanPasteTransferable and PreDestroy aren't used from script (inc. comm-central
and bluegriffon), so we should move these to out of nsIEditor.

MozReview-Commit-ID: GRfBobAm2qi

--HG--
extra : rebase_source : 812792ff43da24bfd9cb99c4b3127e6acdc43ba1
2018-05-22 18:23:21 +09:00
Kris Maglione
8340513b0c Bug 1463287: Add QueryInterface helper macro for concrete class types. r=bz
Using concrete class types with static IIDs in QueryInterface methods is a
pretty common pattern which isn't supported by any existing helper macros.
That's lead to separate ad-hoc implementations, with varying degrees of
dodginess, being scattered around the tree.

This patch adds a helper macro with a canonical (and safe) implementation, and
updates existing ad-hoc users to use it.

MozReview-Commit-ID: HaTGF7MN5Cv

--HG--
extra : rebase_source : ace930129d85960d22bc3048ca3bb19bbbd4a63e
extra : histedit_source : 03a87f746d957789d41381e4e1bfcc4fd7eebaf2%2C9c5bae9feeeef7721105db67be0f83e0ded66bb7
2018-05-21 16:33:18 -07:00
Kris Maglione
8134b33e89 Bug 1462964: Remove obsolete nsIDOMBlob interface. r=bz
MozReview-Commit-ID: 2HIlaSrvfBe

--HG--
extra : rebase_source : 944a6244dbfe1f0a37dd34a041d1329624a86f93
extra : histedit_source : d7859be664fed00f8504e40969480d3af3d674e7%2C4456b502db338bd06823654306e47c2583101396
2018-05-21 17:32:44 -07:00
Masayuki Nakano
8a70ae9bca Bug 1457083 - part 7: Remove methods of TextEditRules and HTMLEditRules, which just return NS_OK r=m_kato
Some Did*() of TextEditRules and HTMLEditRules do nothing except returning
NS_OK.  Let's remove them since there is no reason to keep them.

MozReview-Commit-ID: Jcdh5rnm5Yc

--HG--
extra : rebase_source : 54aedd8187edfa244bc8fbe8f560fb6ee064e9cf
2018-05-10 16:04:06 +09:00
Masayuki Nakano
16e2394c6e Bug 1457083 - part 6: Get rid of unnecessary Selection argument from all protected/private methods of TextEditRules and HTMLEditRules r=m_kato
Now, each protected/private method of TextEditRules and HTMLEditRules can
retrieve Selection instance safely and quickly.  Therefore, their pointer or
reference of Selection arguments are not necessary.  Therefore, this patch
removes them.

MozReview-Commit-ID: 1SPmKXmd7kz

--HG--
extra : rebase_source : 32dfd2d5e8b0667318a5b3766a8a7d8594bba8e7
2018-05-10 15:03:21 +09:00
Masayuki Nakano
dd36848f80 Bug 1457083 - part 5: Make all users of Selection in TextEditRules and HTMLEditRules use TextEditRules::SelectionRef() r=m_kato
After this patch applies, most methods of TextEditRules and HTMLEditRules
don't need to take Selection as their arguments.  Therefore, next patch will
remove them.

MozReview-Commit-ID: 99r3ZkfG2In

--HG--
extra : rebase_source : 8666ded8f2e6954f2e3cf6bb1ba1cf3313f65e70
2018-05-08 17:30:05 +09:00
Masayuki Nakano
97763c2c92 Bug 1457083 - part 4: Replace mHTMLEditor in HTMLEditRules with HTMLEditorRef() r=m_kato
Although, this patch removes first check of mHTMLEditor in each method.  If
this causes some security issues, we should add now.  However, automated
tests don't indicate it.

Anyway, it should be fixed by bug 1454900 in same cycle.

MozReview-Commit-ID: 3LAtOQHyR5J

--HG--
extra : rebase_source : 48b78cb9477c6c47d23a864404ce95ca9edb8588
2018-04-27 01:42:22 +09:00
Masayuki Nakano
07772cd672 Bug 1457083 - part 3: Replace mTextEditor in TextEditRules with TextEditorRef() r=m_kato
This patch adds a debug methods to check if AutoSafeEditorData as expected and
inserting top of each method whose mTextEditor is replaced with TextEditorRef().

MozReview-Commit-ID: 8yjHsypLMRx

--HG--
extra : rebase_source : 0c07d18d102d6ffe6f4bc0cf50ad0dfca1f8bd4d
2018-04-27 00:09:10 +09:00
Masayuki Nakano
30e06e667e Bug 1457083 - part 2: Make all observer methods of HTMLEditRules create AutoSafeEditorData r=m_kato
Except HTMLEditRules::WillJoinNodes(), observer methods of HTMLEditRules
accesses mHTMLEditor.  Therefore, we need to make them create AutoSafeEditorData
instance in the stack.

Note that for reducing EditorBase::GetSelection() calls, this patch adds
Selection& argument to all of them.

MozReview-Commit-ID: 6mjuD2gZwVp

--HG--
extra : rebase_source : 56f16747a80927f0477b9b54f6088be719ed7b01
2018-04-26 23:27:50 +09:00
Masayuki Nakano
5f8ba21730 Bug 1457083 - part 1: Make public methods of TextEditUtils and HTMLEditUtils guarantee that the editor instance and selection instance won't be destroyed while it handles any edit actions r=m_kato
This patch creates a stack class in TextEditRules, its name is
AutoSafeEditorData and make all public methods (except editor observer methods)
which may change DOM tree, fire some DOM events or calling some XPCOM listeners
create its instance in the stack.  Then, it grabs associated editor instance
and its selection instance.

Next patch will make remaining public methods create AutoSafeEditorData.

MozReview-Commit-ID: 8oshdhL3ONQ

--HG--
extra : rebase_source : 591db71e45fe28ca93cbebd9bb7da8c16eae4466
2018-04-26 22:41:34 +09:00
Boris Zbarsky
a02a40bdb5 Bug 1462737. Make AsElement() not compile when called on Element or some subclass. r=mccr8
It's just noise if we already have an Element.
2018-05-18 23:37:56 -04:00
Boris Zbarsky
2e09ba1f75 Bug 1377980 part 2. Remove most C++ use of nsIDOMRange. r=mccr8 2018-05-17 12:01:38 -04:00
Boris Zbarsky
40d2bf9d7f Bug 1377980 part 1. Remove use of nsIDOMRange in xpidl. r=mcc8 2018-05-17 12:01:37 -04:00
Makoto Kato
bf208eff66 Bug 1423767 - Splitting node might be orphan. r=masayuki
SplitNodeDeepWithTransaction will split nodes until better point. But
this test case becomes that node is orphan into loop.  So I would like to
add more check whether parent is nothing.

MozReview-Commit-ID: EroSV4uVBVL

--HG--
extra : rebase_source : f594bdf7cd9efac7d10e6e05a8f87dadfc761295
2018-05-16 16:54:20 +09:00
Dorel Luca
0d2ff9e60d Merge mozilla-inbound to mozilla-central. a=merge 2018-05-16 00:54:22 +03:00
Emilio Cobos Álvarez
11794a944d Bug 1461701: Remove nsUpdateType and UPDATE_CONTENT_MODEL. r=smaug
MozReview-Commit-ID: 33iBMZqnkAc
2018-05-15 18:47:16 +02:00
Emilio Cobos Álvarez
cb56e2c9f3 Bug 1459529: Remove UPDATE_STYLE. r=heycam
Now that BeginUpdate is useless for the UPDATE_STYLE case, we don't need the
update mechanism at all. Just ensure that ApplicableStylesChanged is called on
the pres shell via the relevant RuleChanged, etc. notifications.

There's a big hidden gotcha here. nsIDocument::BeginUpdate does put a script
blocker on the stack for these updates. However it's not needed, since no script
can run during these notifications (only the stylesheet events we post for
devtools, but those use AsyncEventDispatcher and PostDOMEvents, so they don't
try to run immediately).

nsIDocument::BeginUpdate also does XBL binding attached queue stuff, but we
can't change bindings during these notifications anyway, so it also doesn't
matter.

MozReview-Commit-ID: HJvK6zQfloh
2018-05-15 18:44:29 +02:00
Emilio Cobos Álvarez
2054320f28 Bug 1459529: Make sheets be associated to a shadow root too potentially. r=bz
MozReview-Commit-ID: Cd8xJuLRY5w
2018-05-15 18:44:25 +02:00
Adrian Wielgosik
3a8ef6cf8a Bug 1460940 - Remove nsIDOMDocument uses in editor/. r=bz
MozReview-Commit-ID: 8doC9drkrG9

--HG--
extra : rebase_source : 24ac8ea960faff10b04ef0f419bc6dc7b6556452
2018-05-11 19:46:15 +02:00
Emilio Cobos Álvarez
5aab8db970 Bug 1408301: Remove getPropertyCSSValue. r=bz
It's been removed for a while on Nightly without any known regressions. This
gives us a full beta cycle of telemetry and two nightly cycles without the API
before shipping.

This only removes the API, followup work will replace serialization by Servo's,
and remove the remaining DOM interfaces.

MozReview-Commit-ID: 2m1taYg5xEr
2018-05-12 11:23:47 +02:00
Cosmin Sabou
a916fb7c3e Merge inbound to mozilla-central. a=merge 2018-05-09 20:27:38 +03:00
Chris Peterson
87ddcb8273 Bug 1457813 - Part 3: Remove NS_PRECONDITION definition. r=froydnj
--HG--
extra : rebase_source : 9bad9e57e2e0363fb315949ac73b869fac0b9a73
2018-05-08 22:21:22 -07:00
Boris Zbarsky
1fb03996f4 Bug 1387143 part 29. Remove nsISelection. r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky
a44e6132ff Bug 1387143 part 28. Remove nsISelection::AsSelection(). r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky
b47b72dae9 Bug 1387143 part 23. Remove nsISelection collapse* methods. r=mats 2018-05-08 13:52:41 -04:00
Boris Zbarsky
f992e7ed0d Bug 1387143 part 22. Remove nsISelection isCollapsed/collapsed bits. r=mats 2018-05-08 13:52:39 -04:00
Boris Zbarsky
1ff99d888e Bug 1387143 part 20. Remove nsISelectionPrivate. r=mats 2018-05-08 13:52:38 -04:00
Boris Zbarsky
a36e7f946e Bug 1387143 part 9. Remove nsISelectionPrivate::Get/SetAncestorLimiter. r=mats 2018-05-08 13:52:37 -04:00
Boris Zbarsky
2abc41a969 Bug 1387143 part 8. Remove nsISelectionPrivate::Get/SetInterlinePosition. r=mats 2018-05-08 13:52:37 -04:00
Boris Zbarsky
abdd178705 Bug 1387143 part 7. Move the TABLESELECTION_* constants from nsISelectionPrivate to a TableSelection enum. r=mats 2018-05-08 13:52:36 -04:00
Boris Zbarsky
c4c94974c4 Bug 1387143 part 5. Remove JS use of nsISelectionPrivate. r=mats 2018-05-08 13:52:36 -04:00
Boris Zbarsky
921ee1d522 Bug 1387143 part 4. Stop using nsISelection in remaining xpidl. r=mats 2018-05-08 13:52:36 -04:00
Boris Zbarsky
46cae9462a Bug 1387143 part 3. Stop using nsISelection in nsISelectionController. r=mats 2018-05-08 13:52:36 -04:00
Boris Zbarsky
b23f25078d Bug 1387143 part 1. Stop using nsISelection in nsISelectionListener. r=mats 2018-05-08 13:52:35 -04:00
Masayuki Nakano
92a4e5d234 Bug 1452538 - Add telemetry probes HTMLEditors which have shown Gecko build-in editing UIs and count of user interaction with them r=Ehsan
Gecko has some built-in UIs:
* to edit size of objects like <img>, <table> and absolute positioned elements.
* to edit position of absolute positioned elements.
* to add/remove table columns and rows.

Currently, those UIs are available in both designMode editor and contenteditable
editor only on Gecko.  I.e., the other browsers' users cannot modify as such
without web apps implement such function.  So, for compatibility with the
other browsers, we should hide those UIs by default.  On the other hand, if
this is too risky for backward compatibility, we should not do that.

So, before doing that, we should collect actual usage data of object resizers,
inline table editing UI, positioning UI of absolute positioned elements with
telemetry probes.

This patch adds 3 sets of probes for each UI.  One is percentage of showing
each UI in all instantiated HTMLEditor.  The other is number of user interaction
of each UI in HTMLEditors which has shown the UI.

This patch makes all new probes as "opt-out" because they are really important
data since used for deciding whether those UIs are necessary or unnecessary.

MozReview-Commit-ID: B9Y6GTiCPw6

--HG--
extra : rebase_source : 00e49f31712e24cb269ad3aa65c7d13b7cccb3a5
2018-04-09 17:31:23 +09:00
Dorel Luca
2b4e625186 Backed out changeset b57df5aa1534 (bug 1457813) for conflict after bug 833098 got backed out. CLOSED TREE 2018-05-08 14:49:35 +03:00
Chris Peterson
5a63a12794 Bug 1457813 - Part 3: Remove NS_PRECONDITION definition. r=froydnj
Use fatal MOZ_ASSERT or non-fatal NS_ASSERTION instead.

MozReview-Commit-ID: 1QAsgoWpXDn

--HG--
extra : source : 9ca972b6b3e7d3b576e20a0bf412df51d82aad9f
extra : intermediate-source : a909a9d7bc9a53095e963a4bea45f4fc4aa85b72
2018-04-27 21:42:24 -07:00
Chris Peterson
71422dcaa9 Bug 1457813 - Part 2: Replace non-asserting NS_PRECONDITIONs with MOZ_ASSERTs. r=froydnj
s/NS_PRECONDITION/MOZ_ASSERT/ and reindent

MozReview-Commit-ID: KuUsnVe2h8L

--HG--
extra : source : c14655ab3df2c9b1465dd8102b9d25683359a37b
2018-04-28 12:50:58 -07:00
Boris Zbarsky
323a9a7102 Bug 1457862. Don't forget cellParent until we're done using it in HTMLEditor::GetCellContext. r=masayuki 2018-04-30 21:30:44 -04:00
Makoto Kato
db7992dc59 Bug 1457431 - Devirtualize mozInlineSpellChecker::SpellCheckAfterEditorChange. r=masayuki
It is unnecessary to keep virtual method for
mozInlineSpellChecker::SpellCheckAfterEditorChange, so we should remove virtual
keyword.

MozReview-Commit-ID: 2ry5uhMTFVC

--HG--
extra : rebase_source : ba86bb7c4e47598f83e3869733a238a740cef6b2
2018-04-27 21:11:31 +09:00
Xidorn Quan
f2ba299166 Bug 1448759 part 1 - Make KTableEntry an independent type. r=heycam
MozReview-Commit-ID: oZfJAigThN

--HG--
extra : rebase_source : 6a0efbf40fed8c9eaba7bb3af74d281b536677c8
2018-04-29 21:17:26 +10:00
Kris Maglione
a259026c9d Bug 1456035: Part 4 - Convert callers of XPCOMUtils.generateQI to ChromeUtils.generateQI. r=mccr8
This also removes any redundant Ci.nsISupports elements in the interface
lists.

This was done using the following script:

acecb401b7/processors/chromeutils-generateQI.jsm

MozReview-Commit-ID: AIx10P8GpZY

--HG--
extra : rebase_source : a29c07530586dc18ba040f19215475ac20fcfb3b
2018-04-22 20:55:06 -07:00
Cosmin Sabou
68fdb6cf4f Merge inbound to mozilla-central. a=merge 2018-04-27 13:04:36 +03:00
Boris Zbarsky
ffa08d7425 Bug 1455674 part 9. Remove nsIDOMElement use from nsIFocusManager. r=qdot 2018-04-26 23:35:19 -04:00
Boris Zbarsky
9e59f290d1 Bug 1455674 part 7. Simplify HTMLEditor::GetFocusedNode. r=masayuki 2018-04-26 23:35:19 -04:00
Boris Zbarsky
42cb3dbf9d Bug 1455674 part 6. Mostly remove use of nsIDOMElement in editor. r=masayuki 2018-04-26 23:35:18 -04:00
Boris Zbarsky
0659ea615e Bug 1455674 part 5. Remove remaining IDL use of nsIDOMElement in editor. r=masayuki 2018-04-26 23:35:18 -04:00
Boris Zbarsky
550b06a56b Bug 1455674 part 4. Stop using nsIDOMElement in nsIHTMLEditor::GetElementOrParentByTagName. r=masayuki 2018-04-26 23:35:18 -04:00
Boris Zbarsky
2348052be1 Bug 1455674 part 3. Stop using nsIDOMElement in nsITableEditor. r=masayuki
The patch is a bit large because all these methods except
SswitchTableCellHeaderType call each other; doing it piecemeal would have
required introducing, then removing, a bunch of QIs.
2018-04-26 23:35:18 -04:00
Boris Zbarsky
aab9f97f4e Bug 1455674 part 2. Mostly stop using nsIDOMElement in nsIHTMLEditor. r=masayuki
MozReview-Commit-ID: Koxv2qS2gft
2018-04-26 23:35:18 -04:00
Boris Zbarsky
c9bcb72283 Bug 1455674 part 1. Stop using nsIDOMElement in nsIEditor. r=masayuki 2018-04-26 23:35:18 -04:00
Boris Zbarsky
dd4506eee2 Bug 1457155. Rename various focus manager variables to make it clearer that they're Elements. r=mccr8 2018-04-26 15:28:31 -04:00
shindli
af700315a1 Backed out 2 changesets (bug 1457155, bug 1457156) for B failures in builds/worker/workspace/build/src/dom/html/HTMLObjectElement.cpp on a CLOSED TREE
Backed out changeset 8b2a6b54336c (bug 1457155)
Backed out changeset 4e267d999797 (bug 1457156)
2018-04-27 01:34:37 +03:00
Boris Zbarsky
25cec96459 Bug 1457155. Rename various focus manager variables to make it clearer that they're Elements. r=mccr8 2018-04-26 15:28:31 -04:00
Emilio Cobos Álvarez
081d926e7b Bug 1457026: Teach nsDocumentEncoder about display: contents. r=mats
MozReview-Commit-ID: 5F3qurRHMNM
2018-04-26 18:06:37 +02:00
Doug Thayer
ce5461c0d3 Bug 887889 - Fix leak in RemoteSpellCheckingEngineChild r=Ehsan
The work to migrate to Sqlite.jsm seems to have caused a timing problem
in our tests where shutdown the content process while this IPC message
is still unresolved. This causes us to destroy RemoteSpellCheckingEngineChild
without it having processed its RecvNotiy..., leading to the promise being
leaked. As far as I can tell this resolves all of our leak issues on try.

MozReview-Commit-ID: GdwVIp5dj1m

--HG--
extra : rebase_source : b7bf5838c53e40b49bea17df123028a2dbd26e5e
2018-04-19 14:33:18 -07:00
Emilio Cobos Álvarez
a1b2e5070a Bug 1455885: Inline and make document casts fatally assert. r=bz
For consistency with AsElement / AsContent / AsDocumentFragment, etc.

MozReview-Commit-ID: 8GSj8R9hLBe
2018-04-26 17:05:12 +02:00
Emilio Cobos Álvarez
8239c1300e Bug 1386840: Defer loading and don't block rendering for non-matching stylesheets. r=bz,heycam
MozReview-Commit-ID: 24UJZDooGmn
2018-04-26 16:44:03 +02:00
Emilio Cobos Álvarez
5f526b4a81 Bug 1455559: Make FromNode work for references. r=bz,Nika
MozReview-Commit-ID: 1ldU1aKeMzs

--HG--
extra : rebase_source : 70a2537ab56d040f33acd84d4fd0c3d9de392198
2018-04-20 11:10:12 +02:00
Masayuki Nakano
552423e58f Bug 1456377 - Move composition event handlers from EditorBase to TextEditor r=m_kato
Currently, EditorBase handles most composition events.  However, only
eCompositionChange event handler is in TextEditor and it's the main event
of handling composition.  Therefore, we should make all composition event
handlers in one place for easier to read, and make them non-virtual.

MozReview-Commit-ID: BYDhiPyGKvo

--HG--
extra : rebase_source : ed9db0f49d7ae268c85359e48015e86584f9c999
2018-04-19 00:31:51 +09:00
Masayuki Nakano
f52e0b206b Bug 1455903 - Make EditorBase::CloneAttributesWithTransaction() set sourceElement to aSourceElement rather than aDestElement r=m_kato
This is simple mistake of bug 1451672.

EditorBase::CloneAttributesWithTransaction() sets both sourceElement and
destElement to aDestElement, but of course, it should set sourceElement to
aSourceElement.

Additionally, this patch adds mozilla specific web-platform tests to check
attribute cloning with basic edit operation.

MozReview-Commit-ID: GM1VjRHG7C3

--HG--
extra : rebase_source : 95427853442454525232df519ce5b5ad7bb12693
2018-04-23 18:02:50 +09:00
Makoto Kato
3f513220d0 Bug 1455533 - Part 3. Remove unused nsIEditor.outputToStream. r=masayuki
No one uses outputToStream even if c-c and BlueGriffon.  We should remove this.

MozReview-Commit-ID: LEUtfc89DBe

--HG--
extra : rebase_source : f0c5aa918f577ca8a285afd2414fe3da6545fefc
2018-04-20 16:41:07 +09:00
Makoto Kato
da20106275 Bug 1455533 - Part 2. Devirtualize EditorBase::PostCreate. r=masayuki
No one uses postCreate from script even if c-c and BlueGriffon. So we should
devirtualize this

MozReview-Commit-ID: D3FKVEvG7Go

--HG--
extra : rebase_source : 9915a93ea8ae18bee251507a4c94fe66c0f03d0f
2018-04-20 16:40:24 +09:00
Makoto Kato
bda5448bb6 Bug 1455533 - Part 1. Devirtualize EditorBase::SyncRealTimeSpell. r=masayuki
No one uses syncRealTimeSpell from script even if c-c and BlueGriffon. So
we should devirtualize this

MozReview-Commit-ID: AoOb165dOFa

--HG--
extra : rebase_source : e1a9dcdfa6cfe6c918a06a2738c38a6cb9441a1d
2018-04-20 16:27:16 +09:00
Masayuki Nakano
94dd5a92a4 Bug 1454126 - HTMLEditor should adjust selection outside native anonymous subtree when it inserts something at selection r=m_kato
HTMLEditor::InsertElementAtSelection() doesn't check if selection is in
native anonymous subtree.  Therefore, it could insert element into <input>
element etc.

This patch adds new API to EditorDOMPointBase to compute ancestor point which
is not in native-anonymous subtree and make
HTMLEditor::GetBetterInsertionPointFor() use it to not return point in any
native-anonymous subtrees.
2018-04-17 17:01:57 +09:00
Masayuki Nakano
f0d6418200 Bug 1451672 - part 24: Rename HTMLEditor::CopyLastEditableChildStyles() to HTMLEditor::CopyLastEditableChildStylesWithTransaction() r=m_kato
Like this adds new comments into the method, we should optimize the method
since it may create a lot of transactions and dispatch a lot of mutation
events.

MozReview-Commit-ID: FknJfu6QCjS

--HG--
extra : rebase_source : 39dc110b1101134f7c704e64dbff89171fe50e47
2018-04-17 01:15:23 +09:00
Masayuki Nakano
37e4fef8fd Bug 1451672 - part 23: Rename HTMLEditor::Set*BackgroundColor() to HTMLEditor::Set*BackgroundColorWithTransaction() r=m_kato
MozReview-Commit-ID: 7kUahOPZCwE

--HG--
extra : rebase_source : 18478bb1b4f4b91af7e2e6963523a76a69dbca24
2018-04-17 00:02:39 +09:00
Masayuki Nakano
cb6f42437a Bug 1451672 - part 22: Rename HTMLEditor::InsertNodeIntoProperAncestor() to HTMLEditor::InsertNodeIntoProperAncestorWithTransaction() r=m_kato
MozReview-Commit-ID: 6O47YeSpud8

--HG--
extra : rebase_source : 27dfc30cb50dbd0cc31493ed087ffae8744b3017
2018-04-16 23:53:46 +09:00
Masayuki Nakano
043e93a8ba Bug 1451672 - part 21: Refine TextEditor::TypedText() r=m_kato
According to existing comments, TextEditor::TypedText() and
HTMLEditor::TypedText() are intentional bottleneck to debug.  However, only
for that purpose, it and its internal methods are made virtual.  This really
doesn't make sense.

So, this patch creates TextEditor::OnInputText() for callers of TypedText()
with non-empty string, TextEditor::OnInputParagraphSeparator() for callers
of TypedText() with eTypeBreak (Enter key or insertParagraphSeparator),
HTMLEditor::OnInputLineBreak() for callers of TypedText() with eTypeBR
(Shift + Enter or insertLineBreak).  Additionally, this creates internal
non-virtual methods for XPCOM methods which are used as internal methods of
TypedText().  One is InsertTextAsAction() for nsIPlatintextEditor.insertText().
the other is InsertParagraphSeparator() for nsIPlaintextEditor.insertLineBreak().

Although those new methods are not have "WithTransaction" postfix, they must
be clearer they'll use transactions since user input and actions should be
undo-able.

MozReview-Commit-ID: AmOkMqovIKA

--HG--
extra : rebase_source : 9c0f4b25fa2a36ad2f3394f72eb290824c31d82a
2018-04-16 23:43:36 +09:00
Masayuki Nakano
c5bb2c4b29 Bug 1451672 - part 20: Rename HTMLEditor::MakeDefinitionItem() and HTMLEditor::InsertBasicBlock() with "WithTransaction" postfix r=m_kato
MozReview-Commit-ID: 2D50suUnFcw

--HG--
extra : rebase_source : 7ea3cfa390f6d8986be607faf6a4677b05b10a1d
2018-04-16 20:33:27 +09:00
Masayuki Nakano
a409fc4d17 Bug 1451672 - part 19: Remove TextEditor::CreateBR() and rename TextEditor::CreateBRImpl() to TextEditor::InsertBrElementWithTransaction() r=m_kato
TextEditor::CreateBR() is just a wrapper of TextEditor::CreateBRImpl() for
automatically retrieving Selection of the editor.

And TextEditor::CreateBRImpl() should be renamed to
TextEditor::InsertBrElementWithTransaction() for making it clearer what
it does.

MozReview-Commit-ID: D8sjVdLrVrd

--HG--
extra : rebase_source : f269f5c3ce598d221d7263c111475dab0dd5f19f
2018-04-16 19:21:29 +09:00
Masayuki Nakano
5af458988b Bug 1451672 - part 18: Rename EditorBase::CloneAttributes() to EditorBase::CloneAttributesWithTransaction() r=m_kato
MozReview-Commit-ID: 5tL31gRDVc9

--HG--
extra : rebase_source : dede345becde79dd9363f1df1980715713a80ef1
2018-04-13 18:44:08 +09:00
Masayuki Nakano
3da9675a5e Bug 1451672 - part 17: Rename EditorBase::InsertContainerAbove() to EditorBase::InsertContainerWithTransactionInternal() and wraps it with new inline methods, EditorBase::InsertContainerWithTransaction() r=m_kato
Similar to EditorBase::ReplaceContainerWithTransaction(),
EditorBase::InsertContainerAbove() may set an attribute to newly created element
if it's specified.  However, for avoiding the null check, let's make them
as references rather than pointers and treat nsGkAtoms::_empty as nullptr for
making the code safer.

This patch removes "Above" from the method name since it's redundant.
"Insert" sounds like inserting a node, and "Container" means to keep existing
children with new element in EditorBase.

MozReview-Commit-ID: 6EnkKHynYSP

--HG--
extra : rebase_source : d4b4c1a611c46a0f4d86389aab3331af565199d2
2018-04-13 18:17:04 +09:00
Masayuki Nakano
2d04b175d7 Bug 1451672 - part 16: Rename EditorBase::MoveNode() to EditorBase::MoveNodeWithTransaction() and create EditorBase::MoveNodeToEndWithTransaction() r=m_kato
This patch renames EditorBase::MoveNode() to
EditorBase::MoveNodeWithTransaction() and redesign its parameters including
replacing a set of container node and offset in it to EditorDOMPointBase.
However, it takes magic number -1 as meaning end of the container.
Therefore, this patch adds MoveNodeToEndWithTransaction() for keeping the
callers simple.

MozReview-Commit-ID: BeTq5c7GQNN

--HG--
extra : rebase_source : b3a617a5a1a493cb0fcbefe2d9a9708b0257b1a8
2018-04-12 23:58:52 +09:00
Masayuki Nakano
71964e6004 Bug 1451672 - part 15: Rename EditorBase::RemoveContainer() and HTMLEditor::RemoveBlockContainer() with "WithTransaction" postfix and make their argument |Element&| r=m_kato
MozReview-Commit-ID: 2toj48mqHM9

--HG--
extra : rebase_source : 621cb7a3137137dab45c311836b8304e7bd772f2
2018-04-12 22:23:04 +09:00
Masayuki Nakano
b7fe9939db Bug 1451672 - part 14: Rename EditorBase::ReplaceContainer() to EditorBase::ReplaceContainerWithTransactionInternal() and create some wrappers of it r=m_kato
The parameters of EditorBase::ReplaceContainer() are complicated.  For example,
if it's specified as cloning all attributes, aAttribute and aValue are ignored
because CloneAttributes() removes all existing attributes but ReplaceContainer()
sets attributes before calling CloneAttributes().  This method has 3 modes:
1. Just replaces aOldContainer with new element.
2. #1 and clones all attributes from aOldContainer to the new element.
3. #1 and sets aAttribute of the new element to aValue.

Therefore, this patch creates 3 inline wrappers of the renamed method.

MozReview-Commit-ID: IsPu2uZuU8f

--HG--
extra : rebase_source : 02a23f48a91e0c9558126552a4c8d4b12c8b76bc
2018-04-12 21:45:55 +09:00
Masayuki Nakano
e31bcb6efe Bug 1451672 - part 13: Rename EditorBase::InsertTextImpl() and EditorBase::InsertTextIntoTextNodeImpl() to EditorBase::InsertTextWithTransaction() and EditorBase::InsertTextIntoTextNodeWithTransaction() r=m_kato
MozReview-Commit-ID: DF3HBVyu4P2

--HG--
extra : rebase_source : 1ce6c2b005c06df340524d2d617673f4ce93df07
2018-04-12 17:58:14 +09:00
Masayuki Nakano
4131c9f033 Bug 1451672 - part 12: Create HTMLEditor::RemoveStyleSheetWithTransaction() as implementation of nsIEditorStyleSheets::RemoveStyleSheet() r=m_kato
MozReview-Commit-ID: BIXU3jzD1rU

--HG--
extra : rebase_source : ba0eb79cfbfc6c3f8a30dbed457993e436510409
2018-04-12 17:20:21 +09:00
Masayuki Nakano
bd0aa50472 Bug 1451672 - part 11: Rename EditorBase::SetAttribute(), EditorBase::RemoveAttribute() and EditorBase::CloneAttribute() with "WithTransaction" postfix r=m_kato
MozReview-Commit-ID: I8T9MNkY8Yq

--HG--
extra : rebase_source : 767e52098233c5f6a2c0e7efca433ddd9f246749
2018-04-12 16:58:33 +09:00
Masayuki Nakano
c3efa1de72 Bug 1451672 - part 10: Rename TextEditor::DeleteSelectionImpl() to TextEditor::DeleteSelectionWithTransaction() r=m_kato
MozReview-Commit-ID: 8nypHV8X3js

--HG--
extra : rebase_source : 8ca989bd8d5b9e824ed48a0fafa76993a575d0d0
2018-04-11 19:11:15 +09:00
Masayuki Nakano
80c2ea82ed Bug 1451672 - part 9: Create TextEditor::DeleteSelectionAsAction() as implementation of nsIEditor::DeleteSelection() r=m_kato
First, EditorBase::DeleteSelection() is never used since
TextEditor::DeleteSelection() overrides it but does not call it.  So, this patch
makes EditorBase::DeleteSelection() only returns NS_ERROR_NOT_IMPLEMENTED.

Next, EditorBase::DeleteSelectionImpl() actually removes content for
TextEditor::DeleteSelection().  So, it should be named as
DeleteSelectionWithTransaction().  However, it'll be done in the following
patch.  On the other hand, its callers are EditorBase::HandleKeyPressEvent()
and EditorBase::DeleteSelectionAndPrepareToCreateNode().  Fortunately, they
can be moved to TextEditor simply.  Therefore this patch moves the methods
to TextEditor for making related methods in a place.

Then, we can make the implementation of nsIEditor::TextEditor() as a non-virtual
method, TextEditor::DeleteSelectionAsAction().

MozReview-Commit-ID: KXFDhW3G9lA

--HG--
extra : rebase_source : 15986979279b2cae3b61cda1bf6bf3d9e4987f3f
2018-04-11 17:37:49 +09:00
Masayuki Nakano
526463cade Bug 1451672 - part 8: Rename EditorBase::DeleteText() to EditorBase::DeleteTextWithTransaction() r=m_kato
MozReview-Commit-ID: KK4dTpKbpLc

--HG--
extra : rebase_source : 060e5183efd6570cbdd59429552b318fd3865d54
2018-04-10 16:50:06 +09:00
Masayuki Nakano
0a1cfd5226 Bug 1451672 - part 7: Rename EditorBase::DeleteNode() to EditorBase::DeleteNodeWithTransaction() r=m_kato
MozReview-Commit-ID: AQVVTjfXJv

--HG--
extra : rebase_source : 9678e8f2e16c9ec193e292c577912b6df7782202
2018-04-10 16:23:54 +09:00
Masayuki Nakano
7a1b5de42f Bug 1451672 - part 6: Rename EditorBase::JoinNodesImpl() to EditorBase::DoJoinNodes() r=m_kato
MozReview-Commit-ID: 9fqa4fKkAF5

--HG--
extra : rebase_source : 6ec753824488235a03677ef1238aabe607b7d786
2018-04-10 03:56:46 +09:00
Masayuki Nakano
8b1e0b6b9c Bug 1451672 - part 5: Rename EditorBase::JoinNodes() and related methods with "WithTransaction" postfix r=m_kato
This patch renames:
EditorBase::JoinNodes() -> EditorBase::JoinNodesWithTransaction()
EditorBase::JoinNodeDeep() -> EditorBase::JoinNodesDeepWithTransaction()
HTMLEditRules::JoinNodesSmart() ->
  HTMLEditRules::JoinNearestEditableNodesWithTransaction()
HTMLEditRules::TryToJoinBlocks() ->
  HTMLEditRules::TryToJoinBlocksWithTransaction()

MozReview-Commit-ID: Ao16GhAcyIZ

--HG--
extra : rebase_source : 6746735c339cf2799e94137de87c7a7dce6efded
2018-04-10 03:46:44 +09:00
Masayuki Nakano
a1a45ac179 Bug 1451672 - part 4: Rename EditorBase::SplitNodeImpl() to EditorBase::DoSplitNode() r=m_kato
EditorBase::SplitNodeImpl() is called by SplitNodeTransaction::DoTransaction()
for actually splitting a node.  However, "WithoutTransaction" postfix is really
redundant.  Perhaps, just naming DoSplitNode() is better since "Impl" isn't
unclear and not useful if somebody wants to use it as a utility method and
there has already been EditorBase::SplitNode() which is an override of
nsIEditor::SplitNode().  It must not be good to use same name for different
purpose (EditorBase::SplitNode() creates a transaction).

MozReview-Commit-ID: Akjeyp52vVv

--HG--
extra : rebase_source : dcb29cec2749431b59068b670b68e5cd61b18588
2018-04-10 02:32:33 +09:00
Masayuki Nakano
7967ef5834 Bug 1451672 - part 3: Rename EditorBase::SplitNode() and related methods to ending with "WithTransaction" r=m_kato
This patch renames:
EditorBase::SplitNode() -> EditorBase::SplitNodeWithTransaction()
EditorBase::SplitNodeDeep() -> EditorBase::SplitNodeDeepWithTransaction()
HTMLEditRules::MaybeSplitAncestorsForInsert() ->
  HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction()

Note it might be that some callers of those methods should be renamed too.
However, we should do it in follow up bug after landing those patches since
we can investigate it with searchfox.org after landing patches.

MozReview-Commit-ID: FfxCfaI85z5

--HG--
extra : rebase_source : 143960de45791c72dbf4d436f65e55452b4f7b10
2018-04-10 02:16:49 +09:00
Masayuki Nakano
49d8961486 Bug 1451672 - part 2: Rename EditorBase::InsertNode() to EditorBase::InsertNodeWithTransaction() r=m_kato
MozReview-Commit-ID: 4n5EVvUKrux

--HG--
extra : rebase_source : ebee5f0b1da029866653112546973a3bdc9e8e01
2018-04-10 01:34:29 +09:00
Masayuki Nakano
b78528ad78 Bug 1451672 - part 1: Rename EditorBase::CreateNode() to EditorBase::CreateNodeWithTransaction() r=m_kato
EditorBase::CreateNode() creates an element node with transaction.  I.e., it's
undoable.  So, if somebody would use this method as a helper method for changing
the DOM tree, that would cause unexpected undoable transaction.  So, we should
make the method name clearer to avoid such bug.

MozReview-Commit-ID: GZsOGBfqog

--HG--
extra : rebase_source : 8b7539a680ee88f3557acb0837fe1a021d842323
2018-04-10 01:17:26 +09:00
Dorel Luca
65669dae30 Merge mozilla-inbound to mozilla-central. a=merge 2018-04-21 02:00:04 +03:00
Boris Zbarsky
a81bb92f43 Bug 1455052 part 10. Remove various unused nsIDOMEvent bits. r=masayuki
MozReview-Commit-ID: Fzckal7RGUv
2018-04-20 12:55:31 -04:00
Boris Zbarsky
945feaec17 Bug 1455052 part 6. Stop using nsIDOMEvent in editor code. r=masayuki
MozReview-Commit-ID: JoP6kMuYQLQ
2018-04-20 12:53:17 -04:00
Masayuki Nakano
9000054fed Bug 1454945 - Get rid of nsIEditor.suppressDispatchingInputEvent since nobody uses it from JS r=m_kato
So, this patch replaces the setter with non-virtual method and removing the
getter since where is already non-virtual getter method.

MozReview-Commit-ID: Is19Yriz8t8

--HG--
extra : rebase_source : bb2f49f380ddb2e2f96e8690effd8d47d24ae0ae
2018-04-18 22:57:41 +09:00
Makoto Kato
91af9cea10 Bug 1424450 - Don't set selection on ClearStyle. r=masayuki
This crash is that HTMLEditor::ClearStyle returns nullptr for aNode even if
successful.

When current start node and offset isn't within ancestor limiter,
HTMLEditor::ClearStyle will return nullptr for split node even if successful.
Because SplitNodeTransation returns error since Selection::Collapse is failed.
Then, SplitNodeDeep in HTMLEditor::SplitStyleAvovePoint returns error.  But
this error is ignored.  So node will becomes null even if successful.

CreateStyleForInsertText will set new selection when there is split node, so
we shouldn't set selection on ClearStyle.

Also, InsertNodeTransation is ignored for error when Collapse is failed, but
SplitNodeTransaction isn't ignored.  We should create a rule when collapse is
failed on transaction.

And at feature, we shouldn't set selection in CreateStyleForInsertText, and
then, it should return new insertion point for InsertText instead of setting
new selection.

MozReview-Commit-ID: BRKWLqTfrvC

--HG--
extra : rebase_source : 2cd025e9d40688f643a843b39512dccc2bb7c4a2
2018-04-18 16:13:24 +09:00
Nika Layzell
5e2e5fc993 Bug 1444991 - Part 5: Make some XPCOM methods more strongly typed, r=bz
This patch goes through and changes a bunch of places in our tree which mention
this bug to use the new feature, making the methods more strongly typed.

There are probably more places in tree which could be changed, but I didn't try
to find them.
2018-04-17 19:21:05 -04:00
Makoto Kato
5d349b958c Bug 1442499 - EditorBase::IsPreformatted should return bool. r=masayuki
It is unnecessary to get PresShell for nsStyleText, so we can return bool
instead of nsresult and can change it to static method.

MozReview-Commit-ID: LGrdcaJuLO

--HG--
extra : rebase_source : bb6b6d990741c7b478e9699ae84cc6b89a765bf7
2018-04-17 13:08:51 +09:00
Makoto Kato
2b953ae3f5 Bug 1361052 - DeleteSelectionAndPrepareToCreateNode should be more safety. r=masayuki
Bug 768765 isn't enough for fix.  Since Selection::GetAnchorFocusRange can
return nullptr, we should consider this condition.

And I cannot reproduce this using crash test, so I add mochitest for this.

MozReview-Commit-ID: 8Ei5YBIBuWv

--HG--
extra : rebase_source : cd11517f73179d949479716a83baec0e1f492eca
2018-04-13 16:58:06 +09:00
Masayuki Nakano
38691686f7 Bug 1453872 - Make HTMLEditRules::JoinNodesSmart() return { aRightNode - aLeftNode.Length() } by default r=m_kato
This is regression of bug 1423835.

When I fixed the bug, I accidentally changed the result of
HTMLEditRules::JoinNodesSmart() to use new API.  However, it was simple
misunderstand.  The original code sets the initial value of result to
{ aRightNode - aLeftNode.Length() } but I understood it as
{ aRightNode - aRightNode.Length() }.  Therefore, this patch backs out the
patch only for this line.

MozReview-Commit-ID: 5rD7YFij8v

--HG--
extra : rebase_source : c11770892ab7416b9bf5d3329fc8b7b413387747
2018-04-13 13:18:13 +09:00
Andrew McCreight
3f7472aec1 Bug 1449670, part 1 - Convert IsNodeOfType(nsINode::eTEXT) to IsText(). r=bz
This method is not a virtual call, and also looks nicer.

This patch was mostly generated by a Python script, but I manually
cleaned up the code in a few places where statements didn't need to be
split across multiple lines any more.

MozReview-Commit-ID: 8JExxqSRc59

--HG--
extra : rebase_source : df6330a89e8d65dfe7a6fda0c8cb9f9732302efc
2018-04-12 15:41:00 -07:00
Sebastian Hengst
0819f35e51 Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Tristan Bourvon
a3a77c0312 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Jonathan Watt
ef1290712d Bug 1452170 follow-up - Fix Windows unified build bustage by adding missing AutoRestore.h includes. r=me on CLOSED TREE 2018-04-09 10:21:42 +01:00
Makoto Kato
6c2bc77ccf Bug 1451972 - Remove more nsIDOMDocument usages from editor. r=masayuki
We should not use nsIDOMDocument if unnecessary. Because it needs QI to access
nsIDocument.

MozReview-Commit-ID: CMF3tmvBTB9

--HG--
extra : rebase_source : e832023be8d59a2c1e01bd423e6f058b0708dfe9
2018-04-06 14:53:05 +09:00
Boris Zbarsky
88937275cc Bug 1449631 part 9. Remove nsIDOMEventTarget::AddEventListener. r=smaug
Also switch the XPCOM-y version of EventTarget::AddEventListner to a
Nullable<bool> for aWantsUntrusted.

The three-arg overload of AddEventListener in ContentFrameMessageManager was
never called, so all the AddEventListener overloads there are not needed.

MozReview-Commit-ID: 4IhqHmPVWzE
2018-04-05 13:42:42 -04:00
Boris Zbarsky
1dce94cf16 Bug 1449631 part 2. Remove nsIDOMEventTarget::RemoveEventListener. r=smaug
We can't have a null content in
ScrollbarActivity::StopListeningForScrollAreaEvents, because only viewport
frames have a null GetContent().

MozReview-Commit-ID: 9iAg0ivVqqG
2018-04-05 13:42:40 -04:00
Nicholas Nethercote
4b941e22d0 Bug 1449395 - Remove unnecessary nsStaticAtom.h includes. r=froydnj
For nsCSSAnonBoxes.cpp, nsCSSPseudoElements.cpp, nsDirectoryService.cpp, the
corresponding .h file includes nsStaticAtom.h. For the other files in this
patch, nsStaticAtom.h is not needed at all.

MozReview-Commit-ID: IpMmbXwZHhu

--HG--
extra : rebase_source : 46d0a6b40a41ee233adad7c205cf907fa27de34a
2018-03-29 09:08:54 +11:00
Masayuki Nakano
5b5492e588 Bug 1435123 - HTMLEditor::GetBlock() has to specify given ancestor limit node to HTMLEditor::GetBlockNodeParent() r=m_kato
This is a simple bug of internal API of HTMLEditor.  HTMLEditor::GetBlock()
tries to retrieve nearest ancestor block node (including itself) of a node.
HTMLEditor::GetBlock() may have ancestor limiter typically it's active
editing host to prevent to modify editing host or its ancestor accidentally.

However, it forgets to call HTMLEditor::GetBlockNodeParent() with the given
ancestor limit node.  Therefore, if editing host is an inline element and
its parent is a block element, the editing host is split accidentally.

MozReview-Commit-ID: Ermmxdnk4KB

--HG--
extra : rebase_source : c9b57c5bb28cd63b6f16702317f7ddb7fb5a26f6
2018-03-29 18:57:57 +09:00
Ciure Andrei
5d841a3421 Merge inbound to mozilla-central. a=merge 2018-03-30 01:06:18 +03:00
Neil Deakin
6a995d0462 Bug 1448018, remove ContainerBoxObject which is only used to access the docshell, but bug 1448018 made the docshell accessible from the frameloader instead so the container box object is no longer being used. Change some editor tests which just access the docShell directly rather than through the box object, r=bz 2018-03-29 10:44:52 -04:00
Makoto Kato
8c5d5f7c30 Bug 1449147 - Clean up more nsIDOMNode usages in editor. r=masayuki
To reduce QI, I would like to replace nsIDOMNode with nsINode.  And some
parameters in *DataTransder.cpp's methods is unused (it uses as nullptr),
so we should remove these parameters.

Also nsIDOMNodeList is unused now, so we should remove this including.

MozReview-Commit-ID: 1QTIkxDazjJ

--HG--
extra : rebase_source : 3961e897fcaa96975facc822821f1e223cab358d
2018-03-27 20:19:35 +09:00
Jonathan Watt
68e78b291f Bug 1449321 - Remove the IsServo and IsGecko methods from the style system code. r=emilio
--HG--
extra : source : 763277b299e42d8ee7eafede027ee690b66a7a2a
2018-03-23 16:01:34 +00:00
Masayuki Nakano
ec04470e25 Bug 1448876 - Get rid of nsIClipboardDragDropHooks and nsIClipboardDragDropHookList interfaces r=bz
nsIClipboardDragDropHooks and nsIClipboardDragDropHookList allow XUL apps
to customize drag and drop operation and paste operation.  However, this
feature was used only by ChatZilla and it doesn't work on Gecko anymore.
So, we can get rid of them from our tree.

MozReview-Commit-ID: Ibs3V1gI8Ry

--HG--
extra : rebase_source : 83428293d59aaca432d76c71b214aa7799f7f9de
2018-03-26 23:56:53 +09:00
Bogdan Tara
39d9b048b9 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-03-27 12:16:26 +03:00
Bogdan Tara
302a55b534 Merge inbound to mozilla-central. a=merge 2018-03-27 12:12:57 +03:00
Boris Zbarsky
df07d2d834 Bug 1447890 part 5. Remove nsISelection::RemoveAllRanges. r=mystor
MozReview-Commit-ID: EeMje9KW6An
2018-03-27 00:35:23 -04:00
Boris Zbarsky
74e28b0d19 Bug 1447890 part 2. Remove nsISelection::RemoveRange. r=mystor
MozReview-Commit-ID: JXq5FYNNXPJ
2018-03-27 00:35:22 -04:00
Boris Zbarsky
54d1f87ff4 Bug 1447890 part 1. Remove nsISelection::AddRange. r=mystor
MozReview-Commit-ID: 1JNLZp7tbII
2018-03-27 00:35:22 -04:00
Boris Zbarsky
1731f12f9d Bug 1447889 part 9. Remove nsIDOMRange::CompareBoundaryPoints. r=mystor
MozReview-Commit-ID: 29swD9AoqoF
2018-03-27 00:35:21 -04:00
Boris Zbarsky
3906df8d57 Bug 1447889 part 8. Remove nsIDOMRange::SelectNode/SelectNodeContents. r=mystor
MozReview-Commit-ID: 2hbF6pT31Xd
2018-03-27 00:35:21 -04:00
Jonathan Watt
82ebebe276 Bug 1448714 - Fix up comments referring to 'style context' after the rename of nsStyleContext. r=emilio 2018-03-23 13:49:21 +00:00
Masayuki Nakano
10bbfadf8f Bug 1448780 - Get rid of nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems r=m_kato
nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems are shortcut
property for nsITransactionManager.numberOfUndoItems and
nsITransactionManager.numberOfRedoItems of the editor.  However, anybody
uses nsITransactionManager directly.  So, we can get rid of them.

MozReview-Commit-ID: 70J0bsxDNCC

--HG--
extra : rebase_source : fd0847687fe595b257b0256a5f1faa5f2df5f972
2018-03-26 18:11:06 +09:00
Masayuki Nakano
52cffc3290 Bug 1447924 - part 7: Implement AddTransactionListener() and RemoveTransactionListener() in EditorBase and TransactionManager r=m_kato
nsITransactionListener::AddListener() and
nsITransactionListener::RemoveListener() are of course virtual methods.
Additionally, they are safe to call without grabbing the TransactionManager's
instance with local variable.  Therefore, if EditorBase has methods to
add/remove transaction listener to/from its transaction manager, we don't
need EditorBase::GetTransactionManager() anymore.

So, this patch adds AddTransactionListener() and RemoveTransactionListener() to
EditorBase and TransactionManager, and remove
EditorBase::GetTransactionManager() (not nsIEditor's one).

MozReview-Commit-ID: FkPa1YgfagD

--HG--
extra : rebase_source : 8ef7796136804e3d7604c5ca5417fb3379606b93
2018-03-23 18:55:56 +09:00
Masayuki Nakano
f882fa6959 Bug 1447924 - part 6: Implement EnableUndoRedo(), DisableUndoRedo() and ClearUndoRedo() in EditorBase and TransactionManager r=m_kato
nsIEditor::EnableUndo() and nsITransactionManager::Clear(),
nsITransactionManager::SetMaxTransactionCount() are called a lot but they are
virtual and some of or all of them are called once.  There should be each
non-virtual method to do what each root caller wants.  Therefore, this patch
adds EditorBase::EnableUndoRedo(), EditorBase::DisableUndoRedo(),
EditorBase::ClearUndoRedo(), TransactionManager::EnableUndoRedo(),
TransactionManager::DisableUndoRedo() and TransactionManager::ClearUndoRedo().

Note that this patch makes TransactionManager won't clear mUndoStack nor
mRedoStack if mDoStack is not empty.  This is checked only by
TransactionManager::SetMaxTransactionCount() but according to the comment,
TransactionManager::Clear(), TransactionManager::UndoStack() and
TransactionManager::RedoStack() should check it too.

MozReview-Commit-ID: 6qBZOQNwdhw

--HG--
extra : rebase_source : 3249137f7acca0b4698713ab732774140bcc27e8
2018-03-23 15:25:13 +09:00
Masayuki Nakano
a1f13e5b38 Bug 1447924 - part 5: Merge TextEditor::Undo()/Redo() with EditorBase::Undo()/Redo() r=m_kato
EditorBase::Undo() and EditorBase::Redo() implement only undo/redo function.
TextEditor::Undo() and TextEditor::Redo() call them with calling some
notification methods.  However, this causes redundant AutoRules instance
creation and doesn't make sense to separate them under current design.

Therefore this patch merges them into TextEditor.  Unfortunately, they are
XPCOM methods but we cannot implement proper overloads of non-virtual since
they are already minimized design.  Fortunately, reducing only one virtual
call per undo/redo isn't so effective.  So, let's keep simpler design.

Additionally, this patch makes them stop committing composition because
Chrome does not commit composition even if "undo"/"redo" is requested with
execCommand() during composition and it doesn't make sense to try to
undo/redo after committing composition since first undoable transaction
becomes the committing composition and committing composition causes
removing all transactions from redo transaction queue.

MozReview-Commit-ID: 78qlV2I9Lzk

--HG--
extra : rebase_source : 545c787d47fe02bf7e085be9d3ae028816750e69
2018-03-23 01:21:17 +09:00
Masayuki Nakano
6273aa5604 Bug 1447924 - part 4: Optimize NumbeOfUndoItems(), NumbeOfRedoItems(), CanUndo() and CanRedo() of EditorBase r=m_kato
Now, both TransactionManager.h and TransactionStack.h are exposed.  So,
TransactionManager::GetNumberOfUndoItems() and
TransactionManager::GetNumberOfRedoItems() can be rewritten with non-virtual
inline methods because they just return mUndoStack.GetSize() and
mRedoStack.GetSize().  Then, we can implement EditorBase::NumbeOfUndoItems(),
EditorBase::NumberOfRedoItems(), EditorBase::CanUndo() and
EditorBase::CanRedo() as inline methods.

MozReview-Commit-ID: 3CJd0VrlvFY

--HG--
extra : rebase_source : 6848d80a395f1c161e10bfb50d15bd63de288095
2018-03-23 00:08:38 +09:00
Masayuki Nakano
0f92a44d6b Bug 1447924 - part 3: Rename nsTransactionStack to mozilla::TransactionStack r=m_kato
Then, all classes in editor/txmgr is now in mozilla namespace and all
headers which are included by other directory are now exposed.  So,
we can remote local includes from other directories now.

MozReview-Commit-ID: Kdb1c4Hp9Sy

--HG--
rename : editor/txmgr/nsTransactionStack.cpp => editor/txmgr/TransactionStack.cpp
rename : editor/txmgr/nsTransactionStack.h => editor/txmgr/TransactionStack.h
extra : rebase_source : 75035e9e618680af9188820595ab050b612a456f
2018-03-22 23:30:48 +09:00
Masayuki Nakano
01bb2a5690 Bug 1447924 - part 2: Rename nsTransactionItem to mozilla::TransactionItem r=m_kato
MozReview-Commit-ID: 5EmFPCaRYWm

--HG--
rename : editor/txmgr/nsTransactionItem.cpp => editor/txmgr/TransactionItem.cpp
rename : editor/txmgr/nsTransactionItem.h => editor/txmgr/TransactionItem.h
extra : rebase_source : 3d5e39b26dc077bb63f7d39542a42cb3d06b6b21
2018-03-22 23:07:36 +09:00
Masayuki Nakano
c525b695b9 Bug 1447924 - part 1: Rename nsTransactionManager to mozilla::TransactionManager r=m_kato
We should rename nsTransactionManager to mozilla::TransactionManager before
adding new non-virtual methods.

MozReview-Commit-ID: JsivNVfDhex

--HG--
rename : editor/txmgr/nsTransactionManager.cpp => editor/txmgr/TransactionManager.cpp
rename : editor/txmgr/nsTransactionManager.h => editor/txmgr/TransactionManager.h
rename : editor/txmgr/nsTransactionManagerFactory.cpp => editor/txmgr/TransactionManagerFactory.cpp
extra : rebase_source : ff5bf76fec8be8f6a1202c17d488cf6c607d8f03
2018-03-22 22:15:54 +09:00
Masayuki Nakano
537b829474 Bug 1447213 - Change editor methods which take |const EditorRawDOMPoint&| but called with EditorDOMPoint.AsRaw() to template methods r=m_kato
A lot of methods take |const EditorRawDOMPoint&| as their argument.  However,
some of them are called with EditorDOMPoint::AsRaw(). This is not good for
performance because:
1. Needs to create temporary instance of EditorRawDOMPoint.
2. EditorRawDOMPoint::AsRaw() may be used by simple mistake.
3. Such methods may call EditorRawDOMPoint::Offset(), however, it's not copied
   to the original EditorDOMPoint instance.  So, callers may need to compute
   offset again.

So, such methods should be changed to template methods if they are not virtual
method and AsRaw() should be gotten rid of for prevent it looking not expensive.

MozReview-Commit-ID: DAqqW4a2EMS

--HG--
extra : rebase_source : 120b920477fe6e7231271411a00994325acdb842
2018-03-20 14:05:47 +09:00
Emilio Cobos Álvarez
e341b20ec4 Bug 1447483: Merge nsStyleContext and ServoStyleContext, rename to ComputedStyle. r=jwatt on a CLOSED TREE
MozReview-Commit-ID: JPopq0LudD
2018-03-22 20:06:24 +01:00
Emilio Cobos Álvarez
5dd797f154 Back out changeset b683bb3f22a1 (Bug 1447483) for not landing with all the files. r=me on a CLOSED TREE
This reverts commit 1808914126bb9f9e4a82d2c3d7ac961885fe7d62.

MozReview-Commit-ID: 5skESBseEvo
2018-03-22 20:05:22 +01:00
Emilio Cobos Álvarez
ca5ac79cca Bug 1447483: Merge nsStyleContext and ServoStyleContext, rename to ComputedStyle. r=jwatt
MozReview-Commit-ID: JPopq0LudD
2018-03-22 19:48:42 +01:00
Boris Zbarsky
29d232e53f Bug 1447098 part 1. Rename FromContent on various DOM classes to FromNode. r=mystor
MozReview-Commit-ID: 202nkbmkwfR
2018-03-21 17:39:04 -04:00
Xidorn Quan
4cf9aed667 Bug 1449400 part 5 - Remove StyleSetHandle. r=emilio
This patch basically does:
* remove StyleSetHandle and its corresponding files
* revisit #includes of related header files and change correspondingly
* change nsIPresShell::mStyleSet to be UniquePtr<ServoStyleSet>
* change the creating path of ServoStyleSet to pass UniquePtr
* change other mentions of StyleSetHandle to ServoStyleSet*
* remove AsServo() calls on ServoStyleSet

Some unfortunate bits:
* some methods of (Servo)StyleSet only accepts ServoStyleSheet while
  many places call into the methods with StyleSheet, so there are many
  ->AsServo() added to sheets

MozReview-Commit-ID: K4zYnuhOurA

--HG--
extra : rebase_source : 459e8efeb171adad089d94272e143e8c244bd279
extra : source : 65ba2f174fcf7dba4e59c00ee8908b1bd0820a48
2018-03-29 22:15:46 +11:00
Boris Zbarsky
5b0b5358d6 Bug 1446527 part 6. Remove nsIDOMUIEvent. r=qdot
MozReview-Commit-ID: 7GbifGJQUtQ
2018-03-26 14:53:03 -04:00
Boris Zbarsky
18b01d00a3 Bug 1446527 part 3. Remove nsIDOMUIEvent::AsEvent. r=qdot
MozReview-Commit-ID: 9KqSXRUIc8G
2018-03-26 14:53:02 -04:00
Boris Zbarsky
35a72f73ba Bug 1446527 part 2. Remove nsIDOMUIEvent::GetDetail. r=qdot
MozReview-Commit-ID: GlTgti53Akj
2018-03-26 14:53:02 -04:00
Boris Zbarsky
f0bc98f232 Bug 1446527 part 1. Remove rangeParent/rangeOffset members from nsIDOMUIEvent. r=qdot
MozReview-Commit-ID: 86cMORXSV9u
2018-03-26 14:53:02 -04:00
Emilio Cobos Álvarez
f7522ae728 Bug 1447358: Unifdef the old style system code. r=jwatt
Summary:
This has been automatically generated using:

  http://dotat.at/prog/unifdef/

And:

find $OBJDIR -type f -name '*.h' |
while read FILE; do
  echo "$FILE"
  unifdef -m -DMOZ_STYLO -UMOZ_OLD_STYLE "$FILE";
done

find $OBJDIR -type f -name '*.cpp' |
while read FILE; do
  echo "$FILE"
  unifdef -m -DMOZ_STYLO -UMOZ_OLD_STYLE "$FILE";
done

MozReview-Commit-ID: I4NdKqbMXzJ

Reviewers: jwatt

Bug #: 1447358

Differential Revision: https://phabricator.services.mozilla.com/D779
2018-03-21 10:20:34 +01:00
Makoto Kato
d0832ccf7e Bug 1444630 - Don't update dictionary after calling UninitSpellChecker. r=masayuki
When calling UninitSpellChecker during calling UpdateDictionary, this crash
occurs.  Since Thunderbird calls UninitSpellChecker by [Recheck Text] button,
this only occurs on Thunderbird.

After calling UninitSpellChecker, we should not update dictionary.

MozReview-Commit-ID: K4SPJ5FDo8n

--HG--
extra : rebase_source : d760c6472f56cef520c399e8c1f20536c3a22e36
2018-03-20 14:27:06 +09:00
shindli
e83f4555ad Backed out changeset f76b3a9e3005 (bug 1444630) for failures in Z:/task_1521542418/build/tests/reftest/tests/editor/libeditor/crashtests/1444630.html on a CLOSED TREE 2018-03-20 14:03:13 +02:00
Makoto Kato
fda0617389 Bug 1444630 - Don't update dictionary after calling UninitSpellChecker. r=masayuki
When calling UninitSpellChecker during calling UpdateDictionary, this crash
occurs.  Since Thunderbird calls UninitSpellChecker by [Recheck Text] button,
this only occurs on Thunderbird.

After calling UninitSpellChecker, we should not update dictionary.

MozReview-Commit-ID: K4SPJ5FDo8n

--HG--
extra : rebase_source : 67fa439e2a4767502ca84095754150d513a939b2
extra : amend_source : 1b065ebe275cefc02809478eb7d6d807f19dbbee
2018-03-20 14:27:06 +09:00
Makoto Kato
06aaef4673 Bug 1443664 - Form control might not have non-chrome only content. r=smaug 2018-03-20 16:22:39 +09:00
Boris Zbarsky
837dc7eaaa Bug 1446711 part 8. Get rid of nsIDOMMouseEvent. r=qdot
MozReview-Commit-ID: 2FK1MA4LGZj
2018-03-20 00:16:07 -04:00
Boris Zbarsky
dcaa6d2614 Bug 1446711 part 5. Get rid of nsIDOMMouseEvent::GetButton. r=qdot
MozReview-Commit-ID: AZWzObh01uI
2018-03-20 00:16:06 -04:00
Boris Zbarsky
f982b572f8 Bug 1446711 part 2. Get rid of nsIDOMMouseEvent::GetClientX/Y. r=qdot
MozReview-Commit-ID: DqMhK4wajH5
2018-03-20 00:16:05 -04:00
Andreea Pavel
7062e6b6a2 Merge mozilla-inbound to mozilla-central. a=merge 2018-03-20 00:39:56 +02:00
Boris Zbarsky
c4a9eb60ff Bug 1446533 part 10. Remove remaining nsIDOMCharacterData uses in editor. r=mystor
MozReview-Commit-ID: CfZNQRiDs43
2018-03-19 15:45:55 -04:00
Boris Zbarsky
d243dbaa39 Bug 1446533 part 9. Remove nsIDOMCharacterData::ReplaceData. r=mystor
MozReview-Commit-ID: Lei6xZ2rw2K
2018-03-19 15:45:34 -04:00
Boris Zbarsky
e7e7401bc3 Bug 1446533 part 8. Remove nsIDOMCharacterData::DeleteData. r=mystor
MozReview-Commit-ID: 7100YyU5jOG
2018-03-19 15:45:31 -04:00
Boris Zbarsky
5475554b91 Bug 1446533 part 7. Remove nsIDOMCharacterData::InsertData. r=mystor
MozReview-Commit-ID: 48XZ2J9ewHP
2018-03-19 15:38:04 -04:00
Boris Zbarsky
0678b901b6 Bug 1446533 part 4. Remove nsIDOMCharacterData::SubstringData. r=mystor
FromContent will be renamed to FromNode in bug 1447098.

MozReview-Commit-ID: DhiN6mCOb34
2018-03-19 15:18:07 -04:00
Boris Zbarsky
000840f44a Bug 1446533 part 3. Remove nsIDOMCharacterData::Get/SetData. r=mystor
MozReview-Commit-ID: 5YeaCPwvIJH
2018-03-19 15:18:07 -04:00
Boris Zbarsky
971ee6f9cb Bug 1446533 part 2. Rename nsGenericDOMDataNode.{h,cpp} to CharacterData. r=mystor
The DOMMatrix.cpp changes are because it was sneaking in headers via another
unified file.

MozReview-Commit-ID: GPp9WOywI5D

--HG--
rename : dom/base/nsGenericDOMDataNode.cpp => dom/base/CharacterData.cpp
rename : dom/base/nsGenericDOMDataNode.h => dom/base/CharacterData.h
2018-03-19 15:18:07 -04:00
Boris Zbarsky
b06aa7e061 Bug 1446533 part 1. Rename nsGenericDOMDataNode to CharacterData. r=mystor
This is not renaming the files yet; that will be a separate changeset.

MozReview-Commit-ID: 5TxkEiQlaKF
2018-03-19 15:18:06 -04:00
Boris Zbarsky
4fa4d2a7f5 Bug 1446598 part 2. Get rid of nsIDOMComment. r=mystor
MozReview-Commit-ID: GGXPQnlwuUM
2018-03-19 15:15:39 -04:00
arthur.iakab
4dec00af02 Merge mozilla-central to mozilla-inbound 2018-03-19 12:51:12 +02:00
Masayuki Nakano
1c1a60c08d Bug 1446253 - Make EventUtils.synthesizeComposition() dispatch keydown and keyup event in default r=smaug
We'll start to dispatch keydown event and keyup event even during composition.
So, for testing those events won't break our UI, we should make
EventUtils.synhtesizeComposition() and EventUtils.synthesizeCompositionChange()
dispatch keydown event and keyup event even if callers don't specify keyboard
event explicitly.

Typically, "keydown" event is marked as "processed by IME", i.e., keyCode
value is set to DOM_VK_PROCESSKEY and key is set to "Process", with our
widget which handles native IME and key input.  On the other hand, "keyup"
is NOT marked as so.

Therefore, this patch makes TextInputProcessor emulates this behavior without
any new special flags.  And for making possible to emulate special cases,
this patch adds two flags to nsITextInputProcessor.  One is
KEY_DONT_MARK_KEYDOWN_AS_PROCESSED.  The other is KEY_MARK_KEYUP_AS_PROCESSED.
Unfortunately, those flags have opposite meaning but this must be better than
making necessary to one flag for emulating usual keydown/keyup events.

Finally, this makes some tests specify better keyboard information to
synthesizeComposition() and synthesizeCompositionChange() to emulate
actual keyboard events during composition.

MozReview-Commit-ID: ItYaXILkNQE

--HG--
extra : rebase_source : e50cc77c1efbc12686d7ea334d41926c7392b30d
2018-03-16 22:35:07 +09:00
Makoto Kato
250a70b6ca Bug 1446861 - Remove more nsIDOMElement usages from editor. r=masayuki
Except table access and XPCOM methods for c-c, tests and etc, we can remove
more nsIDOMElement usages to avoid QI.

MozReview-Commit-ID: HO5kAaZAs6Q

--HG--
extra : rebase_source : 41ede0bace33504ad852dc4e0016ea346cd7bdee
2018-03-19 14:14:45 +09:00
Gurzau Raul
3057041352 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-03-16 19:58:27 +02:00
Sylvestre Ledru
fa45a3c670 Bug 1443080 - Use the static call for static methods (not instance) r=Ehsan
MozReview-Commit-ID: JwHh4bzxuTR

--HG--
extra : rebase_source : 5f5e37517aa80c2e7b5933962178d761074886e7
2018-03-16 14:29:15 +01:00
Boris Zbarsky
4e402f9b99 Bug 1445983. <bdi> should be an HTMLElement, not HTMLUnknownElement. r=hsivonen
MozReview-Commit-ID: 9eJ45uXRDfR
2018-03-16 11:26:09 -04:00
Masayuki Nakano
4a54352ab1 Bug 1445935 - HTMLEditRules::SplitMailCites() remove left node of split node if it becomes empty r=m_kato
Before bug 1413181, HTMLEditRules::SplitMailCites() receives left node of
split node with |leftCite| from SplitNodeDeep().  However, the out argument
was removed by the bug and now, it can be retrieved with
SplitNodeResult::GetPreviousNode().  Its result is used for creating <br>
element etc, but not set to |leftCite| but HTMLEditRules::SplitMailCites()
still checks if |leftCite| is empty to remove it from the DOM tree.

So, now, both |leftCite| and |rightCite| are not necessary and
HTMLEditRules::SplitMailCites() should use |previousNodeOfSplitPoint|
instead of |leftCite|.

MozReview-Commit-ID: 408MJt6X1IV

--HG--
extra : rebase_source : fa6095ccc972d33afe8deb0f124adffea7371f4e
2018-03-15 22:34:57 +09:00
Masayuki Nakano
24e6e1496b Bug 1445569 - part 4: Get rid of EditorBase::GetStartNodeAndOffset() and EditorBase::GetEndNodeAndOffset() r=m_kato
EditorBase::GetStartNodeAndOffset() and EditorBase::GetEndNodeAndOffset() are
just wrappers of EditorBase::GetStartPoint() and EditorBase::GetEndPoint().
They may *compute* offset in the container node even if some callers don't
need the offset.  Therefore, we should get rid of them and make all callers
use EditorBase::GetStartPoint() or EditorBase::GetEndPoint() directly.

Note that EditorBase::GetStartNodeAndOffset() and
EditorBase::GetEndNodeAndOffset() returns NS_ERROR_FAILURE if
EditorBase::GetStartPoint() or EditorBase::GetEndPoint() returns not set point.
Therefore, checking the result is set equals checking the old nsresult as
an error.

MozReview-Commit-ID: JLwqRMFLjHC

--HG--
extra : rebase_source : 0eb6bf4ba80e8139c6b9f36723d77d23f2b9099e
2018-03-15 21:25:41 +09:00
Masayuki Nakano
16c36d15f7 Bug 1445569 - part 3: Make TextEditRules::CheckBidiLevelForDeletion() take |const EditorRawDOMPoint&| instead of |nsINode*| and offset in it r=m_kato
There are 2 callers of TextEditRules::CheckBidiLevelForDeletion().  One of them
will start to use EditorRawDOMPoint.  Therefore, making it take
|const EditorRawDOMPoint&| instead of |nsINode*| and offset in it keeps the
caller simpler.

MozReview-Commit-ID: DRJXo8gnzba

--HG--
extra : rebase_source : a64d1033699245f54a8f8e6a9b93457e12f33e6c
2018-03-15 18:38:46 +09:00
Masayuki Nakano
456069944a Bug 1445569 - part 2: Make WSRunObject::PriorVisibleNode() and WSRunObject::NextVisibleNode() take |const Editor(Raw)DOMPoint&| instead of a pair of |nsINode*| and offset in it r=m_kato
Similar to the constructor of WSRunObject, PriorVisibleNode() and
NextVisibleNode() callers may become ugly if the callers start to use
Editor(Raw)DOMPoint.  So, let's make them take Editor(Raw)DOMPoint instead of
a pair of nsINode* and offset in it.

Note that a lot of callers of them already use Editor(Raw)DOMPoint.  So, we
don't need to keep maintain overloads which takes nsINode* and offset in it
directly.

MozReview-Commit-ID: 3avMtL000nd

--HG--
extra : rebase_source : f8c83e2fabeb5a94a1729c626583a6699636b06c
2018-03-15 18:23:50 +09:00
Masayuki Nakano
fb2eb05e02 Bug 1445569 - part 1: Create WSRunObject constructor which takes |const Editor(Raw)DOMPoint&| instead of |nsINode*| and offset in it r=m_kato
The following patches make some WSRunObject users use EditorRawDOMPoint or
EditorDOMPoint instead of a pair of nsINode and offset in it.  Then, the
code becomes too long like:

> WSRunObject object(mHTMLEditor, pointToDoSomething.GetContainer(),
>                    pointToDoSomething.Offset());

This is ugly and not easier to read than:

> WSRunObject object(mHTMLEditor, pointToDoSomething);

So, we should create alternative constructor of WSRunObject first.

MozReview-Commit-ID: GiNWRBLl7zB

--HG--
extra : rebase_source : 8616956b9745db130283a4bdbd82155b1cfb2803
2018-03-15 17:56:20 +09:00
Masayuki Nakano
f3c761c198 Bug 1445929 - Make Editor(Raw)DOMPoint::IsEndOfContainer() check if mParent is container node before checking mChild r=m_kato
Editor(Raw)DOMPoint::IsEndOfContainer() checks mIsChildInitialized before
referring mChild.  However, it may be true even if mParent is not a container
node like a text node.  Therefore, if mParent is a text node and
mIsChildInitialized is true, it always returns true (i.e., even if mOffset
isn't same as length of mParent).

This patch makes it check mParent->IsContainerNode() before checking
mIsChildInitialized because after checking mIsChildInitialized, it validates
the relation of the members.  So, this keeps the validation simple.

MozReview-Commit-ID: K2XrAZoNv2I

--HG--
extra : rebase_source : cba8190f199ab2e9d99547948ab50f0cc8c8ff88
2018-03-15 22:08:19 +09:00
Emilio Cobos Álvarez
7536928a98 Bug 1445605: Make GetCSSFloatValue use GetPropertyValue instead of GetPropertyCSSValue. r=masayuki
We only use it for properties that return pixels anyway, so we can use it
without much problem.

This also fixes bug 1428974.

MozReview-Commit-ID: 5BbVOUdQT7o
2018-03-15 18:22:31 +01:00
Emilio Cobos Álvarez
bf16aa2b2b Bug 1445599: Unbreak HTMLEditor::GetTemporaryStyleForFocusedPositionedElement, and make it stop using GetPropertyCSSValue. r=masayuki
MozReview-Commit-ID: 4cRQ8sJfT3a
2018-03-15 18:22:31 +01:00
Boris Zbarsky
7f7ce9b56c Bug 1444686 part 13. Remove remaining nsIDOMDataTransfer uses. r=mystor
MozReview-Commit-ID: EFauqLMGz5S
2018-03-13 16:24:00 -04:00
Boris Zbarsky
145e566cd8 Bug 1444686 part 10. Remove nsIDOMDragEvent::GetDataTransfer. r=mystor
MozReview-Commit-ID: LwKqWBGXVcN
2018-03-13 16:24:00 -04:00
Boris Zbarsky
0da7198eee Bug 1444686 part 4. Get rid of nsIDOMDataTransfer::Get/SetDropEffectInt. r=mystor
MozReview-Commit-ID: EQ8KXMf4mnR
2018-03-13 16:23:59 -04:00
Boris Zbarsky
6139d9be8f Bug 1444686 part 2. Get rid of nsIDOMDataTransfer::GetMozItemCount. r=mystor
MozReview-Commit-ID: 1eo6czER8Qw
2018-03-13 16:23:59 -04:00
Emilio Cobos Álvarez
06bfed73ea Bug 1446451: GetPropertyValue can indeed not return an integer if the node is not displayed. r=masayuki
MozReview-Commit-ID: Gk0PffVE7bz

--HG--
extra : rebase_source : ded727b58d4184a9723d9f2d196882462384bce7
2018-03-16 18:07:33 +01:00
Makoto Kato
492ea93b80 Bug 1443714 - Remove already_AddRefed for GetDocument and GetPresSehll on EditorBase. r=masayuki
It is unnecessary to use already_AddRefed for GetDocument and GetPresShell.
Then, if we remove already_AddRefed, we can replace this with const method.

MozReview-Commit-ID: KTVS0rYrY2i

--HG--
extra : rebase_source : 0199026410fc674f112c960b599a09bc7906cf85
2018-03-07 18:26:00 +09:00
Tiberius Oros
f3c2b2ecf8 Merge autoland to mozilla-central. a=merge 2018-03-06 11:52:14 +02:00
Olli Pettay
51b6aa1b21 Bug 1066965, make contentEditable and spellchecking to work in ShadowDOM, r=mrbkap 2018-03-06 09:34:40 +09:00
Masayuki Nakano
9d71742b36 Bug 662591 - HTMLEditor should set caret to start of first editable text node or before first editable inline node r=m_kato
Currently, HTMLEditor doesn't initialize caret position when it gets focus by
itself in most cases.  Only when it's in designMode, it may move caret to the
first visible (not checking CSS actually).

In most cases, caret position is adjusted when EditorBase::InitializeSelection()
calls Selection::SetAncestorLimiter().  If selected range is outside of
new limiter, it moves caret to start of the new limiter.  However, this is
really different behavior from the other browsers.  The other browsers try
to move caret to the first editable text node or before the first editable
content such as <img>, <input>, etc.

This difference causes a serious incompatible issue with Draft.js.  It doesn't
initialize caret position when it gets focus but it assumes that caret is
always set to before <br> element if there is no other content.

So, let's try to behave as what other browsers do as far as possible.

This patch makes editor behave as:
* if selection is already in the editing host except start of the editing host,
  does nothing.
* if there is non-editable element before any editable node, move caret to
  start of the editing host.
* if there is editable text node or element node which cannot have a text node,
  move its start or before it.
* if there is no editable nodes which can contain text nodes, move caret to
  start of the editing host.

Note that before applying this patch, in designMode, BeginningOfDocument() used
document element instead of <body> element.  Therefore, it may set odd position
if <head> element has some text nodes with <script> or <style>.  However,
this doesn't make sense and for making more consistent behavior between
designMode and contenteditable, this patch makes it use editing host (it's
<body> element if it's in designMode).

MozReview-Commit-ID: 5neYoTMq6Cc

--HG--
extra : rebase_source : c4d06b6864a221d7cd2833a007d73f7d67821e95
2018-03-02 14:20:25 +09:00
Makoto Kato
00cc8e57e1 Bug 1442500 - Part 3. Move spellchecker tests to editor/spellchecker. r=masayuki
Many tests in composer are for spellchecker, so we should move it to
/editor/spellchecker/tests.

MozReview-Commit-ID: 7qmNymVXyZP

--HG--
rename : editor/composer/test/bug1200533_subframe.html => editor/spellchecker/tests/bug1200533_subframe.html
rename : editor/composer/test/bug1204147_subframe.html => editor/spellchecker/tests/bug1204147_subframe.html
rename : editor/composer/test/bug1204147_subframe2.html => editor/spellchecker/tests/bug1204147_subframe2.html
rename : editor/composer/test/bug678842_subframe.html => editor/spellchecker/tests/bug678842_subframe.html
rename : editor/composer/test/bug717433_subframe.html => editor/spellchecker/tests/bug717433_subframe.html
rename : editor/composer/test/de-DE/de_DE.aff => editor/spellchecker/tests/de-DE/de_DE.aff
rename : editor/composer/test/de-DE/de_DE.dic => editor/spellchecker/tests/de-DE/de_DE.dic
rename : editor/composer/test/en-AU/en_AU.aff => editor/spellchecker/tests/en-AU/en_AU.aff
rename : editor/composer/test/en-AU/en_AU.dic => editor/spellchecker/tests/en-AU/en_AU.dic
rename : editor/composer/test/en-GB/en_GB.aff => editor/spellchecker/tests/en-GB/en_GB.aff
rename : editor/composer/test/en-GB/en_GB.dic => editor/spellchecker/tests/en-GB/en_GB.dic
rename : editor/composer/test/mochitest.ini => editor/spellchecker/tests/mochitest.ini
rename : editor/composer/test/test_async_UpdateCurrentDictionary.html => editor/spellchecker/tests/test_async_UpdateCurrentDictionary.html
rename : editor/composer/test/test_bug1200533.html => editor/spellchecker/tests/test_bug1200533.html
rename : editor/composer/test/test_bug1204147.html => editor/spellchecker/tests/test_bug1204147.html
rename : editor/composer/test/test_bug1205983.html => editor/spellchecker/tests/test_bug1205983.html
rename : editor/composer/test/test_bug1209414.html => editor/spellchecker/tests/test_bug1209414.html
rename : editor/composer/test/test_bug1219928.html => editor/spellchecker/tests/test_bug1219928.html
rename : editor/composer/test/test_bug1365383.html => editor/spellchecker/tests/test_bug1365383.html
rename : editor/composer/test/test_bug338427.html => editor/spellchecker/tests/test_bug338427.html
rename : editor/composer/test/test_bug678842.html => editor/spellchecker/tests/test_bug678842.html
rename : editor/composer/test/test_bug697981.html => editor/spellchecker/tests/test_bug697981.html
rename : editor/composer/test/test_bug717433.html => editor/spellchecker/tests/test_bug717433.html
extra : rebase_source : 21c17f40d234670be1eefa680747c9085c843e94
2018-03-02 12:57:54 +09:00
Makoto Kato
6d4d7659bb Bug 1442500 - Part 2. Move some spellchecker source files in /editor/composer to /editor/spellchecker. r=masayuki
Per bug 1439813, some files in composer is for spellchecker, so we should move
it to /editor/spellchecker.

MozReview-Commit-ID: 6vlhC1TcZp5

--HG--
rename : editor/composer/EditorSpellCheck.cpp => editor/spellchecker/EditorSpellCheck.cpp
rename : editor/composer/EditorSpellCheck.h => editor/spellchecker/EditorSpellCheck.h
rename : editor/composer/nsComposeTxtSrvFilter.cpp => editor/spellchecker/nsComposeTxtSrvFilter.cpp
rename : editor/composer/nsComposeTxtSrvFilter.h => editor/spellchecker/nsComposeTxtSrvFilter.h
extra : rebase_source : b9c3fcf7e557a2ff4b58e81020fa7a9ec938d3af
2018-03-02 12:56:44 +09:00
Makoto Kato
43ea41434e Bug 1442500 - Part 1. Rename editor/txtsvc to editor/spellchecker. r=masayuki
txtsvc is ambiguous name, so we should use functional name instead.

XPIDL_MODULE still keeps 'txtsvc' because 'spellchecker' is already used by
extensions/spellchek/idl.  And all IDLs for editor may move to /editor since
most IDLs for editor is on /editor.

MozReview-Commit-ID: v9a5ENEs2M

--HG--
rename : editor/txtsvc/TextServicesDocument.cpp => editor/spellchecker/TextServicesDocument.cpp
rename : editor/txtsvc/TextServicesDocument.h => editor/spellchecker/TextServicesDocument.h
rename : editor/txtsvc/moz.build => editor/spellchecker/moz.build
rename : editor/txtsvc/nsFilteredContentIterator.cpp => editor/spellchecker/nsFilteredContentIterator.cpp
rename : editor/txtsvc/nsFilteredContentIterator.h => editor/spellchecker/nsFilteredContentIterator.h
rename : editor/txtsvc/nsIInlineSpellChecker.idl => editor/spellchecker/nsIInlineSpellChecker.idl
rename : editor/txtsvc/nsISpellChecker.h => editor/spellchecker/nsISpellChecker.h
rename : editor/txtsvc/nsITextServicesFilter.idl => editor/spellchecker/nsITextServicesFilter.idl
extra : rebase_source : 38ea55fe974614b7bb829b614f7de1ee649dbbb1
2018-03-02 12:55:26 +09:00
Emilio Cobos Álvarez
2988d4e66d Bug 1442207: Remove unneeded arguments to nsIMutationObserver. r=smaug
aDocument is always content->OwnerDoc().
aContainer is always content->GetParent().

Differential Revision: https://phabricator.services.mozilla.com/D664

MozReview-Commit-ID: 4xwPCOnhyIL
2018-03-01 22:45:17 +01:00