Bug 1471596 - Simplify the code in HTMLEditor::GetSelectedOrParentTableElement r?m_kato
the first branch of the if was useless
MozReview-Commit-ID: GgKYOcI3sGX
--- a/editor/libeditor/HTMLTableEditor.cpp
+++ b/editor/libeditor/HTMLTableEditor.cpp
@@ -3163,21 +3163,17 @@ HTMLEditor::GetSelectedOrParentTableElem
nsCOMPtr<nsINode> anchorNode = selection->GetAnchorNode();
if (NS_WARN_IF(!anchorNode)) {
return NS_ERROR_FAILURE;
}
// Get child of anchor node, if exists
if (anchorNode->HasChildNodes()) {
nsINode* selectedNode = selection->GetChildAtAnchorOffset();
- if (!selectedNode) {
- selectedNode = anchorNode;
- // If anchor doesn't have a child, we can't be selecting a table element,
- // so don't do the following:
- } else {
+ if (selectedNode) {
if (selectedNode->IsHTMLElement(nsGkAtoms::td)) {
tableOrCellElement = selectedNode->AsElement();
aTagName = tdName;
// Each cell is in its own selection range,
// so count signals multiple-cell selection
*aSelectedCount = selection->RangeCount();
} else if (selectedNode->IsHTMLElement(nsGkAtoms::table)) {
tableOrCellElement = selectedNode->AsElement();