nsITableEditor::GetSelectedOrParentTableElement() is of course an XPCOM method,
but it's used internally. So, there should be non-virtual method.
On the other hand, this API is too ugly. Returns various information but each
meaning is not clear. So, result of the new non-virtual method should be
simpler.
This patch creates the new method as:
- returns found element
- takes ErrorResult to return error code.
- takes optional out-param for returning if a cell is selected.
Then, nsITableEditor::GetSelectedOrParentTableElement() can compute its
result from them with Selection.
Differential Revision: https://phabricator.services.mozilla.com/D5728
--HG--
extra : moz-landing-system : lando
If a cell element and its indexes in the <table> are stored in a struct,
it makes the user methods easier to read. Therefore, this patch implement
such struct as HTMLEditor::CellAndIndexes and make it finds first selected
cell and indexes with its method. Finally, this reimplement
HTMLEditor::GetFirstSelectedCellInTable() with it.
Differential Revision: https://phabricator.services.mozilla.com/D5664
--HG--
extra : moz-landing-system : lando
This adds automated tests for nsITableEditor.getFirstSelectedCellInTable().
However, this test crashes due to regression of bug 1484128. So, we need
to uplift only this fix into the Beta.
Differential Revision: https://phabricator.services.mozilla.com/D5663
--HG--
extra : moz-landing-system : lando
I tried to create automated tests for nsITableEditor::NormalizeTable().
However, this method cannot normalize any broken table element. The method
always returns error after calling HTMLEditor::FixBadRowSpan(). The reason
is that HTMLEditor::FixBadRowSpan() scans all cells in each row with a for
loop, and then, when it fails to find a cell element, it returns error even
though this method needs to fix the odd situation. According to the history
of editor changes, each important point hasn't been changed since first
implementation. So, perhaps, table layout API behavior was changed but
no automated tests couldn't detect the regression since we really don't have
enough tests for editor.
Anyway, this patch makes most part of nsITableEditor::NormalizeTable() with
non-virtual method, HTMLEditor::NormalizeTable().
Differential Revision: https://phabricator.services.mozilla.com/D5633
--HG--
extra : moz-landing-system : lando
When I added some tests into test_middle_click_paste.html, I realized that
SimpleTest.waitForClipboard() in copyHTMLContent() fails to copy the
HTML fragment to clipboard and just quit the test. Therefore, only the
last tests are ignored always.
The reason is, iframe.contentDocument.getSelection() returns nullptr
since the frame becomes visible immediately before accessing the Selection.
This patch makes flushing the pending layout with scrollTop. This makes
getSelection() return non-null.
However, unfortunately, only on Linux, it fails to copy the content. I'm
still not sure the reason. This patch just avoids running the last part
only on Linux.
Differential Revision: https://phabricator.services.mozilla.com/D5742
--HG--
extra : moz-landing-system : lando
Although this reftest is sometimes failure on Android, it is no meaning to run
this test on Android due to no spellchekcer on Firefox Android.
Differential Revision: https://phabricator.services.mozilla.com/D5745
--HG--
extra : moz-landing-system : lando
This enables the editor directory to be linted, and fixes the remaining issues raised by ESLint. Various rules were fixed here including, no-shadow, no-undef, no-unused-vars and others.
I've generally gone conservative, disabling rules where it doesn't make sense to fix them (e.g. sometimes suggests use-services for tests, but it is only used once, or within a Chrome script).
Depends on D5585
Differential Revision: https://phabricator.services.mozilla.com/D5587
--HG--
extra : moz-landing-system : lando
These are all automatically generated by ESLint with the --fix option.
Depends on D5584
Differential Revision: https://phabricator.services.mozilla.com/D5585
--HG--
extra : moz-landing-system : lando
Also block-disables no-multi-spaces for test_resizers_resizing_elements.html
Differential Revision: https://phabricator.services.mozilla.com/D5584
--HG--
extra : moz-landing-system : lando
HTMLEditor::RefereshGrabber() is an XPCOM method which is used by BlueGriffon.
Additionally, it's called internally. Therefore, we should create a non-virtual
method for this and all internal users should use it.
This patch renames all other related methods to *Internal() for consistency.
Additionally, this fixes a bug of nested calls of ShowGrabber() and
HideGrabber(). This makes CreateGrabber() sets mGrabber directly since
it may be cleared by HideGrabber() while it's running, and also makes
HideGrabber() moves all members who will be cleaned up with local variables
and always clean them up even if it meats an error.
Differential Revision: https://phabricator.services.mozilla.com/D5424
--HG--
extra : moz-landing-system : lando
HTMLEditor::RefreshInlineTableEditingUI() is an XPCOM method. Therefore,
we should create a non-virtual method for internal use.
Additionally, this patch makes related methods safer for nested calls of
ShowInlineTableEditingUI() and HideInlineTableEditingUI(). If
ShowInlineTableEditingUI() and RefreshInlineTableEditingUIInternal() detects
hiding or replacing current UI, they return error to make the callers stop
handling anything for new UI.
Differential Revision: https://phabricator.services.mozilla.com/D5428
--HG--
extra : moz-landing-system : lando
nsIHTMLObjectResizers.resizedObject is used only for avoiding warning of
nsIHTMLObjectResizers.refreshResizers() if resizers are not visible.
Therefore, if we remove the unnecessary warnings, we can get rid of the
attribute.
Differential Revision: https://phabricator.services.mozilla.com/D5427
--HG--
extra : moz-landing-system : lando
HTMLEditor::RefreshResizers() is an XPCOM method but it's used internally. So,
HTMLEditor should implement it with non-virtual method and use new one for
internal use.
This patch also makes related methods nested-creation of resizers aware. This
issue must not be dangerous, but looks like buggy.
Differential Revision: https://phabricator.services.mozilla.com/D5426
--HG--
extra : moz-landing-system : lando
Since I have landed bug 1478546, no one (inc. bluegriffon) uses this method.
Differential Revision: https://phabricator.services.mozilla.com/D5497
--HG--
extra : moz-landing-system : lando
HTMLEditor::HideResizers() is an XPCOM method, so, we should create non-virtual
method for internal use.
Differential Revision: https://phabricator.services.mozilla.com/D4923
--HG--
extra : moz-landing-system : lando
First, nobody uses nsIHTMLObjectResizer.showResizers(). So, we can remove it.
Then, we have two private methods, one is non-virtual
HTMLEditor::ShowResizers(), and the other is HTMLEditor::ShowResizersInner().
HTMLEditor::ShowResizers() calls HTMLEditor::ShowResizersInner() and if
it fails, calls HideResizers(). However, in some cases, e.g., when it already
has visible resizers, hiding resizers does not make sense.
So, this patch removes non-virtual HTMLEditor::ShowResizers() method too,
then, renames HTMLEditor::ShowResizersInner() to HTMLEditor::ShowResizers(),
finally, it hides resizers only when it fails to setup resizers for keeping
resizers hidden.
Differential Revision: https://phabricator.services.mozilla.com/D4921
--HG--
extra : moz-landing-system : lando
Because of the rewrite of test_request.html, now, we can enable the mochitests
for editor which were disabled on debug build of Android due to bug 1480702.
Differential Revision: https://phabricator.services.mozilla.com/D4904
--HG--
extra : moz-landing-system : lando
Summary:
Now HTMLEditor::IsInLink returns boolean and nsINode if returning true.
I would like to return Element instead of boolean for reducing refcounting
and QI like HTMLEditRules::IsInListItem.
Reviewers: masayuki
Tags: #secure-revision
Bug #: 1487305
Differential Revision: https://phabricator.services.mozilla.com/D4640
--HG--
extra : rebase_source : 275629d7e1108b4e56fb39fa745f491bfb55963d
Even though HTMLEditor::GetIsCSSEnabled() is an implementation of an XPCOM
method, it uses nsresult as its return type. We should change it to
NS_IMETHODIMP.
Additionally, SetDocumentStateCommand::GetCommandStateParams() calls this,
but HTMLEditor can expose non-virtual method, HTMLEditor::IsCSSEnabled().
Therefore, this patch makes it public and makes SetDocumentStateCommand use
HTMLEditor::IsCSSEnabled().
Differential Revision: https://phabricator.services.mozilla.com/D4304
--HG--
extra : moz-landing-system : lando