Closed Bug 839447 Opened 12 years ago Closed 12 years ago

Convert HTMLOptionElement to WebIDL

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: baku, Assigned: baku)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

No description provided.
Attachment #711825 - Flags: review?(Ms2ger)
Attached patch part 2 - webidl (obsolete) — Splinter Review
Attachment #711826 - Flags: review?(Ms2ger)
Attachment #711825 - Flags: review?(Ms2ger) → review+
Comment on attachment 711826 [details] [diff] [review] part 2 - webidl Review of attachment 711826 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, except for the constructor issue; I'd like Peter to check that. ::: content/html/content/src/HTMLOptionElement.h @@ +9,5 @@ > > #include "nsGenericHTMLElement.h" > #include "nsIDOMHTMLOptionElement.h" > #include "nsIJSNativeInitializer.h" > +#include <nsHTMLFormElement.h> "" instead of <> @@ +90,5 @@ > + { > + SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv); > + } > + > + already_AddRefed<nsHTMLFormElement> GetForm() You should be able to just remove this too, if you add "using nsGenericHTMLFormElement::GetForm;" @@ +130,5 @@ > + } > + > + int32_t GetIndex(ErrorResult& aRv) > + { > + int32_t id; Nit: please initialize this to zero, for safety ::: content/html/content/src/nsHTMLSelectElement.h @@ +669,1 @@ > static_cast<nsGenericHTMLElement&>(*aElement.GetAsHTMLOptGroupElement()); Looks like you're getting a merge conflict with yourself in bug 839056? ::: dom/webidl/HTMLOptionElement.webidl @@ +14,5 @@ > +[NamedConstructor=Option(), > + NamedConstructor=Option(DOMString text), > + NamedConstructor=Option(DOMString text, DOMString value), > + NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected), > + NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected, boolean selected)] Uh, you don't seem to have added code for this... Peter?
Attachment #711826 - Flags: review?(peterv)
Attachment #711826 - Flags: review?(Ms2ger)
Attachment #711826 - Flags: review+
Comment on attachment 711826 [details] [diff] [review] part 2 - webidl Review of attachment 711826 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/html/content/src/HTMLOptionElement.h @@ +90,5 @@ > + { > + SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv); > + } > + > + already_AddRefed<nsHTMLFormElement> GetForm() HTMLOptionElement is not a nsGenericHTMLFormElement, so we can't do |using ...|. I wish we'd implement GetForm (marked as resultNotAddRefed) as nsHTMLFormElement* HTMLOptionElement::GetForm() { nsHTMLSelectElement* selectControl = GetSelect(); return selectControl ? selectControl->GetForm() : nullptr; } and make the XPCOM one forward to this. ::: dom/bindings/Bindings.conf @@ +441,5 @@ > }, > > +'HTMLOptionElement': { > + 'hasInstanceInterface': 'nsIDOMHTMLOptionElement' > +}, Obsolete. ::: dom/webidl/HTMLOptionElement.webidl @@ +14,5 @@ > +[NamedConstructor=Option(), > + NamedConstructor=Option(DOMString text), > + NamedConstructor=Option(DOMString text, DOMString value), > + NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected), > + NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected, boolean selected)] This is fine. We'll get NamedConstructor support soon, but in the meantime the old XPCOM constructors will keep working.
Attachment #711826 - Flags: review?(peterv) → review+
(In reply to Peter Van der Beken [:peterv] from comment #4) > ::: dom/webidl/HTMLOptionElement.webidl > @@ +14,5 @@ > > +[NamedConstructor=Option(), > > + NamedConstructor=Option(DOMString text), > > + NamedConstructor=Option(DOMString text, DOMString value), > > + NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected), > > + NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected, boolean selected)] > > This is fine. We'll get NamedConstructor support soon, but in the meantime > the old XPCOM constructors will keep working. Let's comment them out for now, then, to avoid confusion.
Blocks: 842276
Attached patch part 2 - webidlSplinter Review
Attachment #711826 - Attachment is obsolete: true
Attachment #715111 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Comment on attachment 715430 [details] [diff] [review] Part 3: Add a missing addref Review of attachment 715430 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/html/content/src/HTMLOptionElement.cpp @@ +100,5 @@ > NS_IMETHODIMP > HTMLOptionElement::GetForm(nsIDOMHTMLFormElement** aForm) > { > NS_ENSURE_ARG_POINTER(aForm); > + NS_ADDREF(*aForm = GetForm()); Please, remove NS_ENSURE_ARG_POINTER() as long as you are here.
Attachment #715430 - Flags: review?(mounir) → review+
Part 3 landed directly on m-c (pushed on top of orange, no less...) https://hg.mozilla.org/mozilla-central/rev/b8b9100f6c41
> + NS_ADDREF(*aForm = GetForm()); Uh... NS_IF_ADDREF, no?
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: