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

8460 Коммитов

Автор SHA1 Сообщение Дата
Boris Zbarsky f60fd673d6 Bug 1432186 part 19. Remove the nsIDOMNode::*_NODE constants. r=mccr8
MozReview-Commit-ID: KvKjeKIOB9K
2018-01-29 23:10:53 -05:00
Boris Zbarsky 4d88c28e4d Bug 1432186 part 17. Remove nsIDOMNode's parentNode attribute. r=mccr8
MozReview-Commit-ID: 4xzDwwEqnvE
2018-01-29 23:10:52 -05:00
Boris Zbarsky 37aaea3c1f Bug 1432186 part 16. Remove nsIDOMNode's ownerDocument attribute. r=mccr8
MozReview-Commit-ID: JqfAFxPBz41
2018-01-29 23:10:52 -05:00
Boris Zbarsky 9525cabcc3 Bug 1432186 part 15. Remove nsIDOMNode::HasChildNodes. r=mccr8
MozReview-Commit-ID: GFc2sv4E7b2
2018-01-29 23:10:51 -05:00
Boris Zbarsky 323cec654b Bug 1432186 part 13. Remove nsIDOMNode's nextSibling attribute. r=mccr8
MozReview-Commit-ID: DTaivhMORXr
2018-01-29 23:10:51 -05:00
Boris Zbarsky 97302665b4 Bug 1432186 part 12. Remove nsIDOMNode's previousSibling attribute. r=mccr8
MozReview-Commit-ID: 7UJFaxEnT9Q
2018-01-29 23:10:51 -05:00
Boris Zbarsky e2ce75877d Bug 1432186 part 11. Remove nsIDOMNode's firstChild attribute. r=mccr8
MozReview-Commit-ID: 5jCdAmSuPx8
2018-01-29 23:10:51 -05:00
Boris Zbarsky 96697d35fe Bug 1432186 part 10. Remove nsIDOMNode's lastChild attribute. r=mccr8
MozReview-Commit-ID: FhJs1MXAyeO
2018-01-29 23:10:51 -05:00
Boris Zbarsky eb9faa9b79 Bug 1432186 part 6. Remove nsIDOMNode::RemoveChild. r=mccr8
MozReview-Commit-ID: 9ZbIEIRtYPL
2018-01-29 23:10:50 -05:00
Boris Zbarsky abfab07da3 Bug 1432186 part 5. Remove nsIDOMNode's nodeType attribute. r=mccr8
MozReview-Commit-ID: LKsBgKcqtBS
2018-01-29 23:10:50 -05:00
Boris Zbarsky 3b6d43f65c Bug 1432186 part 4. Remove nsIDOMNode's nodeValue attribute. r=mccr8
MozReview-Commit-ID: Aqt4NDjcdKW
2018-01-29 23:10:50 -05:00
Boris Zbarsky c646473558 Bug 1432186 part 3. Remove nsIDOMNode's nodeName attribute. r=mccr8
MozReview-Commit-ID: Jg0Tuvdi6uX
2018-01-29 23:10:50 -05:00
Boris Zbarsky e9880ecc58 Bug 1432186 part 2. Clean up the string handling in HTMLURIRefObject::GetNextURI. r=mccr8
MozReview-Commit-ID: DB3pSrA9ffy
2018-01-29 23:10:50 -05:00
Kris Maglione 6476f95b13 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
2018-01-29 15:20:18 -08:00
Brindusan Cristian af8879d1eb Backed out 2 changesets (bug 1431533) for ESlint failures on a CLOSED TREE
Backed out changeset 6e56f4c8843e (bug 1431533)
Backed out changeset 12fc4dee861c (bug 1431533)
2018-01-30 02:32:43 +02:00
Kris Maglione c276bb9375 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : rebase_source : c004a023389f1f6bf3d2f3efe93c13d423b23ccd
2018-01-29 15:20:18 -08:00
Masayuki Nakano 4b7e512db0 Bug 1433345 - part 4: Make EditorBase derived from nsISelectionListener and notify its owning classes of selection change r=m_kato
This patch makes EditorBase derived from nsISelectionListener.  Then, we can
make IMEContentObserver, TextInputListener, ComposerCommandsUpdater,
TypeInState not derived from nsISelectionListener since EditorBase or
HTMLEditor can notify them of selection change directly.  Additionally,
ResizerSelectionListener is not necessary anymore since it just implements
nsISelectionListener and calls only a method of HTMLEditor.  So, HTMLEditor
can call it directly.

Note that the order of selection listeners may be different.  However,
according to what each selection listener does, changing the order isn't
problem.

MozReview-Commit-ID: 1JXZxQcS0tP

--HG--
extra : rebase_source : c2ebe622a74001ad4e421da492dcdab8e6fe1649
2018-01-26 17:25:45 +09:00
Masayuki Nakano 1ef303c32e Bug 1433345 - part 3: Make HTMLEditor store ResizerSelectionListener directly r=m_kato
This patch makes HTMLEditor store ResizerSelectionListener directly and
make it cycle collectable.  However, in the following patch, this class will
be removed completely because it doesn't necessary if HTMLEditor becomes a
selection listener.

MozReview-Commit-ID: 2iXlTcZdzvj

--HG--
extra : rebase_source : 893a3bbf290eb1752a701d6d8ac284a1630a6fbe
2018-01-26 15:14:04 +09:00
Masayuki Nakano 905d027c8f Bug 1433345 - part 2: Make HTMLEditor store ComposerCommandsUpdater directly r=m_kato
For making ComposerCommandsUpdater not derived from nsISelectionListener,
HTMLEditor needs to store it directly.

This patch also makes ComposerCommandsUpdater cycle collectable because it
stores a strong pointer and HTMLEditor also needs to store it with RefPtr.
Therefore, ComposerCommandsUpdater becomes unnecessary to use nsWeakPtr.

MozReview-Commit-ID: 2WZnLdq15FK

--HG--
extra : rebase_source : 8ee4968e1a63fe88a8276b1f8ce8d145fb9b31ae
2018-01-26 14:38:05 +09:00
Masayuki Nakano 5436129851 Bug 1433345 - part 1: Expose nsComposerCommandsUpdater with renaming it to mozilla::ComposerCOmmandsUpdater r=m_kato
For making HTMLEditor stores it directly, we should expose
nsComposerCommandsUpdater first.  Then, it should be in mozilla namespace.

MozReview-Commit-ID: 8Vhum4Q3WY

--HG--
rename : editor/composer/nsComposerCommandsUpdater.cpp => editor/composer/ComposerCommandsUpdater.cpp
rename : editor/composer/nsComposerCommandsUpdater.h => editor/composer/ComposerCommandsUpdater.h
extra : rebase_source : 3056eeb4aa3dd3426246b74be1e1e18a93a7c33d
2018-01-26 14:06:29 +09:00
Masayuki Nakano e43e597a9e Bug 1433101 - part 2: Treat Enter and Shift+Enter as printable key r=smaug
Chromium dispatches a keypress event when pressing Enter or Shift+Enter.
Actually, when user press them in <pre> element of HTML editor, ツ・n is inserted.
It makes sense to treat the key combinations as inputting text.

MozReview-Commit-ID: Hvx87MZtZkn

--HG--
extra : rebase_source : 196b63843ebcb6e4b398f6b21a4f5f1d020b8db3
2018-01-25 23:59:20 +09:00
Masayuki Nakano 082c64aa0c Bug 1433101 - part 1: Add new pref which disables keypress event for non-printable keys only for the default event group in web content r=smaug
UI Events declares that keypress event should be fired when the keypress event
causes some text input.  However, we're keeping our traditional behavior for
historical reasons because our internal event handlers (including event
handlers of Thunderbird) handles keypress events for any keys.  Therefore,
for minimizing the side effect, we should stop kicking keypress event handlers
in the default event group in web content.

This patch adds new pref for enabling the standard behavior in web content.

Additionally, creates WidgetKeyboardEvent::IsInputtingText() for sharing the
check logic between TextEventDispatcher and TextEditor/HTMLEditor.

MozReview-Commit-ID: 3rtXdLBPeVC

--HG--
extra : rebase_source : 2fc3c9a09840d0d03800c9a42bb83ca76a8db2d5
2018-01-25 23:27:07 +09:00
Masatoshi Kimura f576a03e65 Bug 1433100 - Constify the parameter of HTMLEditor::DoInlineTableEditingAction. r=m_kato
--HG--
extra : source : 9042789502045102cf46b19d0382b0d4c0364377
2018-01-25 22:16:32 +09:00
Makoto Kato ded973c413 Bug 1432715 - Don't use NS_IMETHOD when method doesn't override. r=masayuki
Some methods in HTMLEditor uses NS_IMETHOD that doesn't override.  So we should
replace with nsresult to avoid virtual method.

MozReview-Commit-ID: 7LillLQNhlg

--HG--
extra : rebase_source : 02655cdcf9350caae1fd12dfeb038f82f74aa0f0
2018-01-25 13:31:01 +09:00
Masayuki Nakano 298150d827 Bug 1432528 - part 4: Remove nsIEditorObserver::BeforeEditAction() and nsIEditorObserver::CancelEditAction() because nobody implements them r=m_kato
Now, nobody implements nsIEditorObserver::BeforeEditAction() and
nsIEditorObserver::CancelEditAction().  So, we can remove them.

MozReview-Commit-ID: DYppLayC5oT

--HG--
extra : rebase_source : 196e042234c65a43947a1aa90898901389a3a53b
2018-01-24 14:31:29 +09:00
Masayuki Nakano 7dab388aae Bug 1432528 - part 3: Make EditorBase store IMEContentObserver directly and make it not derived from nsIEditorObserver r=m_kato
Similar to TextInputListener, EditorBase should store IMEContentObserver
directly instead of via nsIEditorObserver.  Then,
EditorBase::NotifyEditorObservers() can call each method directly.
Additionally, we can make IMEContentObserver not derived from nsIEditorObserver.

MozReview-Commit-ID: cNKWJe5eUC

--HG--
extra : rebase_source : 4ed3b3b3180b8ee4a7c514ce1f89eba4dad64fbe
2018-01-24 14:10:18 +09:00
Masayuki Nakano 74aaf9525b Bug 1432528 - part 2: Make EditorBase treat TextInputListener directly and make TextInputListener not derived from nsIEditorObserver r=m_kato
Now, EditorBase can store TextInputListener directly instead of as
nsIEditorObserver.  And then, EditorBase can call its EditAction() method
directly.  Therefore, we can make TextInputListener not derived from
nsIEditorObserver.

MozReview-Commit-ID: 4qPnnvReLKy

--HG--
extra : rebase_source : cde47e245c9856abf696dbaf8e26d8e4d6d98d42
2018-01-24 12:50:01 +09:00
Masayuki Nakano dc245c4fee Bug 1422234 - part 1: HTMLEditRules::ReturnInParagraph() should adjust split point if caret position is positioned at edge of anchor element r=m_kato
When Enter key is pressed at start or end of <a href="foo"> element, we
shouldn't split it (in other words, we shouldn't create empty <a href="foo">
element in new paragraph) because users must not want to keep editing *same*
link in new paragraph in most cases.

This patch adjusts HTMLEditRules::ReturnInParagraph() selection start point
locally when it gets selection.  If caret is at start of an <a href="foo">
element, moves caret to before the element.  If caret is at end of an
<a href="foo"> element, moves to after the element.

MozReview-Commit-ID: 3L3eDzc6Dk

--HG--
extra : rebase_source : dfb22486d2709e84ef7ec1eee3a9bfdef11cbe99
2018-01-23 11:14:37 +09:00
Makoto Kato 70a0912794 Bug 1425547 - Remove unused methods from nsIHTMLInlineTableEditor. r=masayuki
inlineTableEditingEnabled and refreshInlineTableEditingUI are used by
bluegriffon, but other methods aren't used by m-c, c-c and bluegriffon.
So I would like to remove these methods.  Then we can clean up
DoInlineTableEditingAction.

MozReview-Commit-ID: 3R0bJDU5vqv

--HG--
extra : rebase_source : 74c7615613bba65326069929cb53c3ea48f2e9a4
extra : amend_source : a1ac9af3de50daa0cbfd98e2790afa402d9932ef
2018-01-19 16:41:41 +09:00
Dorel Luca 30b5be6d16 Merge mozilla-inbound to mozilla-central r=merge a=merge 2018-01-23 19:46:03 +02:00
Andrea Marchesini b8bb98af8c Bug 1430997 - Rename nsINode::IndexOf to nsINode::ComputeIndexOf, r=catalinb 2018-01-23 14:30:18 +01:00
Masayuki Nakano 92d5c4cdd8 Bug 1430785 - Make mozInlineSpellChecker not derived from nsIEditActionListener r=m_kato
mozInlineSpellChecker listens to only DidSplitNode() and DidJoinNodes().
So, EditorBase should call them directly rather than treating it as an
nsIEditActionListener since its runtime cost becomes really cheaper.

Different from EditorSpellCheck, nobody creates instance of
nsIInlineSpellChecker.  So, we can now stop supporting createInstance() for it
in chrome JS and should do this since EditorBase cannot support multiple
mozInlineSpellChecker instances without nsIEditActionListener interface.
Therefore, this patch removes the entry from factory.

MozReview-Commit-ID: W1CLdsJaaB

--HG--
extra : rebase_source : 2319999e4b1fc8978386c49236d5d24d78d86047
2018-01-17 14:05:06 +09:00
Masayuki Nakano 2020349542 Bug 1430982 - part 10: Make EditorBase store TextServicesDocument for its mInlineSpellChecker for avoiding to run for loops to call nsIEditActionListener methods r=m_kato
Currently, first edit action listener is always TextServicesDocument for
EditorBase::mInlineSpellChecker if spell check is enabled and it requires
only DidDeleteNode() and DidJoinNodes().  So, in most cases, EditorBase
should call only them to avoid running redundant for loops for
nsIEditActionListener methods.

This patch makes that EditorBase::AddEditActionListener() and
RemoveEditActionListener() check whether coming nsIEditActionListener is
TextServicesDocument for mInlineSpellChecker.  If so, EditorBase should
store it as reference to TextServicesDocument.  And when edit action occurs,
its DidDeleteNode() and DidJoinNodes() should be called directly.

Unfortunately, this patch makes TextServiceDocument's maintaining rules
complicated.  However, it must be really rare case to add new edit action
listener because it's really old component.

Note that EditorSpellCheck may be created multiple instances for an editor
from chrome JS.  Therefore, we need to keep TextServicesDocument being
derived from nsIEditActionListener because in such case, TextServicesDocument
for other EditorSpellCheck instances should be supported via
nsIEditActionListener even though such case makes EditorBase slower.

MozReview-Commit-ID: KtlXsBCOzKL

--HG--
extra : rebase_source : 6827ed09a028f2049fd7afba2f5116d092bd14e5
2018-01-18 23:46:03 +09:00
Masayuki Nakano 0c82cf40da Bug 1430982 - part 9: Create accessors for each member of mozSpellChecker, EditorSpellCheck, mozInlineSpellChecker r=m_kato
mozSpellChecker stores TextServicesDocument, EditorSpellCheck stores
mozSpellChecker and mozInlineSpellChecker stores EditorSpellCheck.
So, they should have accessors for their member.  Then, EditorBase can
access all of them.

MozReview-Commit-ID: Igphm8nRqve

--HG--
extra : rebase_source : 0c70bf3e23f16ea6a97b49901f4b1c87e7da6d37
2018-01-18 21:38:50 +09:00
Masayuki Nakano 04e3a3adfc Bug 1430982 - part 8: Make EditorBase store inline spell checker as mozInlineSpellChecker rather than nsIInlineSpellChecker r=m_kato
EditorBase::mInlineSpellChecker is always an instance of mozInlineSpellChecker.
Fortunately, it's easy to expose mozInlineSpellChecker.h.  So, making EditorBase
store it as mozInlineSpellChecker directly, EditorBase can access any of
mozInlineSpellChecker, EditorSpellCheck, mozSpellChecker and
TextServicesDocument with new accessors created by following patch.

MozReview-Commit-ID: 2oyS5tPeQcg

--HG--
extra : rebase_source : a9ce2e4dbceff7ca800d34d60d56eba184298677
2018-01-17 00:52:37 +09:00
Masayuki Nakano 5fe683df20 Bug 1430982 - part 6: Rename nsEditorSpellCheck to mozilla::EditorSpellCheck and expose its header r=m_kato
For making mozInlineSpellChecker stores nsEditorSpellCheck directly, we need
to expose its header file.  For doing that this patch renames the class to
mozilla::EditorSpellCheck and expose it as "mozilla/EditorSpellCheck.h".

MozReview-Commit-ID: 5H66Y2vVshu

--HG--
rename : editor/composer/nsEditorSpellCheck.cpp => editor/composer/EditorSpellCheck.cpp
rename : editor/composer/nsEditorSpellCheck.h => editor/composer/EditorSpellCheck.h
extra : rebase_source : 7940aa136df312cd43bf592df1e71d2ac6c5dec8
2018-01-18 21:01:13 +09:00
Masayuki Nakano e0d185984f Bug 1430982 - part 5: Make nsEditorSpellCheck store mozSpellChecker directly rather than nsISpellChecker r=m_kato
nsEditorSpellCheck::mSpellChecker is always mozSpellChecker because it's
created only by nsEditorSpellCheck.  Additionally, mozSpellChecker.h is
already exposed.  So, nsEditorSpellCheck can store it as mozSpellChecker
directly.

MozReview-Commit-ID: 2vyDe4plncM

--HG--
extra : rebase_source : 847b2f384163450ab44b94bc12ee489633a849b6
2018-01-18 20:06:49 +09:00
Masayuki Nakano 60d2ed05ca Bug 1430982 - part 4: Get rid of nsITextServicesDocument because it used by nobody r=m_kato
nsITextServicesDocument isn't used by anybody now.  So, we can get rid of it.
Additionally, nsITextService and nsTextServicesFactory are not also used by
anybody.  Therefore, this patch removes all of them.

MozReview-Commit-ID: KSbMdm7QPKF

--HG--
extra : rebase_source : 724a5f48ad49b4231bacf7fba32c6a35d90121d0
2018-01-18 18:43:57 +09:00
Masayuki Nakano 21c3b9e2db Bug 1430982 - part 3: Make mozSpellChecker and nsEditorSpellChecker treat TextServicesDocument directly rather than nsITextServicesDocument r=m_kato
Now, TextServicesDocument can be treated by anybody.  So, let's make
mozSpellChecker and nsEditorSpellChecker treat it directly instead of
nsITextServicesDocument.

MozReview-Commit-ID: 2tMy6y3i17b

--HG--
extra : rebase_source : 2e6c79355a5e0a7044fbea989ba414a7bf1a7d8d
2018-01-18 17:32:23 +09:00
Masayuki Nakano fa1d8d7c3f Bug 1430982 - part 2: Rename nsTextServicesDocument to mozilla::TextServicesDocument and expose its header r=m_kato
For making nsTextServicesDocument accessible from anywhere directly, we need to
expose its header.  Then, it should be in mozilla namespace.

This patch renames nsTextServicesDocument to mozilla::TextServicesDocument
and expose the header file as "mozilla/TextServicesDocument.h".

MozReview-Commit-ID: 9PmP73PXSJu

--HG--
rename : editor/txtsvc/nsTextServicesDocument.cpp => editor/txtsvc/TextServicesDocument.cpp
rename : editor/txtsvc/nsTextServicesDocument.h => editor/txtsvc/TextServicesDocument.h
extra : rebase_source : a12081434d0bc002e3675178486cc7f8eaaa3256
2018-01-18 16:57:01 +09:00
Masayuki Nakano 88c945974e Bug 1430982 - part 1: Make nsTextServicesDocument store editor with RefPtr<TextEditor> rather than nsWeakPtr r=m_kato
nsTextServicesDocument stores editor with nsWeakPtr for avoiding circular
reference.  However, both TextEditor and nsTextServicesDocument are cycle
collectable. So, we don't need to worry about the issue and we can simply
make it store with RefPtr<TextEditor>.  Then, we can make EditorBase and
nsTextServicesDocument access each other directly.

MozReview-Commit-ID: 9I4U8ivFlov

--HG--
extra : rebase_source : 4880c6f7d706acc70324f58aee70d4311db44059
2018-01-18 14:33:31 +09:00
Masayuki Nakano 397a47c1b9 Bug 1430319 - Get rid of nsIEditActionListener::Will*() which are not used by anybody r=m_kato
Most nsIEditActionListener::Will*() are not implemented, except
WillDeleteText() and WillDeleteSelection() which are implemented by
FinderHighlighter.  So, we can get rid of the other Will*() from it.

This patch removes a lot of unnecessary virtual calls and copy of strong
pointers to edit action listeners of EditorBase.

MozReview-Commit-ID: EsqI2tZoBG1

--HG--
extra : rebase_source : cf78eb8d33b12ca65177b0676f6e45d02e7c0688
2018-01-13 10:10:05 +09:00
Masayuki Nakano 31d493d9fa Bug 1430021 - part 2: Make HTMLEditRules not derived from nsIEditActionListener r=m_kato
HTMLEditRules implements only some of nsIEditActionListener and this is always
first edit action listener.  So, if we make EditorBase treat HTMLEditRules
directly before notifying edit action listeners, we can save a lot of runtime
cost (virtual calls especially unnecessary, copying array of edit action
listeners with strong pointer, redundant QIs), although the code becomes not
beautiful.

Perhaps, we should do same thing to nsTextServicesDocument and
mozInlineSpellChecker in other bugs.

MozReview-Commit-ID: Eveaxj398f2

--HG--
extra : rebase_source : 0b7b66ba1002e08591e8d95ef68b216e7ce1f93b
2018-01-13 00:21:17 +09:00
Masayuki Nakano b2a3e52b16 Bug 1430021 - part 1: Move |RefPtr<TextEditRules> mRules| from TextEditor to EditorBase r=m_kato
For calling some methods of mRules from EditorBase, let's move mRules member
from TextEditor to EditorBase.

Unfortunately, TextEditRules.h depends on EditAction which is declared in
EditorBase.h and that caused unnecessary include hell of EditorBase.h.  So,
let's move it to an independent header file.

MozReview-Commit-ID: 5HiSZLP9WHH

--HG--
extra : rebase_source : 3e2c40385a6f3d6d1e03ef4e213434383bb37d5f
2018-01-12 19:01:04 +09:00
Boris Zbarsky f1d64479e7 Bug 1431964 part 10. Remove nsIDOMAttr. r=mccr8
MozReview-Commit-ID: xj4QeXBF9V
2018-01-21 12:07:31 -05:00
Boris Zbarsky e38dec29f4 Bug 1431964 part 8. Remove nsIDOMMozNamedAttrMap. r=mccr8
MozReview-Commit-ID: C7z0hcjC0Tg
2018-01-20 20:57:26 -05:00
Boris Zbarsky ac46271e7c Bug 1431964 part 5. Remove nsIDOMMozNamedAttrMap::Item. r=mccr8
MozReview-Commit-ID: GnrOUhx9nTQ
2018-01-20 18:48:36 -05:00
Makoto Kato 5c5237a5a1 Bug 1402526 - Add crashtest. r=me a=test-only 2018-01-15 14:27:45 +09:00
Adrian Wielgosik 3c2cc07d2d Bug 1379891 - remove nsPIEditorTransaction interface, GetTxnDescription methods. r=m_kato,masayuki
MozReview-Commit-ID: 4NLeMrrqIv5
2018-01-14 16:01:41 +01:00
Chris Peterson 37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Cameron McCormack 8731df3c34 Bug 1427512 - Part 29: Remove nsIDOMCSSDeclaration. r=xidorn,jryans,bz
This removes the .style attribute from nsIDOMSVGElement, but there
shouldn't be any users of that.

MozReview-Commit-ID: LOBSFo85Utn
2018-01-11 16:17:57 +08:00
Cameron McCormack 66141a0c03 Bug 1427512 - Part 27: Remove nsIDOMCSSPrimitiveValue. r=xidorn,bz
MozReview-Commit-ID: IcGKAjPWacZ
2018-01-11 16:17:57 +08:00
Cameron McCormack e3549b2d1c Bug 1427512 - Part 22: Remove nsIDOMStyleSheet. r=xidorn,bz
MozReview-Commit-ID: KO2mWX4P8lI
2018-01-11 16:17:57 +08:00
Makoto Kato 3f840ba7f5 Bug 1425652 - mosueDown, mouseUp and mouseMove should be removed from nsIHTMLObjectResizer. r=masayuki
comm-central and bluegriffon don't use mosueDown, mouseUp and mouseMove in
nsIHTMLObjectResizer, so we should remove these methods from this interface.

MozReview-Commit-ID: BnSkkH7f0xc

--HG--
extra : rebase_source : 40811e1a0b714e3ef30fd9ac5e4f840241de3780
2018-01-10 12:47:16 +09:00
Olli Pettay 3a7a79b6b8 Bug 1428747 - Make EditorBase::GetDOMEventTarget() to return EventTarget* and GetFocusedContent() return nsIContent* in order to optimize out some AddRef/Release calls, r=masayuki
--HG--
extra : rebase_source : 86be9af360438fcb1fa63f07994e41cf12d9c2e2
2018-01-09 15:41:42 +02:00
Margareta Eliza Balazs fe2caaa266 Merge inbound to mozilla-central r=merge a=merge 2018-01-09 11:52:55 +02:00
Dão Gottwald d6173b3fbb Bug 449045 - Drop support for type=timed textboxes. r=enn
MozReview-Commit-ID: Ld6foAxCAhW

--HG--
extra : rebase_source : 94065ccfb55e8a93322cd5fbbeabcc78b222bf1a
2018-01-05 21:03:39 +01:00
Makoto Kato 1f169bb35d Bug 1425091 - Part 4. EditorBase::MoveNode should check valid node that has parent node. r=masayuki
AutoMoveNodeSelNotify doesn't allow container is null.  So we should reject
that parent of moving node is null.

MozReview-Commit-ID: DGNCicLJxuK

--HG--
extra : rebase_source : eea203f16d0296c74d0727f34b6ddc5c165f9092
2017-12-15 10:56:45 -06:00
Makoto Kato d438423b79 Bug 1425091 - Part 3. SelAdjCreateNode and SelAdjInsertNode should check whether valid point. r=masayuki
This crashtest case hits assertion in SelAdjInsertNode due to invalid offset
point. So we check whether this is valid.

Also, SelAdjCreateNode and SelAdjInsertNode should use EditorRawDOMPoint to avoid offset calculation and check valid offset.

MozReview-Commit-ID: A1kaKEzc36e

--HG--
extra : rebase_source : c46843fdd6e9e18f49b9cedb008cda6cf3436811
2017-12-15 10:49:53 -06:00
Makoto Kato 2ca662631f Bug 1425091 - Part 2. Add crashtest. r=masayuki
MozReview-Commit-ID: APqtZUv1q6y

--HG--
extra : rebase_source : 80b64a193a322543c6a34041d77fb5445776e902
2017-12-15 10:51:53 -06:00
Makoto Kato 2dbcd1159a Bug 1425091 - Part 1. Should check whether CreateNode is failure. r=masayuki
This crash occurs when CreateNode returns nullptr that is error.  So we should
check whether this method is failure.

MozReview-Commit-ID: 9jDOnEYSurG

--HG--
extra : rebase_source : a7f2f9797267befe99f7f794c524efdf7bf331c0
2017-12-15 11:01:58 -06:00
Makoto Kato e8bfc9ec8b Bug 1428237 - Remove unused nsIHTMLEditor.getHeadContentsAsHTML. r=masayuki
c-c and bluegriffon don't use this method, so let's remove it to clean up.

MozReview-Commit-ID: BC5Ooy2Jlb9

--HG--
extra : rebase_source : 86e49ef864d5c78049673924c385e6cdbd0cb215
2018-01-05 10:59:37 +09:00
Makoto Kato e38403da76 Bug 1427964 - Remove unused methods from CSSEditUtils. r=masayuki
Some methods in CSSEditUtils are unused now, so let's remove it.

MozReview-Commit-ID: H4HiqL6hW9K

--HG--
extra : rebase_source : 80e10ba5e6de5fcc5032dc2e08fa84bf26e80795
2018-01-04 14:27:15 +09:00
Andrea Marchesini 00e79ef07b Bug 1425321 - Renaming nsINode::GetChildAt to GetChildAt_Deprecated, r=catalinb
We want to deprecate nsINode::GetChildAt as the first step of removing DOM node
child array storage. See bug 651120.
2018-01-03 13:59:54 +01:00
Makoto Kato db9f405bd9 Bug 1427060 - PropItem should use nsAtom instead of nsString. r=masayuki
Actually, PopItem uses nsString to store attribute name.  And when using it,
it converts to nsAtom by NS_Atomize and compare by nsString.

To reduce calculation of atom and string compare, we should store atom directly.

MozReview-Commit-ID: 8OB02mgMg1r

--HG--
extra : rebase_source : 9861217804acac52106a89cad75e08bd547080ad
extra : histedit_source : 2b9f01cf29b1b09dd07fc771ff94a06be4d94f31
2017-12-26 12:25:45 +09:00
Masayuki Nakano 18f7821c7b Bug 1425997 - Don't try to remove whitespaces in WSRunObject::ConvertToNBSP() when the text node is changed by mutation observer r=m_kato
WSRunObject::ConvertToNBSP() inserts an NBSP, then, removes following ASCII
whitespaces.  When inserting an NBSP, mutation observer may change the
text node.  In this case, it shouldn't keep working on removing ASCII
whitespaces because it may causes unexpected result.

This patch also renames ConvertToNBSP() and GetAsciiWSBounds() to
InsertNBSPAndRemoveFollowingASCIIWhitespaces() and
GetASCIIWhitespacesBounds() for making their jobs clearer.

MozReview-Commit-ID: TVy9fEKL6p

--HG--
extra : rebase_source : f0bce124055a86caca57334f06c75a46098f69ac
2017-12-21 19:27:31 +09:00
Emilio Cobos Álvarez c8eb630ebe Bug 1423990: Move the last few attribute-related methods outside of nsIContent. r=bz
MozReview-Commit-ID: 8JZuS6O8f8W
2017-12-25 17:50:10 +01:00
Emilio Cobos Álvarez ffdf5d2cb5 Backout changeset e43f568b3e9a (bug 1423990) because some OSX-only code still doesn't build. r=me 2017-12-25 12:55:45 +01:00
Emilio Cobos Álvarez c0959b2955 Bug 1423990: Move the last few attribute-related methods outside of nsIContent. r=bz
MozReview-Commit-ID: 8JZuS6O8f8W

--HG--
extra : rebase_source : 09b82acb4f3d69e8a4345457ab217443bc28d6e2
2017-12-07 19:13:50 +01:00
Masayuki Nakano 17f76b7cd6 Bug 1393337 - Get rid of nsIEditRules r=m_kato
nsIEditRules is a super class of only mozilla::TextEditRules and not scriptable.
So, we can get rid of it.

This patch merges RulesInfo with TextRulesInfo and name new class is RulesInfo
for minimizing the code change.

Additionally, adds two methods AsHTMLEditRules() and its const version.
They make existing cast code safer.

MozReview-Commit-ID: KwWH3ADj3Bv

--HG--
extra : rebase_source : 4517bdc95b530530e9756e07c4b6cce78c002073
2017-12-21 14:52:32 +09:00
Emilio Cobos Álvarez d5196e4079 Bug 1426494: Share more code among Document / ShadowRoot. r=smaug
MozReview-Commit-ID: C4cJrSFPnIb
2017-12-22 01:56:17 +01:00
Masayuki Nakano 7ffbc78e5c Bug 1359396 - Redesign HTMLEditRules::IsEmptyBlock() r=m_kato
HTMLEditRules::IsEmptyBlock() won't return error in most cases.  Additionally,
HTMLEditRules::WillInsertBreak() doesn't check it.  So, just returning bool
is simpler.

MozReview-Commit-ID: 5DfRv7lIyuS

--HG--
extra : rebase_source : 8b430d88a92fd5830a0b9f1bc1d46ac31e45c12c
2017-12-20 22:25:12 +09:00
Masayuki Nakano 240d199f53 Bug 1359405 - Redesign HTMLEditor::IsVisTextNode() r=m_kato
Despite of its name, HTMLEditor::IsVisTextNode() returns true with its out
argument when the given text node is empty.  And although it returns nsresult,
it's almost always NS_OK because it returns error only when the editor isn't
usual condition.

So, it should return bool and true when the given text node is visible.

This patch separates the method.  One is for checking the node with frames,
called IsInVisibleTextFrames().  The other is for checking it only with
its text, called IsVisibleTextNode().

MozReview-Commit-ID: EdQmkOxfNxO

--HG--
extra : rebase_source : ad9d42f6c8a8e17145f0ca92cd5c02994f8a6b37
2017-12-20 15:07:37 +09:00
Masayuki Nakano e376af4b27 Bug 1425412 - part 12: Create factory methods for DeleteRangeTransaction, EditAggregateTransaction and PlaceholderTransaction for consistency with the other transaction classes r=m_kato
Although, we don't need factory methods for DeleteRangeTransaction,
EditAggregateTransaction nor PlaceholderTransaction, for consistency with the
other transaction classes, they should have factory methods for making easier
to write the code.

For not making the performance slow down, they should be inline methods.

MozReview-Commit-ID: 7jl5yZNFYmP

--HG--
extra : rebase_source : 7cd5b5e268a670b3c8855407cc72dec12d34d8ff
2017-12-18 18:08:43 +09:00
Masayuki Nakano 0dd5b5022a Bug 1425412 - part 11: Create factory methods for ChangeStyleTransaction and remove CSSEditUtils::CreateCSSPropertyTxn() r=m_kato
This patch creates factory methods for ChangeStyleTransaction and removes
CSSEditUtils::CreateCSSPropertyTxn().

MozReview-Commit-ID: 1h8ZAj2PP5O

--HG--
extra : rebase_source : 3da3070ad179bac1aadbfc6984b4c2922a052ec0
2017-12-18 17:46:57 +09:00
Masayuki Nakano bbbb83c937 Bug 1425412 - part 10: Create factory methods for AddStyleSheetTransaction and RemoveStyleSheetTransaction, and remove EditorBase::CreateTxnForAddStyleSheet() and EditorBase::CreateTxnForRemoveStyleSheet() r=m_kato
This patch creates factory methods for AddStyleSheetTransaction and
RemoveStyleSheetTransaction, and removes EditorBase::CreateTxnForAddStyleSheet()
and EditorBase::CreateTxnForRemoveStyleSheet() instead.

MozReview-Commit-ID: 6dnZctDtNik

--HG--
extra : rebase_source : 43eaadbde06e4a0b061ea8136e12ffeccfaf5592
2017-12-18 17:29:32 +09:00
Masayuki Nakano 07e48c2f29 Bug 1425412 - part 9: Create factory methods of ChangeAttributeTransaction and remove EditorBase::CreateTxnForSetAttribute() and EditorBase::CreateTxnForRemoveAttribute() r=m_kato
This patch creates two factory methods of ChangeAttributeTransaction.  One is
for setting an attribute to specific value.  The other is for removing an
attribute.  So, EditorBase::CreateTxnForSetAttribute() and
EditorBase::CreateTxnForRemoveAttribute() are unnecessary anymore.

MozReview-Commit-ID: 2fEVd3pDXsf

--HG--
extra : rebase_source : 674005a5b9fc623999a0f51dc8697027970f06c9
2017-12-18 17:07:52 +09:00
Masayuki Nakano f2369df116 Bug 1425412 - part 8: Create JoinNodeTransaction::MaybeCreate() and remove EditorBase::CreateTxnForJoinNode() r=m_kato
EditorBase::CreateTxnForJoinNode() just hides what it does.
For making the caller clearer, let's create a factory method,
JoinNodeTransaction::MaybeCreate().

MozReview-Commit-ID: 8vADXdzMeuV

--HG--
extra : rebase_source : 6a281aff11bfa019c292d26cadd0cd29da12753f
2017-12-15 21:53:08 +09:00
Masayuki Nakano 2b43d139dd Bug 1425412 - part 7: Create SplitNodeTransaction::Create() and remove EditorBase::CreateTxnForSplitNode() r=m_kato
SplitNodeTransaction::Create() just hides what it does.  For making its caller
clearer, let's create a factory method, SplitNodeTransaction::Create().

MozReview-Commit-ID: KDiC8dDrLuQ

--HG--
extra : rebase_source : ac04544e10644b8a73375fb2b786e0bc86eb56ae
2017-12-15 21:37:23 +09:00
Masayuki Nakano 015555162f Bug 1425412 - part 6: Create DeleteNodeTransaction::MaybeCreate() and remove EditorBaseTransaction::CreateTxnForDeleteNode() r=m_kato
EditorBaseTransaction::CreateTxnForDeleteNode() just hides what it does.
Instead, let's create a factory method, DeleteNodeTransaction::MaybeCreate()
for making callers clearer.

MozReview-Commit-ID: 8WUYN0BjKSU

--HG--
extra : rebase_source : e0ff8b8434b720dc124c770cd7371d84b949ca8d
2017-12-15 21:24:33 +09:00
Masayuki Nakano 6b8e286ddc Bug 1425412 - part 5: Create some factory methods of DeleteTextTransaction and remove EditorBase::CreateTxnForDeleteText() and EditorBase::CreateTxnForDeleteCharacter() r=m_kato
DeleteTextTransaction should have 3 factory methods.  One is, simply to create
an instance with a pair of offset and length.  The others are, to create an
instance for deleting a previous or next character at offset.

The former was EditorBase::CreateTxnForDeleteText() and the latter was
EditorBase::CreateTxnForDeleteCharacter(), but this patch creates
DeleteTextTransaction::MaybeCreate() for the former,
DeleteTextTransaction::MaybeCreateForPreviousCharacter() and
DeleteTextTransaction::MaybeCreateForNextCharacter() for the latter.

MozReview-Commit-ID: DFELbmAJDo3

--HG--
extra : rebase_source : 1600984c704b460e1cc09777b81df2906c154cce
2017-12-15 20:43:26 +09:00
Masayuki Nakano a5bd93a76e Bug 1425412 - part 4: Create CompositionTransaction::Create() and remove EditorBase::CreateTxnForComposition() r=m_kato
EditorBase::CreateTxnForComposition() just hides what it does.  For its caller,
creating a factory method, CompositionTransaction::Create(), is clearer what
it does.

Additionally, capsuling the creation in CompositionTransaction class can make
the text node information in TextComposition updated automatically.  So, now,
it might be better to update them in DoTransaction() because there is a lag
between creating the transaction and calling DoTransaction().  However, this
patch doesn't want to change any existing behavior.  So, this doesn't fix this
issue.

MozReview-Commit-ID: K8ci7ytwh1u

--HG--
extra : rebase_source : d468a0fc997c99f78f7eb46451082e7f1e052890
2017-12-15 18:26:37 +09:00
Masayuki Nakano 7443737c19 Bug 1425412 - part 3: Create CreateElementTransaction::Create() and remove EditorBase::CreateTxnForCreateElement() r=m_kato
EditorBase::CreateTxnForCreateElement() just hides what it does. Let's make
the caller what it does with creating CreateElementTransaction::Create().

MozReview-Commit-ID: DYcfQV6KiUZ

--HG--
extra : rebase_source : d3f31b8db92bd3b2af464c66e064dd7b21018960
2017-12-15 17:54:10 +09:00
Masayuki Nakano 1623a99bae Bug 1425412 - part 2: Create InsertNodeTransaction::Create() and remove EditorBase::CreateTxnForInsertNode() r=m_kato
EditorBase::CreateTxnForInsertNode() just hides what it does.  Let's create
InsertNodeTransaction::Create() and make the caller clearer.

MozReview-Commit-ID: 2J2WV73cdsm

--HG--
extra : rebase_source : 15b6391aee5beca4401e7c7a4ee8bf350a7590fd
2017-12-15 17:34:52 +09:00
Masayuki Nakano ab059453f1 Bug 1425412 - part 1: Create InsertTextTransaction::Create() and remove EditorBase::CreateTxnForInsertText() r=m_kato
EditorBase::CreateTxnForInsertText() just hides what it exactly does.

Rewriting it with a static factory method, InsertTextTransaction::Create()
should be clearer for its caller.

MozReview-Commit-ID: Er7Zlhtbnb0

--HG--
extra : rebase_source : 9dc71b3baab839f61153b96806fac5baae5d46cb
2017-12-15 17:26:52 +09:00
Masayuki Nakano 30d3307a79 Bug 1426318 - Get rid of EditorBase::IsContainer(nsIDOMNode*) r=m_kato
The only caller is HTMLEditor::IsEmptyNodeImpl().  So, we can get rid of it.

MozReview-Commit-ID: GTJiXwSCrwM

--HG--
extra : rebase_source : a44b277547d0641f244ff363f5cde8ae44b13eda
2017-12-20 16:18:47 +09:00
Cosmin Sabou 4620ebda6e Backed out 3 changesets (bug 1426494) for build bustages on dom/base/FuzzingFunctions.h:25:44 r=backout on a CLOSED TREE
Backed out changeset 8d07cb1ef232 (bug 1426494)
Backed out changeset 74a8ebb0f5d3 (bug 1426494)
Backed out changeset 07c4aa18a0b6 (bug 1426494)
2017-12-21 03:09:22 +02:00
Emilio Cobos Álvarez 7e7dee971b Bug 1426494: Share more code among Document / ShadowRoot. r=smaug
MozReview-Commit-ID: C4cJrSFPnIb
2017-12-21 00:24:27 +01:00
Makoto Kato 42a03792a6 Bug 1425467 - mInlineEditedCell should be Element. r=masayuki
mInlineEditedCell for inline table editor is still nsIDOMElement.  To avoid QI
and virtual call, we should replace it with Element.

MozReview-Commit-ID: 76yfQJxwm9d

--HG--
extra : rebase_source : e89de17faa20d16a8823e1016b6ba8a6f78993b6
2017-12-15 10:14:54 -06:00
Masayuki Nakano 59ff865ade Bug 1425390 - part 2: Make the constructor of CompositionTransaction take TextComposition to reduce its arguments r=m_kato
Most arguments of the constructor of CompositionTransaction are now stored by
EditorBase::mComposition.  So, making it take TextComposition reduces the
number of its arguments.

Note that this patch doesn't make it retrieve TextComposition with
EditorBase::GetComposition() for guaranteeing that the editor has non-nullptr
mComposition.

MozReview-Commit-ID: 3O5wL52UBUy

--HG--
extra : rebase_source : 7f48465ef3f2f040e8c526fb7837060ecb6c9147
2017-12-15 16:45:41 +09:00
Masayuki Nakano 6e8192fd45 Bug 1425390 - part 1: Move some IME related members of EditorBase into TextComposition r=m_kato
EditorBase stores a text node, offset in it and length in it of composition
string directly.  However, this wastes memory space if user never uses IME
or user only sometimes uses IME.  Additionally, storing all data in
TextComposition is better than current design when other classes like
CompositionTransaction wants some information of both EditorBase and
TextComposition.

This patch moves those 3 members from EditorBase to TextComposition.

MozReview-Commit-ID: 4N7wmGGfxmt

--HG--
extra : rebase_source : bd7cb37fe9631b959ec21da40c20751fec269dca
2017-12-15 13:14:51 +09:00
Jonathan Kew 1a613e00cb Bug 1424898 - patch 2 - De-virtualize nsIWordBreaker and rename to mozilla::intl::WordBreaker. r=m_kato
--HG--
rename : intl/lwbrk/nsSampleWordBreaker.cpp => intl/lwbrk/WordBreaker.cpp
rename : intl/lwbrk/nsIWordBreaker.h => intl/lwbrk/WordBreaker.h
2017-12-13 22:17:38 -06:00
Jonathan Kew 574a922078 Bug 1424898 - patch 1 - De-virtualize nsILineBreaker and rename to mozilla::intl::LineBreaker. r=m_kato
--HG--
rename : intl/lwbrk/nsJISx4051LineBreaker.cpp => intl/lwbrk/LineBreaker.cpp
rename : intl/lwbrk/nsILineBreaker.h => intl/lwbrk/LineBreaker.h
2017-12-13 22:17:32 -06:00
Makoto Kato 75dffc067d Bug 1424677 - Don't use wstring for nsIEditorSpellCheck. r=masayuki
nsIEditorSpellCheck still uses wstring.  We should replace it with AString
to avoid additional memory allocation.

MozReview-Commit-ID: H4jKY2tylqg

--HG--
extra : rebase_source : c1f0325eb2efbfb07f53514b96121a5ceb58efd4
2017-12-13 04:14:27 -06:00
Masayuki Nakano 510e325f07 Bug 1424676 - part 3: Redesign HTMLEditRules::StandardBreakImpl() with |const EditorDOMPoint&| r=m_kato
HTMLEditRules::StandardBreakImpl() should take |const EditorDOMPoint&| to
specify where a new <br> element inserted before.

Additionally, we should rename it to InsertBRElement().

MozReview-Commit-ID: 4BR7xGFFrpk

--HG--
extra : rebase_source : 873af2c4167227a570878fe03d6dec61dffe9528
2017-12-11 18:28:46 +09:00
Masayuki Nakano ddf72056f7 Bug 1424676 - part 2: Redesign TextEditRules::CreateBR(), TextEditRules::CreateMozBR() and TextEditRules::CreateBRInternal() with |const EditorRawDOMPoint&| r=m_kato
TextEditRules has some wrappers of TextEditor::CreateBR().  Also they should
take |const EditorRawDOMPoint&| to specify the insertion point of new <br>
element.

Additionally, this patch makes them just return add-refed Element instead of
nsresult.  So, we can get rid of out param from it.

MozReview-Commit-ID: 3wfKGaTM89c

--HG--
extra : rebase_source : 47f0d89bc16f0858c7141b2035164adb9105493c
2017-12-11 16:37:10 +09:00
Masayuki Nakano 315b823d03 Bug 1424676 - part 1: Make TextEditor::CreateBR() take |const EditorRawDOMPoint&| to specify the insertion point r=m_kato
TextEditor::CreateBR() should take |const EditorRawDOMPoint&| to specify the
insertion point instead of a set of container node and offset in it.

MozReview-Commit-ID: 4PrWzwmIgfD

--HG--
extra : rebase_source : c509907002693f3b77cd00bf77cfd0f26704fd65
2017-12-11 16:01:50 +09:00
Masayuki Nakano 6b577ea0fa Bug 1423835 - part 3: Rename EditorDOMPointBase::GetChildAtOffset() to EditorDOMPointBase::GetChild() r=m_kato
Different from RangeBoundaryBase, EditorDOMPointBase can store only child node.
I.e., mOffset may be invalid until its Offset() is called.  So,
GetChildAtOffset() isn't good name.  It should be just GetChild().

Similarly, GetNextSiblingOfChildAtOffset() and
GetPreviousSiblingOfChildAtOffset() should be renamed to GetNextSiblingOfChild()
and GetPreviousSiblingOfChild().

MozReview-Commit-ID: WpkPmDwkrL

--HG--
extra : rebase_source : 2be1fcbee129f4c96e9b166be5a924845340708f
2017-12-07 19:08:56 +09:00
Masayuki Nakano dacd109e2f Bug 1423835 - part 2: Rename EditorDOMPointBase::Container() to EditorDOMPointBase::GetContainer() and add some useful methods to access its container r=m_kato
EditorDOMPointBase::Container() may return nullptr.  So, it should be renamed
to GetContainer().

Then, the method name becomes longer and a lot of callers access the result
directly.  So, there should be following methods to make the callers shorter:

- GetContainerAsContent() to return the container as nsIContent*.
- GetContainerAsElement() to return the container as dom::Element*.
- GetContainerAsText() to return the container as dom::Text.
- GetContainerAsDOMNode() to return the container as nsIDOMNode*.
- CanContainerHaveChildren() to check if the container can have child nodes.
- IsInDataNode() to check if the point is in a data node including text node.
- IsInTextNode() to check if the point is in a text node.
- IsContainerHTMLElement() to check if the container is specific HTML element.
- IsContainerAnyOfHTMLElements() to check if the container is one of the
  specified HTML elements.

MozReview-Commit-ID: LkN2WBbCPj0

--HG--
extra : rebase_source : 9da1e70d4c74f7ad573e244cf6c7b21a0c7b4410
2017-12-07 18:45:52 +09:00
Masayuki Nakano d95c27869d Bug 1423835 - part 1: Add EditorDOMPointBase::SetToEndOf() to initialize the instance at end of container node r=m_kato
Editor code sometimes sets a DOM point to end of a node.  In this case, we
need to write |Set(node, node->Length())|.  So, it should have
|void SetToEndOf(const nsINode* aContainer)| for making meaning of the code
clearer.

MozReview-Commit-ID: 91shMCD2d84

--HG--
extra : rebase_source : 3401af50aabc1b677deeae664e8c56506182d28c
2017-12-07 17:27:20 +09:00
Masayuki Nakano ed66480149 Bug 1423097 - part 3: Fix new orange caused by an existing bug of EditorBase::DeleteSelectionAndCreateElement() r=m_kato
Even after EditorBase::DeleteSelectionAndCreateElement() creates a new element,
it tries to collapse selection with |pointToInsert| which is outdated after
inserting new element.

So, it should recompute the caret position with new DOM tree.

MozReview-Commit-ID: DKh2uhItIol

--HG--
extra : rebase_source : c0c30e1c809784af64e87596b471c472350857a8
2017-12-07 13:57:35 +09:00
Masayuki Nakano bab72d08e8 Bug 1423097 - part 2: Add overloads of nsRange::SetStart(), nsRange::SetEnd(), nsRange::IsPointInRange() and nsRange::ComparePoint() to use them with RawRangeBoundary r=smaug
nsRange::SetStart(), nsRange::SetEnd(), nsRange::IsPointInRange() and
nsRange::ComparePoint() take a set of container node and offset in it to
specifying a DOM point.  However, the caller may not have computed the offset
but may know the child node at the point.  In such case, they can avoid
computing the offset with nsINode::IndexOf() if they have overloads which
take RawRangeBoundary.

Therefore, this patch implements the overloads and changes the callers in
editor.

MozReview-Commit-ID: E4DLbAgTTCI

--HG--
extra : rebase_source : 8d1632a030f1e0a0dd2b81c3996c19d427e8b0bd
2017-12-05 17:50:13 +09:00
Masayuki Nakano 0021ffcddf Bug 1423097 - part 1: Implement Selection::AnchorRef() and Selection::FocusRef() r=smaug
Some methods of editor retrieves anchor and focus of selection.  However, there
are no methods which directly access RangeBoundary of anchor and focus.

This patch adds it for making editor code simpler and avoiding unnecessary
child offset computation.

MozReview-Commit-ID: EvepQpFMi8S

--HG--
extra : rebase_source : 38f3c506db5c9d8790bbd625d552bfbc8d99cebc
2017-12-05 16:36:57 +09:00
Masayuki Nakano d942210f2e Bug 1408125 - part 5: Redesign HTMLEditor::NormalizeEOLInsertPosition() with EditorRawDOMPoint r=m_kato
HTMLEditor::NormalizeEOLInsertPosition() takes a set of container node and
offset in it for specifying insertion point.  So, this should be replaced
with |const EditorRawDOMPoint&| and it should return |EditorDOMPoint| rather
than modifying the argument.

Additionally, perhaps, GetBetterInsertionPointFor() is better name for it.

MozReview-Commit-ID: IB1FhrkzK2G

--HG--
extra : rebase_source : 55f8c1d9fa1f149e81114c929f6e6232aba03905
2017-12-05 15:36:49 +09:00
Masayuki Nakano 36d48397f0 Bug 1408125 - part 4: Redesign HTMLEditor::InsertNodeAtPoint() with EditorRawDOMPoint r=m_kato
HTMLEditor::InsertNodeAtPoint() should take |const EditorRawDOMPoint&| as
an argument which specifies point to insert.  Additionally, it should take
|EditorDOMPoint*| to return the next point of actual insertion point.

Additionally, this patch renames it to InsertNodeAtProperAncestor() for
explaining what it will do.

MozReview-Commit-ID: HYUzSlyPxAd

--HG--
extra : rebase_source : 57033cdc4458b45a5fe9d6aa642c185133a79304
2017-11-28 22:28:07 +09:00
Masayuki Nakano f6e37d5fe3 Bug 1408125 - part 3: Redesign nsIEditActionListener::(Will|Did)InsertNode() r=m_kato
Although nsIEditActionListener::WillInsertNode() nobody implements actually,
we should remove it in a follow up bug.

nsIEditActionListener::DidInsertNode() is implemented only by HTMLEditRules.
So, if we make it not use nsIEditActionListener, we can remove it too.
However, keep it for now.

On the other hand, they don't need to receive index of the insertion point.
WillInsertNode() needs next sibling of the insert point, but DidInsertNode()
needs nothing because listener can compute it with new inserted node.

MozReview-Commit-ID: GiTKkVyZJlN

--HG--
extra : rebase_source : 9ee38c28217d25d1a3f79b0b458c7b2121350a76
2017-11-28 21:26:10 +09:00
Masayuki Nakano 8496023596 Bug 1408125 - part 2: EditorBase::CreateTxnForInsertNode() and EditorBase::InsertNode() should take |const EditorRawDOMPoint&| as an argument specifying point to insert r=m_kato
EditorBase::CreateTxnForInsertNode() and EditorBase::InsertNode() should take
|const EditorRawDOMPoint&| as an argument specifying point to insert.

MozReview-Commit-ID: KhK19xS7wXb

--HG--
extra : rebase_source : f7b08b7d049eef8a9c03ee681e53e8d469915b15
2017-11-22 21:25:05 +09:00
Masayuki Nakano 2e842218a1 Bug 1408125 - part 1: Make InsertNodeTransaction use EditorRawDOMPoint and RangeBoundary instead of pair of container node and offset in it r=m_kato
Like CreateNodeTransaction, InsertNodeTransaction should use EditorRawDOMPoint
for temporary variable and arguments of its methods and should use RangeBoudary
to store it as its member.

MozReview-Commit-ID: FCGY8x97egb

--HG--
extra : rebase_source : bd5ce45944b8b367afc9b782e881727061d83035
2017-11-22 17:29:22 +09:00
Sylvestre Ledru 9bfe27d903 Bug 1394734 - Replace CONFIG['GNU_C*'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 7duJk2gSd4m

--HG--
extra : rebase_source : 7312fe276e561e8c034a5f6749774ae812727f9c
2017-12-07 22:09:15 +01:00
Neil Deakin 60e7f4183f Bug 1419925, implement a promise-oriented version of waitForClipboard, promiseClipboardChange, change a selection of tests to use this instead. Simplify some other clipboard tests that were unreliable before the fix for 1394757. r=jmaher 2017-12-07 08:39:50 -05:00
Emilio Cobos Álvarez 74b31155f7 Bug 1423167: Move most attribute-related methods from nsIContent to Element. r=bz
MozReview-Commit-ID: 6WXqNiODttD
2017-12-06 16:05:59 +01:00
Masayuki Nakano 0b2f749b62 Bug 1422668 - Back out changes of RangeBoundary.h which were added for EditorDOMPoint r=catalinb
EditorDOMPoint was a subclass of RangeBoundary.  Therefore, for heavy
use of it in editor, we've implemented a lot of complicated feature
into RangeBoundary.  However, EditorDOMPoint stopped inheriting
RangeBoundary.  So, we can get simple RangeBoundary implementation
back now.

This patch makes RangeBoundary.h almost same as 3f7cbec2446b except
keeps implementing GetPreviousSiblingOfChildAtOffset() and
GetNextSiblingOfChildAtOffset() because the former is used by
Selection and both of them are simple.  And also keeps making it
a friend of EditorDOMPoint because EditorDOMPoint still needs to
copy to/from RangeBoundary.

MozReview-Commit-ID: Hr5SA52ScK0

--HG--
extra : rebase_source : a00a46ff931a5c4fcabf910510fa448b513f50c5
2017-12-04 16:28:50 +09:00
Masayuki Nakano 32f2446662 Bug 1408227 - part 6: WSRunObject::CheckTrailingNBSP() should take |const EditorRawDOMPoint&| instead of a set of container node and offset in it r=m_kato
The name, WSRunObject::CheckTrailingNBSP(), is unclear what it does.  It
replaces previous character of specified point with ASCII space if it is NBSP
and it's not necessary.

So, it should be renamed to ReplacePreviousNBSPIfUnncessary().

Additionally, it should take |const EditorRawDOMPoint&| instead of a set of
container node and offset in it.

MozReview-Commit-ID: 2vq46OiAzo6

--HG--
extra : rebase_source : 132bb71361ff1e60268863cd4ef86bfbd0ddc9d1
2017-11-22 02:45:08 +09:00
Masayuki Nakano b75f048daa Bug 1408227 - part 5: Redesign GetCharAfter(), GetCharBefore(), GetWSPointAfter() and GetWSPointBefore() of WSRunObject r=m_kato
WSRunObject::GetChar(After|Before)(nsINode*, int32_t) returns next/previous
character's DOM point as WSPoint.  If the container node is a text node in
mNodeArray, it calls WSRunObject::GetChar(After|Before)(const WSPoint&) which
returns next/previous offset if the point isn't end/start of the text node.
If the point is at end/start of the text node, it returns start/end of
next/previous text node in mNodeArray.  If the container node is not a text
node in mNodeArray, it calls WSRunObject::GetWSPoint(After|Before)().  It looks
for next/previous text node in mNodeArray from the point.  Then, it calls
WSRunObject::GetChar(After|Before)(const WSPoint&) and returns the result.

So, we should rename GetCharAfter() to GetNextCharPoint(), GetCharBefore() to
GetPreviousCharPoint(), GetWSPointAfter() to GetNextCharPointInternal() and
GetWSPointBefore() to GetPreviousCharPointInternal().

Then, they should take |const EditorRawDOMPoint&| instead of a set of container
node and offset in it.

So, looks like that "WS"RunObject is not good name for this class, perhaps,
AutoTextRunManager or something? But I'm still not sure.

MozReview-Commit-ID: 85cX3MdlFwz

--HG--
extra : rebase_source : 217dbb75653bf2a4c593fb9a0498824b1b764cf4
2017-11-22 02:12:27 +09:00
Masayuki Nakano d5a3f638a3 Bug 1408227 - part 4: WSRunObject::DeleteChars() should take two |const EditorRawDOMPoint&| arguments to specify a range to remove r=m_kato
WSRunObject::DeleteChars() should take two |const EditorRawDOMPoint&| arguments
to represent a range to remove.

Additionally, this renames it to DeleteRange() because it also removes any
nodes in the range.  So, "Chars" isn't good word for this method's name.

MozReview-Commit-ID: 5Dmxnia1JPO

--HG--
extra : rebase_source : a4fd44c9354762db0e37fa156790dc20fdbe23a1
2017-11-22 01:00:35 +09:00
Masayuki Nakano 304f2a7e0f Bug 1408227 - part 3: Redesign WSRunObject::FindRun() with EditorRawDOMPoint r=m_kato
WSRunObject::FindRun() finds the nearest run from aPoint to specified direction.
So, it uses nsContentUtils::ComparePoints() a lot.  Therefore, it should use
an overload which takes RawRangeBoundary.  Although, it's not optimized for
RawRangeBoundary, but if it'd be optimized, this method becomes faster.

And this patch renames it to FindNearestRun().

MozReview-Commit-ID: 2NkR5E1st6d

--HG--
extra : rebase_source : 387ecc9d483c7cd88306197391fc2940b2000e28
2017-11-21 19:03:03 +09:00
Masayuki Nakano 3ad91ac0fd Bug 1408227 - part 2: WSRunObject::InsertBreak() should take |const EditorRawDOMPoint&| as an argument r=m_kato
WSRunObject::InsertBreak() should take |const EditorRawDOMPoint&| instead of
a pair of container node and offset in it.

MozReview-Commit-ID: 38OAn4dvR7x

--HG--
extra : rebase_source : 8e48ba2cec07c1dd4daf3cd9ec44751c860bc3da
2017-11-21 18:12:12 +09:00
Masayuki Nakano 7c6b57669f Bug 1408227 - part 1: TextEditor::CreateBRImpl() should take |const EditorRawDOMPoint&| for insertion point of new <br> element r=m_kato
TextEditor::CreateBRImpl() should take |const EditorRawDOMPoint&| as insertion
point of new <br> element.  Additionally, it doesn't need to have out argument
for the point of after <br> element because callers can get it with
EditorRawDOMPoint(nsINode*) and the new <br> node, and calling AdvanceOffset().
This cost must be enough cheap.

MozReview-Commit-ID: Hxawz3D2dCd

--HG--
extra : rebase_source : 866ff50efd70499ed733da9efcce7399f44bd4a0
2017-11-21 14:38:19 +09:00
Masayuki Nakano 5c35d9705d Bug 1421504 - EditorBase should move children carefully r=m_kato
While moving children of a container to another container, mutation observer
may move children before moving and/or move node immediately after the
insertion point.  Therefore, EditorBase should store all children which
should be moved with a local variable.  Then, move one by one carefully.
E.g., if a child before being moved is moved to different container, it
shouldn't be moved because JS already handles it as expected for the web
app.  If next sibling of the insertion point has been moved, EditorBase
should stop moving the remaining children because it may move children to
odd position and it may cause dataloss.

This patch creates EditorBase::MoveChildren() and it moves children carefully
with above checks.  Additionally, making its callers simpler, this patch also
creates EditorBase::MovePreviousSiblings() and MoveAllChildren().

MozReview-Commit-ID: FJDdSqXIlqD

--HG--
extra : rebase_source : 54bded29dbbd9547339a2c6e1a1264e22fbdc740
2017-11-29 17:57:00 +09:00
Makoto Kato 99a7861946 Bug 1421553 - Part 2. Remove nsIDOMRange usages from nsTextServicesDocument. r=masayuki
nsITextServicesDocument isn't scriptable, so there is no reason to use
nsIDOMRange.

MozReview-Commit-ID: AVPgrwmz38H

--HG--
extra : rebase_source : 0cb03cdb9b0dc4ef85b1b5582b7e3a54cb002904
2017-11-29 17:55:12 +09:00
Makoto Kato fcf9456236 Bug 1421553 - Part 1. OffsetEntry should use nsINode instead of nsIDOMNode. r=masayuki
nsTextServicesDocument still use nsIDOMNode, so we should replace with nsINode
to reduce QI.

MozReview-Commit-ID: 7G9w31dRFi9

--HG--
extra : rebase_source : 322ae89f42183fe780b408f2ceb1c6d699ade985
2017-11-29 17:54:30 +09:00
Brindusan Cristian 6a74eec204 Merge inbound to mozilla-central r=merge a=merge 2017-12-01 00:22:25 +02:00
Olli Pettay af3373dc1d Bug 1418002 - Remove HTMLContentElement, r=jessica 2017-11-30 10:57:15 +02:00
Edgar Chen d9305463a9 Bug 1421561 - Use IgnoredErrorResult in TextEditRules::WillInsertText(); r=masayuki
MozReview-Commit-ID: 5LV5lVEWKO1

--HG--
extra : rebase_source : 75a434db4d01ce3e82f27ab73017ccc0653af08f
2017-11-29 17:09:53 +08:00
Masayuki Nakano f989a6c4d5 Bug 1419745 - part 3: CreateElementTransaction and SplitNodeTransaction should store DOM point with EditorDOMPoint rather than RangeBoundary r=m_kato
CreateElementTransaction and SplitNodeTransaction store DOM point with
RangeBoundary now.  However, it refers next child of referring point.
Therefore, if it's moved to different container or removed from the DOM
tree, they cannot do undo/redo.  We can say for the child node, however,
it doesn't make sense depending on a node which is not directly referring.

MozReview-Commit-ID: Baohbub3RNZ

--HG--
extra : rebase_source : 6776420271cdaf91aae6213fb6e1bcf1841112b1
2017-11-28 17:13:15 +09:00
Masayuki Nakano 83d8db0fdc Bug 1419745 - part 2: Make EditorDOMPointBase store child node at offset instead of previous sibling of child node at offset r=m_kato
EditorDOMPointBase should store child node at offset directly rather than
previous sibling of child node at offset because if referring child node or
its previous sibling is moved to different DOM point,
EditorDOMPointBase::GetChildAtOffset() may return different node.  However,
users of this class assumes that after it stores child node at offset, it'll
return same node.

So, EditorDOMPointBase should store child node instead of "ref".  Additionally,
when it stores nullptr as the child, it should set mOffset to length of the
mContainer because it means it refers after the last child.

MozReview-Commit-ID: 7ZdkwKLJEjo

--HG--
extra : rebase_source : c2a0a1be1285466e5fa96162779e86c37ae78655
2017-11-23 04:09:00 +09:00
Masayuki Nakano 1bb0ec153d Bug 1419745 - part 1: Make EditorDOMPointBase not a sub class of RangeBoundaryBase and duplicate methods of RangeBoundaryBase into EditorDOMPointBase r=m_kato
EditorDOMPointBase should store child at offset for editor uses.  E.g., when
editor wants to refer a node as child node of an EditorDOMPoint instance,
even if the node is unexpectedly moved to different container, editor wants
to keep referring the child node rather than its previous sibling.

Therefore this patch makes EditorDOMPointBase not a sub class of
RangeBoundaryBase but copying all methods and members of RangeBoundaryBase
into EditorDOMPointBase for keeping current behavior completely.

MozReview-Commit-ID: LIyPFkCfsZ9

--HG--
extra : rebase_source : fd76c4808625f8f8a86f7b4e4c1ac22fbdc11dd5
2017-11-23 00:15:29 +09:00
Emilio Cobos Álvarez ec75854b21 Bug 1035091: Disable @-moz-document on author sheets on nightly and early beta. r=xidorn
MozReview-Commit-ID: AAUs1jJifjS

--HG--
extra : rebase_source : b3334ff237e66fd75ef87aa92c4c9a56fef2119f
2017-11-29 22:16:46 +01:00
Masayuki Nakano 09957e4f47 Bug 1421877 - Fix some warnings which hit (almost) always in EditorDOMPointBase r=m_kato
There are 3 spam warning assertion in EditorDOMPointBase.

One is in constructor. Which warns if IsSet() returns false, but it checks
before finishing initializing.

The others are in IsStartOfContainer() and IsEndOfContainer().  They try to
check if mOffset is valid value with current DOM tree if it's initialized
when it's at start or end of the container.  However, they do it even when
it's not start nor end of the container.

This patch fixes those spammers.

MozReview-Commit-ID: DvFa501m9V0

--HG--
extra : rebase_source : c97ac371054a54eabc07b3ec726b924d6be61e25
2017-11-30 13:21:12 +09:00
Makoto Kato 7f97c4e179 Bug 1408829 - Make spellCheckAfterEditorChange as noscript. r=masayuki
No one uses nsIInlineSpellChecker.spellCheckAfterEditorChange from script.
So I think we can mark this interface as noscript.

Since this method is scriptable, we need QI to get nsIDOMNode.  If we can
change to noscript, it can reduce QI to get nsIDOMNode.

MozReview-Commit-ID: GC0WuFyTlaZ

--HG--
extra : rebase_source : 16ca9fc548e86747ac17407be48295c709174fb5
2017-11-29 18:00:11 +09:00
Makoto Kato 90bfbaba4c Bug 1416080 - Part 2. CreateMozBR should use native dom node. r=masayuki
Part 1. moves native dom method of CreateBR, so we should use it for
CreateMozBR, and use native dom as parameter.

MozReview-Commit-ID: DHUB88HfowQ

--HG--
extra : rebase_source : 00fefd12b50bef0f1a9bd69e1b7992a19999d42f
2017-11-27 15:05:04 +09:00
Makoto Kato 71d57c8182 Bug 1416080 - Part 1. Move all CreateBR methods to TextEditor. r=masayuki
One of CreateBR is still virtual method, but it is unnecessary to use it.
So we should remove virtual keyword and remove override method.

Also, we should move native dom version of CreateBR to TextEditor to use it
on TextEdtitor.

MozReview-Commit-ID: GCazJtY4urV

--HG--
extra : rebase_source : 8e0d71631f0070a928bc0f4817dd6efe7c833f1b
2017-11-27 15:01:11 +09:00
Masayuki Nakano 32d89118c3 Bug 1420415 - TextEditor::CreateBRImpl() needs to make pointToInsertBrNode store mOffset before calling EditorBase::CreateNode() r=m_kato
When TextEditor::CreateBRImpl() splits a text node before inserting new <br>
element, it initializes pointToInsertBrNode only with the right text node.
Then, it refers its Offset() after inserting new <br> node before the point.
Therefore, the offset is computed with the new DOM tree.  So, adding 1 to
the offset is redundant only in this case.

So, before calling CreateNode(), it needs to make pointToInsertBrNode store
offset with calling its Offset().

Note that this ugly code will be replaced with patches for bug 1408227.
Additionally, this doesn't use AutoEditorDOMPointChildInvalidator because
it's not available in 58 but we need to uplift this patch.

Finally, I'm not sure how to check this in automated tests.  Therefore, this
patch doesn't include automated tests.

MozReview-Commit-ID: IaQBonoGawR

--HG--
extra : rebase_source : a89559932f27d98a02baf3e207c6be3c2a545aad
2017-11-24 23:17:38 +09:00
Masayuki Nakano c06378ebc9 Bug 1413181 - part 13: HTMLEditRules::MaybeSplitAncestorsForInsert() should be able to return a DOM point in text node r=m_kato
HTMLEditRules::MaybeSplitAncestorsForInsert() may be called with a point in a
text and it needs to return given split point as is.  Additionally, the given
point may be in a text node.  So, it may not be represented with an
nsCOMPtr<nsIContent>.

Therefore, we need to add new member, EditorDOMPoint, to SplitNodeResult and
when MaybeSplitAncestorsForInsert() needs to return the given point as is,
it should use it.

Note that if the methods which return SplitNodeResult split some nodes actually,
the left node and/or the right node may be removed from the DOM tree.  In this
case, EditorDOMPoint cannot store such orphan node.  Therefore, we cannot
make mNextNode nor mPreviousNode EditorDOMPoint.

MozReview-Commit-ID: LwH8RZzkrmT

--HG--
extra : rebase_source : a5ae2328bef3d887c0bf4e1b9c4a4247b93a4ac0
2017-11-19 11:05:26 +09:00
Masayuki Nakano 7537ae3755 Bug 1413181 - part 12: Redesign and rename HTMLEditRules::SplitAsNeeded() r=m_kato
Now, we can make HTMLEditRules::SplitAsNeeded() use |SplitNodeResult| as its
result and |const EditorRawDOMPoint&| as specifying start of the deepest right
node.  Then, the implementation becomes simpler.

And I think that we should rename it to MaybeSplitAncestorsForInsert().

Additionally, this patch makes it stop calling
EditorBase::IsDescendantOfEditorRoot() and HTMLEditor::GetActiveEditingHost()
because they are really expensive.  Instead, it should check if the given start
point of the deepest right node is in active editing host before the loop and
if the loop reaches editing host.

MozReview-Commit-ID: KKpj5uyT2J

--HG--
extra : rebase_source : 0c9e9e9e28505b0fb5752e1cd4d42f64d22af3e7
2017-11-17 16:03:11 +09:00
Masayuki Nakano 02038d75da Bug 1413181 - part 11: Create AutoEditorDOMPointOffsetInvalidator stack class for automatically invalidate offset of EditorDOMPoint r=m_kato
In the following patch, we need to invalidate offset a lot of places after
splitting nodes.  Therefore, there should be a helper stack class before that.

MozReview-Commit-ID: BgijAU7OizU

--HG--
extra : rebase_source : 520f29dacdffe5f7137ba7f11b289241b5fbface
2017-11-17 17:00:56 +09:00
Masayuki Nakano 419273aff1 Bug 1413181 - part 10: Redesign EditorBase::SplitNodeDeep() r=m_kato
First of all, this patches fixes a bug of EditorBase::CreateNode().  It takes
|EditorRawDOMPoint&| but it should be |const EditorRawDOMPoint&| for making
callers can specify temporary instances.

Next, this patch creates |SplitNodeResult| stack class for result of
EditorBase::SplitNodeDeep().  SplitNodeDeep() needs to return previous node
and next node of split point.  They are called as left node and right node,
but these calls are really different term usage.  Therefore, this patch names:

aOutLeftNode -> SplitNodeResult::GetPreviousNode()
aOutRightNode -> SplitNodeResult::GetNextNode()

and also declares SplitNodeResult::GetLeftNode() and
SplitNodeResult::GetRightNode() which are same meaning as left/right node of
other splitting methods.

Additionally, of course, this patch makes SplitNodeDeep() use
|const EditorRawDOMPoint&| to receive the start point of right node.

MozReview-Commit-ID: FnJpeKgtzm4

--HG--
extra : rebase_source : 3829e5528ef837b13fed305e0df1dbbf00e02a07
2017-11-16 12:09:57 +09:00
Masayuki Nakano f9e1aa29a0 Bug 1413181 - part 9: Make EditorBase::SplitNodeDeep() use EditorDOMPoint in the loop r=m_kato
Make the loop in EditorBase::SplitNodeDeep() use EditorDOMPoint for making the
code simpler.

MozReview-Commit-ID: 3do3rWV4eIh

--HG--
extra : rebase_source : 480a5b5b133d8a735bda6ddec07e4edf9ef34035
2017-11-13 16:44:58 +09:00
Masayuki Nakano ebd9a98d13 Bug 1413181 - part 8: Merge two if blocks in the loop of EditorBase::SplitNodeDeep() r=m_kato
Now, we can merge two if blocks in the loop of EditorBase::SplitNodeDeep() and
get rid of |didSplit| variable.

MozReview-Commit-ID: LJZHF6x2GLR

--HG--
extra : rebase_source : 5f58508f6fc0928236252670c85383a13200fc2c
2017-11-13 15:51:56 +09:00
Masayuki Nakano d8cfeab3e4 Bug 1413181 - part 7: EditorBase::SplitNodeDeep() should stop splitting orphan node if it meets an orphan node before meeting the most ancestor node to be split r=m_kato
This doesn't change any meaning of the loop.

It is a bug if the loop meets orphan node before meeting the most ancestor
node to be split which is given as aNode.  So, we can check it before trying
to split it.

MozReview-Commit-ID: 1TD7WHCoZh1

--HG--
extra : rebase_source : 17b8d7b3db458e29fb52be5cedb900560e1b70a4
2017-11-13 15:38:23 +09:00
Masayuki Nakano bf54c638b2 Bug 1413181 - part 6: Rename mozilla::EditorBase::EmptyContainers enum class to mozilla::SplitAtEdges for making its values clearer r=m_kato
EmptyContainers::yes and EmptyContainers::no are not so clear name what they
mean.

They means whether NodeSplitDeep() creates or won't create empty nodes when
split point is at start edge or end edge of an element.

This patch renames them to SplitAtEdges::eDoNotCreateEmptyContainer and
SplitAtEdges::eAllowToCreateEmptyContainer and make
HTMLEditor::InsertNodeAtPoint() use it instead of an bool argument.

Additionally, the argument of NodeSplitDeep() is now not optional because
this difference is really important when you read around the callers.

MozReview-Commit-ID: 9hpMRkVDvCg

--HG--
extra : rebase_source : ee892361d66c9c9c5ed45ee9d3321474257ac417
2017-11-13 14:35:16 +09:00
Masayuki Nakano d94b3f0152 Bug 1413181 - part 5: HTMLEditRules::SplitParagraph() should take EditorRawDOMPoint instead of a set of container node and offset r=m_kato
Although, we need to make WSRunObject::PrepareToSplitAcrossBlocks() in
another bug, we should do it now for making HTMLEditRules::ReturnInParagraph()
implementation simpler.

MozReview-Commit-ID: AoMYqAEgCaV

--HG--
extra : rebase_source : cdfb16379f4ecab2a2694aeb283edd111fc81e95
2017-11-16 13:26:58 +09:00
Masayuki Nakano 11db05dbea Bug 1413181 - part 4: Redesign nsIEditActionListener::DidSplitNode() r=m_kato
nsIEditActionListner::DidSplitNode() takes 4 arguments, the right node,
old offset in the old right node before splitting, the new left node and
nsresult.

Computing offset for this doesn't make sense because it's always same as
the length of the left node.  Additionally, nobody currently use nsersult.
So, we can get rid of it now.

Fortunately, nobody including comm-central and BlueGriffon implements
WillSplitNode().  So, we can get rid of it.  However, removing interface
method should be done in a follow up bug.  So, we can remove offset computation
in EditorBase::SplitNode() completely in the future.

MozReview-Commit-ID: JWj34SjBNJh

--HG--
extra : rebase_source : f0e1ed0e466dc8217c1a0ab1722790883a7efd1f
2017-11-13 23:52:16 +09:00
Masayuki Nakano 070ede0cf4 Bug 1413181 - part 3: EditorBase::CreateTxnForSplitNode() and EditorBase::SplitNode() should take EditorRawDOMPoint to specify the start of right node r=m_kato
EditorBase::CreateTxnForSplitNode() and EditorBase::SplitNode() takes a set of
container and offset in it for specifying a point to split.

Instead, they should take EditorRawDOMPoint for specifying start of right node.

MozReview-Commit-ID: 5VwS8oudzIT

--HG--
extra : rebase_source : 727948e5cf95f0713019f57ae9a007b85569fa56
2017-11-12 11:30:30 +09:00
Masayuki Nakano 9f55e71184 Bug 1413181 - part 2: SplitNodeTransaction should store start of existing right node with RangeBoundary r=m_kato
Make SplitNodeTransaction stores start of existing right node (which will be
split) instead of split point as a pair of the right node and offset in it.

MozReview-Commit-ID: 2DIpJGSuNaC

--HG--
extra : rebase_source : 13949bdddc30c59462e7fea7fadf29f015ab8d3a
2017-11-12 09:27:19 +09:00
Masayuki Nakano 1e31c0d7b6 Bug 1413181 - part 1: Redesign EditorBase::SplitNodeImpl() with EditorDOMPoint r=m_kato
EditorBaseSplitNodeImpl() should be clean up with EditorDOMPoint which should
be an argument to point the first point of right node (existing split node).

MozReview-Commit-ID: DN0yHm9G9yT

--HG--
extra : rebase_source : 256b4e2125e831b7be9e5c4aefc6f04c80e3c1f5
2017-11-12 08:38:56 +09:00
Masayuki Nakano 806984a06a Bug 1417492 - HTMLEditRules::TryToJoinBlocks() should no do nothing when left list node and right list node are not descendant of each other r=m_kato
We hit assertion which were added by bug 1414713.  That tells us an ancient bug.

There is comment which claims that we should move all list items in the right
list node to left list node if the list nodes should be merged.  However, this
has never been done actually since 2002.  The code tried to move *some* list
items in the right list node to the list list node.  However, retrieving first
list item at an offset almost always failed because the offset variable has
never been initialized.

If we believe the comment, we should move all children of the right list node
to the left list node.  However, until we get a testcase to reach this case,
we should keep current behavior, i.e., do nothing, for unexpected regression.

MozReview-Commit-ID: 1r81q1m44oW

--HG--
extra : rebase_source : fc02520f76440d5900fec0517aa6bcd188e1a14f
2017-11-18 16:12:44 +09:00
Makoto Kato 9761443d2a Bug 1417400 - Get rid of nsIContentFilter. r=masayuki
m-c, c-c and bluegriffon don't use this interface. So we should remove this.

MozReview-Commit-ID: 92VwGKlrOw5

--HG--
extra : rebase_source : 003763c6abc1406bcffabbffc3fe0696985ee97a
2017-11-16 13:36:10 +09:00
Makoto Kato 090fe8ebd5 Bug 1417344 - Clean up HTMLEditor::InsertBR. r=masayuki on a CLOSED TREE
--HG--
extra : amend_source : bae27242fcf6e011ba4d1b5e11b5e02a1ddd3bb9
2017-11-17 14:10:07 +02:00
Bogdan Tara b33ee612be Backed out 1 changesets (bug 1417344) for failing test_appinfo.py TestAppInfo.test_invalid_properties r=backout on a CLOSED TREE
Backed out changeset 0d56e0d42f4a (bug 1417344)
2017-11-17 09:44:19 +02:00
Makoto Kato d85b9324d9 Bug 1417344 - Clean up HTMLEditor::InsertBR. r=masayuki
No one uses out parameter of InsertBR, so we should remove it.  Also, CreateBR
has direction parameter for selection, so we should use it.

MozReview-Commit-ID: 8heqaXpR9He

--HG--
extra : rebase_source : 27b952f080a70fe039c9b43d7ae9f1394d4de01e
2017-11-16 13:59:14 +09:00
Makoto Kato afef034e5f Bug 1417320 - ReturnInParagraph should have Element parameter instead of nsINode. r=masayuki
ReturnInListItem and ReturnInHeader uses Element as parameter, but
ReturnInParagraph doesn't use Element parameter even if it is Element.

So we should use Element for parameter.

MozReview-Commit-ID: 35JJTETFK45

--HG--
extra : rebase_source : aa101c921d176b7ae7807c461bca1c4a51f9aecc
2017-11-15 15:35:17 +09:00
Nicholas Nethercote 20ffb0878f Bug 1416622 - Tighten up libpref's process checking. r=glandium
libpref only allows pref modifications in the parent process. This patch
tightens up the checking, which is a bit inconsistent.

- It removes ENSURE_MAIN_PROCESS_WITH_WARNING, which does NS_WARNING on
  failure, and replaces its uses with ENSURE_MAIN_PROCESS, which does NS_ERROR
  on failure. This required adding an XRE_IsParentProcess() check to one place
  in editor/.

- It converts XRE_IsContentProcess() tests to !XRE_IsParentProcess(), because
  we now have multiple kinds of non-parent process.

- It uses ENSURE_MAIN_PROCESS to replace other checking code in a few places.

- It improves a comment in HandleDirty().

MozReview-Commit-ID: D8znQWH7ery

--HG--
extra : rebase_source : ea0fc095b31525bde82a1be217923512d030b76d
2017-11-13 09:19:55 +11:00
Masayuki Nakano 13f0d7e107 Bug 1416099 - part 7: Make HTMLEditRules::ReturnInParagraph() use start of selection to split parent block instead of receiving the point from arguments r=m_kato
Now, we know HTMLEditRules::ReturnInParagraph() always splits the parent block
at start of selection.  So, it doesn't need to receive the position from the
caller because the cost to get start of selection from first range of Selection
is really cheap.

MozReview-Commit-ID: EvNb6lUBLdt

--HG--
extra : rebase_source : 448fcb4e3a3c6df777825e8747839d6cd9ee2d56
2017-11-10 16:51:24 +09:00
Masayuki Nakano a9b50a718e Bug 1416099 - part 6: Make HTMLEditRules::WillInsertBreak() use EditorDOMPoint to store selection start r=m_kato
The only caller of HTMLEditRules::ReturnInParagraph() is
HTMLEditRules::WillInsertBreak().  It should use EditorDOMPoint for storing
selection start.

Then, this patch makes what is set to ReturnInParagraph() clear.  So, the
point ReturnInParagraph() is always start of selection.

MozReview-Commit-ID: 6X0P5gpwXKr

--HG--
extra : rebase_source : d1814e5b7c8e4005886607691b37fe6a83e8e5be
2017-11-10 16:10:06 +09:00
Masayuki Nakano 0483ace6db Bug 1416099 - part 5: Rename |selNode|, |selOffset| and |newSelNode| in HTMLEditRules::ReturnInParagraph() to proper names r=m_kato
|selNode| and |selOffset| in HTMLEditRules::ReturnInParagraph() store the
point to split |aParentDivOrP|.  So, they should be |containerAtSplitPoint|
and |offsetAtSplitPoint|.

Then, |newSelNode| can be renamed to |splitAfterNewBR|.

MozReview-Commit-ID: 1DcmLNx1Cff

--HG--
extra : rebase_source : 38e7e1ec68c060da3ea31f694243adc004eeece7
2017-11-10 17:44:03 +09:00
Masayuki Nakano 71cdd5a933 Bug 1416099 - part 4: Make HTMLEditRules::ReturnInParagraph() use EditorRawDOMPoint to store point to insert new <br> element before splitting the parent block r=m_kato
HTMLEditRules::ReturnInParagraph() stores point to insert new <br> element with
a set of |parent|, |node| and |offset|.  Their names are really unclear and
they're really messy.

So, let's use new local variable, |EditorRawDOMPoint pointToInsertBR|.  This is
set only when new <br> element is necessary.  So, we can get rid of
|newBRneeded| too.

MozReview-Commit-ID: EdnhnlokurN

--HG--
extra : rebase_source : d97a985d71a7b4552ccdeedde55f8b7fcb0be590
2017-11-10 17:24:39 +09:00
Masayuki Nakano aee5a42ba9 Bug 1416099 - part 3: Rename aPara of HTMLEditRules::ReturnInParagraph() to aParentDivOrP and make it and aSelection as references r=m_kato
This cleans up |aSelection| and |aPara| of HTMLEditRules::ReturnInParagraph().

|aSelection| should be reference for avoiding nullptr check.

|aPara| is so too.  Additionally, the name is not clear.  We should rename it
to |aParentDivOrP| because it's a block parent of the point and has to be
<div> or <p> element.

MozReview-Commit-ID: 8LbKGlrvaIj

--HG--
extra : rebase_source : e0593c916791ec5b39b4138e21b6ce8c680dc4d8
2017-11-10 14:58:53 +09:00
Masayuki Nakano 77dd49f0f4 Bug 1416099 - part 2: Rename |sibling| in HTMLEditRules::ReturnInParagraph() to |brNode| r=m_kato
The local variable |sibling| in HTMLEditRules::ReturnInParagraph() is set to
aBRNode of SplitParagraph().  So, the name should be renamed to |brNode|.

Then, the |brNode| should be cleared if it's not a <br> node actually.  However,
SplitParagraph() doesn't allow aBRNode to be nullptr.  aBRNode is only used to
remove it from the document if it's not necessary.  So, it should be able to be
nullptr.  Therefore, this patch changes SplitParagraph() too.

Note that SplitParagrah() is called only by ReturnInParagraph().  So, we don't
need to worry about other callers.

MozReview-Commit-ID: 7Ynk9m5F8Mi

--HG--
extra : rebase_source : e2583c70ad274fe74f48df687796ed71a66bdf98
2017-11-10 14:43:13 +09:00
Masayuki Nakano 69c8b0b603 Bug 1416099 - part 1: Make HTMLEditRules::ReturnInParagraph() use EditActionResult r=m_kato
For reducing the number of arguments of HTMLEditRules::ReturnInParagraph(),
let's make it return EditActionResult and get rid of |aCancel| and |aHandled|.

MozReview-Commit-ID: HU1SthEjonn

--HG--
extra : rebase_source : 072865996aaccc63924c34f91014b41b64aa1a16
2017-11-10 14:17:54 +09:00
Ryan VanderMeulen ef843a0e30 Merge m-c to inbound. a=merge 2017-11-10 16:14:16 -05:00
Kyle Machulis f25f505bc5 Bug 1415747 - Remove nsIDOMHTMLScriptElement; r=bz
MozReview-Commit-ID: 3I7qVTsKFJC
2017-11-10 13:10:00 -08:00
Masayuki Nakano 68294ac1d3 Bug 1415445 - part 4: EditorBase::CreateNode() should take EditorRawDOMPoint as insertion point instead of a set of container, child and offset of the child in the container r=m_kato
EditorBase::CreateNode() should take EditorRawDOMPoint as insertion point of
the new element instead of a set of container, child and offset of the child
in the container.

This patch initializes EditorRawDOMPoint with original 3 arguments as far as
possible.  If the relation of them are broken, MOZ_ASSERT in RawRangeBoundary
constructor detects existing bugs.

MozReview-Commit-ID: 2N55S6pRv7k

--HG--
extra : rebase_source : 2b14a7715815ca0007635b8f791ca9edbe5b65f1
2017-11-08 20:23:10 +09:00
Masayuki Nakano 82358b9f2e Bug 1415445 - part 3: nsIEditActionListener's WillCreateElement() and DidCreateElement() should take child node at insertion point or new node itself rather than the container node and offset in it r=m_kato
nsIEditActionListener::WillCreateElement() and
nsIEditActionListener::DidCreateElement() are implemented only by m-c.

So, we can remove a set of container node and offset in it from their argument.
Instead, WillCreateElement() should take a node which will be next sibling of
the new node.

Note that only implementation of them is, HTMLEditRules::DidCreateElement().
So, we can get rid of them and can call HTMLEditRules::DidCreateElement()
directly from EditorBase::CreateNode().  However, such change should be done
in another bug which checks all nsIEditActionListener method implementations.

MozReview-Commit-ID: 4LQEs2WwrVC

--HG--
extra : rebase_source : ee1bee1413c578b2873a291c712b8ef46221db0f
2017-11-08 18:16:46 +09:00
Masayuki Nakano 9dd0af5112 Bug 1415445 - part 2: EditorBase::CreateTxnForCreateElement() should take EditorRawDOMPoint for insertion point r=m_kato
The constructor of CreateElementTransaction now takes EditorRawDOMPoint instead
of a set of container node and offset in it.  So, its only user,
EditorBase::CreateTxnForCreateElement(), should take EditorRawDOMPoint too.

MozReview-Commit-ID: A8QfPM3LRii

--HG--
extra : rebase_source : 4a99e5cb58230649d19faca788a330fe02eb6bb1
2017-11-08 17:23:28 +09:00
Masayuki Nakano ae419aa495 Bug 1415445 - part 1: CreateElementTransaction should use EditorRawDOMPoint and RangeBoundary r=m_kato
The constructor of CreateElementTransaction should use EditorRawDOMPoint to
receive insertion point of the new element.  Then, it should be stored with
RangeBoundary.  With this change, CreateElementTransaction doesn't need to
compute child node at insertion point.

Additionally, this creates InsertNode() method.  Current code works differently
when DoTransaction() is called and RedoTransaction() is called.

MozReview-Commit-ID: 8ujhmzn65Wg

--HG--
extra : rebase_source : 30cc045a30a3836f211d11e5f70a85804f44a72a
2017-11-08 16:49:06 +09:00
Masayuki Nakano 7c53b094a1 Bug 1415414 - Make DeleteRangeTransaction::CreateTxnsToDeleteBetween() and DeleteRangeTransaction::CreateTxnsToDeleteContent() use RawRangeBoundary as their arguments r=m_kato
By the fix of bug 1407352, DeleteRangeTransaction::CreateTxnsToDeleteBetween()
starts to use child node instead of a set of container node and offset in it.
However, this is ugly and using RawRangeBoundary may reduce computing offset
more.  So, they should use RawRangeBoundary to refer delete points.

MozReview-Commit-ID: pwDHOxpz0E

--HG--
extra : rebase_source : 3871ba4fa3cfb174d5dac57822ae69c40a305323
2017-11-08 15:01:23 +09:00
Masayuki Nakano 806668b21a Bug 1415062 - part 2: Editor should use Selection::Collapse(const RawRangeBoundary&) as far as possible r=m_kato
In some places, editor computes index from child node for collapsing selection
at the child node.  However, it's expensive.  Therefore, editor should use
Selection::Collapse(const RawRangeBoundary&) as far as possible.

MozReview-Commit-ID: LF2MwASuXzZ

--HG--
extra : rebase_source : b7afc35c0d9d88845391b6f18de57cbff1935ae4
2017-11-07 19:50:25 +09:00
Narcis Beleuzu 218e1676cb Merge inbound to mozilla-central r=merge a=merge 2017-11-08 12:51:09 +02:00
Makoto Kato 5edeee8f72 Bug 1414581 - Part 2. Add crashtest. r=masayuki
MozReview-Commit-ID: 3H4DSubkt0q

--HG--
extra : rebase_source : e34e609f0056398f799dc6dbdf769cca89a412df
2017-11-06 17:06:09 +09:00
Makoto Kato 44e777349b Bug 1414581 - Part 1. Require more nullptr check of parent node. r=masayuki
Bug 1402904 added nullptr check for parent node, but I forgot to add this
nullptr check of selected node for outdent command.
So I need to add more nullptr check.

MozReview-Commit-ID: Au9wrG6htk8

--HG--
extra : rebase_source : bd73b1b667b6dc869ebcea3fdfbe1eb3b04a8cde
2017-11-06 17:05:37 +09:00
Margareta Eliza Balazs 130574a8e2 Merge mozilla-central to mozilla-inbound. r=merge a=merge CLOSED TREE 2017-11-08 00:09:29 +02:00
Boris Zbarsky 1d9f0307ac Bug 1413253. Make sure to make it clear that we'd report a JS exception on the ErrorResult in InsertNodeTransaction::DoTransaction. r=peterv
MozReview-Commit-ID: 2DEPzwwXbX9
2017-11-07 15:36:41 -05:00
Masayuki Nakano 365f79c262 Bug 1414713 - EditorUtils::IsDescendantOf() should take EditorDOMPoint and EditorRawDOMPoint as out param r=catalinb,m_kato
EditorUtils::IsDescendantOf() current takes a pointer to offset or a pointer to
child content if the caller needs to know the child of the most ancestor node.

However, some callers should get a child as EditorDOMPoint or EditorRawDOMPoint.
Then, they can be used for some editor methods which need to take child node
for performance optimization.

This patch makes EditorUtils::IsDescendantOf() as only two overloads.  One takes
pointer to EditorRawDOMPoint as optional out argument.  The other takes pointer
to EditorDOMPoint as an out param.

Additionally, this creates new constructor of AutoTrackDOMPoint for making it
can treat EditorDOMPoint directly.

MozReview-Commit-ID: IsAGTUvKI19

--HG--
extra : rebase_source : 97469a21b974c6a1dd515ab472bbc4a88c1899c8
2017-11-06 17:01:33 +09:00
Dão Gottwald e57bb9cb2e Bug 464450 - Get rid of the padded class and clean up related styling. r=mak
MozReview-Commit-ID: KYKqH9vLQ3x

--HG--
extra : rebase_source : 6242214b0c8efd8fde15714d53dd7fd63c082835
2017-11-07 14:15:19 +01:00
Masayuki Nakano 45ce515072 Bug 1408544 - part 2: RangeBoundaryBase shouldn't compute mRef when mOffset is specified r=catalinb
RangeBoundaryBase shouldn't compute mRef when it's initialized with offset.
E.g., some users of the template class may initialize it with a container and
offset in it but it may not refer mRef or may refer after modifying offset.

On the other hand, RangeBoundaryBase::InvalidateOffset() is a special method.
It assumes that mRef is always initialized when it's called but can be
invalidate mOffset until retrieved actually.  This is necessary for
nsRange::mStart and nsRange::mEnd since the offset may be changed when
some nodes are inserted before the referring node.

So, now, InvalidateOffset() should be a protected method and make nsRange a
friend class of RangeBoundaryBase.  Then, when nsRange sets mStart and/or mEnd,
nsRange itself should guarantee that their mRefs are initialized.

MozReview-Commit-ID: Alr4YkDXIND

--HG--
extra : rebase_source : 7e6828374db7989ae91b9e485571ec553f7435af
2017-11-02 21:25:14 +09:00
Masayuki Nakano 8b6c211c36 Bug 1408544 - part 1: Reimplement EditorDOMPoint as a subclass of RangeBoundary r=catalinb,m_kato
A lot of methods in editor returns a child offset with an out param when it
returns its container and offset in the container.  This is ugly hack for
performance of nsINode::IndexOf().  However, there are a lot of regression
since the relation between offset and child node can be broken really easily.

So, we should make EditorDOMPoint as a subclass of RangeBoundary and manage
a set of container, reference child and its offset in it (e.g.,
SetNextSibling() added by this patch).

Note that RangeBoundary's performance is not good for temporary use if we set
a point with offset, it immediately retrieves mRef.  The following patch will
improve this performance.

MozReview-Commit-ID: 7mcJ1P1OjVr

--HG--
rename : editor/libeditor/EditorUtils.h => editor/libeditor/EditorDOMPoint.h
extra : rebase_source : 785094fcfc592d9e5b48cbc36ed225dbb8bb4111
2017-11-01 14:41:03 +09:00
Phil Ringnalda 202bbba5f7 Backed out changeset aa14c955261c (bug 464450) for Win10 debug non-e10s failures in editor reftests
MozReview-Commit-ID: J83gCo2oGUh
2017-11-06 19:55:01 -08:00
Dão Gottwald 7ca44028ae Bug 464450 - Get rid of the padded class and clean up related styling. r=mak
MozReview-Commit-ID: 5uPRgLiSu0Q

--HG--
extra : rebase_source : 4a271f0eb515546586918412c062c3ea853c3844
2017-10-18 14:49:00 +02:00
Xidorn Quan 488a55e50a Bug 1411460 - Sync input.css with style in textbox.css. r=dao
MozReview-Commit-ID: 63Fl0jtMPXc

--HG--
extra : rebase_source : 554537da9f696073f8d38ad064d365c36840e2a5
2017-11-02 11:32:45 +11:00
Sebastian Hengst 4ff29d14f8 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: GSDYk9wLOAM

--HG--
rename : browser/base/content/test/general/browser_bug561636.js => browser/modules/test/browser/formValidation/browser_form_validation.js
rename : browser/base/content/test/general/browser_bug595507.js => browser/modules/test/browser/formValidation/browser_validation_iframe.js
rename : browser/modules/test/browser/browser_bug1319078.js => browser/modules/test/browser/formValidation/browser_validation_invisible.js
2017-11-01 22:55:12 +01:00
Nika Layzell b5701b1266 Bug 1401379 - Part 2: Add more cycle collector edges for nsDocShell, r=smaug
MozReview-Commit-ID: 3j9jfLv7MO2
2017-11-01 11:06:26 -04:00
Masayuki Nakano b327dea259 Bug 1411345 - HTMLEditRules::GetHighestInlineParent() shouldn't return editing host even when it's the highest inline parent of aNode r=m_kato
HTMLEditRules::BustUpInlinesAtRangeEndpoints() tries to split all inline nodes
at range start and range end.  It uses EditorBase::SplitNodeDeep() to split
the nodes and HTMLEditRules::GetHighestInlineParent() to retrieve the highest
inline parent of them.

Currently, HTMLEditRules::GetHighestInlineParent() may return editing host or
ancestor of it if active editing host is not block.  Then, it may cause
splitting editing host or its parents and following methods of HTMLEditRules
will fail to modify the nodes created outside the editing host.

So, HTMLEditRules::GetHighestInlineParent() should return only one of the
descendants of active editing host.

Unfortunately, even if just adding the test case as a crash test, I cannot
reproduce the crash with automated tests.  Therefore, this patch doesn't
include any automated tests.

And this patch changes a crash test, 1402196.html, which expects that an inline
editing host is split by execCommand("insertOrderedList").  However, this patch
fixes this wrong behavior.  Therefore, this patch changes the event target of
event listener from <p> inside the editing host to the editing host itself.

MozReview-Commit-ID: 8i5ci1fcrDd

--HG--
extra : rebase_source : 572a7b22550a38ca71c954f62eefa695addd53c2
2017-10-31 01:14:58 +09:00
Marco Castelluccio f19a57edb0 Bug 1413013 - Remove unused nsITransactionList. r=masayuki
--HG--
extra : rebase_source : de3c858298d63d5658f38fc135ab1f2955dc834a
2017-10-30 20:35:00 +00:00
Chris Peterson 1df202b177 Bug 1412048 - Replace NS_RUNTIMEABORT("...") with MOZ_CRASH("..."). r=froydnj
And remove unreachable code after MOZ_CRASH().

MozReview-Commit-ID: 6ShBtPRKYlF

--HG--
extra : rebase_source : 0fe45a59411bda663828336e2686707b550144ae
extra : source : 8473fd7333d2abe1ea1cc176510c292a5b34df45
2017-10-24 23:30:31 -07:00
Masayuki Nakano f802692190 Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato
Currently, HTMLEditRules::WillInsertBreak() checks if the editing host can
contain a <p> element as a child or a descendant.  However, this is not enough.
If an inline element has a block element which can contain a <p> element,
current implementation considers to insert a <br>.  This is possible when
* The editing host is an unknown element including user defined element.
* The editing host is an inline element and its children and/or descendants
  were added by JS.  E.g., <span contenteditable> element can have <div>
  element.

I think that we should consider to insert a <br> element when:
- There is no block ancestors in the editing host.
- The editing host is the only block element and it cannot contain <p> element
  or the default paragraph separator is <br> element.
- The nearest block ancestor isn't a single-line container declared in the
  execCommand spec and there are no block elements which can contain <p>
  element.

Note that Chromium checks if CSS box of ancestors is block too.  However,
it must be out of scope of this bug.

MozReview-Commit-ID: HdjU9t83Nd1

--HG--
extra : rebase_source : 7030671268a610613359b5d8ae5d126e120f59bd
2017-10-27 01:27:44 +09:00
Masayuki Nakano 2b96b7532a Bug 1411687 - part 1: HTMLEditor::GetBlockNodeParent() and HTMLEditor::GetBlock() should take an ancestor limiter node optionally r=m_kato
Perhaps, most callers don't need parent block outside active editing host.
Therefore, callers of these methods should be able to specify the editing
host for making those methods stop looking for a block ancestor.

Then, callers can avoid using EditorUtils::IsDescendantOf() and
nsContentUtils::IsContentDescendantOf().

MozReview-Commit-ID: 7IK4gAVHY5d

--HG--
extra : rebase_source : 31cd55026f0ce005d906499de4ebe5d1c39555e9
2017-10-26 22:54:30 +09:00
Masayuki Nakano bb82521595 Bug 1411687 - part 0: Get rid of HTMLEditor::GetBlockNodeParent(nsIDOMNode*) r=m_kato
Currently, HTMLEditor::GetBlockNodeParent(nsIDOMNode*) is used only by
HTMLEditor::DoInsertHTMLWithContext() and there is a variable of nsINode*.

So, we don't need to keep it anymore.

MozReview-Commit-ID: LEWaiR5BEB9

--HG--
extra : rebase_source : 64ef772f3b7883bd4aae48dec737663e6036553b
2017-10-26 22:37:45 +09:00
Makoto Kato 146232dd0d Bug 748315 - Part 5. Update browserscope test result. r=masayuki
MozReview-Commit-ID: KIC7OcDe2i6

--HG--
extra : rebase_source : 8a7dbd1467b975f4adb5b35ea854d7035900c96a
2017-10-25 16:13:10 +09:00
Makoto Kato 0bb92c4869 Bug 748315 - Part 3. Use SetAttributeOrEquivalent even if HTMLEditor::IsCSSEnabled() is false. r=masayuki
SetAttributeOrEquivalent can remove CSS property that is same behaviour by
part 2.  So we should use it instead of SetAttribute.

MozReview-Commit-ID: InCZQVdbDRm

--HG--
extra : rebase_source : d746b07bcfffc752ad90b9e1504e2f0afc23d457
2017-10-29 23:05:16 +09:00
Makoto Kato 390c0cb048 Bug 748315 - Part 2. SetAttributeOrEquivalent should remove CSS property when HTMLEditor::IsCSSEnabled() is false. r=masayuki
SetAttributeOrEquivalent sets element's attribute when
HTMLEditor::IsCSSEnabled() is false.  It should remove the CSS property that is
same behaviour too.

MozReview-Commit-ID: ChKjlB7wI0Z

--HG--
extra : rebase_source : c31b940394750757b2393a6876534590410d9398
2017-10-25 16:13:09 +09:00
Makoto Kato ec0a31ac6a Bug 748315 - Part 1. Consider text-align property even if HTMLEditor::IsCSSEnabled() is false. r=masayuki
Actually, we don't consider CSS property to get alignment when IsCSSEnabled()
is false. For WebKit and Blink compatibility, we should consider this situation.

MozReview-Commit-ID: 9ORntUmbIbf

--HG--
extra : rebase_source : 21d27f34cf1331bd2fee097c5c445dc16c453d4e
2017-10-25 16:13:02 +09:00
Emilio Cobos Álvarez d454491418 Bug 1410074: Load input.css from a chrome uri, so windows reftests can use system metric media queries. r=bz,xidorn
This requires exposing the reftest chrome package to content, but that should be
OK, and this seems to work...

MozReview-Commit-ID: EWkwqTHW3dg

--HG--
extra : rebase_source : 12cabe4389375ac4c3abd0a9327baf268aab7c1a
2017-10-06 20:16:43 +02:00
Emilio Cobos Álvarez dd634e3981 Bug 1411612: Kill nsINode::eCONTENT. r=bz
MozReview-Commit-ID: ESlOqlwhcHI

--HG--
extra : rebase_source : fe6a02469dca1e50c24ba166e15e39160ab4551b
2017-10-25 17:19:11 +02:00
Xidorn Quan b5008d1736 Bug 1408811 followup 2 - Swap the annotation of empty-1.xul.
MozReview-Commit-ID: 70FJ2D8HrAY
2017-10-25 14:47:11 +11:00
Xidorn Quan 44b3247164 Bug 1408811 followup - Disable empty-1.xul for stylo windows.
MozReview-Commit-ID: Cx6rhArQm2j
2017-10-25 11:01:50 +11:00
Sebastian Hengst 24b7b2eb7c merge mozilla-central to autoland. r=merge a=merge 2017-10-24 23:59:14 +02:00
Xidorn Quan 2797a4fa56 Bug 1408811 - Update test expectation for this bug. r=emilio
on a CLOSED TREE

MozReview-Commit-ID: H4glCWmL2vc
2017-10-24 21:16:52 +02:00
Masayuki Nakano d7d7a3bbb9 Bug 1409520 - part 1: WSRunObject::InsertText() should update aInOutChildAtOffset after it might be modified r=m_kato
WSRunObject::InsertText() may delete given child node at offset with calling
DeleteChars() or CheckLeadingNBSP() before calling HTMLEditor::InsertTextImpl().

Therefore, even though using nsINode::GetChildAt() is slow, it needs to update
aInOutChildAtOffset after calling them.

MozReview-Commit-ID: AbTTfNAjMIK

--HG--
extra : rebase_source : b4282e8dc6e395acc89d7c155bfeae46e7c41e4a
2017-10-23 21:47:56 +09:00
Masayuki Nakano 558978b80b Bug 1409520 - part 0: Add automated test r=m_kato
The bug is a report for hitting MOZ_ASSERT, but we should also check the result
of the call of execCommand.

MozReview-Commit-ID: FydZKAjI2Rl

--HG--
extra : rebase_source : 327988cea366474cbe659a3b80c09ce7ceef0005
2017-10-23 22:01:58 +09:00