Bug 1425547 - Remove unused methods from nsIHTMLInlineTableEditor. r=masayuki

inlineTableEditingEnabled and refreshInlineTableEditingUI are used by
bluegriffon, but other methods aren't used by m-c, c-c and bluegriffon.
So I would like to remove these methods.  Then we can clean up
DoInlineTableEditingAction.

MozReview-Commit-ID: 3R0bJDU5vqv

--HG--
extra : rebase_source : 74c7615613bba65326069929cb53c3ea48f2e9a4
extra : amend_source : a1ac9af3de50daa0cbfd98e2790afa402d9932ef
This commit is contained in:
Makoto Kato 2018-01-19 16:41:41 +09:00
parent 37fc167ff3
commit 70a0912794
4 changed files with 60 additions and 73 deletions

View File

@ -467,6 +467,13 @@ public:
*/
nsresult OnMouseMove(nsIDOMMouseEvent* aMouseEvent);
/**
* Modifies the table containing the selection according to the
* activation of an inline table editing UI element
* @param aUIAnonymousElement [IN] the inline table editing UI element
*/
nsresult DoInlineTableEditingAction(Element& aUIAnonymousElement);
protected:
class BlobReader final : public nsIEditorBlobListener
{
@ -1139,8 +1146,17 @@ protected:
ManualNACPtr mRemoveRowButton;
ManualNACPtr mAddRowAfterButton;
/**
* Shows inline table editing UI around a table cell
* @param aCell [IN] a DOM Element being a table cell, td or th
*/
nsresult ShowInlineTableEditingUI(Element* aCell);
/**
* Hide all inline table editing UI
*/
nsresult HideInlineTableEditingUI();
void AddMouseClickListener(Element* aElement);
void RemoveMouseClickListener(Element* aElement);

View File

@ -211,11 +211,14 @@ HTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(target, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(target);
nsCOMPtr<Element> element = do_QueryInterface(target);
if (NS_WARN_IF(!element)) {
return NS_ERROR_FAILURE;
}
RefPtr<HTMLEditor> htmlEditor = mEditorBase->AsHTMLEditor();
MOZ_ASSERT(htmlEditor);
htmlEditor->DoInlineTableEditingAction(element);
htmlEditor->DoInlineTableEditingAction(*element);
// DoInlineTableEditingAction might cause reframe
// Editor is destroyed.
if (htmlEditor->Destroyed()) {

View File

@ -42,13 +42,6 @@ HTMLEditor::GetInlineTableEditingEnabled(bool* aIsEnabled)
return NS_OK;
}
NS_IMETHODIMP
HTMLEditor::ShowInlineTableEditingUI(nsIDOMElement* aCell)
{
nsCOMPtr<Element> cell = do_QueryInterface(aCell);
return ShowInlineTableEditingUI(cell);
}
nsresult
HTMLEditor::ShowInlineTableEditingUI(Element* aCell)
{
@ -101,7 +94,7 @@ HTMLEditor::ShowInlineTableEditingUI(Element* aCell)
return RefreshInlineTableEditingUI();
}
NS_IMETHODIMP
nsresult
HTMLEditor::HideInlineTableEditingUI()
{
mInlineEditedCell = nullptr;
@ -129,62 +122,55 @@ HTMLEditor::HideInlineTableEditingUI()
return NS_OK;
}
NS_IMETHODIMP
HTMLEditor::DoInlineTableEditingAction(nsIDOMElement* aElement)
nsresult
HTMLEditor::DoInlineTableEditingAction(Element& aElement)
{
NS_ENSURE_ARG_POINTER(aElement);
bool anonElement = false;
if (aElement &&
NS_SUCCEEDED(aElement->HasAttribute(NS_LITERAL_STRING("_moz_anonclass"), &anonElement)) &&
anonElement) {
nsAutoString anonclass;
nsresult rv =
aElement->GetAttribute(NS_LITERAL_STRING("_moz_anonclass"), anonclass);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString anonclass;
aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::_moz_anonclass, anonclass);
if (!StringBeginsWith(anonclass, NS_LITERAL_STRING("mozTable")))
return NS_OK;
if (!StringBeginsWith(anonclass, NS_LITERAL_STRING("mozTable"))) {
return NS_OK;
}
RefPtr<Element> tableElement = GetEnclosingTable(mInlineEditedCell);
int32_t rowCount, colCount;
rv = GetTableSize(tableElement, &rowCount, &colCount);
NS_ENSURE_SUCCESS(rv, rv);
RefPtr<Element> tableElement = GetEnclosingTable(mInlineEditedCell);
int32_t rowCount, colCount;
nsresult rv = GetTableSize(tableElement, &rowCount, &colCount);
NS_ENSURE_SUCCESS(rv, rv);
bool hideUI = false;
bool hideResizersWithInlineTableUI = (mResizedObject == tableElement);
bool hideUI = false;
bool hideResizersWithInlineTableUI = (mResizedObject == tableElement);
if (anonclass.EqualsLiteral("mozTableAddColumnBefore"))
InsertTableColumn(1, false);
else if (anonclass.EqualsLiteral("mozTableAddColumnAfter"))
InsertTableColumn(1, true);
else if (anonclass.EqualsLiteral("mozTableAddRowBefore"))
InsertTableRow(1, false);
else if (anonclass.EqualsLiteral("mozTableAddRowAfter"))
InsertTableRow(1, true);
else if (anonclass.EqualsLiteral("mozTableRemoveColumn")) {
DeleteTableColumn(1);
if (anonclass.EqualsLiteral("mozTableAddColumnBefore")) {
InsertTableColumn(1, false);
} else if (anonclass.EqualsLiteral("mozTableAddColumnAfter")) {
InsertTableColumn(1, true);
} else if (anonclass.EqualsLiteral("mozTableAddRowBefore")) {
InsertTableRow(1, false);
} else if (anonclass.EqualsLiteral("mozTableAddRowAfter")) {
InsertTableRow(1, true);
} else if (anonclass.EqualsLiteral("mozTableRemoveColumn")) {
DeleteTableColumn(1);
#ifndef DISABLE_TABLE_DELETION
hideUI = (colCount == 1);
hideUI = (colCount == 1);
#endif
}
else if (anonclass.EqualsLiteral("mozTableRemoveRow")) {
DeleteTableRow(1);
} else if (anonclass.EqualsLiteral("mozTableRemoveRow")) {
DeleteTableRow(1);
#ifndef DISABLE_TABLE_DELETION
hideUI = (rowCount == 1);
hideUI = (rowCount == 1);
#endif
}
else
return NS_OK;
} else {
return NS_OK;
}
// InsertTableRow might causes reframe
if (Destroyed()) {
return NS_OK;
}
// InsertTableRow might causes reframe
if (Destroyed()) {
return NS_OK;
}
if (hideUI) {
HideInlineTableEditingUI();
if (hideResizersWithInlineTableUI)
HideResizers();
if (hideUI) {
HideInlineTableEditingUI();
if (hideResizersWithInlineTableUI) {
HideResizers();
}
}

View File

@ -18,24 +18,6 @@ interface nsIHTMLInlineTableEditor : nsISupports
*/
attribute boolean inlineTableEditingEnabled;
/**
* Shows inline table editing UI around a table cell
* @param aCell [IN] a DOM Element being a table cell, td or th
*/
void showInlineTableEditingUI(in nsIDOMElement aCell);
/**
* Hide all inline table editing UI
*/
void hideInlineTableEditingUI();
/**
* Modifies the table containing the selection according to the
* activation of an inline table editing UI element
* @param aUIAnonymousElement [IN] the inline table editing UI element
*/
void doInlineTableEditingAction(in nsIDOMElement aUIAnonymousElement);
/**
* Refresh already visible inline table editing UI
*/