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

8198 Коммитов

Автор SHA1 Сообщение Дата
Ehsan Akhgari 08f095eab1 Bug 1407353 - Remove one of the nsINode::GetChildAt() calls in EditorBase::JoinNodeDeep(); r=masayuki 2017-10-11 02:00:36 -04:00
Ehsan Akhgari 959b55b795 Bug 1407352 - Avoid calling GetChildAt() in DeleteRangeTransaction::CreateTxnsToDeleteBetween(); r=masayuki 2017-10-11 01:49:55 -04:00
Ehsan Akhgari e72bd8ae0d Bug 1406577 - Part 2: Remove some dead code; r=masayuki 2017-10-10 11:21:59 -04:00
Ehsan Akhgari f0705cd727 Bug 1406577 - Part 1: Rewrite HTMLEditRules::FindNearSelectableNode() to use internal DOM APIs; r=masayuki 2017-10-10 11:21:57 -04:00
Ehsan Akhgari 16c54559ca Bug 1408049 - Remove an unneeded call to nsINode::IndexOf() from EditorBase::BeginningOfDocument(); r=masayuki 2017-10-12 14:27:22 -04:00
Ehsan Akhgari 92a2acc32a Bug 1407447 - Part 2: Remove some dead code; r=masayuki 2017-10-12 10:49:14 -04:00
Ehsan Akhgari 91afad1234 Bug 1407447 - Part 1: Remove the call to nsINode::GetChildAt() from HTMLEditor::DoInsertHTMLWithContext(); r=masayuki 2017-10-12 10:49:14 -04:00
Makoto Kato 59c8e03ca6 Bug 1402904 - Part 2. Add crash tests. r=masayuki
1405747.html is kind of same issue.  But when editing 1405747.html, the crash doesn't occur.  So I keep original HTML by jsfuzzy.

MozReview-Commit-ID: 9BcUkWeBlr5

--HG--
extra : rebase_source : 1bac60293d3b4997a380cf625c6492db22f60160
extra : histedit_source : eae38e2d69e0705545acf1ef1f2d04e7977b8899
2017-10-05 14:23:12 +09:00
Makoto Kato 129db593cd Bug 1402904 - Part 1. Some operations should check whether parent node of each selected node is null. r=masayuki
GetNodesForOperation returns node array from current selection.  So some nodes in this array might have no parent node.  We should ignore such as orphans.

MozReview-Commit-ID: 3OK0CUv5QOe

--HG--
extra : rebase_source : 59636177113ad5d3f9789ca22a6a96938e4cf486
extra : histedit_source : fd4fd140a24a8dc5a63fceeb25faba827c317683%2C6ed479239be0a9043d05170231c6613b04cb0d26
2017-10-10 13:41:28 +09:00
Phil Ringnalda 63a7c915ff Backed out changeset 8cce0046e302 (bug 1406482) for mozilla::EditorBase::InsertTextImpl crashes
MozReview-Commit-ID: G9jW217fO0v
2017-10-09 21:33:53 -07:00
Phil Ringnalda 5fee8a40bb Backed out changeset 9843839bf1df (bug 1406482) for mozilla::EditorBase::InsertTextImpl crashes
MozReview-Commit-ID: J7rX4lX2lxM
2017-10-09 21:32:12 -07:00
Kyle Machulis 669ff05b49 Bug 1406525 - Remove nsIDOMHTMLLinkElement; r=bz
MozReview-Commit-ID: 4xUSQ8SiIqX
2017-10-09 16:09:38 -07:00
Ehsan Akhgari 20668d566c Bug 1406482 - Address review comment 2017-10-09 18:24:06 -04:00
Ehsan Akhgari 8fff7a3eb8 Bug 1406482 - Avoid using nsINode::GetChildAt() in EditorBase::InsertTextImpl(); r=masayuki 2017-10-09 18:21:22 -04:00
Nicholas Nethercote d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Sebastian Hengst b834f0d177 merge autoland to mozilla-central. r=merge a=merge
MozReview-Commit-ID: 7Ez95T2ivfR
2017-10-07 10:37:39 +02:00
Ehsan Akhgari e3ed6f0810 Bug 1406215 - Part 2: Remove the usage of nsINode::GetChildAt() from nsTextServicesDocument::GetCollapsedSelection(); r=masayuki 2017-10-06 11:45:40 -04:00
Ehsan Akhgari 6f1701de55 Bug 1406215 - Part 1: Remove a useless bounds check for a selection range offset; r=masayuki
This offset is obtained from a Range, so it doesn't need to be
validated.
2017-10-06 11:45:40 -04:00
Ehsan Akhgari 3674cbeaa1 Bug 1405794 - Avoid using nsINode::GetChildAt() in TextEditor::SelectEntireDocument(); r=masayuki 2017-10-06 11:12:04 -04:00
Phil Ringnalda 6ea2792d77 Backed out 9 changesets (bug 1396066) for Windows reftest failures
CLOSED TREE

Backed out changeset e41f9295ee00 (bug 1396066)
Backed out changeset 7a22efa8df6b (bug 1396066)
Backed out changeset ed95eea7105c (bug 1396066)
Backed out changeset 635746c88630 (bug 1396066)
Backed out changeset 5b1997aeaead (bug 1396066)
Backed out changeset 19c9ea492f5e (bug 1396066)
Backed out changeset b9d8e4588584 (bug 1396066)
Backed out changeset 87b44ea10407 (bug 1396066)
Backed out changeset e5b9aed44133 (bug 1396066)

MozReview-Commit-ID: K9q3MfPBc5E
2017-10-06 20:48:23 -07:00
Emilio Cobos Álvarez 28bfd5dbba Bug 1396066 another followup. Load input.css from a chrome uri, so it can use :-moz-system-metric. This requires exposing the reftest chrome package to content, but that should be OK. r=bzbarsky
The CLOSED TREE odyssey must end.

MozReview-Commit-ID: EWkwqTHW3dg
2017-10-06 20:16:43 +02:00
Kyle Machulis 2090426dc0 Bug 1405792 - Remove nsIDOMHTMLIFrameElement r=bz
MozReview-Commit-ID: 1u9C66X8j59

--HG--
extra : rebase_source : 5d87fe933170e32fbb44e24ec843623e143164d2
2017-10-04 20:41:24 -07:00
Kyle Machulis e54a4653ba Bug 1404079 - Remove nsIDOMHTMLFrameElement; r=bz
MozReview-Commit-ID: GSvMwRpl7g4

--HG--
extra : rebase_source : a5e8ee45bae90eaa9ecdcc6f0bac0c9dac0ce2c8
2017-09-28 19:06:14 -07:00
Wes Kocher d8985b6e57 Merge inbound to central, a=merge
MozReview-Commit-ID: IUFdbLdYFhX
2017-10-04 16:37:59 -07:00
Ehsan Akhgari f149573106 Bug 1405419 - Part 2: Remove a dead overload of HTMLEditor::GetPriorHTMLSibling(); r=masayuki 2017-10-04 13:39:48 -04:00
Ehsan Akhgari 73a4c4fd54 Bug 1405419 - Part 1: Remove the HTMLEditor::GetPriorHTMLSibling() overload accepting a parent and an offset; r=masayuki 2017-10-04 13:39:48 -04:00
Ehsan Akhgari d7d7a890e5 Bug 1405414 - Avoid using nsINode::GetChildAt() in HTMLEditor::SetCSSBackgroundColor(); r=masayuki 2017-10-04 13:34:06 -04:00
Masayuki Nakano b1236d3f9d Bug 1390562 - part 1: HTML editor shouldn't split <div> container at inserting a line break for backward compatibility if defaultParagraphSeparator is "br" r=m_kato
Starting from bug 1297414, HTMLEditor treats <div> container as same as <p>
container at inserting a line break.  This new behavior is check in WPT.
So, it's better to use the new behavior for compatibility with other browsers.

However, we're still using <br> as default paragraph separator for backward
compatibility even though this is non-standard behavior.

So, although, the old behavior is odd, we should keep treating them differently
in the backward compatibility mode.  Actually, this behavior change causes
an incompatibility problem in Gmail, and may be in other web apps.

MozReview-Commit-ID: INCihKYmcPd

--HG--
extra : rebase_source : 874e41ddf7bbedbea2c7af79285ea79fbc48f0f2
2017-10-03 19:36:39 +09:00
Masayuki Nakano 62ca7eb7cd Bug 1390562 - part 0: Add automated tests r=m_kato
MozReview-Commit-ID: 7cgxdWClOBQ

--HG--
extra : rebase_source : a7a1028635c1ee27242a1eab97043139eb3f80c1
2017-10-03 18:33:40 +09:00
Ehsan Akhgari 24927971c8 Bug 1404581 - Fallback to the slow path if we're in Thunderbird's plaintext editor; r=masayuki 2017-10-03 11:07:59 -04:00
Catalin Badea f8162c4bfd Bug 651120 - Remove index argument from content removed/appended/inserted notifications. r=peterv 2017-10-03 11:09:08 +01:00
Ehsan Akhgari 850a7084d5 Bug 1405751 - Part 2: Remove a dead overload of HTMLEditor::GetNextHTMLSibling(); r=masayuki 2017-10-05 15:17:28 -04:00
Ehsan Akhgari 879f3317d1 Bug 1405751 - Part 1: Remove the HTMLEditor::GetNextHTMLSibling() overload accepting a parent and an offset; r=masayuki 2017-10-05 15:17:27 -04:00
Ehsan Akhgari a3b87e2b92 Bug 1405039 - Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement(); r=masayuki 2017-10-02 14:22:57 -04:00
Ehsan Akhgari 4f6e533800 Bug 1405027 - Avoid using nsINode::GetChildAt() in HTMLEditor::GetElementOrParentByTagName(); r=masayuki 2017-10-02 14:01:25 -04:00
Sebastian Hengst 4d183e475c Backed out changeset 9b5b03b2114d (bug 1401379) 2017-10-02 19:57:33 +02:00
Nika Layzell 484b697044 Bug 1401379 - Part 2: Add more cycle collector edges for nsDocShell, r=smaug
MozReview-Commit-ID: 3j9jfLv7MO2
2017-10-02 11:58:01 -04:00
Nika Layzell cbc8fa8a3b Bug 1399626 - Part 4: Allow initializing nsIContentIterator with RangeBoundaries, r=masayuki
This patch adds an overload to nsIContentIterator::Init which accepts
RangeBoundary objects, and modifies the codepath to avoid using the offset of
the start or end nodes to construct the nsIContentIterator.

MozReview-Commit-ID: 5ZqKeiUunoN
2017-10-02 11:58:00 -04:00
Olli Pettay 657d54de19 Bug 1402941 - Add HTMLSlotElement (disabled for now), r=hsivonen
--HG--
extra : rebase_source : ced3d844425bee6fddd22641646a7366ffd5d69e
2017-10-02 13:22:12 +03:00
Ehsan Akhgari 46338d5db2 Bug 1404106 - Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement(); r=masayuki 2017-09-29 12:50:52 -04:00
Ehsan Akhgari 4b26a85879 Bug 1404084 - Avoid using nsINode::GetChildAt() in HTMLEditor::GetCSSBackgroundColorState(); r=masayuki 2017-09-29 12:40:03 -04:00
Ehsan Akhgari 17d3fe6833 Bug 1393140 - Rewrite EditorBase::FindBetterInsertionPoint() to not use nsINode::GetChildAt() in the fast path used in Firefox; r=masayuki 2017-09-29 12:16:53 -04:00
Makoto Kato 6d4428a710 Bug 1403841 - IsSelectionEditable should check whether focus node and anchor node aren't null. r=masayuki
This might be regression by bug 1319340, but there is crash signature from old version.  We should check whether focus node and anchor node aren't null.

MozReview-Commit-ID: J7npxN5kC9G

--HG--
extra : rebase_source : e2f19690d529abc1a8e2852a5ed826b0caa39244
2017-09-29 13:12:35 +09:00
Kartikaya Gupta 6039f99c16 Bug 1403559 - Remove unnecessary asserts-if clause because we only run webrender reftests with e10s. r=jrmuizel
MozReview-Commit-ID: ChEtYwbsFq5

--HG--
extra : rebase_source : 86dbb6fdb7d61d2dd612e7b27e1b1b696dc7772f
2017-09-27 10:12:09 -04:00
Sebastian Hengst 92393ec0c5 Backed out changeset db9c439a8298 (bug 1403559) for failing reftest layout/reftests/reftest-sanity/reftest-no-paint.html. r=backout 2017-09-27 20:20:00 +02:00
Kartikaya Gupta 1bb174e043 Bug 1403559 - Remove unnecessary asserts-if clause because we only run webrender reftests with e10s. r=jrmuizel
MozReview-Commit-ID: ChEtYwbsFq5

--HG--
extra : rebase_source : e587f16f68b760633dea9541958d5409cf9eb3b6
2017-09-27 10:12:09 -04:00
Sebastian Hengst 72d1ea4a4b merge mozilla-central to autoland. r=merge a=merge 2017-09-27 11:49:57 +02:00
Wes Kocher acf8913934 Merge m-c to inbound, a=merge
MozReview-Commit-ID: IsbKCdZU2Ui
2017-09-26 17:14:31 -07:00
Makoto Kato 24d3058066 Bug 1402469 - Part 2. Add crash test. r=masayuki
MozReview-Commit-ID: HogVH2OTyd6

--HG--
extra : rebase_source : 61e23c7fcc466eccef8bf496436841fe153c4767
2017-09-25 14:11:29 +09:00
Makoto Kato 2fc292406d Bug 1402469 - Part 1. Return value of ConvertListType should use Element instead of nsresult. r=masayuki
This is a typo bug of Bug 1053779 Part 2.  ConvertListType might return NS_OK
even if ReplaceContainer doesn't return valid value.

So, to clean up code, we should return Element instead of nsresult since out
parameter of this function is Element only.

MozReview-Commit-ID: 44UHETzcdGy

--HG--
extra : rebase_source : ab76486505cb4e7caea3fb99e11fccd606878f02
2017-09-25 14:15:50 +09:00
Kyle Machulis a3876f104a Bug 1389650 - Remove nsIDOMHTMLAnchorElement; r=bz
Removes the XPCOM interface for nsIDOMHTMLAnchorElement, replacing it
with binding class usage.

MozReview-Commit-ID: 7v0bKlY7Fax
2017-09-26 11:41:28 -07:00
Sebastian Hengst 5ed0b93c50 Backed out changeset 26805294a547 (bug 1389650) 2017-09-26 10:47:41 +02:00
Nicholas Nethercote dfd3b7e7aa Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ

--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
2017-09-26 08:33:21 +10:00
Kyle Machulis e2ace7d91f Bug 1389650 - Remove nsIDOMHTMLAnchorElement; r=bz
Removes the XPCOM interface for nsIDOMHTMLAnchorElement, replacing it
with binding class usage.

MozReview-Commit-ID: 7v0bKlY7Fax
2017-09-25 23:12:44 -07:00
Olli Pettay c80e124562 Bug 1396584 - Remove support for multiple ShadowRoots, r=mrbkap
--HG--
extra : rebase_source : 2bb600ed1ffd35c195617a7eb70d0ba847a46898
2017-09-25 18:09:26 +03:00
Kyle Machulis 9b4ac7e03f Bug 1402102 - Remove nsIDOMHTMLObjectElement; r=bz
Removes the nsIDOMHTMLObjectElement XPCOM interface, replacing it with
HTMLObjectElement and FromContent conversion usage.

MozReview-Commit-ID: dmsjSO97uh

--HG--
extra : rebase_source : 9b2c25b8681f754bc34233afccdb6fc5d38f0804
2017-09-22 17:05:12 -07:00
Nicholas Nethercote cea0a3af5d Bug 1400777 (part 1) - Remove eHTMLTags. r=mrbkap.
It's just a too-cute-by-half typedef for nsHTMLTag.

--HG--
extra : rebase_source : 142128de90c3bed06648db445ca0159c23ea6ff3
2017-09-19 11:07:49 +10:00
Ehsan Akhgari 78f4e42447 Bug 1399722 - Don't prevent changing the selection in the editor when setting the value attribute; r=masayuki 2017-09-20 09:10:03 -04:00
Ehsan Akhgari 445bf0b3fc Bug 1401225 - Pass the correct length when collapsing the selection in EditorBase::SetTextImpl(); r=masayuki 2017-09-20 09:09:58 -04:00
Nicholas Nethercote 2ef37710e7 Bug 1395828 (part 4) - Remove nsIParserService/nsParserService. r=mrbkap.
It a stateless wrapper around static methods in nsHTMLTags and nsHTMLElement,
and hence an unnecessary layer of indirection that just adds complexity and
slowness. This patch removes it, cutting almost 300 lines of code.

This requires making nsElementTable.h an exported header, to expose the
nsHTMLElement methods.

--HG--
extra : rebase_source : abbcb8e5001389affbf717092213b898673db07f
2017-09-05 20:19:06 +10:00
Xidorn Quan fd467033f9 Bug 1407847 - Enable stylo for XUL document without system principal and annotate failures accordingly. r=heycam
MozReview-Commit-ID: KcJxloT2rR8

--HG--
extra : rebase_source : 8943efaa7afbf1bc74ac85ca103a52e2f4d1b1a4
2017-10-12 10:43:38 +11:00
Sylvestre Ledru e8734313d2 Bug 1408767 - HTMLEditor::MouseMove: Remove two unused variables r=m_kato
MozReview-Commit-ID: 8aP9nevSXPz

--HG--
extra : rebase_source : 6fce6c36c77518c1c75092c36e3e3454ae03a019
2017-10-15 19:32:43 +02:00
Gerald Squelart 7dbe315e25 Bug 1398999 - nsDequeFunctor::operator() doesn't need to return anything - r=froydnj
Its return value is never used, and most implementations return nullptr anyway.

MozReview-Commit-ID: 8rxC053mmE8

--HG--
extra : rebase_source : 61a0b8b1373396182efd27d3c01b96e5e5541364
2017-02-09 14:06:36 +11:00
Sebastian Hengst dbddac850d merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: IgyDMUVYYBm
2017-09-11 23:58:31 +02:00
Michael Layzell c67b1f18a3 Bug 1340578 - Allow execCommand('paste') to be called from webextensions without a target, r=ehsan 2017-09-11 14:13:26 -04:00
Makoto Kato 6b536f8760 Bug 1394758 - Part 2. WSRunObject::InsertBreak should convert space to NBSP when current position is first text run object. r=masayuki
After applying part 1 fix, it doesn't pass test_bug430392.html like the following..

1. content is <span contenteditable=false>A</span>[caret] ;
2. [VK_RETURN]
3. content is <span contenteditable=false>A</span><br>; <- whitespace is removed

Since we started to treat readonly text nodes as WSType::special with previous patch, WSRunObject::InsertBreak doesn't convert space (after caret) to NBSP because WSRunObject::InsertBreak does it only when inserted position isn't first text run object.

So even if this is first text run object, space after caret should be converted to NBSP.

MozReview-Commit-ID: Hj0i3wm45c3

--HG--
extra : rebase_source : 2d0ae7c47c6187e56d6c29e8eb48974f7ab7ff72
2017-09-04 15:01:16 +09:00
Makoto Kato bf93a68c34 Bug 1394758 - Part 1. non-editable text node should be treated as WSType::special, not WSType::text. r=masayuki
This bug occurs that WSRunObject::PrepareToDeleteRangePriv() calls WSRunObject::ConvertToNBSP for non-editable text node.

Actually, even if text node isn't editable, WSFragment::mType becomes WSType::text now.  So, whitespace only node at the end of contenteditable=false is treated as WSType::normalWS, i.e., treated as editable.

So text node in contenteditable=false should treated as WSType::special which means a non-editable inline object.   Then, WSRunObject won't create object chunk of WSType::normalWS for text node in contenteditable=false.

MozReview-Commit-ID: GOjxax8KvDD

--HG--
extra : rebase_source : e5fff30a2710c2021d59ce88bf2698ce4ebe2dfc
2017-09-11 15:52:05 +09:00
Makoto Kato 012ef9e1c1 Bug 1380292 - Don't turn on object resizer, inline table editor and etc when element isn't into editor. r=masayuki 2017-09-09 10:49:02 -04:00
Wes Kocher 5ee13ebe8a Merge m-c to inbound, a=merge
MozReview-Commit-ID: 4CJDJBAcVPL
2017-09-08 13:41:21 -07:00
Christoph Kerschbaumer 2f720638ac Bug 1397656 - Update tests within editor/ to comply with new toplevel data: URI navigation policy. r=masayuki 2017-09-08 15:40:34 +02:00
Masayuki Nakano 4ce89d8f61 Bug 1369072 - part3: nsXBLPrototypeHandler::DispatchXBLCommand() should use controller of visible window r=smaug
With previous change, KeyboardEvent is dispatched even when invisible window
has focus.  However, nsRootWindow::GetControllerForCommand() returns controller
for focused window even when the window is invisible because it uses
nsFocusManager::GetFocusedDescendant() to retrieve focused window.

Perhaps, we can assume that users won't expect to do something with invisible
window when they type some keys.  Then, nsRootWindow::GetControllerForCommand()
should return controller for visible ancestor window if focused window is
invisible.

This patch makes nsFocusManager::GetFocusedDescendant() can return only visible
descendants.  However, it already has a bool argument.  Therefore, it should
have a flag instead of adding new flag.  Most changes of this patch is replacing
its callers.

Then, nsRootWindow::GetControllerForCommand() and nsRootWindow::GetControllers()
should have a bool flag if it should return controller(s) for visible window.
This patch adds a bool flag for it.  Fortunately, the interface isn't scriptable.

Finally, this patch makes nsXBLPrototypeHandler::DispatchXBLCommand() and
EventStateManager::DoContentCommandEvent() retrieve controller for visible
window since they are always handles user input.

MozReview-Commit-ID: GygttTHuKRm

--HG--
extra : rebase_source : 1341273c4606298cb9b890b9312d9f5c8a75d144
2017-09-07 22:54:49 +09:00
Sebastian Hengst 9a6b5140c4 merge mozilla-central to autoland. r=merge a=merge 2017-09-08 11:03:59 +02:00
Chris Peterson ce7edc4de1 Bug 1394603 - Replace fails-if(!styloVsGecko) to fails. r=jryans
Skip tests that are expected to fail in both Stylo and Gecko modes. They would unexpectedly "pass" in styloVsGecko mode when comparing the two failures, which is not a useful result.

MozReview-Commit-ID: 3mOpjU225Q1

--HG--
extra : rebase_source : 22bb5d4e3c5138ef832995eaf5716824f4707ffe
extra : source : d40fb20c9a49d0797c0eeae613a04912b12a28f7
2017-09-01 20:39:44 -07:00
Ehsan Akhgari 2231e4a948 Bug 1397577 - Avoid using GetChildAt() in HTMLEditor::GetSelectedOrParentTableElement(); r=smaug 2017-09-07 10:29:02 -04:00
Ehsan Akhgari 233352f9ba Bug 1397576 - Avoid using GetChildAt() in HTMLEditor::GetCellFromRange(); r=smaug 2017-09-07 09:36:07 -04:00
Sebastian Hengst 8eb249afcc merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: JSRVc5yW6Kx
2017-09-07 12:39:12 +02:00
Nicholas Nethercote f92bd5e9ab Bug 1393642 (follow-up) - Fix potential leak in HTMLEditor methods. r=masayuki.
As written, these functions will leak if they are passed strings that don't
match static atoms. In practice, all strings passed *do* match static atoms,
but let's fix it anyway in case that changes in the future.

--HG--
extra : rebase_source : 01685428e7dfc577e63bb6423382817359623151
2017-09-07 12:20:51 +10:00
Phil Ringnalda 75f9cdbd7e Backed out 3 changesets (bug 1394603) for reftest syntax error
CLOSED TREE

Backed out changeset 44117208f321 (bug 1394603)
Backed out changeset 31088c59d895 (bug 1394603)
Backed out changeset 20551d68f602 (bug 1394603)

MozReview-Commit-ID: 4F4jSQ8GyfG
2017-09-06 22:48:55 -07:00
Chris Peterson 2d629378b2 Bug 1394603 - Replace fails-if(!styloVsGecko) to fails. r=jryans
Skip tests that are expected to fail in both Stylo and Gecko modes. They would unexpectedly "pass" in styloVsGecko mode when comparing the two failures, which is not a useful result.

MozReview-Commit-ID: 3mOpjU225Q1

--HG--
extra : rebase_source : 0c307639c3626af3b6b43e05d3ee73d08b3f47ce
2017-09-01 20:39:44 -07:00
Wes Kocher a14d71906d Merge m-c to inbound, a=merge
MozReview-Commit-ID: BJ4WkYrJ9g6
2017-09-06 17:24:48 -07:00
Masayuki Nakano 7fb91d43b5 Bug 1397178 - Make EditorBase::GetRoot() not call nsIEditor::GetRootElement() r=smaug
In the old design, EditorBase::mRootElement is initialized when
nsIEditor::GetRootElement() is called.  Therefore, EditorBase::GetRoot()
calls if mRootElement is nullptr.

However, mRootElement is now initialized when EditorBase::UpdateRootElement()
is called and it's always initialized when EditorBase::Init() is called.

So, EditorBase::GetRoot() doesn't need to call nsIEditor::GetRootElement()
anymore.

MozReview-Commit-ID: 6dNEJaGNMZe

--HG--
extra : rebase_source : ed29488cfd1434fb200387706ca5a96cb2185090
2017-09-05 23:32:17 +09:00
Makoto Kato daeca3277c Bug 1395443 - DictionaryFetcher::Fetch should initializate nsIContentPrefService2 by idle thread. r=masayuki
When using contenteditable with spellchecker (it is by default), spellchecker will be initialized by mozilla::EditorEventListener::Focus.  This method will call nsEditorSpellCheck::UpdateCurrentDictionary, but this method seems to be slow.

DictionaryFetcher::Fetch gets nsIContentPrefService2 that is implemented by JavaScript, so we should create nsIContentPrefService2 out of Fetch method.

MozReview-Commit-ID: 1fxug0sqD72

--HG--
extra : rebase_source : c46a54f9fc811aace20c54c4a3e468a83c2530d2
2017-09-04 19:57:45 +09:00
Andrew McCreight 7f7f149167 Bug 1395636 - Convert code to use NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED. r=peterv
MozReview-Commit-ID: DivJPerL5SF

--HG--
extra : rebase_source : 890df75914906a5d34e8af67f9fc3a4be239d2d6
2017-08-31 16:29:22 -07:00
Sebastian Hengst 2f7f455fa1 Backed out changeset 9306866e8df0 (bug 1395636) for build bustage. r=backout on a CLOSED TREE
--HG--
extra : amend_source : 20d028d6b971cf6a221dc2f1553687d6c074bdcb
2017-09-06 19:18:06 +02:00
Andrew McCreight 4d6e76dfcf Bug 1395636 - Convert code to use NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED. r=peterv
MozReview-Commit-ID: DivJPerL5SF

--HG--
extra : rebase_source : cb952cfc5600a163a5580438e5b0177595689dab
2017-08-31 16:29:22 -07:00
Catalin Badea d952c00aad Bug 1395936 - Avoid child index usage in HTMLEditor::DoContentInserted. r=masayuki 2017-09-06 21:38:43 +01:00
Sebastian Hengst c2f7bd1de9 Backed out changeset dbb4fb7aa5bb (bug 1395936) for assertions and crashes in a11y test, mochitests, reftests, crashtest, ...; r=backout on a CLOSED TREE 2017-09-06 13:25:37 +02:00
Catalin Badea c90d69fac0 Bug 1395936 - Avoid child index usage in HTMLEditor::DoContentInserted. r=masayuki 2017-09-06 11:26:03 +01:00
Nicholas Nethercote 9b8908c88e Bug 1395828 (part 3) - Remove AssertParserServiceIsCorrect(). r=mrbkap.
It's a bit strange for the editor to distrust the parser service in this way.
The double-checking seems unnecessary, especially given that it is *buggy*: it
incorrectly includes `col`, `colgroup`, and `legend` as block elements, but
excludes `pre`. (It must only be called in situations where these
incorrectly-classified elements are not passed in, otherwise it would have
triggered by now.) So this patch removes it.

The patch also removes `li` and `pre` from the IsAnyOfHTMLElements() test in
HTMLEditor::NodeIsBlockStatic. Contrary to what the comment in
NodeIsBlockStatic() says, they *are* identified as block elements by the parser
service.

--HG--
extra : rebase_source : c9bb3c9e07320fafed17942229c316f41ac2a0a6
2017-09-04 15:45:07 +10:00
Makoto Kato 6e004e975d Bug 1363896 - Adjust fuzzy-if for Android's reftest. r=masayuki
editor/reftests/input-text-onfocus-reframe-ref.html is sometimes failed due to "image comparison, max difference: 1, number of differing pixels: 1".

As long as I check both images, I don't know why focus ring is different.  But this is 1 pixel only diff, so we should use fuzz-if.

MozReview-Commit-ID: 5SrjorXEBW

--HG--
extra : rebase_source : d6fbb2f3a5ea2bff5ee6c2b39909831830f5d47c
2017-09-04 13:44:59 +09:00
Sebastian Hengst 3528754b01 Backed out changeset d2305bd57a97 (bug 1393140) for changed behavior on request from jorgk. r=backout a=backout
MozReview-Commit-ID: HGulTnPx6TF
2017-09-02 23:48:23 +02:00
Wes Kocher 8b84853ed6 Merge m-c to autoland, a=merge
MozReview-Commit-ID: GcHZLNPPNnI
2017-09-01 16:34:14 -07:00
Wes Kocher 5f157c17dc Merge inbound to central, a=merge
MozReview-Commit-ID: 3JxUEFuinHY
2017-09-01 16:29:10 -07:00
Ehsan Akhgari b62766b04e Bug 1393140 - Rewrite EditorBase::FindBetterInsertionPoint() without using nsINode::GetChildAt(); r=masayuki 2017-09-01 12:12:39 -04:00
Masayuki Nakano 199c190cbe Bug 1395157 - Make EditorBase::EndPlaceholderTransaction() not retrieve nor hold nsIPresShell and nsCaret r=Ehsan
EditorBase::EndPlaceholderTransaction() has hidden caret.  However, it doesn't
do it anymore.  However, bug 805697 didn't remove unnecessary code that
retrieves and hold nsIPresShell and nsCaret.  This patch removes them.

MozReview-Commit-ID: Eh9pbf8p2bZ

--HG--
extra : rebase_source : e766906089af1cd3c6efa95b82e3b126ae097ab2
2017-08-30 23:24:26 +09:00
Henri Sivonen 3c8567b60d Bug 1354989 - Avoid pivoting via UTF-16 when loading CSS in the Stylo mode. r=jdm,SimonSapin
MozReview-Commit-ID: Llt29dvB4Io

--HG--
extra : rebase_source : 3ae51dc8beff3fb19e9318a6c7c30c9ab08a5b57
2017-08-29 16:01:42 +03:00
Makoto Kato 2f39643ca1 Bug 1395080 - Part 4. Remove unused nsIDOMRange parameter. r=masayuki
GetFirstSelectedCell and GetNextSelectedCell allow that 1st parameter is nullptr when current range is unnecessary.  So we should use nullptr when it is unused.

MozReview-Commit-ID: BuI7ds47h0U

--HG--
extra : rebase_source : 4cb67aa15c5b5a7692c7e5eb43976c8e7a7884e4
2017-09-01 13:36:35 +09:00
Makoto Kato cc0f4f0109 Bug 1395080 - Part 3. Replace nsIDOMRange::GetStartContainer and nsIDOMRange::GetEndContainer with nsRange::GetStartContainer and nsRange::GetEndContainer. r=masayuki
Except to nsTextServicesDocument.cpp, we replace nsIDOMRange::GetStartContainer and nsIDOMRange::GetEndContainer with nsRange::GetStartContainer and nsRange::GetEndContainer.

Since nsTextServicesDocument.cpp still uses a lot of nsIDOMNode, I will change it by new bug.

MozReview-Commit-ID: 9x1oajmabca

--HG--
extra : rebase_source : c22072a39c907df631025a423c6302df2047e824
2017-09-01 13:35:57 +09:00
Makoto Kato 09107665a4 Bug 1395080 - Part 2. Replace nsIDOMRange::GetStartOffset and nsIDOMRange::GetEndOffset with nsRange::StartOffset and nsRange::EndOffset. r=masayuki
MozReview-Commit-ID: 4wja9Lu53IR

--HG--
extra : rebase_source : 2fa7f89435645dbc90d39089b2856612bd71dfdf
2017-09-01 12:20:28 +09:00
Makoto Kato c171902197 Bug 1395080 - Part 1. Replace nsIDOMRange::GetCollapsed with nsRange::Collapsed. r=masayuki
MozReview-Commit-ID: LefqnYBJGec

--HG--
extra : rebase_source : f85c786ee218cf6e8528be8d2d91aa9ac0e3ce97
2017-09-01 12:19:11 +09:00
Andrew McCreight 78807d8776 Bug 1391005 - Eliminate NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED. r=peterv
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.

MozReview-Commit-ID: 5agRGFyUry1

--HG--
extra : rebase_source : 5388c56b2f6905c6ef969150f0c5b77bf247624d
2017-08-29 16:02:48 -07:00
Nicholas Nethercote 0eadf50d37 Bug 1394583 - Remove default properties from nsIHTMLEditor. r=masayuki.
nsIHTMLEditor's addDefaultProperty(), removeDefaultProperty(),
removeAllDefaultProperties() methods are never used -- not from C++ code or
script, in either mozilla-central or comm-central.

So this patch removes them. This means that HMLTEditor::mDefaultStyles is never
used, so the patch removes it and all the code that manipulates it as well.

--HG--
extra : rebase_source : 76634ce2bb2d94534b8d7f299c4ebd6a83b66637
2017-08-25 16:59:17 +10:00
Makoto Kato fedf4a0136 Bug 1391978 - Part 9. Replace nsISelection::GetAnchorNode with Selection::GetAnchorNode. r=masayuki
MozReview-Commit-ID: CiIClvsiNxX

--HG--
extra : rebase_source : a739151e75d8920dd76b9729fd0d698f574218ed
extra : histedit_source : d9004420476b49aa5e063a00b01928e509214843
2017-08-25 16:12:39 +09:00
Makoto Kato 349e2e739f Bug 1391978 - Part 8. Replace nsISelection::GetAnchorOffset with Selection::AnchorOffset. r=masayuki
MozReview-Commit-ID: GgxyRsVXHwl

--HG--
extra : rebase_source : 7d3d869f21669486e9dd3bb925451e5bd20fa3b0
extra : histedit_source : 0e2f13e733d143a782391c420da9bfa34f0c228a
2017-08-25 16:12:39 +09:00
Makoto Kato 7732ebc1b4 Bug 1391978 - Part 7. HTMLEditRules::NormalizeSelection should use nsINode instead of nsIDOMNode. r=masayuki
HTMLEditRules::NormalizeSelection uses nsIDOMNode for node handling, so we replace with nsINode, then use Selection::Extend and Selection::Collapse.

MozReview-Commit-ID: 6Ijo19vTwRi

--HG--
extra : rebase_source : 3171ed5808d9045b268cc76989c7d06ea220d393
extra : histedit_source : f3a1af1f84cceb80200a3965385dfb1d036c9e60
2017-08-25 16:12:39 +09:00
Makoto Kato 83778753b6 Bug 1391978 - Part 6. Replace nsISelection::Extend with Selection::Extend. r=masayuki
Except to HTMLEditRules::NormalizeSelection, I replace nsISelection::Extend with Selection::Extend.

MozReview-Commit-ID: H83zpvAo5Xa

--HG--
extra : rebase_source : b217dd1d506229d848126b9c2494d1b4f9dc3a35
extra : histedit_source : 8999bc5b1b1edfe7e48a432d52640b8181490624
2017-08-28 17:54:34 +09:00
Makoto Kato 6f6e4ef550 Bug 1391978 - Part 5. Replace nsISelection::GetFocusOffset/GetAnchroOffset with Selection::FocusOffset/AnchorOffset. r=masayuki
MozReview-Commit-ID: 6OpO1GQyhFO

--HG--
extra : rebase_source : 3e57ddbebc7985ec0e5ada4b1e83631d6f1c83b5
extra : histedit_source : 655c5c3e4c4a3f30d028f9b4b316573a187bd0f0
2017-08-25 16:12:38 +09:00
Makoto Kato 72387d25cd Bug 1391978 - Part 4. Replace nsISelection::GetFocusNode with Selection::GetFocusNode. r=masayuki
MozReview-Commit-ID: GFtkRvsFaYI

--HG--
extra : rebase_source : c11007a58ee312a7845ba4b8c0886dec49cd8c39
extra : histedit_source : e0a2d06a061a9cad3ff83e6be5e697a1c2748756
2017-08-25 16:12:38 +09:00
Makoto Kato 1480dbb45c Bug 1391978 - Part 3. Replace nsISelection::GetIsCollapsed with Selection::IsCollapsed. r=masayuki
MozReview-Commit-ID: AYCX9V8smzm

--HG--
extra : rebase_source : 2c45cffa7d526a9e07126c90f17232b02b1612ea
extra : histedit_source : bd451bdd633df2eb155102f9c3b29b49a25b9c69
2017-08-25 17:48:04 +09:00
Makoto Kato a7d3c9c2a0 Bug 1391978 - Part 2. Replace nsISelection::SelectAllChildren with Selection::SelectAllChildren. r=masayuki
MozReview-Commit-ID: m9bLHIIfy9

--HG--
extra : rebase_source : 47aa2e674a8f6615989b25ddb2b11b6614587b7b
extra : histedit_source : 847922b8ff86389a4a264efda7c4f933743c8f63
2017-08-25 16:12:38 +09:00
Makoto Kato 26ce168fcc Bug 1391978 - Part 1. Replace nsISelection::GetRangeCount with Selection::RangeCount. r=masayuki
I would like to remove more dependency of old nsISelection interface from editor if possible.  So we can replace nsISelection::GetRangeCount with Selection::RangeCount.

MozReview-Commit-ID: 2Mh5ceQI2om

--HG--
extra : rebase_source : 03c8a5b49e2929b0ce6c6af8b78c9677a55a14c4
extra : histedit_source : ca7741379c7cc5b7b938aad22a57f419a2442fd3
2017-08-28 14:52:25 +09:00
Olli Pettay 4ef3c3fdf6 Bug 1371657 - Ensure we use the right root element in editor. r=masayuki 2017-08-28 14:57:46 -04:00
Sebastian Hengst 9769c22d10 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: AeoHOxZLi6m
2017-08-28 16:53:53 +02:00
Ehsan Akhgari 6f420e6a00 Bug 1394180 - Reduce the number of calls to nsINode::GetChildAt() in EditorBase::InsertTextImpl(); r=masayuki 2017-08-28 01:42:30 -04:00
Masayuki Nakano 3bd4299525 Bug 1393348 - part2: nsISelectionController::SELECTION_* should be sequential integer values r=smaug
nsISelectionController::SELECTION_* are declared as bit-mask.  However, no
methods of nsISelectionController treat them as bit-mask and these
values need a switch statement in nsFrameSelection to convert SelectionType to
array index of nsFrameSelection::mDOMSelections because it's too big to create
an array to do it.  Additionally, this conversion appears profile of
attachment 8848015.

So, now, we should declare these values as sequential integer values.

However, only nsTextFrame uses these values as bit-mask.  Therefore, this patch
adds new type, SelectionTypeMask and creates new inline method,
ToSelectionTypeMask(SelectionType), to retrieve mask value for a SelectionType.

MozReview-Commit-ID: 5Za8mA6iu4

--HG--
extra : rebase_source : 86617c1f5fa23166458f4353cb834f9e7c5b131b
2017-08-24 19:14:04 +09:00
Nicholas Nethercote c7df832636 Bug 1393642 - Remove nsIAtom/nsIAtomService usage from script in editor/. r=masayuki.
nsIHTMLEditor has several scriptable methods (addDefaultProperty(),
removeDefaultProperty(), etc.) that have nsIAtom parameters. We're in the
process of deCOMtaminating nsIAtom (bug 1392883) so these methods need to be
changed.

This patch does the following.

- It changes those methods to take an AString instead of an nsIAtom.

- For each existing method, it adds to HTMLEditor a new C++ method of the same
  name that takes an nsIAtom parameter.

- It updates TextEditorTest.cpp to use strings instead of atoms, in order to
  keep using the XPIDL methods.

- It updates test_bug1140105.html to pass strings instead of atoms to
  getInlineProperty(). This removes the use of nsIAtomService.

--HG--
extra : rebase_source : e005c3b5a08207b3d5d5fb55c47c8bc475b33453
2017-08-25 15:40:45 +10:00
Sebastian Hengst 6fd5b9e1ca merge mozilla-central to autoland. r=merge a=merge 2017-08-25 13:19:59 +02:00
Sebastian Hengst 31302b9cec merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: 5armhVE9Jui
2017-08-25 13:12:04 +02:00
Ehsan Akhgari b174b2306a Bug 1392867 follow-up: Document that the aChild argument won't get AddRef'ed
DONTBUILD
2017-08-24 18:39:24 -04:00
Makoto Kato 5bd44e5cfd Bug 1393355 - Move SetTextRangeStyle from nsISelectionPrivate to Selection. r=masayuki
There is no reason that SetTextRangeStyle is defined at nsISelectionPrivate.  Also, SetTextRangeStyle isn't scriptable, and is called from CompositionTransaction::SetIMESelection only.  So we should move this to Selection.

MozReview-Commit-ID: FCOA6wVhvYZ

--HG--
extra : rebase_source : 64eb9e5fb973195b2c87ab4eb296685c8a4d0319
2017-08-24 16:56:12 +09:00
Masayuki Nakano e3529fd155 Bug 1375502 - part2: Add nsIContentIterator::Init(nsINode*, uint32_t, nsINode*, uint32_t) r=mats
nsIContentIterator::Init() takes nsRange but it's too expensive for some users.
So, there should be another Init() which can be specified a range in DOM tree
with 2 pairs of nsINode* and uint32_t.

MozReview-Commit-ID: 6JXic0KOM2d

--HG--
extra : rebase_source : 28ff355a2aa0dcb5d65495806ef8c67f1da642ea
2017-06-26 17:26:27 +09:00
Olli Pettay 045eeefaaa Bug 1390402, add a faster variant of TextEditor::GetDocumentIsEmpty(), r=masayuki
--HG--
extra : rebase_source : 3238aec96be5b0393c395ce8cce9a0489d2e671d
2017-08-24 13:53:34 +03:00
Eric Rahm a33f11e0f5 Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj
We should not be declaring forward declarations for nsString classes directly,
instead we should use nsStringFwd.h. This will make changing the underlying
types easier.

--HG--
extra : rebase_source : b2c7554e8632f078167ff2f609392e63a136c299
2017-08-16 16:48:52 -07:00
Sebastian Hengst 99e5cb9c14 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: GSKVB94r7Kk
2017-08-23 16:29:51 +02:00
Makoto Kato a1548f0668 Bug 1348073 - Part 4. Unnecessary VK_RIGHT to move caret on non-visual frame that is whitespace only node. r=masayuki
Since we enable lazy frame construction for editable region, whitespace only node might not have frame even if editable.  This test has whitespace only node into contenteditable, we need adjust caret operation for this test.

MozReview-Commit-ID: GQfKiYdYOdi

--HG--
extra : rebase_source : 0685d724f6af050d79c1cf007c7ee48c05da14ac
2017-08-21 15:33:03 +09:00
Ehsan Akhgari 31e4d33b89 Bug 1392870 - Avoid using nsINode::GetChildAt() in HTMLEditRules::DeleteNonTableElements(); r=masayuki 2017-08-23 01:01:04 -04:00
Ehsan Akhgari e7f2972a7f Bug 1392867 - Part 2: Avoid calling GetChildAt() in HTMLEditRules::TryToJoinBlocks(); r=masayuki 2017-08-23 01:00:07 -04:00
Ehsan Akhgari 07f926500c Bug 1392867 - Part 1: Add an overload of EditorUtils::IsDescendantOf() which returns an nsIContent* out argument for the child node found instead of its index in the parent; r=masayuki 2017-08-23 01:00:07 -04:00
Nicholas Nethercote 092af8e0a1 Bug 1390428 (part 5) - Remove more nsXPIDLCString uses. r=erahm.
These are all simple cases, with similarities to previous patches in this
series.

--HG--
extra : rebase_source : 6ef36382df9fef217d5cb737e218d65ac062f90a
2017-08-16 14:07:18 +10:00
Olli Pettay aeabc0c261 Bug 1392564 - Use nursery purple buffer for nsRange and RangeItem, r=mccr8
--HG--
extra : rebase_source : 650d101bb0cec4ed21b35945ae1185aca577b120
2017-08-22 17:47:00 +03:00
Makoto Kato 3ee9303468 Bug 1381541 - queryCommandState should consider that parent node of selection is null. r=masayuki
When parent node of selected node is null, crash might occur in GetCSSBackgroundColorState.  So when parent is null, we should return default value.  In this situation, Edge and Blink don't throw error, Gecko shouldn't return error too.

MozReview-Commit-ID: 5C6jSAFkCso

--HG--
extra : rebase_source : 0185f9fb5fde92eee5611e6bb95e8676c10b135c
2017-08-18 14:48:39 +09:00
Masayuki Nakano a7240d8532 Bug 1391538 - nsTextFragment for text nodes in <input> or <textarea> shouldn't store text as single byte characters even if all characters are less than U+0100 r=smaug
nsTextFrame stores text as single byte character array if all characters are
less than U+0100.  Although, this saves footprint, but retrieving and modifying
text needs converting cost.  Therefore, if it's created for a text node in
<input> or <textarea>, it should store text as char16_t array.

MozReview-Commit-ID: 9Z82rketT7g

--HG--
extra : rebase_source : 59f59ac1488c21a57d95d253cc794a011d672c95
2017-08-18 16:05:16 +09:00
Wes Kocher c043502159 Merge m-c to autoland, a=merge
MozReview-Commit-ID: 7sFZmPUXSx6
2017-08-18 17:21:29 -07:00
Masayuki Nakano 30fb5747b0 Bug 1391165 - part4: nsIEditor::EndOfDocument() should be implemented with an internal method which takes pointer to Selection r=smaug
EditorBase::GetSelection() sometimes appears in profile.  So, it shouldn't be
called in nsIEditor::EndOfDocument() if the callers of
nsIEditor::EndOfDocument() has a pointer to Selection.

This patch adds EditorBase::CollapseSelectionToEnd() for the internal method
and make all callers of nsIEditor::EndOfDocument() use it.

MozReview-Commit-ID: 8H4ThxzdKDf

--HG--
extra : rebase_source : 7436d7f286351fa9c91175b40e686f7ca1f3c69f
2017-08-17 17:08:22 +09:00
Masayuki Nakano a329587e5e Bug 1391165 - part3: TextEditRules::CollapseSelectionToTrailingBRIfNeeded() should use EditorBase::GetChildOffset() only when it's necessary r=smaug
In most cases, TextEditRules::CollapseSelectionToTrailingBRIfNeeded() doesn't
use the index anymore.  Therefore, it should stop using
EditorBase::GetNodeLocation() and use EditorBase::GetChildOffset() only when
the offset is necessary.

MozReview-Commit-ID: 9vGcLnTUnsu

--HG--
extra : rebase_source : af0cdad3a1905bf2e5654a109aa4037ec70b422b
2017-08-17 16:48:49 +09:00
Masayuki Nakano 0290f8a69f Bug 1391165 - part2: TextEditRules::CollapseSelectionToTrailingBRIfNeeded() should use nsINode::GetNextSibling() for retrieving next child of a node r=smaug
nsINode::GetChildAt() is too expensive if it's used for next sibling of a node.

This patch makes it use nsINode::GetNextSibling() instead.

MozReview-Commit-ID: CAC7gFNo77w

--HG--
extra : rebase_source : 185457b910e2e09c58a6f02525ae61aff149511c
2017-08-17 16:35:30 +09:00
Masayuki Nakano 87f491432c Bug 1391165 - part1: EditorBase::GetChildOffset() and EditorBase::GetNodeLocation() shouldn't use nsINode::IndexOf() as far as possible r=smaug
nsINode::IndexOf() is expensive especially when it's in a hot path, it's too
expensive.  So, EditorBase::GetChildOffset() and EditorBase::GetNodeLocation()
should check child's siblings first.  If some of them are nullptr, it means
that it's first child or last child of the parent.

Note that EditorBase::GetChildOffset() may return wrong index if it's called
while aChild is being removed from aParent or aParent isn't actual parent of
aChild.  However, there are MOZ_ASSERTs to ensure value isn't -1.  Therefore,
it's safe to assume that aParent is always the parent of aChild and it won't
be called from ContentRemoved() of mutation observers.

MozReview-Commit-ID: 8JdYWuZbHe5

--HG--
extra : rebase_source : 6ded91a3aa8b00ab4d2d544c2c392d88cb769cef
2017-08-17 16:24:16 +09:00
Ehsan Akhgari 950a791753 Bug 1391315 - Avoid using nsINode::GetChildAt() in TextEditRules::DocumentIsEmpty(); r=masayuki
This method will become a lot slower when bug 651120 lands.
2017-08-18 01:49:08 -04:00
Yoshi Huang b930b3d1ee Bug 1390770 - rewrite test_bug289384.html for new data: URI inheritance model. r=masayuki 2017-08-18 10:35:58 +08:00
Ehsan Akhgari 43a6f66350 Backout bug 1386480 for causing bug 1391410 2017-08-17 17:16:27 -04:00
Carsten "Tomcat" Book 99aa3f8e70 Merge mozilla-central to mozilla-inbound 2017-08-17 13:13:10 +02:00
Makoto Kato 4ad29844a4 Bug 1380824 - Call RepaintSelection out of script blocker. r=masayuki
MozReview-Commit-ID: LFyZLW0da7f
2017-08-17 15:28:04 +09:00
Nicholas Nethercote 025461bde7 Bug 1390428 (part 1) - Remove many nsXPIDLCString local variables. r=erahm.
These are all easy cases where an nsXPIDLCString local variable is set via
getter_Copies() and then is only used in ways that nsCStrings can also be used
(i.e. no null checks or implicit conversions to |char*|).

In every case the patch trivially replaces the nsXPIDLCString with an
nsCString. (Also, there are a couple of unused nsXPIDLCString variables that
the patch simply removes.)
2017-08-16 13:58:35 +10:00
Xidorn Quan 179961b3c9 Bug 1383845 - Enable tests disabled for bug 1383845. r=TYLin
MozReview-Commit-ID: Glao9d9PiUF

--HG--
extra : rebase_source : cfc70fcb350a7ee8e325ba1bda0bcdead62d786e
2017-08-17 10:51:59 +10:00
Masayuki Nakano d2dd8c5d8f Bug 1390831 - Make test_bug635636.html e10s-aware r=Ehsan
test_bug655636.html refers gBrowser, however, it's available only in chrome
process and it's referred only for listening to "pageshow" event instead of
"load" event of the data URI.  So, we must be able to use "unload" event of the
previous URL instead.

Although, this testcase (even without this change) won't cause crash even if
backing out the patch for bug 635636 anymore.

MozReview-Commit-ID: B8qOwVZqZQm

--HG--
extra : rebase_source : d383181886152684a8bf9c2caf7248d5f7582c0a
2017-08-16 21:03:18 +09:00
Masatoshi Kimura be91c9a266 Bug 886907 - Remove old synchronous contentPrefService from the tree. r=adw
MozReview-Commit-ID: BZsB3FR3jHC

--HG--
rename : toolkit/components/contentprefs/ContentPrefService2.jsm => toolkit/components/contentprefs/ContentPrefService2.js
rename : toolkit/components/contentprefs/nsContentPrefService.manifest => toolkit/components/contentprefs/ContentPrefService2.manifest
extra : rebase_source : ab45b7668e97734004502ea776effedcb9b74974
2017-08-11 23:29:55 +09:00
Masayuki Nakano e1a21d5a3e Bug 1387317 - part5: AutoPlaceHolderBatch should take EditorBase instead of nsIEditor r=m_kato
AutoPlaceHolderBatch can take EditorBase class and its inherited class, AutoEditBatch, can be removed if we implement other constructor which doesn't take transaction name.

Additionally, nsIEditor::(Begin|End)PlaceHolderTransaction() are referred only by AutoPlaceHolderBatch.  Therefore, they can be non-public methods and removed from nsIEditor interface.

Note that this patch also repalces "PlaceHolder" with "Placeholder" since it's a word.

MozReview-Commit-ID: 5dw3kcX3bOx

--HG--
extra : rebase_source : e926cc1c2ebea70eb08e43778a8b52912b559b7b
2017-08-14 14:56:39 +09:00
Masayuki Nakano 1bbc0d5920 Bug 1387317 - part4: Make editor flag setters use new AddFlags() or RemoveFlags() if useful r=m_kato
MozReview-Commit-ID: EMDeGfK37Lx

--HG--
extra : rebase_source : 8a2b4e809c608649fbb41edd32d2165db7e77516
2017-08-08 12:36:29 +09:00
Masayuki Nakano 8437aa287b Bug 1387317 - part3: HTMLEditor should use RefPtr<HTMLEditor> rather than nsCOMPtr<nsIHTMLEditor> for kungFuDeathGrip r=m_kato
MozReview-Commit-ID: 1F6wwjvdD8H

--HG--
extra : rebase_source : 23c2fefa67e11b584868d349bd043148c4b91770
2017-08-08 12:06:10 +09:00
Masayuki Nakano 7c54bc878b Bug 1387317 - part2: EditorEventListener should stop using interface methods as far as possible r=m_kato
MozReview-Commit-ID: EPQeBez2tJh

--HG--
extra : rebase_source : b18b3399f703d3cdcb6f26cec3fcb8f707fb9519
2017-08-08 11:25:36 +09:00
Masayuki Nakano 20fc8ab477 Bug 1387317 - part1: Make AutoSelectionSetterAfterTableEdit use HTMLEditor instead of nsITableEditor r=m_kato
nsITableEditor is now a builtin class.  So, it's implemented only by HTMLEditor.  Therefore, AutoSelectionSetterAfterTableEdit can use HTMLEditor.

Then, nsITableEditor.setSelectionAfterTableEdit() can be removed from nsITableEditor and moved to HTMLEditor as non-virtual method since nobody uses it from JS.

MozReview-Commit-ID: KnN6Fw4TYyn

--HG--
extra : rebase_source : 48412a5f81f30d9ada47550fdb4d1ee0d88de6f4
2017-08-08 10:57:19 +09:00
Carsten "Tomcat" Book bcbc42d4e3 Merge mozilla-central to mozilla-inbound 2017-08-15 13:09:01 +02:00
Yoshi Huang 60b7d9f697 Bug 1390398: fix failures on windows for new data: URI inheritance model. r=smaug 2017-08-15 18:09:28 +08:00
Carsten "Tomcat" Book 6b36e00b7c merge mozilla-inbound to mozilla-central a=merge 2017-08-15 11:42:11 +02:00
Makoto Kato 357fdca523 Bug 1390053 - Enable editor/libeditor/tests/test_bug830600.html on mochitest-e10s. r=masayuki
This test is turned off by bug 1269209 on e10s.  But there is no exactly reason why this test on e10s is turned off.

Although I run this test on e10s now, it seems to pass this.  So we should turn on this test even if e10s.

MozReview-Commit-ID: JHQP2ZYvsHL

--HG--
extra : rebase_source : 2bc45f0d2b5cc99bad93267f40191866264af414
2017-08-14 18:29:40 +09:00
Masayuki Nakano 9ee491b79f Bug 1388001 - part3: Remove nsIEditor argument of nsIHTMLDocument::TearingDownEditor() since it's unused r=smaug
nsIHTMLDocument::TearingDownEditor() takes nsIEditor as an argument.  However, it's not used in it.  So, we can remove it.

MozReview-Commit-ID: KUmIsnVGB6H

--HG--
extra : rebase_source : ddd344b9df18e0b33d54d2f99e6335449f55df81
2017-08-07 14:25:52 +09:00
Masayuki Nakano d66337db9a Bug 1388001 - part2: nsEditingSession should treat editor as HTMLEditor r=m_kato
nsEditingSession should treat editor as HTMLEditor in its internal handling.

MozReview-Commit-ID: 51SfY4oeq3p

--HG--
extra : rebase_source : 90535267e62de17755fff9f21b6a0f74244d849a
2017-08-04 22:53:28 +09:00
Masayuki Nakano fc87c572fa Bug 1388001 - part1: Create nsIEditingSession::GetHTMLEditorForWindow() r=smaug
Some users of HTMLEditor retrieve pointer to editors with nsIEditingSession::GetEditorForWindow() but it returns nsIEditor.  So, there should be a method which returns HTMLEditor*.

MozReview-Commit-ID: Bzc1LIlTSDF

--HG--
extra : rebase_source : f6fb3e5852809487883e3e6fedda9580206b2cb5
2017-08-12 11:44:16 +09:00
Sebastian Hengst d98ea1f774 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: FzIkMLHbOh2
2017-08-14 01:30:32 +02:00
Aryeh Gregor 99a150fe57 Bug 1359397 - Don't allow Selection in nodes not in the document; r=masayuki
This matches the spec and Chrome, and seems to bring us closer to Edge
and WebKit as well.  It also matches our own behavior for addRange(),
which was changed in bug 1341137.

For collapse and selectAllChildren, we match the tests and browsers, but
the spec is incorrect at the time of this writing:
https://github.com/w3c/selection-api/pull/86

The removeAllRanges test hadn't been updated for the spec change.

MozReview-Commit-ID: DTK8283k5IP

--HG--
extra : rebase_source : 54701e7136c33ebce651d5f74c3dc1d8b944f9a3
2017-08-10 15:02:08 +03:00
Kyle Machulis 649634a721 Bug 1387184 - Remove nsIDOMHTMLEmbedElement; r=bz
Removes nsIDOMHTMLEmbedElement and all references. HTML elements are
now handled by WebIDL. With the deprecation of extensions, XPCOM
interfaces to HTML elements are no longer needed.

MozReview-Commit-ID: DI4XVvdgPDI

--HG--
extra : rebase_source : 74bd92619e3d1db04c3dd40ec3022474fe1d647c
2017-08-09 12:05:08 -07:00
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
Stone Shih 55c5359fa6 Bug 1351148 Part4: Revise those test cases that have some tasks have to be processed before or after the synthesized key events. r=smaug.
Make sure input events are processed before or after the dependent tasks.

MozReview-Commit-ID: 8KfZnT2wjJR
2017-06-07 14:28:16 +08:00
Wes Kocher 7a772df5bf Merge m-c to inbound, a=merge
MozReview-Commit-ID: BYZASFIrXxp
2017-08-14 17:58:17 -07: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