Closed Bug 581644 Opened 14 years ago Closed 13 years ago

Don't use nsIDOMHTMLMapElement in nsHTMLDocument::GetImageMap

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: Ms2ger, Assigned: Ms2ger)

References

Details

Attachments

(1 file, 4 obsolete files)

Depends on: 587469
Attached patch Patch v1 (obsolete) — Splinter Review
Attachment #466143 - Flags: review?(peterv)
Comment on attachment 466143 [details] [diff] [review]
Patch v1

I think you should also make GetImageMap return a nsIContent, and let callers do the QI if needed. Also, why are you removing the error checking for the GetAttr calls?
Attachment #466143 - Flags: review?(peterv) → review-
(In reply to comment #2)
> make GetImageMap return a nsIContent

Or Element.
Attached patch Patch v2 (obsolete) — Splinter Review
Now returns Element. In the GetAttr call, I'm not actually changing behavior here, as GetId and GetName just return the empty string if the attribute is absent, like GetAttr.
Attachment #466143 - Attachment is obsolete: true
Attachment #468129 - Flags: review?(peterv)
Comment on attachment 468129 [details] [diff] [review]
Patch v2

>diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp

>+    map->GetAttr(kNameSpaceID_None, nsGkAtoms::id, name);
>+    PRBool match = name.Equals(aMapName);

I'd just use AttrValueIs instead.

>+
>     if (!match) {
>-      rv = map->GetName(name);
>-      NS_ENSURE_SUCCESS(rv, nsnull);
>-
>+      map->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
>       match = name.Equals(aMapName, nsCaseInsensitiveStringComparator());

Same here.

>-#ifndef nsIHTMLDocument_h___
>-#define nsIHTMLDocument_h___
>+
>+#ifndef nsIHTMLDocument_h
>+#define nsIHTMLDocument_h

No need for this change, and afaict it makes these inconsistent with the rest of the tree. Please revert.
Attachment #468129 - Flags: review?(peterv) → review+
Attached patch Patch v3 (obsolete) — Splinter Review
Now with AttrValueIs... This function is actually starting to look sane now.

> >-#ifndef nsIHTMLDocument_h___
> >-#define nsIHTMLDocument_h___
> >+
> >+#ifndef nsIHTMLDocument_h
> >+#define nsIHTMLDocument_h
> 
> No need for this change, and afaict it makes these inconsistent with the rest
> of the tree. Please revert.

As was mentioned in bug 514661 comment 25, all names with two consecutive
underscores are reserved to the implementation, and the rest of the tree uses roughly any style you can imagine. Your call, though; I'll revert if you prefer.
Attachment #468129 - Attachment is obsolete: true
Please remove #include "nsIDOMHTMLMapElement.h" from nsHTMLDocument.h also.
Attached patch Patch v4 (obsolete) — Splinter Review
Done, thanks.
Attachment #471077 - Attachment is obsolete: true
Whiteboard: [needs landing]
Depends on: post2.0
Blocks: 557768
Attachment #483422 - Attachment is obsolete: true
Keywords: checkin-needed
Whiteboard: [needs landing]
The patch no longer applies correctly. Could you update it?
Keywords: checkin-needed
My bad, I didn't apply the deps before this patch...
Keywords: checkin-needed
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/9df21e557f71
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: fixed-in-cedar
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: