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

34 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano c4cea9a380 Bug 1337718 part.1 Make EditorBase::HandleKeyPressEvent() take WidgetKeyboardEvent* instead of nsIDOMKeyEvent* r=m_kato
MozReview-Commit-ID: 8QUiHPRf9AH

--HG--
extra : rebase_source : d9a531248f4e72dfb501146976af7efd64d1e122
2017-02-08 20:18:17 +09:00
Carsten "Tomcat" Book e2a2f8d124 merge mozilla-inbound to mozilla-central a=merge 2017-02-09 16:04:14 +01:00
Makoto Kato b8d5c8b156 Bug 1337698 - Part 1. PlaceholderTransaction should use UniquePtr. r=masayuki
MozReview-Commit-ID: 8xqAKRcKCLb

--HG--
extra : rebase_source : d0a8d202e973d06c823cd5351d9561b9b5919f43
extra : histedit_source : 696ac1246fbb3691b2f042a0d16e438f37dcf64d%2C446038a833523fed82771c3c177811971679c269
2017-02-09 14:26:10 +09:00
Masayuki Nakano 431e1a12b3 Bug 1336011 part.3 Create an alias of the type of mDocStateListeners r=smaug
MozReview-Commit-ID: L0TczDcH4t8

--HG--
extra : rebase_source : 0a250056797c6fb760e7aa674565d3e71df6f568
2017-02-07 22:52:23 +09:00
Masayuki Nakano a5c23d8c73 Bug 1336011 part.2 Create an alias of the type of mEditorObservers r=smaug
MozReview-Commit-ID: 7LWl5F4C0Ge

--HG--
extra : rebase_source : 0393619ad8f3ea1090244db5eeb117f73afb47ea
2017-02-07 22:36:16 +09:00
Masayuki Nakano 36efe8eb2b Bug 1336011 part.1 EditorBase shouldn't refer mActionListeners directly in loops because it might be removed during a loop r=smaug
Items in mActionListeners may be removed during a call of a method of another item.  Therefore, all items should be copied to different array before each loop referring mActionListeners.

MozReview-Commit-ID: FA2xXdJ9SoR

--HG--
extra : rebase_source : 054a58f5a82df6911d42b17fdb3f11738ceab2af
2017-02-07 22:26:56 +09:00
Makoto Kato 78b1b5964b Bug 1336349 - Merge GetIsDocumentEditable implementation to EditorBase. r=masayuki
GetIsDocumentEditable is implemnted in EditorBase, TextEditor, and HTMLEditor.  This is virtual method, we won't use EditorBase::GetIsDocumentEditable.  Also, TextEditor::GetIsDocumentEditable and HTMLEditor::GetIsDocumentEditable are same implementation.  So we should merge this to EditorBase.

MozReview-Commit-ID: 62euqUaYAuY

--HG--
extra : rebase_source : 1a3025aeddc61d0ae3e0de334472ee8393893114
2017-02-03 16:22:50 +09:00
Makoto Kato 4d5ef610ea Bug 1335997 - Part 2. Don't use virtual method for NotifyDocumentListeners and ScrollSelectionIntoView. r=masayuki
Both methods don't override by TextEditor and HTMLEditor.  It is unnecessary to use as virtual method.

MozReview-Commit-ID: 6FNO78RauML

--HG--
extra : rebase_source : fb74a9b83a889ab2be04529527704f6de4b666dd
2017-02-02 13:56:57 +09:00
Masayuki Nakano 7ab96b2cef Bug 1314053 part.2 Change EditorBase::IsAcceptableInputEvent()'s argument from nsIDOMEvent* to WidgetGUIEvent* r=smaug
MozReview-Commit-ID: Jo6EwQubUAM

--HG--
extra : rebase_source : 098b23946f349bbe7641a2059538ffb20ae4f5bb
2017-01-17 17:17:06 +09:00
Makoto Kato 1f259574fb Bug 1328023 - Part 1. Don't use RangeUpdater except to composition transaction. r=masayuki
Part 3 fix of bug 1310912 is incorrect for not composition transaction.  PlaceholderTransation is for saving and restoring current selection for undo. So we shouldn't use range updater to normal transaction.

Composition transaction can modify multiple nodes and it merges text node for ime into single text node. So if current selection is into IME text node, it might be failed to restore selection by UndoTransaction. So we need update selection by range updater to work UndoTransaction.

Also, CompositionTransaction::UndoTransaction will set selection after committed text. So at finally, selection will set correct position that composition transaction wants.

MozReview-Commit-ID: 1NcH32YoKPQ

--HG--
extra : rebase_source : 8a29ef3d4d4c64997416a8f3c7fd174766764ad3
2017-01-30 17:25:43 +09:00
Makoto Kato 461fd31b94 Bug 1334372 - Part 2. Don't use virtual method for CreateTxnForAddStyleSheet and CreateTxnForRemoveStyleSheet. r=masayuki
We don't have no overload method for both methods.  So we shouldn't use virtual.

And, other transaction methods return transaction object directly, we should change to it.

MozReview-Commit-ID: 7CXz4XeOobk

--HG--
extra : rebase_source : e208484decec42496e88bbee5ed7d19b1f6daf91
extra : amend_source : 1ebe4378f6c8133b874e573c10c368ae96a51d45
2017-01-27 13:29:00 +09:00
Makoto Kato f1e9546f92 Bug 1334372 - Part 1. Use EditorBase directly in AddStyleSheetTransaction/RemoveStyleSheetTransaction. r=masayuki
Other transaction classes use EditorBase directly, but these transaction classes use nsIEditor.  To remove nsIDOMDocument XPCOM interface usage, I would like to use EditorBase directly.

MozReview-Commit-ID: 3alRd9Zj5aZ

--HG--
extra : rebase_source : ed8e917201a7b8b84551aa8494b7879202553238
2017-01-27 13:15:20 +09:00
Makoto Kato 054bbb8432 Bug 1332984 - Clean up usage of nsIDOMCharacterData into editor. r=masayuki
Some uses nsIDOMCharacterData to get the attribute of text node.  But, by using Text object, we don't need nsIDOMCharacter.  So we should use Text object instead of nsIDOMCharacterData instead if possible.

MozReview-Commit-ID: 1cwTUcecFj3

--HG--
extra : rebase_source : 2b3745c1aa71ccaca7def3d10e9ad655b4987991
2017-01-23 14:14:30 +09:00
Cameron McCormack babad063ff Bug 1328832 - Part 2: Rename mozFlushType to mozilla::FlushType and make it an enum class. r=bzbarsky
MozReview-Commit-ID: D3fIngSHSsl
2017-01-05 15:31:56 +08:00
Cameron McCormack ce51bd51e0 Bug 1328832 - Part 1: Rename mozFlushType.h to FlushType.h. r=bzbarsky
MozReview-Commit-ID: 1ubwNkBEdfz

--HG--
rename : dom/base/mozFlushType.h => dom/base/FlushType.h
2017-01-05 14:54:02 +08:00
Makoto Kato aba106bb59 Bug 1324996 - Part 2. Use nsIAtom to change attirbute if possible. r=masayuki
We can replace old nsIEditor API with nsIAtom version.

MozReview-Commit-ID: EMEANldtTo0

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

MozReview-Commit-ID: 8CutpdyVuew

P1

MozReview-Commit-ID: 9MdmGcTqaxT

--HG--
extra : rebase_source : 2ae876cd33839f61880bd6c55644d4381139dd25
2016-12-20 19:24:08 +09:00
Makoto Kato b2b4afaf31 Bug 1310912 - Part 5. InsertTextIntoTextNodeImpl should use IMETextNode for listener. r=masayuki
When using CompositionTransaction, text node will be inserted into IMETextNode, not aTextNode of parameter.  So we should use it for listener.

MozReview-Commit-ID: 72a3ZjF1wsz

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

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

MozReview-Commit-ID: 9so9tR8uQ6t

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

So we should add selection into PlaceholderTrancation to RangeUpdater.

MozReview-Commit-ID: LcUIiUExNhx

--HG--
extra : rebase_source : 9e1a71a7f497181171209ac05edcbddae227ab93
extra : histedit_source : 200dfd7957bf1b4dc92af72bb8b864cb457d62ab
2016-11-10 21:10:50 +09:00
Masayuki Nakano a912bd8141 Bug 1230473 If there is no TextComposition instance even when EditorBase receives eCompositionStart event, the editor should do nothing r=smaug
Even when editor receives eCompositionStart event, the active composition may have gone since web contents can listen to composition events before editor (so, web contents can commit the composition before "compositionstart" reaching focused editor).

Therefore, editor shouldn't crash as unexpected scenario.  Instead, it should do nothing in such case.

Note that when editor receives 2nd or later "compositionupdate" or "text" event, it should not modify composition.  However, currently, it does that.  This patch does NOT fix it since it's really rare case.  It should be fixed in another bug because this should be uplifted (crashing with some IMEs on Android is serious).

MozReview-Commit-ID: HIbMy4eFRMw

--HG--
extra : rebase_source : a98661ab2c1c8ee67ef551af3d1770b61cd25c84
2016-11-08 00:36:32 +09:00
Masayuki Nakano b83f17b535 Bug 1311606 Rename |result| of nsresult variants to |rv| in editor r=smaug
For conforming to our coding rules, |result| of nsresult variants should be renamed to |rv|.

MozReview-Commit-ID: Bk8CyLAnvXQ

--HG--
extra : rebase_source : dd3dc34a032f22abf3fd7f85556b47ffbeec55b2
2016-10-25 00:43:49 +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
Makoto Kato d4e1205058 Bug 850043 - Part 1. Looking for better insertion point when using plain text editor. r=masayuki
When typing character, current selection node might be anonymous DIV, not text node.  So even if plain text, we might not get it.

We should get text node correctly when using plain text editor.

MozReview-Commit-ID: LmfYa7BqZnC

--HG--
extra : rebase_source : d08c74c8cc5fdec4d19772f112e54a08b95afeb3
2016-10-17 14:22:46 +09:00
Olli Pettay d04af0658f Bug 1309720, ensure expected DOM tree operations when calling insertBefore, r=ehsan
--HG--
extra : rebase_source : 9583d0f4aa9c395c3615f17244c4531a9d441534
2016-10-14 15:33:42 +03:00
Xidorn Quan 2f49a48a09 Bug 1304302 part 10 - Replace all uses of StyleSheetHandle. r=heycam
This commit is generated by the following commands with some minor
manual adjustment:

find . \( -name '*.h' -or -name '*.cpp' \) -not -path './layout/style/StyleSheet*' -exec sed -i -b \
  -e '/^\(#include\|using\)/s/StyleSheetHandle/StyleSheet/g' \
  -e 's/\(mozilla::\)\?StyleSheetHandle::RefPtr/RefPtr<\1StyleSheet>/g' \
  -e 's/StyleSheetHandle()/nullptr/g' \
  -e 's/->AsStyleSheet()//g' \
  -e 's/StyleSheetHandle/StyleSheet*/g' {} +
sed -i -b 's/sheet->AsVoidPtr()/sheet.get()/' layout/style/Loader.cpp
sed -i -b 's/AsHandle()/this/' layout/style/StyleSheet.cpp

MozReview-Commit-ID: 7abdvlKHukd

--HG--
extra : source : e5682242db07203b5a91810fe1e243c955310588
2016-09-26 22:03:25 +10:00
Manish Goregaokar aad318e17a Bug 1300337 - Replace None_ variants from nsStyleConsts.h with None; r=heycam,TYLin
MozReview-Commit-ID: CxHzbEzjLxT

--HG--
extra : rebase_source : 232f90b8b107f7fb49f47a29a4e493660b8a7d87
2016-09-04 00:16:58 +05:30
Emilio Cobos Álvarez 619cb14d87 Bug 1299066: Make NS_STYLE_DISPLAY_* an enum class. Prefer indexing instead of linear search in the frame constructor r=heycam,bz
The main renaming was generated with the following python script:

```

import sys
import re

CAMEL_CASE_REGEX = re.compile(r"(^|_|-)([A-Z])([A-Z]+)")
DISPLAY_REGEX = re.compile(r"\bNS_STYLE_DISPLAY_([^M][A-Z_]+)\b")

def to_camel_case(ident):
  return re.sub(CAMEL_CASE_REGEX,
                lambda m: m.group(2) + m.group(3).lower(), ident)

def constant_to_enum(constant):
  return "StyleDisplay::" + to_camel_case(constant) + ("_" if constant == "NONE" else "")

def process_line(line):
  return re.sub(DISPLAY_REGEX,
                lambda m: constant_to_enum(m.group(1)), line)

lines = []
with open(sys.argv[1], "r") as f:
  for line in f:
    lines.append(process_line(line))

with open(sys.argv[1], "w") as f:
  for line in lines:
    f.write(line)
```

And the following shell commands:

```
find . -name '*.cpp' -exec python display.py {} \;
find . -name '*.h' -exec python display.py {} \;
```

MozReview-Commit-ID: 91xYCbLC2Vf
2016-09-01 20:41:17 -07:00
Aryeh Gregor a97d9af06f Bug 1295563 - Assert that editors can't be reinitialized during an edit action; r=masayuki
Many HTMLEditRules methods use the pattern of
  nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
at the beginning of the method, followed by using mHTMLEditor freely.
If Init() is then called on the editor, mHTMLEditor is set to null, so
it will crash.  Other bad stuff will probably happen too.

MozReview-Commit-ID: gUtaTAQJIh
2016-08-23 14:13:16 +03:00
Nicholas Nethercote e7f10a07fd Bug 1293603 (part 2) - Make Run() declarations consistent. r=erahm.
This patch makes most Run() declarations in subclasses of nsIRunnable have the
same form: |NS_IMETHOD Run() override|.

As a result of these changes, I had to add |override| to a couple of other
functions to satisfy clang's -Winconsistent-missing-override warning.

--HG--
extra : rebase_source : 815d0018b0b13329bb5698c410f500dddcc3ee12
2016-08-08 12:18:10 +10:00
Masayuki Nakano fb4dd2591f Bug 1260651 part.61 Replace "etc" with "etc." r=mccr8
MozReview-Commit-ID: JFgd0t2bqzu
2016-07-08 14:15:21 +09:00
Masayuki Nakano 7f30e926b8 Bug 1260651 part.60 editor/libeditor should export some headers which are required by other modules and other modules shouldn't use local include for them r=mccr8
MozReview-Commit-ID: FZSExwkHH2B
2016-07-08 14:03:31 +09:00
Masayuki Nakano f382711dc3 Bug 1260651 part.59 Rename nsEditor to mozilla::EditorBase (and also their file names) r=mccr8
This patch also renames:

EditorInputEventDispatcher -> mozilla::EditorInputEventDispatcher

And some variable names are renamed from aEditor or mEditor to aEditorBase or mEditorBase for making their types clearer.

MozReview-Commit-ID: 2FCXWpLMn8e

--HG--
rename : editor/libeditor/nsEditor.cpp => editor/libeditor/EditorBase.cpp
rename : editor/libeditor/nsEditor.h => editor/libeditor/EditorBase.h
2016-07-08 13:10:13 +09:00