mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #2732 - Part 3: Explicitly search for <area> only.
Relying on the implicit conversion by `::FromContent` doesn't work for us because we inherit that from `nsGenericHTMLElement` and isn't specific to `HTMLAreaElement`, so it would accept other elements. This also updates the Attribute changed event handler to exclude `<a>` elements and cleans up an unused variable from the old code.
This commit is contained in:
parent
8a21d95ea3
commit
8ae2b45691
1 changed files with 5 additions and 7 deletions
|
|
@ -751,16 +751,15 @@ nsImageMap::Init(nsImageFrame* aImageFrame, nsIContent* aMap)
|
|||
void
|
||||
nsImageMap::SearchForAreas(nsIContent* aParent)
|
||||
{
|
||||
uint32_t n = aParent->GetChildCount();
|
||||
|
||||
// Look for <area> elements.
|
||||
for (nsIContent* child = aParent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (auto* area = static_cast<HTMLAreaElement*>(HTMLAreaElement::FromContent(child))) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::area)) {
|
||||
HTMLAreaElement* area = static_cast<HTMLAreaElement*>(HTMLAreaElement::FromContent(child));
|
||||
AddArea(area);
|
||||
|
||||
// Continue to next child. This stops mConsiderWholeSubtree from
|
||||
// Continue to next sibling. This stops mConsiderWholeSubtree from
|
||||
// getting set. It also makes us ignore children of <area>s which
|
||||
// is consistent with how we react to dynamic insertion of such
|
||||
// children.
|
||||
|
|
@ -895,11 +894,10 @@ nsImageMap::AttributeChanged(nsIDocument* aDocument,
|
|||
const nsAttrValue* aOldValue)
|
||||
{
|
||||
// If the parent of the changing content node is our map then update
|
||||
// the map. But only do this if the node is an HTML <area> or <a>
|
||||
// the map. But only do this if the node is an HTML <area>
|
||||
// and the attribute that's changing is "shape" or "coords" -- those
|
||||
// are the only cases we care about.
|
||||
if ((aElement->NodeInfo()->Equals(nsGkAtoms::area) ||
|
||||
aElement->NodeInfo()->Equals(nsGkAtoms::a)) &&
|
||||
if (aElement->NodeInfo()->Equals(nsGkAtoms::area) &&
|
||||
aElement->IsHTMLElement() &&
|
||||
aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::shape ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue