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

17 Коммитов

Автор SHA1 Сообщение Дата
Nicholas Nethercote dfd3b7e7aa Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

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

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

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

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

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

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

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

MozReview-Commit-ID: DykOl8aEnUJ

--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
2017-09-26 08:33:21 +10:00
Makoto Kato e9bdbc5bb1 Bug 1387945 - Use nsIContent for CreateAnonymousElement. r=masayuki
CreateAnonymousElement still uses nsIDOMNode, but we should use nsIContent for it.

MozReview-Commit-ID: 2xgzlE6NVra

--HG--
extra : rebase_source : c93a9acb230604da391f705b0038e3cf7fbd4f23
2017-08-07 14:09:51 +09:00
Cameron McCormack 536fe8ffa0 Bug 1387481 - Part 1: Don't eagerly style editor-created NAC if it's appended to an element in a display:none subtree. r=hiro
MozReview-Commit-ID: 7bucY7JKRS0

--HG--
extra : rebase_source : 8a4fd542fe72c6abc0636784841d3851c69b6fb4
2017-08-05 17:36:09 +08:00
Bobby Holley 1bd3bc937c Bug 1386110 - Use a smart pointer to reliably de-register NAC regardless of how it goes away. r=masayuki
MozReview-Commit-ID: HTSu5BjxD8I
2017-08-03 20:26:11 -07:00
Xidorn Quan 137ea130e8 Bug 1383780 - Avoid adding anonymous editor element into non-HTML element. r=masayuki
It is mainly for avoiding other anonymous element being inserted into
<svg:use>, but in general we probably don't want to insert some random
HTML anonymous element into a non-HTML element.

MozReview-Commit-ID: J5kCUzA7K90

--HG--
extra : rebase_source : 1d38cd9297071b9ba8151eb27d74b56ad540cc49
2017-08-03 14:23:38 +10:00
Makoto Kato 44c1ed6949 Bug 1383755 - Part 1. NAC property might be removed by nsIDocument::AdoptNode. r=masayuki
nsIDocument::AdoptNode might to remove all properties.  So before destroying editor, NAC property might be already removed.  So we have to consider that NAC is removed.

MozReview-Commit-ID: DakRRqrzEtF

--HG--
extra : rebase_source : ce972f1b42b6ff7efdf09b9a70cc1a9d27f128fb
2017-07-31 12:56:34 +09:00
Cameron McCormack 7b2f841ea9 Bug 1383988 - stylo: Ensure editor handle elements are styled before attempting to construct frames for them. r=hiro
MozReview-Commit-ID: 2T0ZjP00U7A

--HG--
extra : rebase_source : 02e527baac50c2267afb3ed199aee91e72a08b02
2017-07-25 14:08:19 +08:00
Cameron McCormack fdb731a4d4 Bug 1377256 - Part 1: Don't pass parent explicitly into HTMLEditor::DeleteRefToAnonymousNode. r=m_kato
MozReview-Commit-ID: HUySaoG07jg

--HG--
extra : rebase_source : adb3a65387eb209073d95211fa185bcab2791b0f
2017-07-04 17:01:32 +08:00
Cameron McCormack e86592ca35 Bug 1374999 - stylo: Iterate over manually created editor NAC. r=bholley
MozReview-Commit-ID: 1CiWVfYbxaJ

--HG--
extra : rebase_source : 48ea8a0f1cb0a4072632f706ffd99529bb4447b1
2017-06-27 17:34:48 -07:00
Emilio Cobos Álvarez d2f3dc13ec Bug 1357142: Kill PresShell::RecreateFramesFor. r=bz
It's not only inefficient, but also prone to buggyness. Since styles may not be
up-to-date when it happens.

Post a reconstruct instead, which ensures a style flush happens before running
frame construction.

MozReview-Commit-ID: DrakHsJv5fY
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>

--HG--
extra : rebase_source : 11900af908654336cc2391ab9480542c5474e38f
2017-04-17 18:01:37 +02:00
Makoto Kato ced4cccc2c Bug 1313986 - Part 5. Remove createAnonymousElement from nsIHTMLEditor. r=masayuki
c-c nor add-ons seem noet to use it.  We should remove this.

MozReview-Commit-ID: 3jN8kUp6D4Z

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

MozReview-Commit-ID: TTFSvqn5GE

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

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

MozReview-Commit-ID: ICaAWVPjcej

--HG--
extra : rebase_source : 9585214aa678c16905250265a75b817c90246fcc
2016-11-24 16:12:04 +09:00
Masayuki Nakano 6bc92def07 Bug 1311240 Fix odd "{" and "}" of control statements in editor for conforming to our coding rules r=smaug
Currently, editor code uses following style (or similar style) in a lot of places:

if (foo)
{

}
else
{

}

This patch fixes this as conforming to our coding rules, i.e., it becomes:

if (foo) {

} else {

}

Additionally, this fixes other odd control statements in the files which include above issue because it's difficult to find following issues with searching the files:

* if (foo) bar;
* if (foo) { bar; }
* if (foo)
    bar;

Finally, if it becomes much simpler than current code, this patch rewrites existing code with "early return style". But this case is only a few places because this is risky.

MozReview-Commit-ID: 2Gs26goWXrF

--HG--
extra : rebase_source : 603f9003a3566b3203bdeb27dc73ac33502d2853
2016-10-24 11:27:45 +09:00
Masayuki Nakano 2773c4d0ef Bug 1310618 Replace nsresult variables |res| with |rv| under editor/ r=Ehsan
In our coding rules, variable names of nsresult should be rv.  Indeed, when you see |rv| in the code, you must assume that its type if nsresult.

However, a lot of code under editor/ uses |res| for the variables of nsresult.  Let's replace |res| with |rv|.

And this patch improves following points:

1. When |rv| is set in both |if| and |else| block and they are check outside of them, this moves the check into each |if| and |else| block because even if the failure is notified with warning, you cannot see which case was performed and failed.  This change makes it clear.

2. When |return rv;| returns non-error code because |rv| is checked with NS_ENSURE_SUCCESS() immediately before, setting replacing it with |return NS_OK;| is clearer.

3. Move declaration of |nsresult rv| into smaller scope as far as possible.  This prevents setting rv to unexpected value and easier to check its value at reading the code.

MozReview-Commit-ID: 9MAqj7sFey3

--HG--
extra : rebase_source : 0fd316b851ea616b3a95d8c1afc111ff55e11993
2016-10-19 18:09:33 +09:00
Olli Pettay f8d35b16d1 Bug 1283497, unbind editor created native anonymous content properly, r=wchen 2016-07-14 13:41:14 +03:00
Masayuki Nakano 9b6e26f0bb Bug 1260651 part.56 Rename nsHTMLEditor to mozilla::HTMLEditor and related stuff r=mccr8
This patch renames classes/structs as:

nsHTMLEditor -> mozilla::HTMLEditor
nsHTMLEditor::BlobReader -> mozilla::HTMLEditor::BlobReader
SetSelectionAfterTableEdit -> mozilla::AutoSelectionSetterAfterTableEdit

nsHTMLEditor.h -> HTMLEditor.h (exposed as mozilla/editor/HTMLEditor.h)
nsHTMLAbsPosition.cpp -> HTMLAbsPositionEditor.cpp
nsHTMLAnonymousUtils.cpp -> HTMLAnonymousNodeEditor.cpp
nsHTMLDataTransfer.cpp -> HTMLEditorDataTransfer.cpp
nsHTMLEditorStyle.cpp -> HTMLStyleEditor.cpp
nsHTMLInlineTableEditor.cpp -> HTMLInlineTableEditor.cpp
nsHTMLObjectResizer.cpp -> HTMLEditorObjectResizer.cpp
nsTableEditor.cpp -> HTMLTableEditor.cpp

These new file names are clearer names which related to HTMLEditor than old names.

MozReview-Commit-ID: DTWaoFvy0DF

--HG--
rename : editor/libeditor/nsHTMLAbsPosition.cpp => editor/libeditor/HTMLAbsPositionEditor.cpp
rename : editor/libeditor/nsHTMLAnonymousUtils.cpp => editor/libeditor/HTMLAnonymousNodeEditor.cpp
rename : editor/libeditor/nsHTMLEditor.cpp => editor/libeditor/HTMLEditor.cpp
rename : editor/libeditor/nsHTMLEditor.h => editor/libeditor/HTMLEditor.h
rename : editor/libeditor/nsHTMLDataTransfer.cpp => editor/libeditor/HTMLEditorDataTransfer.cpp
rename : editor/libeditor/nsHTMLObjectResizer.cpp => editor/libeditor/HTMLEditorObjectResizer.cpp
rename : editor/libeditor/nsHTMLInlineTableEditor.cpp => editor/libeditor/HTMLInlineTableEditor.cpp
rename : editor/libeditor/nsHTMLEditorStyle.cpp => editor/libeditor/HTMLStyleEditor.cpp
rename : editor/libeditor/nsTableEditor.cpp => editor/libeditor/HTMLTableEditor.cpp
2016-07-09 11:42:33 +09:00