Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1484092 - part 2: Drop supporting "namedanchor" special element n…
Browse files Browse the repository at this point in the history
…ame 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
  • Loading branch information
masayuki-nakano committed Aug 17, 2018
1 parent 16eb03f commit 77878a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
3 changes: 1 addition & 2 deletions editor/libeditor/HTMLEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ IsLinkTag(const nsAtom& aTagName)
static bool
IsNamedAnchorTag(const nsAtom& aTagName)
{
return aTagName.Equals(NS_LITERAL_STRING("anchor")) ||
aTagName.Equals(NS_LITERAL_STRING("namedanchor"));
return aTagName.Equals(NS_LITERAL_STRING("anchor");
}

template EditorDOMPoint
Expand Down
15 changes: 6 additions & 9 deletions editor/libeditor/HTMLEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,8 @@ class HTMLEditor final : public TextEditor
* If nsGkAtoms::td, the result may be <td> or <th>.
* If nsGkAtoms::href, the result may be <a> element
* which has "href" attribute with non-empty value.
* If nsGkAtoms::anchor or atom of "namedanchor", the
* result may be <a> which has "name" attribute with
* non-empty value.
* If nsGkAtoms::anchor, the result may be <a> which
* has "name" attribute with non-empty value.
* @param aNode If non-nullptr, this starts to look for the result
* from it. Otherwise, i.e., nullptr, starts from
* anchor node of Selection.
Expand Down Expand Up @@ -846,9 +845,8 @@ class HTMLEditor final : public TextEditor
* If nsGkAtoms::td, the result may be <td> or <th>.
* If nsGkAtoms::href, the result may be <a> element
* which has "href" attribute with non-empty value.
* If nsGkAtoms::anchor or atom of "namedanchor", the
* result may be <a> which has "name" attribute with
* non-empty value.
* If nsGkAtoms::anchor, the result may be <a> which
* has "name" attribute with non-empty value.
* @return If an element which matches aTagName, returns
* an Element. Otherwise, nullptr.
*/
Expand All @@ -867,9 +865,8 @@ class HTMLEditor final : public TextEditor
* If nsGkAtoms::td, the result may be <td> or <th>.
* If nsGkAtoms::href, the result may be <a> element
* which has "href" attribute with non-empty value.
* If nsGkAtoms::anchor or atom of "namedanchor", the
* result may be <a> which has "name" attribute with
* non-empty value.
* If nsGkAtoms::anchor, the result may be <a> which
* has "name" attribute with non-empty value.
* @param aNode Start node to look for the element.
* @return If an element which matches aTagName, returns
* an Element. Otherwise, nullptr.
Expand Down
4 changes: 2 additions & 2 deletions editor/nsIHTMLEditor.idl
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ interface nsIHTMLEditor : nsISupports
* If "td", the result may be <td> or <th>.
* If "href", the result may be <a> element
* which has "href" attribute with non-empty value.
* If "anchor" or "namedanchor", the result may be <a>
* which has "name" attribute with non-empty value.
* If "anchor", the result may be <a> which has
* "name" attribute with non-empty value.
* @param aNode If non-null, this starts to look for the result
* from it. Otherwise, i.e., null, starts from
* anchor node of Selection.
Expand Down

0 comments on commit 77878a8

Please sign in to comment.