Closed Bug 641409 Opened 13 years ago Closed 13 years ago

Move methods using only GetType from nsGenericHTMLFormElement to nsIFormControl

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(1 file)

Attached patch Patch v1Splinter Review
That way, we can make those methods inline and non-virtual.

Unfortunately:
- GetType() is still virtual and making it non-virtual might not be doable (does it worth adding a PRUint32 to all form controls?);
- I've been told that I still have to use PRBool in interfaces. That makes me really sad :(

A possible follow-up would be to create a structure that keeps track of form control properties and make those methods more maintainable.
Attachment #519064 - Flags: review?(bzbarsky)
Blocks: 563669
I thought we were moving things the other way? Will this patch break anything for elements that don't have a frame?
(In reply to comment #1)
> I thought we were moving things the other way?

What do you mean? The idea here is that we declare a method in nsIFormControl and define it in nsGenericHTMLFormElement, thus making the method virtual. But we could have the definition in the interface quite easily.

> Will this patch break anything for elements that don't have a frame?

nsGenericHTMLFormElement inherits from nsIFormControl so it shouldn't change anything.
> - I've been told that I still have to use PRBool in interfaces.

Hmm.  Only ones we expect to be called from outside our code, I'd think.

Mounir, if we really cared we might be able to stuff the type into element-specific flags once we make flags 64-bit on nodes, right?
Comment on attachment 519064 [details] [diff] [review]
Patch v1

The two-argument form of IsSingleLineTextControl should probably be protected.

r=me with that.
Attachment #519064 - Flags: review?(bzbarsky) → review+
Summary: Move methods using only using GetType from nsGenericHTMLFormElement to nsIFormControl → Move methods using only GetType from nsGenericHTMLFormElement to nsIFormControl
I've changed:
public PRBool IsSingleLineTextControl(PRBool, PRUint32)
to:
protected bool IsSingleLineTextControl(bool, PRUint32)

Thanks for the quick review.
Whiteboard: [needs review] → [can land][post-2.0]
Pushed:
http://hg.mozilla.org/mozilla-central/rev/364e0b9a2168
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [can land][post-2.0]
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: