Commit Graph

7457 Commits

Author SHA1 Message Date
Tim Nguyen
d7db347638 Bug 1322938 - Basic implementation of HTMLDialogElement. r=smaug, masayuki
MozReview-Commit-ID: AU92mq2QZIc
2016-12-23 16:01:50 +01:00
Cameron McCormack
61569b57a1 Bug 1324624 - Tweak stylo crashtest assertion annotations a bit more.
MozReview-Commit-ID: D2AntG68VGr
2017-01-02 16:25:22 +08:00
Masayuki Nakano
c20fedebf4 Bug 1312991 Get rid of nsIHTMLEditor::SetDocumentTitle() and mozilla::SetDocumentTitleTransaction r=smaug
Now, nobody (including add-ons) uses nsIHTMLEditor::SetDocumentTitle(), so, we can remove it.

Additionally, mozilla::SetDocumentTitleTransaction is created only when nsIHMLEditor::SetDocumentTitle(), so, we can remove this class too.

MozReview-Commit-ID: HK7G9u7HUlh

--HG--
extra : rebase_source : da68cabbf929a684d26f6316fdc7f58b8e32ab02
2016-12-26 17:46:23 +09:00
Makoto Kato
45e40588b0 Bug 1325843 - Use explicitly static method call for EditorBase::IsTextNode. r=masayuki
IsTextNode is static method, so we should use explicitly static method call into EditRule.

MozReview-Commit-ID: EX2BbbN2vNJ

--HG--
extra : histedit_source : 4194477320ffad62da36b272239d1443bb6c88b6
2016-12-26 14:32:57 +09:00
Makoto Kato
ac78727eab Bug 1325300 - Use explicitly static method call for GetStartNodeAndOffset and GetEndNodeAndOffset. r=masayuki
Most codes into HTMLEditRules and TextEditRules don't use explicitly static method call such as EditorBase::GetStartNodeAndOffset.  So we should use it instead of "editor->GetStartNodeAndOffset".

MozReview-Commit-ID: DGAEFK6AYzh

--HG--
extra : rebase_source : d1dafaca2dbe95d9b1c50c52245f29af75e0a9f2
extra : amend_source : c183380253a1cf5c1dbc1cf18eb70e26ca0cadeb
2016-12-22 15:48:41 +09:00
Makoto Kato
aba106bb59 Bug 1324996 - Part 2. Use nsIAtom to change attirbute if possible. r=masayuki
We can replace old nsIEditor API with nsIAtom version.

MozReview-Commit-ID: EMEANldtTo0

--HG--
extra : rebase_source : 2828270d42efe1786f88f13bf20c34bd56083d41
2016-12-20 20:53:00 +09:00
Makoto Kato
5b2e25c11c Bug 1324996 - Part 1. Implement nsIAtom version of SetAttribute/RemoveAttribute/CloneAttirubte. r=masayuki
Add nsIAtom version of the following.
 - CloneAttribute
 - RemoveAttribute
 - RemoveAttributeOrEquivalent
 - SetAttribute
 - SetAttributeOrEquivalent

MozReview-Commit-ID: 8CutpdyVuew

P1

MozReview-Commit-ID: 9MdmGcTqaxT

--HG--
extra : rebase_source : 2ae876cd33839f61880bd6c55644d4381139dd25
2016-12-20 19:24:08 +09:00
Cameron McCormack
d4d8ba1d5f Bug 1324624 - stylo: Mark currently failing crashtests with asserts-if(stylo,...). r=xidorn
MozReview-Commit-ID: 7iiwRwiQ8s4
2016-12-21 15:42:36 +08:00
Masayuki Nakano
7436f01057 Bug 564411 Move all methods/attributes of nsIEditorIMESupport to nsIEditor r=smaug
Doing QI from nsIEditor to nsIEditorIMESupport doesn't make sense because editor should always support all methods and attributes of nsIEditorIMESupport (it does NOT mean that all nsIEditor implementation need to support IME).

This patch moves all of them to nsIEditor for avoiding redundant QIs.

MozReview-Commit-ID: DzIKuGHG4iy

--HG--
extra : rebase_source : cc5e9a6ae4572ebe461d9770ffa5c23d33dc8526
2016-12-20 21:47:31 +09:00
Carsten "Tomcat" Book
a244c7fb4a merge mozilla-inbound to mozilla-central a=merge 2016-12-16 16:04:50 +01:00
Cameron McCormack
366f6eb24d Bug 1323892 - Disable currently crashing stylo crashtests. r=xidorn
MozReview-Commit-ID: 2BNjdBWdT5V
2016-12-16 18:54:41 +08:00
Makoto Kato
9ca28d2919 Bug 1317704 - Part 2. Add test. r=masayuki
MozReview-Commit-ID: AVOvEZ1sMVq

--HG--
extra : rebase_source : 82695e8f1b24b61258311d11f9ce19cfbae2033f
2016-12-15 15:02:10 +09:00
Makoto Kato
787ae4f9c9 Bug 1317704 - Part 1. Hold current ranges into RemoveInlineProperty. r=masayuki
Since current selection ranges might be modified by SplitStyleAboveRange,  this crash occurs into RemoveInlinePropertyImpl.  So we need hold current selection range for loop.

MozReview-Commit-ID: JuXn9XlwCp6

--HG--
extra : rebase_source : f34cd77d19c1a8bfcc6e26c6f0b1cd833ce4b19e
2016-12-15 15:01:53 +09:00
Jorg K
714e747215 Bug 1288911 - Use CSS trick to avoid unwanted line wraps in quotes. r=masayuki
--HG--
extra : rebase_source : 5c6ebecddc27c9ad076c5c90fe83016a0008cb83
2016-12-14 13:37:00 +01:00
Gijs Kruitbosch
cb6c0c81ac Bug 1322414 - part 2,3,4: use a separate 'primary' attribute for primary child browsers, r=bz,mconley
MozReview-Commit-ID: 2yb0WGFYBsH

--HG--
extra : rebase_source : 376171077c577e41e82cec5e994c425c6d9f2d80
extra : histedit_source : 39aad91381749a263042cd0452fe32019a1974b8
2016-12-09 09:23:24 -10:00
Makoto Kato
ec8701e677 Bug 1323138 - CSSEditUtils should use atom for CSS property if possible. r=masayuki
There is a lot of string compare when using CSS property name.  We should use nsGkAtoms instead.

MozReview-Commit-ID: JvpWRTkM8U

--HG--
extra : rebase_source : 404518a52fdab6b64a804835acd1ea16b5adde7c
2016-12-12 00:03:36 -10:00
Karl Tomlinson
4c027cc4bc bug 1322422 use assertSnapshots() to log failures better r=Ehsan
MozReview-Commit-ID: 54WgoCdKjMX

--HG--
extra : rebase_source : 1ab5cccb586edad9f3a30c90f413124df006820f
2016-12-06 22:38:23 -10:00
Makoto Kato
4f19afdf88 Bug 1318570 - Clean up GetTextNode into TextEditRules. r=masayuki
EditorBase parameter of GetTextNode is unnecessary because it uses static method only.  Also, we should return nsINode to reduce QI.

MozReview-Commit-ID: 3KazYFcr899

--HG--
extra : rebase_source : 092bbcc84d7c1e7174029bb90f606f3953fe8597
2016-11-22 20:56:03 +09:00
Olli Pettay
6dabfdba6b Bug 1314442 - Limit editor's editability to the right subtree. r=masayuki
--HG--
extra : rebase_source : bb528d3c82c962dc31883654a81f87285e49e2b9
2016-11-29 17:07:27 -05:00
Makoto Kato
ced4cccc2c Bug 1313986 - Part 5. Remove createAnonymousElement from nsIHTMLEditor. r=masayuki
c-c nor add-ons seem noet to use it.  We should remove this.

MozReview-Commit-ID: 3jN8kUp6D4Z

--HG--
extra : rebase_source : cc31001bb87da2888a9c1da6d92a305cdebebb7a
2016-10-31 18:06:27 +09:00
Makoto Kato
ef514b53ec Bug 1313986 - Part 4. Use Element instead of nsIDOMElement for resizer. r=masayuki
Resizer and etc attributes on table editor still use nsIDOMElement.  Converting to Element makes both implementation and the callers simpler.

MozReview-Commit-ID: TTFSvqn5GE

--HG--
extra : rebase_source : 705576c4eb0fe5f8f566f3415a8a72842c919edd
2016-11-24 15:58:01 +09:00
Makoto Kato
3d6d028dd6 Bug 1313986 - Part 3. Use CreateAnonymousElement with nsIAtom for simple case. r=masayuki
Now we can return Element directly via CreateAnonymousElement. We should use it.

MozReview-Commit-ID: Et1i3hLVSqc

--HG--
extra : rebase_source : e09c2b2b41481dd6608d9c816676030d8aae1ed6
2016-11-24 18:07:47 +09:00
Makoto Kato
ba151083a7 Bug 1313986 - Part 2. Add CreateAnonymousElement with nsIAtom. r=masayuki
I would like to nsIAtom and mozilla::dom::Element version of CreateAnonymousElement to clean up code.  When getting/setting attirubte, editor sometimes use string, not nsGkAtoms.  We should use new mozilla::dom::Element methods.

Also, we should add  _moz_anonclass to atom list that uses on editor.

MozReview-Commit-ID: ICaAWVPjcej

--HG--
extra : rebase_source : 9585214aa678c16905250265a75b817c90246fcc
2016-11-24 16:12:04 +09:00
Makoto Kato
18132c8907 Bug 1313986 - Part 1. Add test for inlineTableEditing and objectResizing. r=masayuki
We have no mochitest for objectResizing and inlineTableEditing.  So I add simple test for this.

MozReview-Commit-ID: Hnjpopr3h5F

--HG--
extra : rebase_source : 8cb81a89f11d4092f2adaa8822733f861a71ace1
2016-11-24 15:00:04 +09:00
Andi-Bogdan Postelnicu
d9b3715501 Bug 1319401 - Use C++11's override and remove virtual where applicable in editor/. r=masayuki
MozReview-Commit-ID: CdlsJOlAW9e

--HG--
extra : rebase_source : 2c56fbdb44db8b6084b50a656513227cd26db278
2016-11-22 14:14:48 +02:00
Andi-Bogdan Postelnicu
e311c3aa44 Bug 1319401 - Replace default bodies of special member functions with = default; in editor/. r=masayuki
MozReview-Commit-ID: F9p3cvxPIrs

--HG--
extra : rebase_source : 63a3753634c5eed9303bb3f569095a644a52cc04
2016-11-22 14:14:22 +02:00
Ryan VanderMeulen
012910643b Bug 1211213 - Re-enable test_bug597331.html on ASAN and Windows.
--HG--
extra : rebase_source : 62ab2f2f59067ff4ad5869420e7495e9c2963fa1
2016-11-21 14:13:54 -05:00
Carsten "Tomcat" Book
59bb309e38 merge mozilla-inbound to mozilla-central a=merge 2016-11-21 15:44:20 +01:00
Masayuki Nakano
dbf69d5b2c Bug 1316302 part.4 Refine HTMLEditRules::TryToJoinBlocks() and HTMLEditRules::MoveNodeSmart() with early return style for making scope of EditActionResult variable smaller r=smaug
For now, let's make the scope of EditActionResult variable in them smaller without big change.

MozReview-Commit-ID: 9vDoU9bUdVO

--HG--
extra : rebase_source : 6cdd50954d6cfe1fa80aeee5b06b3fec6b1ada3d
2016-11-18 18:59:39 +09:00
Masayuki Nakano
e8b4d6d5fe Bug 1316302 part.3 Create EditActionResult class for making the methods which return nsresult, handled and canceled with out params r=smaug
In a lot of places, edit action handlers and their helper methods return nsresult and aHandled and aCanceled with out params.  However, the out params cause the code complicated since:

* it's not unclear if the method will overwrite aHandled and aCanceled value.
* callers need to create temporary variable event if some of them are not necessary.

This patch rewrites the helper methods of HTMLEditRules::WillDeleteSelection() with it.

MozReview-Commit-ID: CJv75KdOdXf

--HG--
extra : rebase_source : 708d378bdd0ddc4ae984de9294525b01a829b0b7
2016-11-18 17:59:23 +09:00
Masayuki Nakano
8b2ac2889e Bug 1316302 part.2 WillDeleteSelection() should retry to handle it when selection is collapsed and JoinBlocks() doesn't handle nor cancel the action r=smaug
When selection is collapsed and JoinBlocks() doesn't handle nor cancel the action, WillDeleteSelection() should move selection to the start/end of leftmost/rightmost editable leaf node and retry to handle the action again.

For avoiding infinite loop, it checks if selected node is changed actually before calling itself again.

MozReview-Commit-ID: GtEC4dim3r9

--HG--
extra : rebase_source : f84afd754e71f441c3fad15456d20a11c42dd6de
2016-11-16 20:20:41 +09:00
Masayuki Nakano
a8116bc72f Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block.  However, JoinBlocks() always fails to join them since it's impossible operation.  In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.

This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is.  And this patch adds |bool* aHandled| to the helper methods.  Then, *aHandled and *aCancel are now always returns the result of each method.  Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.

Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.

MozReview-Commit-ID: 7ApUOgtLUog

--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 17:54:31 +09:00
Carsten "Tomcat" Book
866da9f9c6 merge mozilla-inbound to mozilla-central a=merge 2016-11-18 16:51:17 +01:00
Makoto Kato
0d166881ec Bug 1317718 - Unnecessary QI to nsIContent to check whether text node. r=masayuki
If not text node, QI to nsIContent will be failed.  So we should use IsNodeType (Or EditorBase::IsTextNode) without QI for detection of text node.

Also, to get content length into text node, we should use TextLength() simply instead of getting content string.  It can reduce memory allocation.

MozReview-Commit-ID: C8EKxfUBjTP

--HG--
extra : rebase_source : 30614bd21393f96f9a9b13aeb5a742fa8c6eb83f
extra : amend_source : 8b956f9fbd521f7c9503bdb5481694579cb6e3e9
2016-11-17 11:14:19 +09:00
Benjamin Smedberg
00f9f7a30c Bug 1314350 - Port TestTXMgr to gtest. This removes the framework for testing object destruction order because that was already non-deterministic due to the cycle collector, r=masayuki
MozReview-Commit-ID: vK4iYmytgt

--HG--
extra : rebase_source : fc4be47bf0e68777aaf45250b339cf0d3d332240
extra : source : bb1325166026fec5e13db34eca7588ce18c94505
2016-11-15 13:06:05 -05:00
Masayuki Nakano
ab6651b316 Bug 1314852 Make background and border of the input element in test_bug636465.html since it's sometimes not painted correctly r=smaug
The test compaires 4 screenshots for checking spellchecker's behavior.  However, the input element is sometimes not painted correctly on Linux.

Even if I make it wait more delay before taking screenshot, the random failure isn't fixed. So, I guess that it's a bug of gfx of Theme API of GTK.

On the other hand, the most important thing here is, compairing the foreground contents of the input element.  Therefore, this patch makes the background and border of the input element transparent.  That prevents to use Theme API. This must be enough for fixing the random orange.

MozReview-Commit-ID: L2uXcPLvbNg

--HG--
extra : rebase_source : 451f1c45d70ceb8406ea9749f0dfa3264c615151
2016-11-16 15:51:21 +09:00
Boris Zbarsky
784a52fd02 Bug 1317720. Use NeedsCallerType instead of NeedsSubjectPrincipal for DataTransfer.types. r=mystor 2016-11-15 12:46:32 -05:00
Boris Zbarsky
dda84c3ef8 Bug 1317599. Get rid of LegacyIsCallerChromeOrNativeCode use in datatransfer code. r=mystor 2016-11-15 12:46:32 -05:00
Makoto Kato
e012b6c81b Bug 1314790 - Part 2. Add test. r=masayuki
MozReview-Commit-ID: HcauemPpe4r

--HG--
extra : rebase_source : 6adb8338981c7654c3b9af2ab0f0ac46a9effb84
extra : amend_source : 1f1c5392b784d788d06924c69c95df569947d9e6
extra : histedit_source : e8b277c0cb2dbdf80344426036dd59fe56d2f477
2016-11-12 21:59:49 +09:00
Makoto Kato
0a98c8f610 Bug 1314790 - Part 1. GetGoodSelPointForNode doesn't work with ePrevousWord action. r=masayuki
Although GetGoodSelPointForNode only supports ePrevious or eNext as action, we use other action.  So we should add aseetion for it.

MozReview-Commit-ID: 3gLFFTAdNxU

--HG--
extra : rebase_source : b22cd532b6072e19fe1bff7f90a0e4a4ae4236e1
extra : histedit_source : 117509f1b76a382e8b23c5fa3345b81460385e56
2016-11-12 21:59:04 +09:00
SkyLined
df22496a19 Bug 1264921 - Crashtest. 2016-11-21 00:26:37 +01:00
Makoto Kato
2e67c9f2eb Bug 1314790 - Part 3. Ignore nsIEditor::eNone case. r=masayuki
MozReview-Commit-ID: 6KHFQ84J7dU

--HG--
extra : rebase_source : 5067eb13b7b0147a91bc6684e22738941dd5c965
extra : histedit_source : 620f146445556e90029665f1a2575105347ad441
2016-11-20 10:35:17 +09:00
Boris Zbarsky
6cee715d54 Bug 1318479 part 2. Remove uses of nsIDOMNode::AppendChild in editor. r=ehsan 2016-11-18 16:38:29 -05:00
Makoto Kato
74fe2d5fc8 Bug 1310912 - Part 6. Add redo test. r=masayuki
MozReview-Commit-ID: 5TgGAq3tM01

--HG--
extra : rebase_source : 031c1687887b67892ac4c9569fe843c17d5b1a49
extra : histedit_source : 3006cca58c3c5736ab603f3088296272db9763ed
2016-11-10 21:17:34 +09:00
Makoto Kato
b2b4afaf31 Bug 1310912 - Part 5. InsertTextIntoTextNodeImpl should use IMETextNode for listener. r=masayuki
When using CompositionTransaction, text node will be inserted into IMETextNode, not aTextNode of parameter.  So we should use it for listener.

MozReview-Commit-ID: 72a3ZjF1wsz

--HG--
extra : rebase_source : 325909c0d141c238ab41e33d7f3959f4db27339e
extra : histedit_source : 52d6fc9d2668e4e41783e524276d7041eec0301c
2016-11-12 15:46:33 +09:00
Makoto Kato
272781396f Bug 1310912 - Part 4. RangeUpdater should be called on DoTransaction. r=masayuki
Although PlaceholderTransaction will use the selection on Merge, it is too late to use UpdateRange.  Because RangeUpdater will be used after DoTransaction is finished.  So we should update selection on DoTransaction.

Also, part 1 fix doesn't update selection correctly via RangeUpdater when IME composition is multiple node.

MozReview-Commit-ID: 9so9tR8uQ6t

--HG--
extra : rebase_source : 02a8bebe6c89ceb023bd598b77b40c5817cd4007
extra : histedit_source : d114420552779d3352637c5554bf9e90e6e9cd40
2016-11-12 14:56:33 +09:00
Makoto Kato
ed68b31349 Bug 1310912 - Part 3. The selection into PlaceholderTransaction should be updated via RangeUpdater. r=masayuki
Since the selection into PlaceholderTransaction isn't updated via RangeUpdater, UndoTransaction may return error when selection/caret position is changed.  Then, redo is failed.

So we should add selection into PlaceholderTrancation to RangeUpdater.

MozReview-Commit-ID: LcUIiUExNhx

--HG--
extra : rebase_source : 9e1a71a7f497181171209ac05edcbddae227ab93
extra : histedit_source : 200dfd7957bf1b4dc92af72bb8b864cb457d62ab
2016-11-10 21:10:50 +09:00
Makoto Kato
c962bbc74c Bug 1310912 - Part 2. Add test. r=masayuki
We need skip this test on Android.  Although mochitest doesn't use native IME data, Android's GeckoEditable.java wants to access native IME composition.  See bug 1315898.

MozReview-Commit-ID: BNCKmDEmwKw

--HG--
extra : rebase_source : e7be1cb9e5c7c0fb4283f81541fc7441f52a1101
2016-11-04 19:04:43 +09:00
Makoto Kato
65c64fee1d Bug 1310912 - Part 1. CompositionTransaction should support multiple text nodes. r=masayuki
Google Keep uses range.insertNode on input event.  So, text node will be inserted into current caret position.

Microsoft IME's caret is after composition string, but ATOK's caret is before it.  So when using ATOK, this issue occurs.  By range.insertNode, text nodes that have IME attribute becomes multiple text nodes.  But CompositionTransanction doesn't consider that IME range isn't single text node.  Although it replaces current composition string with new string on first text node, it doesn't delete composition string on other text node.

MozReview-Commit-ID: 9uRx0A9mppx

--HG--
extra : rebase_source : fe0754cee2197822ca6ac9ebed13013a8f13b606
2016-11-08 16:14:57 +09:00
Masayuki Nakano
e940a313f8 Bug 1315065 When selection is collapsed in an empty text node, Backspace/Delete key press should modify the nearest text node r=smaug
Currently, when selection is collapsed at an empty text node, the behavior of each major browser is different.

When you remove the last character of non-empty text node followed by empty text nodes, Chromium removes all following empty text nodes.  However, Edge never removes empty text nodes even when selection is collapsed at an empty text node.

With this patch, our behavior becomes same as Edge.  I think that we should take this for keeping backward compatibility since Gecko never removes empty text nodes.  So, in other words, this patch makes Backspace key press at an empty text node modify the preceding non-empty text node.

When you remove the first character of non-empty text node preceded with empty text nodes, Edge removes all preceding empty text nodes.  However, Chromium and Gecko keeps previous empty text nodes than caret position.  So, we should keep current behavior for backward compatibility.  In other words, this patch makes Delete key press at an empty text node modify the following non-empty text node and keep current behavior.


The fixing approach of this is, making WSRunObject::PriorVisibleNode() and WSRunObject::NextVisibleNode() ignore empty text node.  This should make sense because empty text node is not a visible node. (On the other hand, when the DOMPoint has a null character, it should treat as visible character.  That is visible with Unicode codepoint.)

MozReview-Commit-ID: 11YtqBktEvK

--HG--
extra : rebase_source : 70fa858866cc768179c1ca6a869e1a5c7cfe6e1a
2016-11-11 12:24:21 +09:00