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

8857 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 6bba243c2c Bug 1484124 - part 1: Create HTMLEditor::GetCellIndexes() class to get and store indexes of a table cell r=m_kato
HTMLEditor::GetCellIndexes() is an XPCOM method and used a lot internally.
So, we need alternative way to retrieve indexes of a cell without virtual
calls.  In a lot of places, receiving indexes with 2 int32_t variables causes
the code messy and that causes making it harder to understand which are
index for same cell and where they come from.  So, making both of them stored
one variable makes the callers simpler.  Therefore, this patch creates
CellIndexes stack class to get and store the result simply.  Then, this makes
all callers of GetCellIndexes() use this new class and makes GetCellIndexes()
also use this new class.

FYI: This patch does NOT put ErrorResult instances in small block scope as far as
possible. The reason is, I see its destructor in profile sometimes. I don't think
that we should use nsresult& instead of ErrorResult& only for this performance
reason, but I think that creating each instance in loops does not make sense.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 03:34:40 +00:00
Masayuki Nakano d344ead994 Bug 1484124 - part 0: Add automated tests for nsITableEditor::GetCellIndexes() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3848

--HG--
extra : moz-landing-system : lando
2018-08-22 03:35:05 +00:00
Masayuki Nakano 28c6b4ddec Bug 1484115 - part 2: Get rid of nsITableEditor.getNextRow() r=m_kato
Nobody uses nsITableEditor.getNextRow().  Therefore, this patch removes this
XPCOM API.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 06:52:16 +00:00
Masayuki Nakano 9bcbe841c9 Bug 1484115 - part 1: Create HTMLEditor::GetNextTableRowElement() for internal use of nsITableEditor::GetNextRow() r=m_kato
nsITableEditor::GetNextRow() is an XPCOM method.  Therefore, we should have
a non-virtual method for internal use of it.

This changes the definition in nsITableEditor.  First, it allows only <tr>
element as what HTMLEditor::GetNextRow() has actually done.  Then, changes
the return type to Element since it always returns an element node.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 06:52:07 +00:00
Masayuki Nakano 7b00fb391b Bug 1484693 - Fix some nits of test_resizers_resizing_elements.html r=m_kato
There are 2 bugs:

One is a simple mistake. kTest is each item of the tests, kTests is array of
all tests.  When it needs to refer kTest.isAbsolutePosition, it referred
kTests.isAbsolutePosiiton.  Therefore, the test always failed to enable
editing UI for absolute positioned element.

The other is, this test requires to disable inline-table-editing UI (which is
add or remove rows and columns).  Note that even if the UI is disabled,
resizers is available for <table> elements.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 06:44:51 +00:00
Masayuki Nakano 57ac6bcbf2 Bug 1484113 - part 1: Create HTMLEditor::GetFirstTableRowElement() for internal use of nsITableEditor::GetFirstRow() r=m_kato
nsITableEditor::GetFirstRow() is an XPCOM method, so, for internal use,
we should create non-virtual method, that is GetFirstTableRowElement().

This patch makes it never return NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND since
nobody refers it and it's detectable.  If the method returns nullptr without
error, it's the case of NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND.

Additionally, this patch changes the return type of GetFirstRow() from
Node to Element since it always return an Element node if not null.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 01:20:23 +00:00
Masayuki Nakano 56de772ab3 Bug 1484113 - part 0: Create automated tests for nsITableEditor::GetFirstRow() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3779

--HG--
extra : moz-landing-system : lando
2018-08-22 02:16:36 +00:00
Makoto Kato 77fffe84be Bug 1476914 - Add fuzzy-if on Bug 1443902's reftests for Android. r=masayuki
Android's reftest of Bug 1443902 is failed rarely (Bug 1476914, Bug 1475049
Bug 1477502 and Bug 1476129) due to "image comparison, max difference: 1,
number of differing pixels: 1". But I don't know why difference is 1 and
I think that this might be reftest framework for Android or Android emulator
issue.

So I would like to add fuzzy-if as workaround.

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

--HG--
extra : moz-landing-system : lando
2018-08-21 09:29:29 +00:00
Dorel Luca 3fa761ade8 Merge mozilla-inbound to mozilla-central. a=merge 2018-08-21 19:01:08 +03:00
Makoto Kato 539755989c Bug 1484602 - Don't reuse variables in WillDeleteSelection. r=masayuki
HTMLEditRules::WillDeleteSelection is complex since some variables is reused.
So I would like to clean up this to use block scope and EditorDOMPoint
before fixing bug 685799.

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

--HG--
extra : moz-landing-system : lando
2018-08-21 06:54:47 +00:00
Makoto Kato a86db13435 Bug 1484612 - Remove EditSubActionInfo.bOrdered due to unused. r=masayuki
RemoveList doesn't use aListType parameter, but c-c still call this method.
So I keep aListType parameter even if unused.

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

--HG--
extra : moz-landing-system : lando
2018-08-20 12:23:56 +00:00
Dorel Luca d11c177f44 Merge mozilla-central to mozilla-inbound 2018-08-21 12:59:51 +03:00
Masayuki Nakano d33fe8cd6d Bug 1484110 - part 3: HTMLEditor::RefereshEditingUI() should refresh UIs when one of them is changed to enabled or disabled r=m_kato
HTMLEditor::RefereshEditingUI() works only with enabled UIs.  Therefore, if
UI is disabled while it's visible, it keeps shown.  This is too bad if web
apps tries to disable the Gecko specific UIs after we show some of them.

This patch adds HTMLEditor::HideAnonymousEditingUIsIfUnnecessary() to hide
unnecessary UIs and makes RefereshEditingUI() call it always.
2018-08-17 19:03:02 +09:00
Masayuki Nakano a24cf41019 Bug 1484110 - part 2: Rewrite HTMLEditor::HideInlineTableEditingUI() r=m_kato
First, HTMLEditor::HideInlineTableEditingUI() always returns NS_OK.  So, we
can change its return type to void.

Additionally, it removes each UI from the DOM tree one by one.  However, each
mutation could cause showing same UI again.  In such case,
ShowInlineTableEditingUI() overwrites each UI with newly created element.
Then, HTMLEditor cannot remove the old UI anymore.  Therefore, this patch
moves all members of the UI into local variables first.
2018-08-17 18:23:13 +09:00
Masayuki Nakano 7fc2bdaae1 Bug 1484110 - part 1: Create HTMLEditor::RefereshEditingUI() for internal use of nsIHTMLEditor::CheckSelectionStateForAnonymousButtons() r=m_kato
HTMLEditor::CheckSelectionStateForAnonymousButtons() is called a lot internally.
Especially, its virtual call cost may make damage to our performance since
it's called from a selection listener.

So, we should create non-virtual method, RefereshEditingUI() for internal use.
2018-08-17 17:56:28 +09:00
Masayuki Nakano d70e55af73 Bug 1449564 - part 4: Make users can show Gecko specific editing UIs with new prefs r=m_kato
Even after we disable Gecko specific editing UIs by default, web apps can
enable them with execCommand.  However, until such web apps change their
behavior, users cannot use Gecko specific UIs.  At least for now, we should
make users can enable them by default.

MozReview-Commit-ID: AuAdw4FQ4He

--HG--
extra : rebase_source : a1f88f2928df0d7afb4361c425d75c74872ac9d5
2018-08-16 13:51:36 +09:00
Masayuki Nakano be1b849fa2 Bug 1449564 - part 3: Make absolute position editor listen to mouse events at the system event group r=m_kato
Currently, absolute position editor listens to mouse events at the default
event group to handle dragging of positioner.  However, this is blocked by
a call of Event.stopPropagation() in web apps unexpectedly.  Therefore,
we should make it listen to the events at the system event group instead.

MozReview-Commit-ID: Hoa8c9QvMuG

--HG--
extra : rebase_source : 77500356fd1a65e8d81da131e09bc48229a208f9
2018-04-05 00:32:32 +09:00
Masayuki Nakano 44ae690779 Bug 1449564 - part 2: Make absolute positioned element editor disabled in default and make it possible to enable it with new command r=m_kato
We have another built-in UI of editor which is not implemented by any other
browsers.  That is a draggable handler to move absolute positioned elements.
So, we should disable it in default for compatibility with the other browsers.

However, different from resizers and inline table editor, we don't have
command to enable/disable this feature but for backward compatibility, we
should have it.  Therefore, this patch adds new command
"enableAbsolutePositionEditor".

Note that whether resizing UI is available only with enableObjectResizing
state is different from enableInlineTableEditing command.  Resizers for
absolute positioned elements are NOT available both enableObjectResizing
and enableAbsolutePositionEditor are enabled.

Additionally, this adds automated tests to check basic functions of absolute
positioned editor.

MozReview-Commit-ID: 9ZSGB8tLpFw

--HG--
rename : editor/libeditor/tests/test_resizers_appearance.html => editor/libeditor/tests/test_abs_positioner_appearance.html
rename : editor/libeditor/tests/test_resizers_resizing_elements.html => editor/libeditor/tests/test_abs_positioner_positioning_elements.html
extra : rebase_source : d516f3f3ef36d4ad13938f214cb6e3868d7ff407
2018-04-04 22:27:49 +09:00
Masayuki Nakano b808917841 Bug 1449564 - part 1: Disable object resizer and inline table editor in default r=m_kato
Gecko supports resizers of <img> elements and <table>, <td>, <th> elements and
has UI to remove existing table row or column in default.  However, the other
browsers don't have such UI and web apps need to disable this feature with
calling both:
document.execCommand("enableObjectResizing", false, false);
document.execCommand("enableInlineTableEditing", false, false);
for avoiding conflicting with their own features to edit such elements.

Therefore, it doesn't make sense to keep enabling them in default only on
Gecko.  If web apps want to keep using these features, they should call:
document.execCommand("enableObjectResizing", false, true);
document.execCommand("enableInlineTableEditing", false, true);
at initializing the editor.

And also this patch fixes bugs of
document.queryCommandState("enableObjectResizing") and
document.queryCommandState("enableInlineTableEditing").  They always return
false even after calling document.execCommand(..., false, true) since
nsSetDocumentStateCommand::GetCommandStateParams() sets bool value as
STATE_ATTRIBUTE.  However, nsHTMLDocument::QueryCommandValue() which is the
caller referring STATE_ATTRIBUTE doesn't treat it as bool value.  And also
those commands are related to state of document.  Therefore, they should be
return as bool value of STATE_ALL instead.  Then,
nsHTMLDocument::QueryCommandState() returns the state as expected.  Note that
those commands are supported only by Gecko.  So, we don't need to worry about
the compatibility.

Finally, this patch rewrites 2 existing tests to check basic behavior of
resizers and appearance of resizers.

Note that this patch does not add new tests to test inline table editor
since it's difficult to test the behavior with current API.  Perhaps, we
should add an API to nsIHTMLEditor to retrieve each anonymous elements in
another bug since it requires to add wrapping API of SpecialPowers.

MozReview-Commit-ID: 1FhYo5vcV60

--HG--
rename : editor/libeditor/tests/test_objectResizing.html => editor/libeditor/tests/test_resizers_appearance.html
rename : editor/libeditor/tests/test_bug640321.html => editor/libeditor/tests/test_resizers_resizing_elements.html
extra : rebase_source : a707de5a64ef1f8ce974cdf1be093d1b4f61c7bc
2018-04-02 17:26:46 +09:00
Daniel Varga 36e523e699 Merge mozilla-central to mozilla-inbound 2018-08-18 01:05:36 +03:00
Masayuki Nakano b7d5928ee6 Bug 1484092 - part 3: IsLinkTag() and IsNamedAnchorTag() should compare with nsGkAtoms r=m_kato
The methods compared with const characters since we've supported "namedanchor"
which is not in nsGkAtoms.  Now, it's dropped so that we can compare given
atom with nsGkAtoms.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 14:51:40 +00:00
Masayuki Nakano 65bb9451c3 Bug 1484092 - part 2: Drop supporting "namedanchor" special element name from nsIHTMLEditor::GetSelectedElement(), nsIHTMLEditor::GetElementOrParentByTagName() and nsIHTMLEditor::CreateElementWithDefaults() r=m_kato
Nobody (including comm-central and BlueGriffon) does not use "namedanchor"
special element name with those XPCOMs.  Of course, our internal callers too.
Therefore, we can drop.

Note that there is no static Atom for this, so, keeping it makes unnecessary
runtime cost for Firefox users.

This could cause breaking some legacy add-ons for Thunderbird.  However,
they can use "anchor" special element name for same purpose.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 14:50:56 +00:00
Masayuki Nakano b212948c3b Bug 1484092 - part 1: Make HTMLEditor::GetElementOrParentByTagName() use nsAtom for the tag name r=m_kato
HTMLElementOrParentByTagName() is the last user of IsLinkTag(const nsAString&)
and IsNamedAnchorTag(const nsAString&).  For making their maintenance easier,
let's make GetElementOrParentByTagName() take const nsAtom& for tag name.

GetElementOrParentByTagName() has two functions, one is looking for an element
starting from a node.  The other is, if the start node is nullptr, it retrieves
anchor node of Selection as start node.  Therefore, this patch splits the
first part to GetElementOrParentByTagNameInternal().  Then, creates its
wrapper which retrieves anchor of Selection automatically,
GetElementOrParentByTagNameAtSelection().

Additionally, this patch makes all internal callers of HTMLEditor use
GetElementOrParentByTagNameInternal() or
GetElementOrParentByTagNameAtSelection() directly.  Then, public method,
GetElementOrParentByTagName() is called only by outer classes.

Note that some callers use both GetElementOrParentByTagNameInternal()
and GetElementOrParentByTagNameAtSelection() since they don't check whether
setting node is nullptr.  They may be bug of them.  We should investigate
the API callers later.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 14:06:18 +00:00
Noemi Erli 79400be144 Backed out 2 changesets (bug 1484092) for build bustages in builds/worker/workspace/build/src/editor/libeditor/HTMLEditor.cpp💯53 on a CLOSED TREE
Backed out changeset 10fdd041f1b5 (bug 1484092)
Backed out changeset d0b14e8711df (bug 1484092)
2018-08-17 13:39:44 +03:00
Masayuki Nakano 16a97643c7 Bug 1484092 - part 2: Drop supporting "namedanchor" special element name from nsIHTMLEditor::GetSelectedElement(), nsIHTMLEditor::GetElementOrParentByTagName() and nsIHTMLEditor::CreateElementWithDefaults() r=m_kato
Nobody (including comm-central and BlueGriffon) does not use "namedanchor"
special element name with those XPCOMs.  Of course, our internal callers too.
Therefore, we can drop.

Note that there is no static Atom for this, so, keeping it makes unnecessary
runtime cost for Firefox users.

This could cause breaking some legacy add-ons for Thunderbird.  However,
they can use "anchor" special element name for same purpose.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 07:41:55 +00:00
Masayuki Nakano a8b7670d10 Bug 1484092 - part 1: Make HTMLEditor::GetElementOrParentByTagName() use nsAtom for the tag name r=m_kato
HTMLElementOrParentByTagName() is the last user of IsLinkTag(const nsAString&)
and IsNamedAnchorTag(const nsAString&).  For making their maintenance easier,
let's make GetElementOrParentByTagName() take const nsAtom& for tag name.

GetElementOrParentByTagName() has two functions, one is looking for an element
starting from a node.  The other is, if the start node is nullptr, it retrieves
anchor node of Selection as start node.  Therefore, this patch splits the
first part to GetElementOrParentByTagNameInternal().  Then, creates its
wrapper which retrieves anchor of Selection automatically,
GetElementOrParentByTagNameAtSelection().

Additionally, this patch makes all internal callers of HTMLEditor use
GetElementOrParentByTagNameInternal() or
GetElementOrParentByTagNameAtSelection() directly.  Then, public method,
GetElementOrParentByTagName() is called only by outer classes.

Note that some callers use both GetElementOrParentByTagNameInternal()
and GetElementOrParentByTagNameAtSelection() since they don't check whether
setting node is nullptr.  They may be bug of them.  We should investigate
the API callers later.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 10:04:42 +00:00
Ehsan Akhgari a930263192 Bug 1484137 - Remove the XPCOM component registration for content iterator classes; r=qdot 2018-08-17 14:51:12 -04:00
Masayuki Nakano 0e96aef5c8 Bug 1483144 - Make HTMLEditor::GetSelectionContainer() protected r=m_kato
HTMLEditor::GetSelectionContainer() is a public method, but it's not used by
outer classes. So, we can make it a protected member.

Additionally, this patch cleans up the method.

  - Renames to GetSelectionContainerElement() for making clearer what will be
    returned.
  - Makes it const.
  - Makes it take Selection reference since most callers already have Selection.
  - Makes it use RangeBoundary to access start point and end point of range since nsRange::StartOffset() and nsRange::EndOffset() may be slow.
  - Makes it not use GetSelectedElement() since it requires unnecessary additional cost and the condition to call it means it uses only the first path in GetSelectedElement() which just returns start node of the range.
  - Makes it output warning when it returns nullptr since it reaches nullptr only when illegal cases, e.g., Selection is in orphan node.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 15:12:51 +00:00
Masayuki Nakano 4bf13b90c7 Bug 1483132 - Make EditorBase::AreNodesSameType() non-virtual r=m_kato
EditorBase::AreNodesSameType() is overridden only by HTMLEditor and the
implementation is enough simple to re-implement in EditorBase.

Additionally, this is called from condition of a loop in
JoinNodesDeepWithTransaction().  So, the virtual call cost may make damage
to the performance.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:29:20 +00:00
Masayuki Nakano d9f788a4df Bug 1483127 - Use NS_IMETHODIMP at definition of HTMLEditor::SetIsCSSEnabled() r=m_kato
HTMLEditor::SetIsCSSEnabled() is an XPCOM but it's defined with nsresult.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:05:06 +00:00
Masayuki Nakano 72aa2e3133 Bug 1483119 - Get rid of HTMLEditor::GetURLForStyleSheet() since unused r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3458

--HG--
extra : moz-landing-system : lando
2018-08-16 10:03:49 +00:00
Masayuki Nakano b01e3d2d25 Bug 1482023 - Create HTMLEditor::EnableStyleSheetInternal() for internal use r=m_kato
HTMLEditor::EnableStyleSheet() is an XPCOM method but it's used internally.
Therefore, we should create non-virtual method for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:03:46 +00:00
Masayuki Nakano e9f6afbc49 Bug 1482022 - Create HTMLEditor::RemoveOverrideStyleSheetInternal() for internal use r=m_kato
HTMLEditor::RemoveOverrideStyleSheet() is an XPCOM method but used internally.
So, we should create non-virtual method for this.

Additionally, it calls GetStyleSheetForURL() and RemoveStyleSheetFromList(),
but they search index of internal override style sheet array redundantly.
Moreover, RemoveStyleSheetFromList() returns error only when given URL is
not found, but RemoveOverrideStyleSheet() which is the only one caller, ignores
the error.  Therefore, for saving the redundant cost, this patch makes
RemoveStyleSheetFromList() return removing StyleSheet which is retrieved
with the call of GetStyleSheetForURL().  So, RemoveOverrideStyleSheetInternal()
stops calling GetStyleSheetForURL().

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:01:23 +00:00
Masayuki Nakano 9e79dd8fe6 Bug 1482021 - Create HTMLEditor::AddOverrideStyleSheetInternal() for internal use r=m_kato
HTMLEditor::AddOverrideStyleSheet() is an XPCOM method but it's called
internally.  So, we should create non-virtual method for it and call it
for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 09:26:09 +00:00
Masayuki Nakano b8fd63d7b5 Bug 1482020 - Make all callers of CreateElementWithDefaults() use non-virtual method r=m_kato
Fortunately, despite of becoming public method,
HTMLEditor::CreateElementWithDefaults() can be used by internal methods too
since it does not touch undo transactions nor the DOM tree, and does not
refer mRules nor GetSelection().  So, we can make it public and make any
C++ callers use it.
2018-08-10 19:36:24 +09:00
Masayuki Nakano 53b9108e13 Bug 1482019 - part 5: Make HTMLEditor::GetSelectedNode() never return non-element node and change its name to GetSelectedElement() r=m_kato
If HTMLEditor::GetSelectedNode() is called with nullptr for aTagName,
the first block may return non-element node.  In such case, we should return
nullptr without error for now (since I have no idea which element node is
a good node to return).

Then, we can rename it to GetSelectedElement() and can replace existing
GetSelectedElement() with the new one.
2018-08-10 18:01:42 +09:00
Masayuki Nakano f1cdc15e87 Bug 1482019 - part 4: Reduce the indent level of the last block in HTMLEditor::GetSelectedNode() r=m_kato
The first check of the last block of HTMLEditor::GetSelectedNode() can use
early-return style.  Additionally, |current| is not necessary since Selection
is not changed since the method retrieved first range.  So, we can get rid of
|current| and the |nullptr| case of it.
2018-08-10 17:46:33 +09:00
Masayuki Nakano 0dd29e1830 Bug 1482019 - part 3: Minimize some scope of auto varaiables in HTMLEditor::GetSelectedNode() r=m_kato
Some variables in HTMLEditor::GetSelectedNode() are declared very large block
they are not used and/or referred.  So, we can get rid of some variables or
move smaller block.
2018-08-10 17:41:58 +09:00
Masayuki Nakano 837bcd9d8e Bug 1482019 - part 2: Make HTMLEditor::GetSelectedNode() take nsAtom* for element name r=m_kato
Using nsAtom makes the method faster and simpler, although the caller needs
to atomize lower-cased string.
2018-08-10 17:30:04 +09:00
Masayuki Nakano 8e992098fa Bug 1482019 - part 1: Create non-virtual method HTMLEditor::GetSelectedNode() for implementing nsIHTMLEditor::GetSelectedElement() r=m_kato
For making each diff compact, this bug needs some patches.

First of all, this patch moves implementation of
nsIHTMLEditor::GetSelectedElement() to new non-virtual method
HTMLEditor::GetSelectedNode().
2018-08-10 16:51:52 +09:00
Masayuki Nakano 3b38503bf4 Bug 1482019 - part 0: Add automated tests for nsIHTMLEditor.getSelectedElement() r=m_kato
The HTMLEditor::GetSelectedElement() is ugly.  Probably, it's checked only with
expected simple cases since the result does not make sense in some cases.

For example, when Selection is collapsed, it returns an element only when
"href" is specified with the argument.  When Selection selects only one
element node (including its children), it quickly returns the node, however,
in the slow path, it returns second element node if first element node matches
with the argument.  Or returns first element ndoe if it does not match with
the argument.

For preventing regressions, new test is designed to keep current odd behavior.

The new test is disabled only debug build on Android because adding this test
causes permanent orange of non-related test,
dom/tests/mochitest/fetch/test_request.html, see bug 1480702.
2018-08-13 15:31:56 +09:00
Makoto Kato d3b4ee4c97 Bug 1483434 - Allow nullptr parameter for PriorVisibleNode and NextVisibleNode. r=masayuki
Summary:
Sometimes the caller of PriorVisibleNode or NextVisibleNode doesn't use
outVisNode and/or outvisOffset. But both methods require all parameters and
it don't allow nullptr. It is complex whether parameter is used or unused.

So I would like to allow nullptr.

Also, this methods can change to const method, so I will change some methods
to const method too for this change.

Reviewers: masayuki

Tags: #secure-revision

Bug #: 1483434

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

--HG--
extra : rebase_source : 5bd9c87f05c8e88879268188a46a4a80126bd3e5
2018-08-14 18:26:46 +09:00
Masayuki Nakano 557a9e3c62 Bug 1482018 - Create non-virtual methods of nsIHTMLEditor::Indent() equivalents r=m_kato
nsIHTMLEditor::Indent() is used for handling Tab key in HandleKeyPressEvent()
and used for implementing indent/outdent commands.  Unfortunately, it takes
string argument to switch between indent or outdent.  So, it does not make
sense to use this in C++ code.

This patch creates IndentAsAction() and OutdentAsAction() as public methods
and the implementation is moved to IndentOrOutdentAsSubAction() which takes
EditSubAction to switch between indent and outdent.

Note that HandleKeyPressEvent() uses the new public methods.  However, this
is not problem for the future changes since HandleKeyPressEvent() is an
exception which may call other public methods.

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

--HG--
extra : moz-landing-system : lando
2018-08-14 08:30:09 +00:00
Masayuki Nakano ecc94d2ee3 Bug 1482017 - part 1: Create HTMLEditor::CollapseSelectionAfter() for internal use of nsIHTMLEditor::SetCaretAfterElement() r=m_kato
We need to make it possible nsIHTMLEditor::SetCaretAfterElement() to distinguish
if it's called by outer class or editor itself.  Therefore, this patch creates
CollapseSelectionAfter() for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-08-14 06:13:54 +00:00
Masayuki Nakano bdc0aaa4af Bug 1482017 - part 0: Add automated tests for nsIHTMLEditor.setCaretAfterElement() r=m_kato
The new test is disabled only debug build on Android because adding this test
causes permanent orange of non-related test,
dom/tests/mochitest/fetch/test_request.html, see bug 1480702.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 12:46:51 +00:00
Masayuki Nakano 5499f18c98 Bug 1482016 - part 1: Create HTMLEditor::SelectContentInternal() for internal use of HTMLEditor::SelectElement() r=m_kato
For making it possible HTMLEditor::SelectElement() to distinguish if it's
called by outer class or editor itself, this patch creates
HTMLEditor::SelectContentInternal().

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

--HG--
extra : moz-landing-system : lando
2018-08-15 08:59:40 +00:00
Masayuki Nakano 9eb55eb576 Bug 1482016 - part 0: Add automated tests for nsIHTMLEditor.selectElement() r=m_kato
The new test is disabled only debug build on Android because adding this test
causes permanent orange of non-related test,
dom/tests/mochitest/fetch/test_request.html, see bug 1480702.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 08:49:25 +00:00
Cosmin Sabou 425b934989 Backed out changeset 419fd4edef4f (bug 1482016) for turning Bug 1480702 into permafail. a=backout 2018-08-15 04:29:48 +03:00
Cosmin Sabou 3a67fed29b Backed out changeset 302ce3cdb98f (bug 1482016) for turning bug 1480702 into permafail. a=backout 2018-08-15 04:17:26 +03:00
Andreea Pavel 5d75e43adc Merge mozilla-inbound to mozilla-central. a=merge 2018-08-14 19:15:33 +03:00