Closed Bug 885996 Opened 12 years ago Closed 12 years ago

Interaction between nsIColorPicker and content

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(3 files, 2 obsolete files)

Attached patch Patch (obsolete) — Splinter Review
This is using the patch in bug 875747 to interact between <input type='file'> and the nsIColorPicker widget. It is taking care of the input and change events. I am going to attach tests later.
Attachment #766270 - Flags: review?(bugs)
(In reply to Mounir Lamouri (:mounir) from comment #0) > between <input type='file'> I guess you meant <input type='color'> ;)
Depends on: 886046
Attached patch TestsSplinter Review
Attachment #766338 - Flags: review?(bugs)
Comment on attachment 766270 [details] [diff] [review] Patch returnOK/Cancel are odd names for consts, but not really about this bug. Could you make |win| nsCOMPtr. It is used so far a way from declaration that making a security bug by accident is easy. And this is not perf-critical code. aTrustedUpdate is odd name. Perhaps call it aFinalUpdate or some such.
Attachment #766270 - Flags: review?(bugs) → review+
Comment on attachment 766338 [details] [diff] [review] Tests >+ if (element.dataset.type == 'update') { >+ MockColorPicker.returnColor = '#f00ba4'; >+ update(); >+ >+ is(inputEvent, true, 'input event should have been received'); >+ is(changeEvent, false, 'change event should not have been received'); >+ >+ inputEvent = changeEvent = false; >+ >+ is(element.value, MockColorPicker.returnColor); >+ >+ MockColorPicker.returnColor = '#f00ba7'; >+ isnot(element.value, MockColorPicker.returnColor); >+ } else if (element.dataset.type == 'cancel') { >+ MockColorPicker.returnColor = '#bababa'; >+ isnot(element.value, MockColorPicker.returnColor); >+ } else if (element.dataset.type == 'done') { >+ MockColorPicker.returnColor = '#098766'; >+ isnot(element.value, MockColorPicker.returnColor); >+ } else if (element.dataset.type == 'noop-done') { >+ MockColorPicker.returnColor = element.value; >+ is(element.value, MockColorPicker.returnColor); >+ } >+ I don't understand what these .returnColor = foo; is[not] tests are trying to test. Do they test how MockColorPicker works or what? >+ <meta charset="utf-8"> >+ <title>Test for Bug 1234567</title> >+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> >+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> >+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> >+ <script type="application/javascript;version=1.8"> >+ >+ /** Test that update() modifies the element value such as done() when it is >+ * not called as a concellation. This whole sentence is hard to parse. You mean cancellation and 'the same way as done() ...' or something like that?
Attachment #766338 - Flags: review?(bugs) → feedback?(mounir)
Attachment #766338 - Flags: feedback?(mounir) → review?(bugs)
(In reply to Olli Pettay [:smaug] from comment #4) > Comment on attachment 766338 [details] [diff] [review] > Tests > > > >+ if (element.dataset.type == 'update') { > >+ MockColorPicker.returnColor = '#f00ba4'; > >+ update(); > >+ > >+ is(inputEvent, true, 'input event should have been received'); > >+ is(changeEvent, false, 'change event should not have been received'); > >+ > >+ inputEvent = changeEvent = false; > >+ > >+ is(element.value, MockColorPicker.returnColor); > >+ > >+ MockColorPicker.returnColor = '#f00ba7'; > >+ isnot(element.value, MockColorPicker.returnColor); > >+ } else if (element.dataset.type == 'cancel') { > >+ MockColorPicker.returnColor = '#bababa'; > >+ isnot(element.value, MockColorPicker.returnColor); > >+ } else if (element.dataset.type == 'done') { > >+ MockColorPicker.returnColor = '#098766'; > >+ isnot(element.value, MockColorPicker.returnColor); > >+ } else if (element.dataset.type == 'noop-done') { > >+ MockColorPicker.returnColor = element.value; > >+ is(element.value, MockColorPicker.returnColor); > >+ } > >+ > I don't understand what these .returnColor = foo; is[not] tests are trying > to test. > Do they test how MockColorPicker works or what? Those tests are indeed naive but the idea is to check that the value did (or did not) change when the color picker current color changed. There is no way to really express that with MockColorPicker so I expressed that with .returnColor which makes those checks a bit stupid. Though, they do not hurt and if we end up having a better way to change the current selected color in MockColorPicker we will have tests for free.
Comment on attachment 766338 [details] [diff] [review] Tests this is rs'ish r+
Attachment #766338 - Flags: review?(bugs) → review+
Attached patch Patch (obsolete) — Splinter Review
Olli, I applied your change requests and some changes requested by roc in the interface review. Could you review this new patch? (I am going to attach an inter-diff.)
Attachment #766270 - Attachment is obsolete: true
Attachment #770884 - Flags: review?(bugs)
Attached patch inter-diffSplinter Review
The new patch looks good to me. I've updated the Gtk Widget in bug 875753 accordingly, so you can use it if you want to test this patch "for real".
Attached patch PatchSplinter Review
Some cleaning up.
Attachment #770884 - Attachment is obsolete: true
Attachment #770884 - Flags: review?(bugs)
Attachment #771361 - Flags: review?(bugs)
Attachment #771361 - Flags: review?(bugs) → review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Depends on: 936483
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: