Closed Bug 572896 Opened 15 years ago Closed 15 years ago

Split nsHTMLInputElement::Reset() to prevent calling it to set the default value to the current value

Categories

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

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b3

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(2 files, 2 obsolete files)

Attached patch Patch v1 (obsolete) — Splinter Review
It's a follow-up from bug 549475: it makes thing clearer when reading the code.
Attachment #452121 - Flags: review?(Olli.Pettay)
No longer blocks: 549475
Depends on: 549475
Comment on attachment 452121 [details] [diff] [review] Patch v1 How does this make the code easier to read. Yet another switch-case.
(In reply to comment #1) > (From update of attachment 452121 [details] [diff] [review]) > How does this make the code easier to read. Yet another switch-case. Well, it prevents calling Reset when we don't really want to reset but set the value to the default value. In addition, the current call to reset is working only because we are calling it when the VALUE_CHANGED bit is false. For any reason, if that's done when VALUE_CHANGE is true, it would be wrong. I admit a switch case isn't really readable but I think that worths it because when doing a first read of AfterAttrSet, you understand what's SetValueAsDefaultValue is doing and you don't have to ask yourself why Reset is called. In addition, with the ValueMode() function I've added in on of my patch, the size of the switch could be reduced to 4 lines (two cases). I could introduce this function (ValueMode()) in a separate patch if you think the patch in it's current shape is only making thing worse.
Attachment #452121 - Flags: review?(Olli.Pettay) → review+
Attached patch Patch v1.1 (obsolete) — Splinter Review
Refreshed patch.
Attachment #452121 - Attachment is obsolete: true
Attachment #458636 - Flags: approval2.0?
This is bug 549475 follow-up. Only refactorization. (for the approval)
Attachment #458636 - Flags: approval2.0? → approval2.0+
Attached patch Patch v1.2Splinter Review
Updated patch for checkin. r=smaug a=bsmedberg
Attachment #458636 - Attachment is obsolete: true
Keywords: checkin-needed
Blocks: 572897
If you push this patch, could you push the patch from bug 572897 with it? (this patch has to be applied before)
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b3
Attached patch Fix bustageSplinter Review
volkmar: when @value is set, it becomes the <input> value if !BF_VALUE_CHANGED volkmar: it was done with Reset() which was doing SetValue() then resetting BF_VALUE_CHANGED ehsan: hmm, ok, makes sense I guess volkmar: so i've introduced a new argument to not set BF_VALUE_CHANGED when doing SetValue volkmar: SetValueInternal volkmar: but i forgot to do that for SetChecked
To be more accurate, the new "SetValueAsDefaultValue" method do not reset BF_VALUE_CHANGED because SetValueInternal has a new argument to not set it. Reset() do reset it because it has to. However, I forgot to take into consideration DoSetChecked. Sorry about that :(
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: