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

9325 Коммитов

Автор SHA1 Сообщение Дата
Mirko Brodesser 1669cc6770 Bug 1566046: rename `GetParentOrHostNode` to `GetParentOrShadowHostNode`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D38078
2019-07-16 09:25:02 +02:00
Mirko Brodesser 2f40f072ab Bug 1565584: move `nsIContentUtils::ContentIsDescendantOf` to `nsINode::IsInclusiveDescendantOf`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37880
2019-07-15 10:02:21 +02:00
Brendan Dahl 84f1f82f3d Bug 1557371 - Part 1 - Load all XUL reftests with chrome privilege. r=dbaron
This will have two benefits:

1) Align test setup with shipping Firefox - We don't allow content
privilege XUL in shipping versions of Firefox, so having the tests be
chrome would be more realistic to our use case.

2) Support the XUL to XHTML migration. These files will soon become XHTML
files, but will still need to load XUL elements, so they'll need to be
marked as chrome privileged to continue working.

One test (404149-1.xul) is now disabled, since it fails when loaded as
chrome. Bug 1557383 was filed to address this.

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

--HG--
extra : moz-landing-system : lando
2019-07-09 19:40:33 +00:00
Emilio Cobos Álvarez c17be889ab Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful.

Differential Revision: https://phabricator.services.mozilla.com/D37406
2019-07-09 23:08:05 +02:00
Emilio Cobos Álvarez 28801c9e84 Bug 1218456 - Allow navigating when there's no pres context. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37404
2019-07-09 23:07:29 +02:00
Dorel Luca 9925ca654c Backed out 5 changesets (bug 1218456) for Crashtest failures on dom/l10n/tests/mochitest/dom_localization/test_overlay.html. CLOSED TREE
Backed out changeset 31afe89c2d42 (bug 1218456)
Backed out changeset 8bd57ebc4528 (bug 1218456)
Backed out changeset e5d37afff36a (bug 1218456)
Backed out changeset e3da86278ecf (bug 1218456)
Backed out changeset 343046089f8e (bug 1218456)

--HG--
extra : rebase_source : f092d903c8c80581d187493e036b1875d8668b3d
2019-07-09 22:04:13 +03:00
Emilio Cobos Álvarez 23a7cb7a68 Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful.

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

--HG--
extra : moz-landing-system : lando
2019-07-09 16:17:47 +00:00
Emilio Cobos Álvarez d5db3842a0 Bug 1218456 - Allow navigating when there's no pres context. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37404

--HG--
extra : moz-landing-system : lando
2019-07-09 16:17:27 +00:00
Masayuki Nakano dddc25e1e9 Bug 1563508 - part 5: Make `runRemoveContentTest()` async and fix an editor's bug which found by the test order change r=m_kato
Previously, `runRemoveContentTest()` was the last test which synthesizes
composition in the `<textarea>`.  However, new test order move it to middle
of the other tests.  Then, it hits an `MOZ_ASSERT()` in
`TextComposition::EditorWillHandleCompositionChangeEvent()` that detects a
bug.  When editable element is removed from the DOM tree during a composition,
editor cannot listen to `eCompositionEnd` event.  Therefore, when the editor
gets back, it still has destroyed `TextComposition` and keeps handling new
composition with the old one.  Therefore this patch makes
`EditorBase::InstallEventListeners()` forget the destroyed composition.

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

--HG--
extra : moz-landing-system : lando
2019-07-09 05:20:01 +00:00
Victor Porof 5065489a4e Bug 1561435 - Format editor/, a=automatic-formatting
# ignore-this-changeset

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

--HG--
extra : source : 31c98530f9be7521baab316d7edc309361623fb1
2019-07-05 10:45:46 +02:00
Razvan Maries daed363fd7 Merge mozilla-inbound to mozilla-central a=merge 2019-07-05 00:40:17 +03:00
Rob Wu 7efa6b1bd8 Bug 1396224 - Avoid cache for private clipboard data r=mstange
To avoid populating the clipboard cache,
`nsContentUtils::IPCTransferableToTransferable` should set the
IsPrivateData flag on the output transferable BEFORE assigning data to
it, not therafter.

This patch includes a new regression test for this specific scenario.

The patch also includes fixes for incorrect IsPrivateData flags in some
other locations with `transferable->Init(nullptr)`, but without unit
tests.

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

--HG--
extra : moz-landing-system : lando
2019-07-02 21:45:10 +00:00
Mirko Brodesser 6b67de025f Bug 1562876: rename `Selection::RemoveRange` to `Selection::RemoveRangeAndUnselectFramesAndNotifyListeners`. r=smaug
The name of the corresponding webidl interface of course remains unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D36607
2019-07-03 13:26:14 +02:00
Mirko Brodesser 63b4627d28 Bug 1562876: rename `Selection::AddRange` to `Selection::AddRangeAndSelectFramesAndNotifyListeners`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D36602
2019-07-03 13:26:13 +02:00
Mihai Alexandru Michis 761fb3a596 Backed out changeset c68a6b2e0157 (bug 1557371) for causing failures in reftest/content/bugs/272646-1.xul CLOSED TREE 2019-07-02 06:01:31 +03:00
Brendan Dahl c5fbaae97e Bug 1557371 - Part 1 - Load all XUL reftests with chrome privilege. r=dbaron
This will have two benefits:

1) Align test setup with shipping Firefox - We don't allow content
privilege XUL in shipping versions of Firefox, so having the tests be
chrome would be more realistic to our use case.

2) Support the XUL to XHTML migration. These files will soon become XHTML
files, but will still need to load XUL elements, so they'll need to be
marked as chrome privileged to continue working.

One test (404149-1.xul) is now disabled, since it fails when loaded as
chrome. Bug 1557383 was filed to address this.

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

--HG--
extra : moz-landing-system : lando
2019-06-29 00:04:12 +00:00
Kris Maglione fd61f8b9d4 Bug 1541557: Part 7 - Convert SpecialPowers to use JSWindowActors rather than framescripts. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D35057

--HG--
rename : testing/specialpowers/content/SpecialPowersObserverAPI.jsm => testing/specialpowers/content/SpecialPowersAPIParent.jsm
rename : testing/specialpowers/content/SpecialPowers.jsm => testing/specialpowers/content/SpecialPowersChild.jsm
rename : testing/specialpowers/content/SpecialPowersObserver.jsm => testing/specialpowers/content/SpecialPowersParent.jsm
extra : rebase_source : f3edaf8edc918bb4291b66cb50f4de117f57b2bd
extra : source : 46ff845a7b0cdabf640bb2e3c783735ab68b7cd1
2019-06-12 10:48:29 -07:00
Kris Maglione 3e44c16cf9 Bug 1541557: Part 5 - Update callers of ChromeScript.sendSyncMessage to use sendQuery instead. r=nika
Since JSWindowActors don't have direct access to synchronous messaging,
ChromeScript callers are going to need to migrate to asynchronous messaging
and queries instead.

Since there's no comparable API to sendQuery for frame message managers, this
patch adds a stub that uses synchronous messaging, but makes the API appear
asynchronous, and migrates callers to use it instead of direct synchronous
messaging. This will be replaced with a true synchronous API in the actor
migration.

Fortunately, most of the time, this actually leads to simpler code. The
`sendQuery` API doesn't have the odd return value semantics of
`sendSyncMessage`, and can usually just be used as a drop-in replacement. Many
of the `sendSyncMessage` callers don't actually use the result, and can just
be changed to `sendAsyncMessage`. And many of the existing async messaging
users can be changed to just use `sendQuery` rather than sending messages and
adding response listeners.

However, the APZ code is an exception. It relies on intricate properties of
the event loop, and doesn't have an easy way to slot in promise handlers, so I
migrated it to using sync messaging via process message managers instead.

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

--HG--
extra : rebase_source : d5707e87f293a831a5cf2e0b0a7e977090267f78
extra : source : 75ebd6fce136ab3bd0e591c2b8b2d06d3b5bf923
2019-06-12 12:40:51 -07:00
Kris Maglione f70e67ad2d Bug 1541557: Part 4 - Stop relying on synchronous preference getters/setters. r=nika
The SpecialPowers set*Pref/get*Pref APIs currently use synchronous messaging
to set and get preference values from the parent process. Aside from directly
affecting callers of those APIs, it also affects callers of `pushPrefEnv`,
which is meant to be asynchronous, but is in practice usually synchronous due
to the synchronous messaging it uses.

This patch updates the getPref APIs to use the in-process preference service
(which most callers are expecting anyway), and also updates the callers of
the setPref and pushPrefEnv APIs to await the result if they're relying on it
taking effect immediately.

Unfortunately, there are some corner cases in tests that appear to only work
because of the quirks of the current sync messaging approach. The synchronous
setPref APIs, for instance, trigger preference changes in the parent
instantly, but don't update the values in the child until we've returned to
the event loop and had a chance to process the notifications from the parent.
The differnce in timing leads some tests to fail in strange ways, which this
patch works around by just adding timeouts.

There should be follow-ups for test owners to fix the flakiness.

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

--HG--
extra : rebase_source : 941298157e7c82f420cf50ce057154ce9b85301c
extra : source : 189dc8a359815e059a4a217f788d183260bb2bfe
2019-06-13 09:34:39 -07:00
Masayuki Nakano ccf6a4c660 Bug 1444847 - part 7: Make `EditorSpellCheck` use `StaticRange` instead of `nsRange` to initialize itself r=smaug
`EditorSpellCheck` clones `nsRange` instance only for temporary use during
initialization even though the DOM tree won't be changed during it.  In this
case, using `StaticRange` is better since it does not need to observe the
DOM tree mutation.  I.e., we can save the cost of registering and
unregistering the mutation observer.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:36 +00:00
Masayuki Nakano 15b95c47c4 Bug 1444847 - part 6: Make `HTMLEditRules::PinSelectionToNewBlock()` use `StaticRange` instead of `nsRange` for temporary use r=smaug
This patch makes `HTMLEditRules::PinSelectionToNewBlock()` use `StaticRange`
instead of `nsRange` for comparing a point and a range (i.e., the DOM tree
won't be changed during it's alive).  Unfortunately, we still have allocation
cost, but we can save the cost of registering and unregistering mutation
observer and computing common ancestor of the range.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:34 +00:00
Masayuki Nakano 8d6b106ff6 Bug 1444847 - part 5: Make `HTMLEditRules::ExpandSelectionForDeletion()` use `StaticRange` instead of `nsRange` for temporary use r=smaug
This patch makes `HTMLEditRules::ExpandSelectionForDeletion()` use `StaticRange`
instead of `nsRange` for comparing a point and a range (i.e., the DOM tree
won't be changed during it's alive).  Unfortunately, we still have allocation
cost, but we can save the cost of registering and unregistering mutation
observer and computing common ancestor of the range.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:32 +00:00
Masayuki Nakano da61ea3112 Bug 1444847 - part 3: Create `RangeUtils` to place public static methods of `nsRange` r=smaug
Some `nsRange` static methods are useful in `StaticRange` and some of them
are used in a lot of places but not related to `nsRange` directly.  This
patch moves them into new static method only class, `mozilla::RangeUtils`.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:48:07 +00:00
Masayuki Nakano 2a450c5196 Bug 1444847 - part 2: Sort out basic API of `nsRange` for consistency with coming `StaticRange` r=smaug
For avoiding confusion between API of `nsRange` and `StaticRange`, I'd like to
rename `nsRange::CreateRange()` to `nsRange::Create()` because
`StaticRange::CreateStaticRange()` is too long name and
`StaticRange::CreateRange()` sounds odd.  This patch renames it and changes
related methods to template methods to avoid runtime cost of temporary
`RawRangeBoundary` instance creation.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:47:29 +00:00
Brendan Dahl ccb8b2f945 Bug 1558674 - Allow chrome privileged documents to enable/disable copy/paste. r=Ehsan,bgrins
For content HTML/XHTML copy/paste should always be enabled, but for chrome
docs we can support enabling/disabling copy/paste.

Also, restores tests to how they were before copy/paste was always enabled.

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

--HG--
extra : moz-landing-system : lando
2019-06-18 20:40:19 +00:00
Ciure Andrei 2e6ac83efb Backed out changeset 7312aba8ec3b (bug 1558674) for causing browser_console_context_menu_entries.js to permafail CLOSED TREE 2019-06-15 08:48:18 +03:00
Brendan Dahl 7c478fba5b Bug 1558674 - Allow chrome privileged documents to enable/disable copy/paste. r=Ehsan,bgrins
For content HTML/XHTML copy/paste should always be enabled, but for chrome
docs we can support enabling/disabling copy/paste.

Also, restores tests to how they were before copy/paste was always enabled.

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

--HG--
extra : moz-landing-system : lando
2019-06-15 00:27:36 +00:00
Narcis Beleuzu 72a734cf98 Backed out changeset aa7f507ac743 (bug 1558674) for dt failures on browser_console_context_menu_entries.js . CLOSED TREE 2019-06-14 05:57:52 +03:00
Brendan Dahl 04a85879bb Bug 1558674 - Allow chrome privileged documents to enable/disable copy/paste. r=Ehsan
For content HTML/XHTML copy/paste should always be enabled, but for chrome
docs we can support enabling/disabling copy/paste.

Also, restores tests to how they were before copy/paste was always enabled.

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

--HG--
extra : moz-landing-system : lando
2019-06-14 00:32:21 +00:00
Brendan Dahl 8496f09e8e Bug 1558704 - Fix spellchecker when XUL is loaded as XHTML r=masayuki
Temporary workaround to use the document element as the root content node
in XHTML pages that have a XUL root element.

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

--HG--
extra : moz-landing-system : lando
2019-06-13 11:53:12 +00:00
Jonathan Kingston a5ba216f93 Bug 1315460 - Removal of keygen element r=keeler,baku,jld,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D22810

--HG--
extra : moz-landing-system : lando
2019-06-13 08:58:07 +00:00
Boris Zbarsky d5a8a4a595 Bug 1557793 part 3. Change the signatures of various nsContentUtils localization methods to play nicer with the new stringbundle API. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D34201

--HG--
extra : moz-landing-system : lando
2019-06-08 21:26:12 +00:00
Masayuki Nakano 121e90ba98 Bug 1557996 - Make `HTMLEditor::GetSelectedElement()` not treat an element as selected when it's followed by a <br> element r=m_kato
Currently, `HTMLEditor::GetSelectedElement()` is not used in mozilla-central
and mainly used for handling double clicks in the editor with its complicated
path.  In most cases, users don't want double clicks to cause showing
property dialog in mail composer.  Therefore, we must be able to stricter in
the complicated path.

This patch adds new check whether the selected range ends immediately before
a `<br>` element.  If it's end at a `<br>` element, we shouldn't treat found
element as selected.

Note that when `<a href="...">` element is double-clicked, the element itself
is selected like `<img>` element.  So, we don't need to worry about the case
which is that users probably want to update a link with double-clicking since
such case is handled by the first optimized path in the method.

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

--HG--
extra : moz-landing-system : lando
2019-06-11 07:59:07 +00:00
Masayuki Nakano a1b8ba8568 Bug 1556235 - Make `HTMLEditRules::WillDeleteSelection()` remove empty parent blocks when it's called by drop handler r=m_kato
Chromium removes new empty blocks only when the content is removed by dragging.
Before bug 1504910, we just removed the dragged range, i.e., kept the new
empty blocks.  However, now, we put `<br>` element from
`HTMLEditRules::AfterEditInner()` because a D&D action was split to the deletion
part and inserting part (It wasn't called after inserting the dropped content).

Therefore, this patch adds new path for D&D into
`HTMLEditRules::WillDeleteSelection()`.  If parent blocks become empty,
the path removes such blocks and collapse `Selection` to where the most
ancestor empty block was.  With this patch, we get same behavior as Chrome
in most cases.  You can check it in https://jsfiddle.net/d_toybox/9px07yLr/

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

--HG--
extra : moz-landing-system : lando
2019-06-10 10:31:13 +00:00
Masayuki Nakano 84cbc7e792 Bug 1529884 - part 6: Through subject principal at Document::ExecCommand() to constructor of EditorBase::AutoEditActionDataSetter r=smaug
`Document::ExecCommand()` knows subject principal.  This patch makes it tell
`EditorCommand::DoCommand()` and `EditorCommand::DoCommandParam()`.  Then,
makes they tell each editor public methods which may cause dispatching
`beforeinput` event once we implement it.  Finally, each editor public
method sets it to the constructor of `EditorBase::AutoEditActionDataSetter`.
This means that when editor tries to dispatch `beforeinput` event, editor
can check whether it's called by JS or not from everywhere.

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

--HG--
extra : moz-landing-system : lando
2019-06-10 10:27:07 +00:00
Masayuki Nakano 94e3b7524c Bug 1529884 - part 1: Make Document use hashtable to map HTML command and internal command data r=smaug
Currently, `Document` converts HTML command (e.g., used by `execCommand()`) to
internal XUL command with array in the global space.  However, it requires scan
of the array for every command access.

This patch makes `Document` use hashtable to make the conversion faster.

New mapping info comes from:

- `mXULCommandName` is same as `internalCommandString`
- `mCommand` is mapped in CommandList.h from `mXULCommandName`
- `mGetEditorCommandFunc` is mapped from `mXULCommandName` in:
  - https://searchfox.org/mozilla-central/rev/d143f8ce30d1bcfee7a1227c27bf876a85f8cede/editor/libeditor/EditorController.cpp#31-32,34-38,40-41,43,45-51,54-57,67-112
  - https://searchfox.org/mozilla-central/rev/75294521381b331f821aad3d6b60636844080ee2/editor/libeditor/HTMLEditorController.cpp#26-28,31-39,48,51-52,55-58,60-63,65-73,76-80,83-88,90-91,93-94,97-100,102-104
- `mExecCommandParam` is converted from `useNewParam` and `convertToBoolean`:
  - If corresponding editor command class's `DoCommandParam()` just calls
    `DoCommand()`, `ExecCommandParam::Ignore`.
  - If `useNewParam` is `true` and `convertToBoolean` is `false`, given value
    should be ignored and may set constant instead.  In this case,
    `ExecCommandParam::Ignore`.
  - If `useNewParam` is `false` and `convertToBoolean` is `false`, given value
    should be treated as string.  In this case, `ExecCommandParam::String`.
  - If `useNewParam` is `false` and `convertToBoolean` is `true`, given value
    should be treated as bool.  In this case, if given command is not a legacy
    one, `ExecCommandParam::Boolean`.  Otherwise, i.e., if given command
    is a legacy one, `ExecCommandParam::InvertedBoolean`.
  - Otherwise, `ExecCommandParam::String`.

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

--HG--
extra : moz-landing-system : lando
2019-06-10 10:23:59 +00:00
Boris Zbarsky 5eb248348f Bug 1557847. Stop using [array] in nsIClipboard. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D34243

--HG--
extra : moz-landing-system : lando
2019-06-09 01:06:39 +00:00
Boris Zbarsky dc2b7685d7 Bug 1557231. Stop using [array] in nsIInlineSpellChecker. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D33908

--HG--
extra : moz-landing-system : lando
2019-06-06 06:59:37 +00:00
Makoto Kato b60b55e5bc Bug 1556656 - Restrict script access for some methods in nsIEditingSession r=masayuki
Some methods in `nsIEditingSession` isn't used from script. So we should move
these to `nsEditingSession` or add `[noscript]`.

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

--HG--
extra : moz-landing-system : lando
2019-06-06 05:31:16 +00:00
Emilio Cobos Álvarez 7540d08d90 Bug 1556799 - Remove manual NAC as soon as parent chain changes. r=masayuki
Having NAC bound to the tree when not connected is not quite fine, make sure to
clean up properly.

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

--HG--
extra : moz-landing-system : lando
2019-06-06 01:48:10 +00:00
Boris Zbarsky 9b956f652d Bug 1556922. Stop using [array] in nsIEditorSpellCheck. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D33742

--HG--
extra : moz-landing-system : lando
2019-06-05 04:07:28 +00:00
Ehsan Akhgari adf073ce68 Bug 836176 - Part 3: Remove nsIHTMLDocument; r=farre
Differential Revision: https://phabricator.services.mozilla.com/D32925

--HG--
extra : moz-landing-system : lando
2019-06-04 17:27:43 +00:00
Masayuki Nakano d9e3ea7e57 Bug 1426709 - Make HTMLEditor update selection ancestor limit synchronously when editing host is changed to ancestor element r=smaug
`HTMLEditor` initializes selection ancestor limit when it receives `focus`
event.  If `Document.execCommand()` is called immediately after an
ancestor of active editing host becomes new editing host,
`HTMLEditor::GetActiveEditingHost()` returns the new one, but selection
ancestor limit is still the previous one.  This mismatch causes a lot of
bugs.  Therefore, this patch makes `nsGenericHTMLElement` notifies `HTMLEditor`
of an element becoming `contenteditable`, and makes `HTMLEditor` update
selection ancestor limit only when the new editing host is ancestor of
old selection ancestor limit.

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

--HG--
extra : moz-landing-system : lando
2019-06-04 08:42:43 +00:00
Masayuki Nakano 5ac5e497b5 Bug 1555227 - Make GetInternalCommand() return new commands when the command is "cmd_align" without params r=m_kato
`cmd_align` is always with `nsCommandParams` when it's executed.  However,
when somebody checks whether the command is enabled or not, or retrieves the
state, `GetInternalCommand()` is called without `nsCommandParams`.  Therefore,
even when `nsCommandParmas` is nullptr for `cmd_align`, `GetInternalCommand()`
shouldn't warn it.

Additionally, internal command supports to set `align` to empty string.
Therefore, `GetInternalCommand()` also needs to support it.

This patch adds `Command::FormatJustify` for the former case and
`Command::FormatJustifyNone` for the latter case.

Note that this does not affect to actual behavior since `AlignCommand`
does not refer the result of `GetInternalCommand()`.

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

--HG--
extra : moz-landing-system : lando
2019-06-04 10:01:31 +00:00
Emilio Cobos Álvarez 6917a38081 Bug 1555216 - Change the signature of BindToTree to be (BindContext&, nsINode& aParentNode). r=bzbarsky
BindContext was going to have way more information at first, but then I realized
that most of the things I wanted to know were basically a flag away using the
parent node.

Still I think it's worth it, now experimenting with BindToTree will only mean
adding a field to a struct that's included from a couple cpp files, instead of a
massive pain.

I also think this is clearer, and doing this highlights quite a few
inconsistencies in our code which I've left untouched, but commented with
FIXMEs.

Steps are:

$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsresult BindToTree(Document\* aDocument, nsIContent\* aParent,#nsresult BindToTree(BindContext\&, nsINode\& aParent)#g' $file; done
$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#                      nsIContent\* aBindingParent) override#override#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(Document\* aDocument, nsIContent\* aParent,#::BindToTree(BindContext\& aContext, nsINode\& aParent)#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsIContent\* aBindingParent)##g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(aDocument, aParent, aBindingParent)#::BindToTree(aContext, aParent)#g' $file; done
$ ./mach clang-format

Then manual fixups.

Depends on D32948

Differential Revision: https://phabricator.services.mozilla.com/D32949
2019-05-31 23:31:52 +02:00
Emilio Cobos Álvarez 19258bfbb4 Bug 1554716 - Remove nsStyleColor moving the color property to nsStyleText. r=jfkthame
I think this is a good change regardless of other discussion in bug 1552587. If
we decide to move `mColor` to the top-level of the struct that can be done
separately.

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

--HG--
extra : moz-landing-system : lando
2019-05-31 14:48:22 +00:00
Ehsan Akhgari df65fc2dfc Bug 1415270 - Part 2: Enable editing support for non-HTML documents as well; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D32912

--HG--
extra : moz-landing-system : lando
2019-05-31 01:38:58 +00:00
Ehsan Akhgari a9e9f5ccdb Bug 1415270 - Part 1: Move nsHTMLDocument editing APIs to Document; r=farre,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D32911

--HG--
extra : moz-landing-system : lando
2019-05-31 01:37:26 +00:00
Masayuki Nakano a3d946e313 Bug 1555640 - Check if `aPointAfterInsertedString` is nullptr when `WSRunObject::InsertText()` sets its value r=m_kato
`aPointAfterInsertedString` of `WSRunObject::InsertText()` is optional (i.e.,
may be nullptr).  However, the fix for bug 1534394 makes it always set to
original insertion point when `InsertTextWithTransaction()` is failed.

This patch just make it check if `aPointAfterInsertedString` is nullptr before
setting its value.

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

--HG--
extra : moz-landing-system : lando
2019-05-30 10:32:44 +00:00
Masayuki Nakano 761f01d612 Bug 1533913 - Make HTMLEditRules::ApplyBlockStyle() stop handling it if target node is moved from expected container unexpectedly r=m_kato
`HTMLEditRules::ApplyBlockStyle()` stores `curBlock` and `newBlock` during its
loop to keep handling from deeper child to ancestor, and may do two things for
a `curNode`.  If `curBlock` and/or `newBlock` is moved from expected container
when it sets one of or both of them, this patch check whether mutation event
listeners change the DOM tree.  Additionally, this patch also checks whether
`curNode' is moved by mutation event listener at first step of two jobs for it.

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

--HG--
extra : moz-landing-system : lando
2019-05-29 04:44:23 +00:00