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

116 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano c3b56cac82 Bug 1770877 - part 15: Implement equivalent of `HTMLEditor::GetSelectionRangesExtendedToHardLineStartAndEnd` r=m_kato
It's always work with `Selection` ranges.  Then, it should be treated within
`AutoRangeArray` which can be initialized with `Selection` ranges automatically.
Then, we can making `HTMLEditor` simpler.

Note tha this tries to make it get editing host when the corresponding
public method is called (after dispatched `beforeinput` event if handling a
users' operation).  However, as commented in
`HTMLEditor::SetParagraphFormatAsAction`, it breaks a tricky crash test.
Therefore, only the format block path computes it after the preparation.

Differential Revision: https://phabricator.services.mozilla.com/D149079
2022-06-17 21:28:36 +00:00
Masayuki Nakano 684a30f93f Bug 1771448 - part 4: Rename `HTMLEditor::GetActiveEditingHost` to `ComputeEditingHost` r=m_kato
It's currently computes the corresponding editing host from the focus node of
`Selection` with climbing up the DOM tree.  So, it does not just return a stored
element.  Therefore, some callers use it multiple times.  For avoiding it, we
should rename it to explain that it computes the editing host.

Note that I think that we should make it takes a node to compute editing host
without `Selection` for solving the case of no selection ranges.  Therefore,
I don't like to include more information into the name.

Differential Revision: https://phabricator.services.mozilla.com/D147504
2022-05-31 03:41:01 +00:00
Masayuki Nakano 3d7afa934d Bug 1771448 - part 3: Get rid of `EditorBase::GetEditorRoot` r=m_kato
It returns the anonymous `<div>` element if the instance is a `TextEditor`, and
compute editing host otherwise.  So it's unclear what it returns.  Additionally,
all users except `EditorBase::CreateTransactionForCollapsedRange` are the
methods of `HTMLEditor`.  Therefore, we should remove it and unwrap the code
which it's done.

Differential Revision: https://phabricator.services.mozilla.com/D147503
2022-05-31 03:41:01 +00:00
Masayuki Nakano bd948d52e9 Bug 1771448 - part 2: Get rid of `EditorBase::IsDescendantOfEditorRoot` r=m_kato
With this patch, there are some odd points.  We should investigate them later...

Differential Revision: https://phabricator.services.mozilla.com/D147502
2022-05-31 03:41:01 +00:00
Emilio Cobos Álvarez 9c190fff4b Bug 1771564 - Constify ComputedStyle usage in nsComputedDOMStyle. r=dholbert
None of the consumer need to mutate styles, and this saves some ugly
const_casting on the next patch.

Doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D147555
2022-05-28 01:04:24 +00:00
Masayuki Nakano f5d4ddc057 Bug 1766355 - part 7: Rewrite `HTMLEditor::RemoveContainerWithTransaction` with `MoveNodeTransaction` and make it stop touching `Selection` directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D146403
2022-05-20 09:01:40 +00:00
Kagami Sascha Rosylight 1c1a9d5457 Bug 1767998 - Apply readability-make-member-function-const on editor/libeditor r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D145626
2022-05-13 05:35:25 +00:00
Masayuki Nakano 57b3cd700f Bug 1762115 - part 10: Make `HTMLEditor::InsertBRElement` stop touching `Selection` directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D144653
2022-05-03 01:03:05 +00:00
Masayuki Nakano 5ffc15f39d Bug 1742933 - part 4: Make `HTMLEditor::CreateAndInsertElementWithTransaction()` and `HTMLEditor::InsertBRElementWithTransaction()` work without transactions r=m_kato
At initializing new element which has not been connected, undo transactions
are not necessary because just removing the new element gets same result for
users.  Therefore, they should be able to work without transactions.

Differential Revision: https://phabricator.services.mozilla.com/D140468
2022-03-11 07:18:48 +00:00
Masayuki Nakano 45ba6f356a Bug 1753508 - Add logger of selection batch r=smaug
This was required for debugging the bug.

Differential Revision: https://phabricator.services.mozilla.com/D139350
2022-03-11 02:24:24 +00:00
Masayuki Nakano 667224045f Bug 1745882 - Move all editor prefs in `all.js` to `StaticPrefList.yaml` r=m_kato
Depends on D133729

Differential Revision: https://phabricator.services.mozilla.com/D133730
2021-12-15 05:17:52 +00:00
Emilio Cobos Álvarez 2d0a072174 Bug 1723921 - Cleanup nsComputedDOMStyle and related APIs. r=layout-reviewers,jfkthame
This will make implementing the new behavior behind a pref
really straight-forward, and is generally nicer.

Depends on D121858

Differential Revision: https://phabricator.services.mozilla.com/D121705
2021-08-07 09:47:15 +00:00
Masayuki Nakano 4ac1a649ab Bug 1717178 - part 3: Get rid of `nsIHTMLObjectResizer.refreshResizers()` because of unused r=m_kato
Depends on D118798

Differential Revision: https://phabricator.services.mozilla.com/D118799
2021-06-28 12:08:49 +00:00
Masayuki Nakano ab7d00e972 Bug 1717178 - part 2: Get rid of `nsIHTMLAbsPosEditor.refreshGrabber()` because of unused r=m_kato
Depends on D118797

Differential Revision: https://phabricator.services.mozilla.com/D118798
2021-06-28 12:08:49 +00:00
Masayuki Nakano 867fd9ab9a Bug 1707630 - part 1: Make `HTMLEditor::InsertBREelementWithTransaction()` return error when it fails r=m_kato
The testcase hits the assertion because `CreateNodeTransaction::DoTransaction()`
returns error, but it's not handled by `HandledInsertParagraphInParagraph()`
so that we should make `InsertBRElementWithTransaction()` and its callees
should return error if they meet unexpected cases.

Depends on D113471

Differential Revision: https://phabricator.services.mozilla.com/D113472
2021-04-28 03:33:25 +00:00
Andi-Bogdan Postelnicu b6b336c821 Bug 1683534 - Make `editor` buildable outside of `unified-build` environment. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D100206
2021-01-04 14:18:50 +00:00
Masayuki Nakano 053daa2052 Bug 1627924 - Make `HTMLEditor::HideGrabberInternal()` reset dragging state r=emilio
When the grabber to move absolutely positioned element is disabled,
`HTMLEditor::HideGrabberInternal()` is called to delete it.  However,
it does not reset dragging state.  Therefore, `mousemove` event listener
will try to handle drag even after the grabber is removed.

This patch makes `HideGrabberInternal()` reset the dragging state to
make the event listener stop handling the drag action.

However, I hit a buggy assertion in `EventStateManager`.  It tries to
set active state to parent of the grabber (in this case, absolutely positioned
element).  However, editable element in `contenteditable` cannot have
active state.  Therefore, `leaf` becomes `nullptr`, but `newleaf` is the
absolutely positioned element.  Therefore, this patch adds this condition
into the `MOZ_ASSERT`.

Differential Revision: https://phabricator.services.mozilla.com/D93632
2020-10-16 02:34:15 +00:00
Simon Giesecke de7bab0f06 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82325
2020-09-23 15:17:15 +00:00
Makoto Kato 0a0fc918b8 Bug 1663638 - Don't use edit transaction for editing UI. r=masayuki
Although we use CSS property for Inline table editing UI, we use edit
transaction for it unfortunately. When hiding this UI, since removing
element doesn't use edit transaction, transaction will be canceled before
showing this UI.

It is unnecessary to use edit transaction for UI, so we shouldn't use it.

Differential Revision: https://phabricator.services.mozilla.com/D90056
2020-09-14 05:10:08 +00:00
Masayuki Nakano 5bca4199fb Bug 1660378 - part 9: Avoid QI for getting `nsStyledElement` pointer r=smaug
The editor modules does QI too many times when it sets or removes some style
with `execCommand` or XPCOM API.  Therefore, there should be an API to
retrieve `nsStyledElement` pointer from `nsINode*`.

Differential Revision: https://phabricator.services.mozilla.com/D87990
2020-08-26 05:29:06 +00:00
Masayuki Nakano decd85f7d6 Bug 1660378 - part 6: Make `CSSEditUtils::SetCSSProperty()` and its callers take `nsStyledElement&` instead of `Element&` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D87987
2020-08-26 04:48:28 +00:00
Masayuki Nakano 801ca86f89 Bug 1660378 - part 2: Make `CSSEditUtils::RemoveCSSPoperty()` take `nsStyledElement&` instead of `Element&` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D87983
2020-08-26 04:48:16 +00:00
Masayuki Nakano 19c23d725f Bug 1659276 - Make `AutoPlaceholderBatch` choose whether do or do not `ScrollSelectionIntoView` r=m_kato
The root cause of this bug is a bug of async `ScrollSelectionIntoView` that
is what it won't be canceled even if web app changes scroll position with
any API.  Fixing it is really risky and this bug affects an existing website.
Therefore, this patch makes the constructors of `AutoPlaceholderBatch` take
whether do or do not `ScrollSelectionIntoView` when it's destructed.  And
makes `HTMLEditor::SetInlinePropertyAsAction()` not request
`ScrollSelectionIntoView` for taking back the traditional behavior.

Note that this patch does not make it an optional argument because it's hard to
guess that it'll run `ScrollSelectionIntoView` automatically.

Differential Revision: https://phabricator.services.mozilla.com/D87819
2020-08-24 06:39:50 +00:00
Simon Giesecke cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Olli Pettay 9a394a854e Bug 1637712 - Consider to move *Ancestor* API to nsINode r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D75169
2020-05-20 14:55:15 +00:00
Masayuki Nakano 878d787eaa Bug 1540037 - part 2: Move `EditorBase::RemoveContainerWithTransaction()` to `HTMLEditor` r=m_kato
Its users are only `HTMLEditor` and `CSSEditUtils` so that we should move it
into `HTMLEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D72823
2020-04-30 06:36:41 +00:00
Masayuki Nakano 9f10b2a2a0 Bug 1627573 - part 4: Mark `CSSEditUtils` methods which refer computed style as `MOZ_CAN_RUN_SCRIPT` r=m_kato
When it refers computed value of style, it may flush pending notifications.
Therefore, they should be marked as `MOZ_CAN_RUN_SCRIPT`.

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

--HG--
extra : moz-landing-system : lando
2020-04-09 10:10:34 +00:00
Bogdan Tara a81dc418ef Backed out 4 changesets (bug 1627573) for bustages complaining about CSSEditUtils.cpp CLOSED TREE
Backed out changeset 8ced0e6ed31e (bug 1627573)
Backed out changeset 07b5b67c32c2 (bug 1627573)
Backed out changeset 04734d17e8d0 (bug 1627573)
Backed out changeset 77486fd073af (bug 1627573)
2020-04-09 10:58:46 +03:00
Masayuki Nakano 1142d3105a Bug 1627573 - part 4: Mark `CSSEditUtils` methods which refer computed style as `MOZ_CAN_RUN_SCRIPT` r=m_kato
When it refers computed value of style, it may flush pending notifications.
Therefore, they should be marked as `MOZ_CAN_RUN_SCRIPT`.

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

--HG--
extra : moz-landing-system : lando
2020-04-08 15:51:17 +00:00
Masayuki Nakano ba0909ed8b Bug 1620504 - part 22-2: Clean up warnings in HTMLAbsPositionEditor.cpp r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D66980

--HG--
extra : moz-landing-system : lando
2020-03-18 06:06:22 +00:00
Masayuki Nakano 90cd2122dd Bug 970802 - part 5: Make `AutoEditActionDataSetter` created method dispatch "beforeinput" event r=smaug,m_kato
`AutoEditActionDataSetter` is created in the stack when editor's public method
is called and that guarantees lifetime of global objects in editor such as
editor itself, selection controller, etc.

The dispatcher of `beforeinput` event returns `NS_ERROR_EDITOR_ACTION_CANCELED`
if an event is actually dispatched but canceled.  The reason why it's an error
is, editor code must stop handling anything when any methods return error.
So, returning an error code is reasonable in editor module.  But when it's
filtered by `EditorBase::ToGenericNSResult()` at return statement of public
methods, it's converted to `NS_SUCCESS_DOM_NO_OPERATION`.  This avoids throwing
new exception, but editor class users in C++ can distinguish whether each edit
action is canceled or handled.  The reason why we should not throw new
exception from XPCOM API is, without taking care of each caller may break some
our UI (especially for avoiding to break comm-central).  Therefore, this patch
does not make XPCOM methods return error code when `beforeinput` event is
canceled.

In most cases, immediately after creating `AutoEditActionDataSetter` is good
timing to dispatch `beforeinput` event since editor has not touched the DOM
yet.  If `beforeinput` requires `data` or `dataTransfer`, methods need to
dispatch `beforeinput` event after that.  Alhtough this is not a good thing
from point of view of consistency of the code.  However, I have no better
idea.

Note 1: Our implementation does NOT conform to the spec about event order
between `keypress` and `beforeinput` (dispatching `beforeinput` event after
`keypress` event).  However, we follow all other browsers' behavior so that it
must be safe and the spec should be updated for backward compatibility.
Spec issue: https://github.com/w3c/uievents/issues/220

Note 2: Our implementation does NOT conform to the spec about event order
between `compositionupdate` and `beforeinput`.  Our behavior is same as
Safari, but different from Chrome.  This might cause web-compat issues.
However, our behavior does make sense from point of view of consistency of
event spec.  Additionally, at both `compositionupdate` and `beforeinput`,
composition string in editor has not been modified yet.  Therefore, this
may not cause web-compat issues (and I hope so).
Spec issue: https://github.com/w3c/input-events/issues/49

Note that this patch makes editor detect bugs that `beforeinput` event hasn't
been handled yet when it dispatches `input` event or modifying `data` and
`dataTransfer` value are modified after dispatching `beforeinput` event with
`MOZ_ASSERT`s.

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

--HG--
extra : moz-landing-system : lando
2020-01-14 07:18:51 +00:00
Razvan Maries 0df75c8122 Backed out 5 changesets (bug 970802) for xpcshell perma fails. CLOSED TREE
Backed out changeset 5511edd700f7 (bug 970802)
Backed out changeset 1fb9cf2264b6 (bug 970802)
Backed out changeset 6b185296c742 (bug 970802)
Backed out changeset ce6853e64ed6 (bug 970802)
Backed out changeset aa9bd45c09b1 (bug 970802)
2020-01-14 04:41:15 +02:00
Masayuki Nakano 00f4c31bb7 Bug 970802 - part 5: Make `AutoEditActionDataSetter` created method dispatch "beforeinput" event r=smaug,m_kato
`AutoEditActionDataSetter` is created in the stack when editor's public method
is called and that guarantees lifetime of global objects in editor such as
editor itself, selection controller, etc.

The dispatcher of `beforeinput` event returns `NS_ERROR_EDITOR_ACTION_CANCELED`
if an event is actually dispatched but canceled.  The reason why it's an error
is, editor code must stop handling anything when any methods return error.
So, returning an error code is reasonable in editor module.  But when it's
filtered by `EditorBase::ToGenericNSResult()` at return statement of public
methods, it's converted to `NS_SUCCESS_DOM_NO_OPERATION`.  This avoids throwing
new exception, but editor class users in C++ can distinguish whether each edit
action is canceled or handled.  The reason why we should not throw new
exception from XPCOM API is, without taking care of each caller may break some
our UI (especially for avoiding to break comm-central).  Therefore, this patch
does not make XPCOM methods return error code when `beforeinput` event is
canceled.

In most cases, immediately after creating `AutoEditActionDataSetter` is good
timing to dispatch `beforeinput` event since editor has not touched the DOM
yet.  If `beforeinput` requires `data` or `dataTransfer`, methods need to
dispatch `beforeinput` event after that.  Alhtough this is not a good thing
from point of view of consistency of the code.  However, I have no better
idea.

Note 1: Our implementation does NOT conform to the spec about event order
between `keypress` and `beforeinput` (dispatching `beforeinput` event after
`keypress` event).  However, we follow all other browsers' behavior so that it
must be safe and the spec should be updated for backward compatibility.
Spec issue: https://github.com/w3c/uievents/issues/220

Note 2: Our implementation does NOT conform to the spec about event order
between `compositionupdate` and `beforeinput`.  Our behavior is same as
Safari, but different from Chrome.  This might cause web-compat issues.
However, our behavior does make sense from point of view of consistency of
event spec.  Additionally, at both `compositionupdate` and `beforeinput`,
composition string in editor has not been modified yet.  Therefore, this
may not cause web-compat issues (and I hope so).
Spec issue: https://github.com/w3c/input-events/issues/49

Note that this patch makes editor detect bugs that `beforeinput` event hasn't
been handled yet when it dispatches `input` event or modifying `data` and
`dataTransfer` value are modified after dispatching `beforeinput` event with
`MOZ_ASSERT`s.

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

--HG--
extra : moz-landing-system : lando
2020-01-14 01:09:45 +00:00
Gabriele Svelto 69790bc62e Bug 1600545 - Remove useless inclusions of header files generated from IDL files in accessible/, browser/, caps/, chrome/, devtools/, docshell/, editor/, extensions/, gfx/, hal/, image/, intl/, ipc/, js/, layout/, and media/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

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

--HG--
extra : moz-landing-system : lando
2019-12-06 09:16:44 +00:00
Masayuki Nakano 6a1791bc12 Bug 1566795 - part 3: Clean up `HTMLEditor::RemoveStyleInside()` r=m_kato
Surprisingly, its `aChildOnly` is never set to `true` and if it were set to
`true`, it does unnecessary recursive calls.  Therefore, we can make it
simpler.

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

--HG--
extra : moz-landing-system : lando
2019-10-07 03:33:11 +00:00
Gabriele Svelto 10d41866a5 Bug 1585156 - Remove useless inclusions of nsIDOMWindow.h and nsIDOMWindowUtils.h r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D47678

--HG--
extra : moz-landing-system : lando
2019-09-30 22:06:47 +00:00
Masayuki Nakano 58f9c64190 Bug 1581034 - part 2: Get rid of `TextEditUtils::IsBreak()` and `TextEditUtils` itself r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45811

--HG--
extra : moz-landing-system : lando
2019-09-18 12:37:14 +00:00
Masayuki Nakano 6789366d5e Bug 1540029 - part 10: Get rid of `TextEditRules` and `HTMLEditRules` r=m_kato
Now, we can get rid of `TextEditRules` and `HTMLEditRules` completely.
And also this patch renames their cpp files to `TextEditSubActionHandler`
and `HTMLEditSubActionHandler`.

`TextEditor::Init()` and `HTMLEditor::Init()` are still complicated due to
`AutoEditInitRulesTrigger`.  The following patch will remove it.

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

--HG--
rename : editor/libeditor/HTMLEditRules.cpp => editor/libeditor/HTMLEditSubActionHandler.cpp
rename : editor/libeditor/TextEditRules.cpp => editor/libeditor/TextEditSubActionHandler.cpp
extra : moz-landing-system : lando
2019-09-18 08:40:08 +00:00
Masayuki Nakano d87ff4830d Bug 1574852 - part 99: Move `HTMLEditRules::WillRelativeChangeZIndex()` to `HTMLEditor` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45293

--HG--
extra : moz-landing-system : lando
2019-09-12 06:20:49 +00:00
Masayuki Nakano fee93a3a4d Bug 1574852 - part 98: Move `HTMLEditRules::WillAbsolutePosition()` and `HTMLEditRules::WillRemoveAbsolutePosition()` to `HTMLEditor` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45292

--HG--
extra : moz-landing-system : lando
2019-09-12 05:45:13 +00:00
Masayuki Nakano 8b9c4d3ad1 Bug 1574852 - part 96: Merge `HTMLEditRules::DidAbsolutePosition()` with `HTMLEditRules::WillAbsolutePosition()` r=m_kato
Oddly, absolute position is handled as following steps.
1. `WillAbsolutePosition()` calls `PrepareToMakeElementAbsolutePosition()`
   to consider the target element.
2. Set TopLevelEditSubActionData::mNewBlockElement to it.
3. `DidAbsolutePosition()` makes it absolute-positioned.

So that, all of them can be done in `WillAbsolutePosition()` like other
edit sub-action handling.

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

--HG--
extra : moz-landing-system : lando
2019-09-12 01:54:28 +00:00
Masayuki Nakano 2bc7658314 Bug 1574852 - part 83: Move `HTMLEditRules::MakeSureElemStartsOrEndsOnCR()` to `HTMLEditor` r=m_kato
`HTMLEditRules::MakeSureElemStartsOrEndsOnCR()` is unclear what it does.
And fortunately, its job is simple if we split it to each mode.  Therefore,
this patch splits it to `EnsureHardLineBeginsWithFirstChildOf()` and
`EnsureHardLineEndsWithLastChildOf()`.  Finally, the batch caller of them,
`HTMLEditRules::MakeSureElemStartsAndEndsOnCR()` is removed since directly
calling both of them is clearer.

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

--HG--
extra : moz-landing-system : lando
2019-09-09 10:47:08 +00:00
Masayuki Nakano d741d7dbe7 Bug 1572685 - part 11: Move `HTMLEditRules::JoinOffset` to `EditorBase::EditSubActionData` r=m_kato
The members of `HTMLEditRules` which are used only while `WillDoAction()` and
`DidDoAction()` are called should be moved to specific stack only struct
`EditorBase::EditSubActionData`.

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

--HG--
extra : moz-landing-system : lando
2019-08-20 01:52:50 +00:00
Mirko Brodesser 81a41b2d7d Bug 1573119: declare more methods around `HTMLEditor` `const`/`static`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D41524

--HG--
extra : moz-landing-system : lando
2019-08-13 07:34:11 +00:00
Masayuki Nakano 11ae238f0f Bug 1569902 - part 4: Make `TextEditor` inserts padding `<br>` element for empty last line after setting flags to `NS_PADDING_FOR_EMPTY_LAST_LINE` r=m_kato
Stopping using attribute for "moz-br", `IMEContentObserver` cannot know when
new `<br>` element is changed to padding element for empty last line.
Therefore, editor needs to insert padding `<br>` element after setting the
flag properly.  Then, `IMEContentObserver` does not need to recompute the
length of `<br>` element (if it's for padding, it computes the length as 0).

Unfortunately, `TextEditor::InsertBrElementWithTransaction()` is used in too
many places and it already has optional argument.  Therefore, it's difficult
to change it.  However, we should share the preparation before creating `<br>`
element in it with new method.  Therefore, this patch creates
`EditorBase::PrepareToInsertBRElement()` to share the preparation point (almost
just moved from the method).  Then, new method is created as
`EditorBase::InsertPaddingBRElementForEmptyLastLineWithTransaction()` because
it's used both in `TextEditor` and `HTMLEditor`.  Finally, `TextEditor` won't
insert `<br>` element with `InsertBrElementWithTransaction()`.  Therefore, it's
moved to `HTMLEditor` with renaming to `InsertBRElementWithTransaction()`.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 05:46:41 +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
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
Masayuki Nakano 19fbb1a392 Bug 1549925 - Mark all methods of nsIDocumentStateListener as can_run_script r=m_kato
`nsIDocumentStateListener` is a scriptable interface and each method may run
any script.  So, we should mark them as `can_run_script`.  Then, we need to
mark a lot of editing methods because we need to mark
`EditorBase::EndTransactionInternal()` and `EditorBase::DoTransactionInternal()`
as `MOZ_CAN_RUN_SCRIPT`.

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

--HG--
extra : moz-landing-system : lando
2019-05-09 07:37:51 +00:00
Masayuki Nakano 4579004eac Bug 1549319 - Make template methods marked as MOZ_CAN_RUN_SCRIPT take only EditorDOMPoint (i.e., not allow EditorRawDOMPoint) r=m_kato
It'd be better to change copy constructor of `EditorDOMPointBase` to explicit,
but it'd require too many changes in editor code.  So, this patch just changes
each method callers only.

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

--HG--
extra : moz-landing-system : lando
2019-05-08 09:40:17 +00:00
Sylvestre Ledru 7f60810d86 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-12 13:14:25 +00:00