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

9754 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 03baeb9f3d Bug 1620504 - part 18: Clean up warnings in SplitNodeTransaction r=m_kato
Depends on D66179

Differential Revision: https://phabricator.services.mozilla.com/D66226

--HG--
extra : moz-landing-system : lando
2020-03-11 06:13:26 +00:00
Masayuki Nakano 476081f03e Bug 1620504 - part 17: Clean up warnings in PlaceholderTransaction r=m_kato
Additionally, this makes some `nsIAbsorbingTransaction` methods infallible for
reducing unnecessary warnings.

Differential Revision: https://phabricator.services.mozilla.com/D66179

--HG--
extra : moz-landing-system : lando
2020-03-11 02:11:52 +00:00
Masayuki Nakano 5343ffcff8 Bug 1620504 - part 16: Clean up warnings in JoinNodeTransaction r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D66178

--HG--
extra : moz-landing-system : lando
2020-03-10 14:20:22 +00:00
Masayuki Nakano b4e1588a17 Bug 1620504 - part 15: Clean up warnings in InsertTextTransaction r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D66177

--HG--
extra : moz-landing-system : lando
2020-03-10 14:23:48 +00:00
Masayuki Nakano 605bafef7b Bug 1620504 - part 14: Clean up warnings in InsertNodeTransaction r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D66176

--HG--
extra : moz-landing-system : lando
2020-03-10 14:17:53 +00:00
Masayuki Nakano 8371d74f49 Bug 1620504 - part 13: Clean up warnings in editor/txmgr r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D66175

--HG--
extra : moz-landing-system : lando
2020-03-10 13:59:36 +00:00
Masayuki Nakano 9c836ea324 Bug 1620504 - part 12: Clean up warnings in EditorEventListener r=m_kato
Depends on D65877

Differential Revision: https://phabricator.services.mozilla.com/D66174

--HG--
extra : moz-landing-system : lando
2020-03-10 07:54:29 +00:00
Ehsan Akhgari a96ff3afcf Bug 848644 - Add a crashtest based on the test case for the bug
Differential Revision: https://phabricator.services.mozilla.com/D66256

--HG--
extra : moz-landing-system : lando
2020-03-10 16:43:26 +00:00
Ehsan Akhgari e23c47bb28 Bug 745494 - Add a crashtest based on the test case for the bug
Differential Revision: https://phabricator.services.mozilla.com/D66254

--HG--
extra : moz-landing-system : lando
2020-03-10 16:28:57 +00:00
Masayuki Nakano 96f81476ca Bug 1620504 - part 11: Clean up warnings in editor command classes r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D65877

--HG--
extra : moz-landing-system : lando
2020-03-10 04:34:15 +00:00
Masayuki Nakano 0e68df00a5 Bug 1620504 - part 10: Clean up warnings in EditorBase r=m_kato
Depends on D65875

Differential Revision: https://phabricator.services.mozilla.com/D65876

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:24 +00:00
Masayuki Nakano be4d995f31 Bug 1620504 - part 9: Clean up warnings in EditAggregateTransaction r=m_kato
This also changes `mChildren` to array of `OwningNonNull` for removing
unnecessary `nullptr` checks.

Depends on D65874

Differential Revision: https://phabricator.services.mozilla.com/D65875

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:24 +00:00
Bogdan Tara db31d5b274 Backed out changeset 00ab51ea2723 (bug 1620778) for test_autocomplete_mac_caret.xhtml failures CLOSED TREE 2020-03-10 12:24:48 +02:00
Emilio Cobos Álvarez 49598c22ee Bug 1620778 - Fix interaction of up/down keys with autocomplete and <input type=number>. r=masayuki,smaug
Differential Revision: https://phabricator.services.mozilla.com/D66011

--HG--
extra : moz-landing-system : lando
2020-03-10 02:44:44 +00:00
Masayuki Nakano 9af3340409 Bug 1620504 - part 8: Clean up warnings in DeleteTextTransaction r=m_kato
Depends on D65873

Differential Revision: https://phabricator.services.mozilla.com/D65874

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:24 +00:00
Masayuki Nakano 994ae78613 Bug 1620504 - part 7: Clean up warnings in DeleteRangeTransaction r=m_kato
Depends on D65872

Differential Revision: https://phabricator.services.mozilla.com/D65873

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:23 +00:00
Masayuki Nakano 32ad653b14 Bug 1620504 - part 6: Clean up warnings in DeleteNodeTransaction r=m_kato
Depends on D65871

Differential Revision: https://phabricator.services.mozilla.com/D65872

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:23 +00:00
Masayuki Nakano 09bb52cb18 Bug 1620504 - part 5: Clean up warnings in ChangeAttributeTransaction r=m_kato
Depends on D65870

Differential Revision: https://phabricator.services.mozilla.com/D65871

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:23 +00:00
Masayuki Nakano 20296adfc3 Bug 1620504 - part 4: Clean up warnings in CreateElementTransaction r=m_kato
Depends on D65869

Differential Revision: https://phabricator.services.mozilla.com/D65870

--HG--
extra : moz-landing-system : lando
2020-03-09 04:53:55 +00:00
Masayuki Nakano c1fc16a11b Bug 1620504 - part 3: Clean up warnings in CompositionTransaction r=m_kato
Depends on D65867

Differential Revision: https://phabricator.services.mozilla.com/D65869

--HG--
extra : moz-landing-system : lando
2020-03-09 07:14:19 +00:00
Masayuki Nakano c6ab66e5b6 Bug 1620504 - part 2: Clean up warnings in ChangeStyleTransaction r=m_kato
Depends on D65866

Differential Revision: https://phabricator.services.mozilla.com/D65867

--HG--
extra : moz-landing-system : lando
2020-03-09 03:15:02 +00:00
Masayuki Nakano 9748db36aa Bug 1620504 - part 1: Clean up warnings in CSSEditUtils r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D65866

--HG--
extra : moz-landing-system : lando
2020-03-09 01:58:24 +00:00
Masayuki Nakano 7bd48e79b8 Bug 1618906 - Make `HTMLEditor` stop handling anything if container of a range in `Selection` is not a content node r=m_kato
It's valid thing that a container of a `Range` of `Selection` is not a content
node.  Actually, it can be a `Document` node.  But it's illegal case for
editor.  So, if `HTMLEditor` meets such case, it does not need to do anything.

This patch makes that if `HTMLEditor` meets the situation at very first time
of public edit action method, it returns "OK" for avoiding new exception case.
Otherwise, i.e., it's an XPCOM API or meeting such situation after a DOM
mutation, returns error.

Differential Revision: https://phabricator.services.mozilla.com/D65278

--HG--
extra : moz-landing-system : lando
2020-03-05 04:39:35 +00:00
Mark Banner 15cfe23b88 Bug 1620542 - Automatically fix ESLint errors in .eslintrc.js files. r=mossop
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D65703

--HG--
extra : moz-landing-system : lando
2020-03-07 10:09:44 +00:00
Boris Zbarsky c6c4a83796 Bug 1535530. Fix can-run-script analysis to not mishandle on-stack refs to RefPtrs. r=andi,masayuki
The key here is to test the type of the variable declaration for being a
smartptr type, instead of testing the type of the variable _use_.

Differential Revision: https://phabricator.services.mozilla.com/D65581

--HG--
extra : moz-landing-system : lando
2020-03-06 09:57:45 +00:00
Masayuki Nakano 85a0bd9a61 Bug 1620135 - Clean up trivial constructor and destructor under libeditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D65448

--HG--
extra : moz-landing-system : lando
2020-03-06 04:38:25 +00:00
Mirko Brodesser 4be580237d Bug 1619617: part 1) Annotate `RemoveRangeAndUnselectFramesAndNotifyListeners` with `MOZ_CAN_RUN_SCRIPT`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D65511

--HG--
extra : moz-landing-system : lando
2020-03-06 12:03:23 +00:00
Coroiu Cristina e3e3fb9577 Backed out changeset 97a8f04641de (bug 1618906) on request by masayuki 2020-03-05 06:36:44 +02:00
Masayuki Nakano ed016cbd72 Bug 1618906 - Make `HTMLEditor` stop handling anything if container of a range in `Selection` is not a content node r=m_kato
It's valid thing that a container of a `Range` of `Selection` is not a content
node.  Actually, it can be a `Document` node.  But it's illegal case for
editor.  So, if `HTMLEditor` meets such case, it does not need to do anything.

This patch makes that if `HTMLEditor` meets the situation at very first time
of public edit action method, it returns "OK" for avoiding new exception case.
Otherwise, i.e., it's an XPCOM API or meeting such situation after a DOM
mutation, returns error.

Differential Revision: https://phabricator.services.mozilla.com/D65278

--HG--
extra : moz-landing-system : lando
2020-03-04 09:14:44 +00:00
Simon Giesecke dd65843b46 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in editor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D65287

--HG--
extra : moz-landing-system : lando
2020-03-04 09:10:03 +00:00
Masayuki Nakano 9a2dc9a516 Bug 1619647 - Make `WSRunObject::ReplacePreviousNBSPIfUnnecessary()` check `IsEndOfContainer()` before calling `IsCharNBSP()` r=m_kato
I forgot to add this check only here. (I also checked again for all similar
methods' callers.)  So, if the point is end of a text node (i.e., offset equals
its length), `IsCharNBSP()` refers wrong address.

I cannot find a way to reproduce this crash, therefore, this patch does not
have new crashtest.

(Additionally, this corrects the misspell in the method name.)

Differential Revision: https://phabricator.services.mozilla.com/D65279

--HG--
extra : moz-landing-system : lando
2020-03-04 08:15:15 +00:00
Masayuki Nakano 8bdbe3afd6 Bug 1619852 - Fix the mistake in `HTMLEditor::HandleDeleteCollapsedSelectionAtTextNode()` r=m_kato
The check was written with `NS_ASSERTION`, but I realized that it's possible
case with mutation event listeners.  Therefore, I changed it to `if` and
`return`, but I forgot to revert the sign of inequality.

Differential Revision: https://phabricator.services.mozilla.com/D65280

--HG--
extra : moz-landing-system : lando
2020-03-04 06:22:23 +00:00
Masayuki Nakano dace885161 Bug 1449831 - part 4: Add automated tests for `InputEvent.getTargetRanges()` r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D64731

--HG--
extra : moz-landing-system : lando
2020-03-03 03:41:16 +00:00
Masayuki Nakano f5af8613ec Bug 1449831 - part 3: Make editor set target ranges of `beforeinput` event if the editor instance is an `HTMLEditor` r=smaug
In most cases, `InputEvent.getTargetRange()` of `beforeinput` event should
return `Selection` ranges at dispatching the event.

This patch also handles special cases.
* composition change - target range should be the previous composition string
  which will be replaced with new composition string.
* replace text - target range should be the replace range.  This is used by
  spellchecker.
* drop - target range should be the drop point.

However, the other exception is not handled by this patch.  That is, deletions.
The target range(s) should be the range(s) which will be removed.  In most
cases, they also matches selection ranges, but may be extended to:
* surrogate pair boundary
* grapheme cluster boundary like complex emoji
* word/line deletion deletion
* `Backspace` or `Delete` from collapsed selection
* to end of unnecessary whitespaces

For supporting these cases, we need to separate
`HTMLEditor::HandleDeleteSelection()` and its helper methods and helper class
to range computation part and modifying the DOM tree part.  Of course, it
requires big changes and `InputEvent.getTargetRanges()` may be important for
feature detection of `beforeinput` event so that we should put off the big
changes to bug 1618457.

Differential Revision: https://phabricator.services.mozilla.com/D64730

--HG--
extra : moz-landing-system : lando
2020-03-03 03:39:26 +00:00
Masayuki Nakano 0af4f88f9d Bug 1449831 - part 2: Make `InputEventOptions` be able to take target ranges r=smaug
`InputEventOptions` should be able to take target ranges for `beforeinput`
event.  However, it requires to include `StaticRange.h` from `nsContentUtils.h`
even though most `nsContentUtils.h` users don't need it.  Therefore, this patch
moves it from `nsContentUtils.h` to new header file.

And makes `nsContentUtils::DispatchInputEvent()` moves the target ranges
from `InputEventOptions` to `InternalEditorInputEvent`.

Differential Revision: https://phabricator.services.mozilla.com/D64729

--HG--
extra : moz-landing-system : lando
2020-03-03 03:38:43 +00:00
Masayuki Nakano 3406e1e208 Bug 1618089 - part 8: Make `WSRunObject::PrepareToDeleteRange()` take 2 pointers of `EditorDOMPoint` r=m_kato
Note that the input can be `EditorDOMPointInText`, but modified range may start
and/or end with different container.  Therefore, it needs to take
`EditorDOMPoint` rather than `EditorDOMPointInText`.

Differential Revision: https://phabricator.services.mozilla.com/D64339

--HG--
extra : moz-landing-system : lando
2020-03-03 04:35:26 +00:00
Masayuki Nakano c5eeb32fe1 Bug 1618089 - part 7: Make some related methods use `EditorDOMPointInText` for arguments or result r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D64338

--HG--
extra : moz-landing-system : lando
2020-03-03 01:15:38 +00:00
Masayuki Nakano 8ca8aa8311 Bug 1618089 - part 6: Get rid of `WSRunScanner::WSPoint` r=m_kato
With adding new type, `EditorDOMPointInText` whose container is
`RefPtr<dom::Text>`, we can replace `WSRunScanner::WSPoint` and make
`WSRunScanner` and `WSRunObject` can use its various API.  Then, this
patch adds a lot of `NS_ASSERTION`s which can detect existing bugs.

Note that it may look like redundant that `EditorDOMPointInText::IsChar*()`
requires `EditorDOMPointInText::IsEndOfContainer()` check before that.
However, this makes what the callers check clearer.

Differential Revision: https://phabricator.services.mozilla.com/D64336

--HG--
extra : moz-landing-system : lando
2020-03-02 10:08:59 +00:00
Masayuki Nakano 2d12d4abab Bug 1618089 - part 5: Make `WSRunObject::GetASCIIShitespacesBounds()` return 2 `EditorDOMPoint`s r=m_kato
Before changing `WSPoint` to `EditorDOMPointBase`, we need to change some
methods which are helped by the methods returning `WSPoint`.

Differential Revision: https://phabricator.services.mozilla.com/D64335

--HG--
extra : moz-landing-system : lando
2020-03-02 07:35:49 +00:00
Masayuki Nakano 3b631553d3 Bug 1618089 - part 4: Make `WSRunObject` instantiators guarantee `WSRunObject::mHTMLEditor` lifetime r=m_kato
Some script run methods of `WSRunObject` guarantee the lifetime of its
`mHTMLEditor`.  However, they should be guaranteed by the instantiators
(all of them are `HTMLEditor`).

Differential Revision: https://phabricator.services.mozilla.com/D64334

--HG--
extra : moz-landing-system : lando
2020-03-02 07:35:37 +00:00
Masayuki Nakano febc3dd7e5 Bug 1618089 - part 3: Rename `WSRunScanner::Get(Previous|Next)CharPoint(const WSPoint&)` to `WSRunScanner::Get(Previous|Next)CharPointFromPointInText()` r=m_kato
For making it easier to review the following patches, rename the overloads
of `WSRunScanner::Get(Previous|Next)CharPoint()` which take `WSPoint`.

Differential Revision: https://phabricator.services.mozilla.com/D64333

--HG--
extra : moz-landing-system : lando
2020-03-02 07:35:34 +00:00
Masayuki Nakano abaebf7909 Bug 1618089 - part 2: Rename `WSRunScanner::Get(Next|Previous)CharPointInternal()` to `WSRunScanner::LookFor(Next|Previous)CharPointWithinAllTextNodes()` r=m_kato
They are fallback methods when the container of given point is not a text node
in `WSRunScanner::mNodeArray`, and then, looks for a text node for the given
point.

Differential Revision: https://phabricator.services.mozilla.com/D64332

--HG--
extra : moz-landing-system : lando
2020-03-02 07:33:56 +00:00
Masayuki Nakano b93a2782a0 Bug 1618089 - part 1: Redsign `EditorDOMPointBase` with template methods r=m_kato
Some methods of `EditorDOMPointBase` assumes the container node type is
`nsINode`.  However, it's not good for reuse.  Therefore, this patch makes
most methods of them be template methods.

Differential Revision: https://phabricator.services.mozilla.com/D64331

--HG--
extra : moz-landing-system : lando
2020-03-02 07:33:23 +00:00
Masayuki Nakano 38171fabc5 Bug 1616257 - part 5: Make `WSRunObject` stop keeping `HTMLEditor` as a friend class r=m_kato
With the preceding patches, `HTMLEditor` mostly does not need to be a friend of
`WSRunObject`.

This patch stops it, and adding some self-documented methods for checking
`mStartReason` and `mEndReason`, and also adding self-documented alternative
methods of `GetStartReasonContent()` and `GetEndReasonContent()`.

Differential Revision: https://phabricator.services.mozilla.com/D63616

--HG--
extra : moz-landing-system : lando
2020-02-25 23:19:45 +00:00
Masayuki Nakano 4ef76b0f91 Bug 1616257 - part 4: Use content of `WSScanResult` instead of reason content of `WSRunScanner` if they are same r=m_kato
When `WSScanResult::ReachedCurrentBlockBoundary()` returns true, reached content
of backward scan result is same as the scanner's `GetStartReasonContent()` and
reached content of forward scan result is same as the scanner's
`GetEndReasonContent()`.  For making code in the blocks of
`if (foo.ReachedCurrentBlockBoundary())` easier to understand, we should use
the result's content.

Differential Revision: https://phabricator.services.mozilla.com/D63615

--HG--
extra : moz-landing-system : lando
2020-02-25 12:12:30 +00:00
Masayuki Nakano f5407e4219 Bug 1616257 - part 3: Make `WSRunScanner::NextVisibleNode()` and `WSRunScanner::PriorVisibleNode()` return stack only class instance which storing the visible node as `nsIContent` r=m_kato
They are really messy because they take a lot of out parameters, and these
out parameter meaning is really unclear.  Therefore, they should return
a stack only class instance which explain the meaning with getter methods.
And also it should store the result node as `nsIContent`.

And also this patch adds static methods for them for their users which don't
need `WSRunScanner` instance.

Differential Revision: https://phabricator.services.mozilla.com/D63613

--HG--
extra : moz-landing-system : lando
2020-02-25 12:10:04 +00:00
Masayuki Nakano 6382dae45f Bug 1616257 - part 2: Change `mStartReasonNode` and `mEndReasonNode` to `nsIContent` r=m_kato
Now, all setter guarantee that they are subclass instances of `nsIContent`.

Differential Revision: https://phabricator.services.mozilla.com/D63612

--HG--
extra : moz-landing-system : lando
2020-02-25 09:31:18 +00:00
Masayuki Nakano ca9705cc2b Bug 1616257 - part 1: Redesign `WSRunScanner::GetWSBoundingParent()` r=m_kato
Its result has 4 meanings:

1. an editable block element for container of `mScanStartPoint`.
2. a topmost inline editable content for container of `mScanStartPoint` if there
is no editable block parent.
3. container of `mScanStartPoint` if it's a block (either editable or
non-editable).
4. container of `mScanStartPoint` if its parent is not editable and a inline
content.

#1, #2 and editable case of #3 make sense because the results are topmost
editable content in current context.  On the other hand, non-editable case
of #3 and #4 are caused by unexpected wrong fallback code.

So, let's make it always returns the content in the former meaning and if
the caller needs the latter one, they should use the container by themselves.
Therefore, for making what's the start of the search, this patch also makes
new method take start content instead of hiding `mScanStartPoint` from the
callers.

Differential Revision: https://phabricator.services.mozilla.com/D63610

--HG--
extra : moz-landing-system : lando
2020-02-25 08:58:43 +00:00
Kris Maglione c31aa68fb4 Bug 1535617: Part 2 - Clear weak references for most cycle collected objects on unlink. r=mccr8
This covers most cycle collected objects which support weak references, but
not the ones which inherit from a cycle collected class and don't do any cycle
collection on their own.

Differential Revision: https://phabricator.services.mozilla.com/D63962

--HG--
extra : moz-landing-system : lando
2020-02-25 19:44:39 +00:00
Masayuki Nakano 5f656bfdd1 Bug 1616539 - Make `TextEditor::OnDrop()` compare newly focused element with active editing host r=m_kato
Currently, it checks whether proper element gets focus as expected with
`nsFocusManager::GetFocusedElement()`, but it returns globally focused element.
I.e., it may return different document's element or `nullptr` if application
itself is inactive.

The purpose of the focus check is, `HTMLEditor` can modify contents only in
active editing host.  Therefore, comparing with
`HTMLEditor::GetActiveEditingHost()` is better and simpler for here.

Differential Revision: https://phabricator.services.mozilla.com/D63581

--HG--
extra : moz-landing-system : lando
2020-02-25 01:28:01 +00:00