Commit Graph

7773 Commits

Author SHA1 Message Date
Cameron McCormack
fdb731a4d4 Bug 1377256 - Part 1: Don't pass parent explicitly into HTMLEditor::DeleteRefToAnonymousNode. r=m_kato
MozReview-Commit-ID: HUySaoG07jg

--HG--
extra : rebase_source : adb3a65387eb209073d95211fa185bcab2791b0f
2017-07-04 17:01:32 +08:00
Carsten "Tomcat" Book
1367c473cd Merge mozilla-central to mozilla-inbound 2017-06-29 15:49:39 +02:00
Carsten "Tomcat" Book
5f00ae3a8b merge mozilla-inbound to mozilla-central a=merge 2017-06-29 15:47:04 +02:00
Olli Pettay
da0ec0a364 Bug 1375491, make child process to cache ime properties only at animation tick time, r=masayuki
--HG--
extra : rebase_source : 6f13f4d91fc4873d135824431adb4b0b2843b738
2017-06-29 14:46:11 +03:00
Makoto Kato
48c416047f Bug 1375910 - Don't remove text node when setting value is empty string. r=masayuki
When setting empty value by input.value, we remove text node and insert bogus node.  But creating and removing node are expensive.  So we should keep text node for performance if possible.

Now, DocumentIsEmpty only checks bogus node to detect empty.  So, keeping text node change causes that document cannot detect as empty.  If root has only text node and all is empty, we should detect empty document.

This change should be only plain text editor.  HTML editor already allows multiple text nodes, so we should keep old behaviour on HTML editor.


MozReview-Commit-ID: Gt8GmdWAA3E

--HG--
extra : rebase_source : 4c5deba024cab3d7e2e1e2a8ec53a29f2fdf8cd9
2017-06-28 07:42:09 +09:00
Cameron McCormack
e86592ca35 Bug 1374999 - stylo: Iterate over manually created editor NAC. r=bholley
MozReview-Commit-ID: 1CiWVfYbxaJ

--HG--
extra : rebase_source : 48ea8a0f1cb0a4072632f706ffd99529bb4447b1
2017-06-27 17:34:48 -07:00
Carsten "Tomcat" Book
4e00eff077 merge mozilla-inbound to mozilla-central a=merge 2017-06-27 10:56:41 +02:00
Bill McCloskey
f115503a0b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Masatoshi Kimura
b515c9c804 Bug 1373984 - Turn nsIDocument::mCharacterSet into mozilla::NotNull<const mozilla::Encoding*>. r=hsivonen
MozReview-Commit-ID: GF0YXDwfA14

--HG--
extra : rebase_source : fdae0046f882d47fb539a7f882364e5c5caafdcd
extra : source : 49249788c0dee331ac2989dc39f0505d965a7bd8
2017-06-18 20:37:50 +09:00
Olli Pettay
70cd98776b Bug 1375484 - ScrollSelectionIntoViewEvent should be called during refresh driver tick, r=ehsan 2017-06-25 00:38:42 +03:00
Nicholas Nethercote
fe9268c4cd Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj.
All the instances are converted as follows.

- nsAFlatString  --> nsString
- nsAFlatCString --> nsCString

--HG--
extra : rebase_source : b37350642c58a85a08363df2e7c610873faa6e41
2017-06-20 19:19:05 +10:00
Carsten "Tomcat" Book
7fa56f5378 Merge mozilla-central to autoland 2017-06-22 14:11:46 +02:00
Florian Quèze
66f6d259bc Bug 1374282 - script generated patch to remove Task.jsm calls, r=Mossop. 2017-06-22 12:51:42 +02:00
Masayuki Nakano
5af13a8f29 Bug 1374207 - part5: nsTextControlFrame should use TextEditor instead of nsIEditor r=smaug
MozReview-Commit-ID: Eh6Cp546bXT

--HG--
extra : rebase_source : 1bb83361b72af61434a91eb08aba09e79a1dd976
2017-06-19 23:47:02 +09:00
Masayuki Nakano
c5fbe1617e Bug 1374207 - part3: Editor classes should use concrete classes instead of nsI*Editor r=m_kato
HTMLEditor inherits some interface classes.  Therefore, CachedWeakPtr is confused at ambiguous conversion from HTMLEditor to nsISupports.  Therefore, this patch adds second parameter to the template class.

MozReview-Commit-ID: KGSYJHfp1L5

--HG--
extra : rebase_source : 7189372c4c06218c3040701196eac51ded85d3fa
2017-06-22 15:02:59 +09:00
Masayuki Nakano
583dafd5d4 Bug 1374207 - part2: TextComposition, IMEContentObserver and IMEStateManager should use EditorBase instead of nsIEditor r=m_kato
MozReview-Commit-ID: IdHmseTiv2t

--HG--
extra : rebase_source : b2f9f42dee97e1ba2cc081014d1696506088d375
2017-06-20 19:23:44 +09:00
Masayuki Nakano
7ad4ad3aab Bug 1374207 - part1: nsTextEditorState should use mozilla::TextEditor instead of editor interfaces r=smaug
Using concrete class rather than interface classes (nsI*Editor) will allow to reduce QI and some virtual calls.  Therefore, Editor classes should be used as concrete class as far as possible.

Unfortunately, if classes referring editor are initialized via scriptable interface, we cannot do this because nsI*Editor is still not marked as builtinclass.  Therefore, their editor may be implemented by JS.  E.g., inline nsIInlineSpellChecker.init() and nsIDocShell.editor.  Such remaining cases should be fixed after nsI*Editor classes are marked as builtinclass.

Note that this patch also creates nsIdentifierMapEntry.h which is separated from nsDocument.h because ShadowRoot.h needs the class but exposing nsDocument.h to the global and includes it causes bustage on Linux and Android.  Therefore, for fixing the include hell, this patch touches them and ContentChild.cpp.

MozReview-Commit-ID: i6fLWw6Qeo

--HG--
rename : dom/base/nsDocument.h => dom/base/nsIdentifierMapEntry.h
extra : rebase_source : c57bdfc1c13775acdcfd4732d8157d04d6b6613f
2017-06-20 22:57:08 +09:00
Makoto Kato
31c7043d79 Bug 1375131 - Part 3. Use stack class to save ranges before using on loop. r=masayuki
We have a possible loop like this bug.  So we should use stack class for loop.

MozReview-Commit-ID: LQb9w8LEtbx

--HG--
extra : rebase_source : 67c40a0f2e3528d58fe7d0ea6ca290bbc136c6d1
2017-06-23 16:46:54 +09:00
Makoto Kato
82d2f60a4d Bug 1375131 - Part 2. Add crash test. r=masayuki
MozReview-Commit-ID: DxYWPNcb7jK

--HG--
extra : rebase_source : f5c5ca6d6fb4c3bb276398b08c81eda1a72b84ae
2017-06-23 16:45:50 +09:00
Makoto Kato
db293de97e Bug 1375131 - Part 1. Store ranges before using on loop. r=masayuki
This crash occurs that range is nullptr.

DeleteNonTableElements will update selection and range, so we shouldn't use range count before modifying selection.  So we should save range data for loop.

MozReview-Commit-ID: C9c4TZqRvUc

--HG--
extra : rebase_source : cbadc6d6d82e1c904c20309f2e82f2b6c2f438e7
2017-06-27 17:34:18 -07:00
Makoto Kato
a7f8e06327 Bug 1343918 - Add crash test for document.execCommand('italic'). r=masayuki
Although this crash doesn't occur after landing bug 1369140, we should add this test to crashtest.

MozReview-Commit-ID: mRm4P876zg

--HG--
extra : rebase_source : 9a85c8ba3a5652000512d165b82df9aa2c8176e1
2017-06-20 14:46:28 +09:00
Masayuki Nakano
7231604754 Bug 596501 TextEditRules::WillOutputText() should handle itself if it can return only the text of first text node r=m_kato
TextEditor::OutputToString() uses DocumentEncoder if TextEditRules::WillOutputText() doesn't handle it.  However, TextEditRules::WillOutputText() doesn't handle it even if it's really simple case of <input type="text"> and <textarea>.
This patch makes TextEditRules::WillOutputText() handle it if DOM tree in the editor root element is expected and there is no special flag which requires complicated handling.

MozReview-Commit-ID: 3HvdTAWRpw0

--HG--
extra : rebase_source : ab3e630faa95ce8d4c1e9eb1786b7ece7212e38f
2017-06-16 19:08:10 +09:00
Wes Kocher
976d5437f9 Merge m-c to autoland, a=merge
MozReview-Commit-ID: 6A96Fe0GPjw
2017-06-19 17:37:53 -07:00
Masayuki Nakano
f337b95b60 Bug 1372829 - part2: mozilla::EditorBase should cache raw pointer of nsISelectionController and nsIDocument with nsWeakPtr r=froydnj,m_kato
mozilla::EditorBase stores nsISelectionController and nsIDocument with nsWeakPtr.  However, nsWeakPtr requires QI to retrieve actual pointer and it makes some damage to the performance.  If mozilla::WeakPter were available for them, it'd be great.  However, it's not available with nsISelectionController nor nsIDocument because it's possible to implement SupportsWeakPtr only with their subclasses but the subclasses shouldn't be referred by editor.  Therefore, this patch creates mozilla::CachedWeakPtr<class T> which stores both raw pointer (as cache) and nsWeakPtr and when its cache is requested, it checks if the object referred by nsWeakPtr is still alive.

Additionally, this patch hides the members from subclasses of EditorBase for reducing the maintenance cost.

MozReview-Commit-ID: FvtM7453Vv8

--HG--
extra : rebase_source : a524a8ea327c3993645fafa81db8aef65090f1e0
2017-06-20 00:55:00 +09:00
Masayuki Nakano
46f0810215 Bug 1372829 - part1: Make mozilla::PlaceholderTransaction inherit mozilla::SupportsWeakPtr instead of nsSupportsWeakReference r=m_kato
EditorBase stores PlaceholderTransaction with nsWeakPtr.  However, retrieving its pointer requires a QI.  So, for reducing the QI cost, EditorBase should use WeakPtr instead and PlaceholderTransaction needs to inherit SupportsWeakPtr instead of nsSupportsWeakReference.

MozReview-Commit-ID: IYwSTbJebMk

--HG--
extra : rebase_source : fa728b09afa826506befbeb46aba54075ecf4787
2017-06-14 19:05:48 +09:00
Carsten "Tomcat" Book
b6627b974a Merge mozilla-central to mozilla-inbound 2017-06-19 14:48:12 +02:00
Olli Pettay
33c9c232a2 Bug 1374116, avoid some extra QIs in EditorBase::GetFocusedContent(), r=masayuki
--HG--
extra : rebase_source : c4d9898073d62c6aa8d9926f9a4785d39c90760f
2017-06-19 14:57:09 +03:00
Ehsan Akhgari
147a0e6607 Bug 1373762 - Make editor mochitests correctly wait for spell checking to finish; r=mystor 2017-06-16 14:41:02 -04:00
Bill McCloskey
0767e31489 Bug 1372736 - Avoid using AbstractThread for non-media MozPromises (r=bkelly)
MozReview-Commit-ID: BBi0pK4DXxf
2017-06-15 20:16:25 -07:00
Henri Sivonen
2f2bb984f8 Bug 1372994 - Clear up leftover ISO-8859-1 encoding names. r=emk
MozReview-Commit-ID: IBuUPa9H9Q2

--HG--
extra : rebase_source : fb8db0c70caeec179d50b9ecaeb811d1e87eb0dd
2017-06-15 10:35:22 +03:00
Makoto Kato
945e02484a Bug 1372859 - Remove SelAdj* method of nsIDOM* version from RangeUpdater. r=masayuki
Since RangeUpdater::SelAdj* method of nsIDOM* version requires additional QI and we don't use nsIDOM* as parameter, it is unnecessary to keep it.

MozReview-Commit-ID: 4XyYBG6Qrhl

--HG--
extra : rebase_source : 5fd830a2ffeff944471f026ded704a46ac4dd3d5
2017-06-14 19:34:38 +09:00
Masayuki Nakano
3e6f20f54d Bug 1357642 TextEditor::UpdateIMEComposition() shouldn't call NotifyEditorObservers(eNotifyEditorObserversOfBefore) by itself r=m_kato
TextEditor::UpdateIMEComposition() uses AutoPlaceHolderBatch class which calls NotifyEditorObservers(eNotifyEditorObserversOfBefore) automatically when it's created.  Therefore, it causes calling NotifyEditorObservers(eNotifyEditorObserversOfBefore) twice from TextEditor::UpdateIMEComposition().

MozReview-Commit-ID: DJqzmCtyHCf

--HG--
extra : rebase_source : 44e350d66a01ba9e0beaada0f349422a896acf3d
2017-06-16 21:30:22 +09:00
Carsten "Tomcat" Book
5e8c1546ec merge mozilla-inbound to mozilla-central a=merge 2017-06-14 14:45:26 +02:00
Bill McCloskey
c85ab6308c Bug 1366072 - Change promises to take nsISerialEventTarget instead of AbstractThread (r=jwwang)
MozReview-Commit-ID: 4azUhSB6whu
2017-06-13 14:51:01 -07:00
Makoto Kato
5400a2fb98 Bug 1361008 - Part 2. add test for invisible node. r=masayuki
Since this step requires keyboard operation, we cannot create web-platform-test.

MozReview-Commit-ID: ExuaNOj9JG4

--HG--
extra : rebase_source : 0115e48fe1c3bdd7495e3bfc610f03ac1ee15ecb
2017-06-12 15:30:16 +09:00
Makoto Kato
b32c372b3d Bug 1361008 - Part 1. Don't select invisible text node on makeBasicBlock. r=masayuki
GetNodesForOperation(..., makeBasicBlock) will get all nodes of promoted range.  But it includes invisible text node after <br> element.  So HTMLEditRules::MakeBasicBlock will creates block for invisible text node.

So we should remove invisible text node from nodes of formatBlock.

MozReview-Commit-ID: L1bsPAYcwx3

--HG--
extra : rebase_source : d9e4e3ff3eef41fb7a4b4c88d73d000b2e53806f
2017-06-12 15:28:54 +09:00
Ehsan Akhgari
5a1d782b90 Bug 1371277 - Use reserved space for one item in SelectionState::mArray; r=masayuki
This avoids dynamic allocations in SelectionState::SaveSelection() in the common
case for the selections that only have a maximum of one range stored in them.
2017-06-09 01:17:42 -04:00
Ting-Yu Lin
2923be5074 Bug 1290276 Part 8 - Update test expectations after implementing XBL <stylesheet> for stylo. r=heycam
Disable 461917-1.xhtml under dom/xul/crashtests/ because I cannot reproduce
it locally.

Annotate assert-if on some crashtests (bug 1370830). Other modifications are
all removal of fails-if.

MozReview-Commit-ID: 6Q2A5M5rOry

--HG--
extra : rebase_source : b282a919fcda6287fe2eaa6b139a11f2663ad578
2017-05-31 16:44:38 -07:00
Makoto Kato
684c70a6ba Bug 1371170 - Add non-virtual EditorBase::GetSelectionController. r=masayuki
GetSelectionController is virtual method, but we should have non-virtual version of GetSelectionController that return value is nsISelectionController since we have a lot of call of GetSelection().

MozReview-Commit-ID: 41JFqTyIh0b

--HG--
extra : rebase_source : 4d40d1a8b31c2b6aff3f3b9ff4609bb3e41ea8f6
2017-06-08 13:58:09 +09:00
Brad Werth
6aa25ee4e2 Bug 1369903 Part 2: Allow HTMLEditor to enable/disable any type of stylesheet. r=emilio
MozReview-Commit-ID: JSlJ8yhqLXm

--HG--
extra : rebase_source : 35fd4c941fd09109779f454020c7af8de72dba55
2017-06-05 09:00:20 -07:00
Makoto Kato
83a6b6422e Bug 1369252 - Don't use nsISelection::CollapseNative / ExtendNative. r=masayuki
Editor still uses CollapseNative and ExtendNative even if it uses Selection, not nsISelection.  CollapseNative and ExtendNative are virtual method, but Selection::Collapse and Extend are non-virtual.  So, we should use Selection::Collapse and Extend instead.

MozReview-Commit-ID: 1AEaaJRbkIm

--HG--
extra : rebase_source : 33b4059c558cfb88c61cedc4e71de8263f2fc387
2017-06-02 17:25:17 +09:00
Makoto Kato
15a281942d Bug 1368544 - Part 2. Add setting empty value test whether creating trailing node. r=masayuki
MozReview-Commit-ID: 3eAFkmUntv0

--HG--
extra : rebase_source : c8a23e2c9c75413bed7d57439f312716c82230bd
2017-05-30 18:59:31 +09:00
Makoto Kato
63af283568 Bug 1368544 - Part 1. Use root node for mozInlineSpellChecker::SpellCheckAfterEditorChange on setText trasaction. r=masayuki
textarea element will use fallback code (using TextEditor::DeleteSelection) to set empty value for SetText.

Actually, if EditorBase::HandleInlineSpellCheck returns error in AfterEdit, we might not create bogus node and trailing br node.  Since SetText's fallback uses DeleteSelection, SpellCheckAfterEditorChange will return error when previous selection is invalid on SetText transaction.

mozInineSpellChecker::SpellCheckAfterEditorChange creates the range between previousSelection and anchorNode.  So when using setText, we should set the range of all text, and we should not use previous selection for SpellCheckAfterEditorChange.



MozReview-Commit-ID: 7eDzMdRmOSz

--HG--
extra : rebase_source : 67861ca3c779b2fb6b5a26174f391fa7fb9ca390
2017-05-31 14:50:51 +09:00
Masayuki Nakano
61af94acbd Bug 1367683 Optimize initializing nsRange r=smaug
nsRange::DoSetRange() adds/remove its root to/from mutation observer, initializes common ancestor, registers itself to the common ancestor, unregisters itself from old common ancestor, and notifies selection listeners of selection change.

However, those runtime cost is expensive but on the other hand, a lot of callers set both start and end of the range and that causes calling DoSetRange() twice.

This patch renames Set() to SetStartAndEnd() for easier to understand the meaning and make it call DoSetRange() only once.

MozReview-Commit-ID: FRV55tuBAgg

--HG--
extra : rebase_source : 67adf929cf119e2425f7d3741651217522094590
2017-05-30 13:18:25 +09:00
Makoto Kato
ecc0e24787 Bug 1368387 - Remove nsIDOMText usages from Editor. r=masayuki
nsIDOMText is old interface and it needs QI to access node etc.  So we should use Text etc.

MozReview-Commit-ID: 7VrTrE0p2Q9

--HG--
extra : rebase_source : baa6601708d4b71e624a4dc893cc413d7743dbeb
2017-05-29 11:28:21 +09:00
Makoto Kato
d3b2a25a43 Bug 1342417 - ClearStyle should check that SplitStyleAbovePoint returns node. r=masayuki
SplitStyleAbovePoint can return null for split node, but we don't check it.
Also, this crash occurs on paste operation, so I think that there is 100% reproduce test.  But I cannot find it.

MozReview-Commit-ID: 69OlPTc0I9h

--HG--
extra : rebase_source : 61eea8af83e60cc4f9c6f25d2952d57d0fea1d05
2017-05-25 17:15:54 +09:00
Makoto Kato
153cf127c6 Bug 1358025 - Part 5. Add undo transaction test on input element. r=masayuki
When setting same value (including empty to empty), some browsers might not turn off undo.  If settings non-empty value, all browsers doesn't turn off undo.  Also, if empty value, Edge and Chrome doesn't turn off undo.

MozReview-Commit-ID: 1nVYEzBr5KJ

--HG--
extra : rebase_source : e49f38e7c5a8f69902d6320eb6740e34e3f161ed
2017-05-25 14:19:39 +09:00
Makoto Kato
da0ebf60c0 Bug 1358025 - Part 2. Add SetText Transaction API. r=masayuki
Actually, input.value setter behaviour (when editor has focus) is the following.

- select all
- delete selection
 - delete text node
- insert text
 - create text node
  - create nsIFrame since we don't support lazy construction for editable element

It is too expensive to change text.  So I would like to change like the following when there is 1 text node only (normal case).  If child nodes isn't 1 text node only, use original way.

- set text on existed text node

So, for this fast path, I would like to add SetText transaction API.

MozReview-Commit-ID: A7bjXtCtSoB

--HG--
extra : rebase_source : ff6348d7a3304e676a0a4b897f91623962961ae0
2017-05-25 14:30:50 +09:00
Fernando Jimenez Moreno
3ccdd927e6 Bug 1365871 - stylo: Make editor/libeditor/tests pass by removing MOZ_CRASH from CSSEditUtils. r=xidorn
The MOZ_CRASH was added because we were lacking a implementation of ServoDeclarationBlock::GetPropertyValueByID, but it was added in Bug1294299

MozReview-Commit-ID: GPsFvTLxsMd

--HG--
extra : rebase_source : d51837def3a9a76dfa2af01dcb26b607dd48a5e6
2017-05-25 09:27:40 +02:00
Shing Lyu
5d8a5a598c Bug 1361645 - Change reftest condition stylo to styloVsGecko r=dbaron
MozReview-Commit-ID: 3ekoU1zg8xA

--HG--
extra : rebase_source : f62c84516f5ac0d4b4d0c876514b72fa786ec542
2017-05-25 11:26:12 +08:00