Closed
Bug 893909
Opened 12 years ago
Closed 12 years ago
Cleanup HTMLSelectElement
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: Ms2ger, Assigned: Ms2ger)
References
Details
Attachments
(15 files)
|
4.43 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
6.69 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
2.37 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.02 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
3.58 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.10 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.08 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
747 bytes,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
20.31 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
17.54 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.20 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.08 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.26 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
2.17 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.31 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
No description provided.
| Assignee | ||
Comment 1•12 years ago
|
||
Attachment #775765 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 2•12 years ago
|
||
Attachment #775767 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 3•12 years ago
|
||
Attachment #775771 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 4•12 years ago
|
||
Attachment #775775 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 5•12 years ago
|
||
Attachment #775776 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 6•12 years ago
|
||
Attachment #775777 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 7•12 years ago
|
||
Attachment #775778 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 8•12 years ago
|
||
Attachment #775780 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 9•12 years ago
|
||
Attachment #775781 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 10•12 years ago
|
||
| Assignee | ||
Comment 11•12 years ago
|
||
Attachment #775786 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 12•12 years ago
|
||
Attachment #775788 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 13•12 years ago
|
||
Attachment #775789 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 14•12 years ago
|
||
I hope you appreciate the removed QI in particular.
Attachment #775791 -
Flags: review?(dzbarsky)
| Assignee | ||
Comment 15•12 years ago
|
||
Attachment #775792 -
Flags: review?(dzbarsky)
Updated•12 years ago
|
Attachment #775767 -
Flags: review?(dzbarsky) → review+
Updated•12 years ago
|
Attachment #775771 -
Flags: review?(dzbarsky) → review+
Comment 16•12 years ago
|
||
Comment on attachment 775777 [details] [diff] [review]
Part f: Cleanup IsOptionSelectedByIndex
Review of attachment 775777 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ +817,5 @@
> return mOptions->GetOptionIndex(option->AsElement(), aStartIndex, aForward, aIndex);
> }
>
> bool
> HTMLSelectElement::IsOptionSelectedByIndex(int32_t aIndex)
This is only called from one place. Why don't you change this and the loop in HTMLSelectElement::FindSelectedIndex to use uint32_t?
Attachment #775777 -
Flags: review?(dzbarsky) → review+
Updated•12 years ago
|
Attachment #775780 -
Flags: review?(dzbarsky) → review+
Updated•12 years ago
|
Attachment #775786 -
Flags: review?(dzbarsky) → review+
Updated•12 years ago
|
Attachment #775788 -
Flags: review?(dzbarsky) → review+
Updated•12 years ago
|
Attachment #775778 -
Flags: review?(dzbarsky) → review+
Comment 17•12 years ago
|
||
Comment on attachment 775792 [details] [diff] [review]
Part n: Cleanup IsValueMissing
Review of attachment 775792 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ +1777,1 @@
> if (!value.IsEmpty()) {
So GetValue should be void but we're using the XPIDL method? ok
Attachment #775792 -
Flags: review?(dzbarsky) → review+
Comment 18•12 years ago
|
||
Comment on attachment 775791 [details] [diff] [review]
Part m: Cleanup SubmitNamesValues
Review of attachment 775791 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ -1719,1 @@
> }
Why do we eat this return value?
Updated•12 years ago
|
Attachment #775789 -
Flags: review?(dzbarsky) → review+
Comment 19•12 years ago
|
||
Comment on attachment 775765 [details] [diff] [review]
Part a: Add a IsOptionDisabled overload without an outparam
Review of attachment 775765 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ +1146,1 @@
> while (1) {
how about
for (nsCOMPtr<Element> node = aOption->GetParentElement();
node;
node = node->GetParentElement())
@@ +1163,2 @@
> // If you put something else between you and the optgroup, you're a
> // moron and you deserve not to have optgroup disabling work.
Nice.
Attachment #775765 -
Flags: review?(dzbarsky) → review+
Comment 20•12 years ago
|
||
Comment on attachment 775775 [details] [diff] [review]
Part d: Cleanup Remove
Review of attachment 775775 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ +685,1 @@
> return NS_OK;
Hrm. Remove() ends up calling IndexOf twice. Probably not a big deal because we have the cache, but kind of unfortunate.
Attachment #775775 -
Flags: review?(dzbarsky) → review+
Comment 21•12 years ago
|
||
Comment on attachment 775776 [details] [diff] [review]
Part e: Cleanup SetLength
Review of attachment 775776 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ +738,2 @@
> }
>
whitespace
@@ -733,3 @@
> }
>
> - // This violates the W3C DOM but we do this for backwards compatibility
Any idea what this comment was referring to?
@@ +742,5 @@
> nsContentUtils::NameChanged(mNodeInfo, nsGkAtoms::option,
> getter_AddRefs(nodeInfo));
>
> + nsCOMPtr<nsINode> node = NS_NewHTMLOptionElement(nodeInfo.forget());
> + if (!node) {
This is infallible.
Attachment #775776 -
Flags: review?(dzbarsky) → review+
Comment 22•12 years ago
|
||
Comment on attachment 775784 [details] [diff] [review]
Part i -w
Review of attachment 775784 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.h
@@ +321,5 @@
> int32_t aEndIndex,
> bool aIsSelected,
> bool aClearAll,
> bool aSetDisabled,
> + bool aNotify);
Can you change this to use an enum instead of bool flags?
Attachment #775784 -
Flags: review+
Updated•12 years ago
|
Attachment #775781 -
Flags: review?(dzbarsky) → review+
Comment 23•12 years ago
|
||
Comment on attachment 775791 [details] [diff] [review]
Part m: Cleanup SubmitNamesValues
Review of attachment 775791 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/HTMLSelectElement.cpp
@@ -1719,1 @@
> }
I guess this is fine since we don't check the return value anyway.
Attachment #775791 -
Flags: review?(dzbarsky) → review+
| Assignee | ||
Comment 24•12 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #16)
> Comment on attachment 775777 [details] [diff] [review]
> Part f: Cleanup IsOptionSelectedByIndex
>
> Review of attachment 775777 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ +817,5 @@
> > return mOptions->GetOptionIndex(option->AsElement(), aStartIndex, aForward, aIndex);
> > }
> >
> > bool
> > HTMLSelectElement::IsOptionSelectedByIndex(int32_t aIndex)
>
> This is only called from one place. Why don't you change this and the loop
> in HTMLSelectElement::FindSelectedIndex to use uint32_t?
I considered, but it seems non-equivalent if aStartIndex is negative.
(In reply to David Zbarsky (:dzbarsky) from comment #17)
> Comment on attachment 775792 [details] [diff] [review]
> Part n: Cleanup IsValueMissing
>
> Review of attachment 775792 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ +1777,1 @@
> > if (!value.IsEmpty()) {
>
> So GetValue should be void but we're using the XPIDL method? ok
Yeah; I'll leave it to you to fix that :)
(In reply to David Zbarsky (:dzbarsky) from comment #18)
> Comment on attachment 775791 [details] [diff] [review]
> Part m: Cleanup SubmitNamesValues
>
> Review of attachment 775791 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ -1719,1 @@
> > }
>
> Why do we eat this return value?
(In reply to David Zbarsky (:dzbarsky) from comment #23)
> Comment on attachment 775791 [details] [diff] [review]
> Part m: Cleanup SubmitNamesValues
>
> Review of attachment 775791 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ -1719,1 @@
> > }
>
> I guess this is fine since we don't check the return value anyway.
Yeah; we did it before, and I don't want to change that.
(In reply to David Zbarsky (:dzbarsky) from comment #19)
> Comment on attachment 775765 [details] [diff] [review]
> Part a: Add a IsOptionDisabled overload without an outparam
>
> Review of attachment 775765 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ +1146,1 @@
> > while (1) {
>
> how about
> for (nsCOMPtr<Element> node = aOption->GetParentElement();
> node;
> node = node->GetParentElement())
Nice.
(In reply to David Zbarsky (:dzbarsky) from comment #20)
> Comment on attachment 775775 [details] [diff] [review]
> Part d: Cleanup Remove
>
> Review of attachment 775775 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ +685,1 @@
> > return NS_OK;
>
> Hrm. Remove() ends up calling IndexOf twice. Probably not a big deal
> because we have the cache, but kind of unfortunate.
Ignored as discussed on IRC.
(In reply to David Zbarsky (:dzbarsky) from comment #21)
> Comment on attachment 775776 [details] [diff] [review]
> Part e: Cleanup SetLength
>
> Review of attachment 775776 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.cpp
> @@ +738,2 @@
> > }
> >
>
> whitespace
Removed
> @@ -733,3 @@
> > }
> >
> > - // This violates the W3C DOM but we do this for backwards compatibility
>
> Any idea what this comment was referring to?
Nope; the old spec didn't even say anything about the setter.
> @@ +742,5 @@
> > nsContentUtils::NameChanged(mNodeInfo, nsGkAtoms::option,
> > getter_AddRefs(nodeInfo));
> >
> > + nsCOMPtr<nsINode> node = NS_NewHTMLOptionElement(nodeInfo.forget());
> > + if (!node) {
>
> This is infallible.
Removed.
(In reply to David Zbarsky (:dzbarsky) from comment #22)
> Comment on attachment 775784 [details] [diff] [review]
> Part i -w
>
> Review of attachment 775784 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/html/content/src/HTMLSelectElement.h
> @@ +321,5 @@
> > int32_t aEndIndex,
> > bool aIsSelected,
> > bool aClearAll,
> > bool aSetDisabled,
> > + bool aNotify);
>
> Can you change this to use an enum instead of bool flags?
Not in this bug.
| Assignee | ||
Comment 25•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/1db8a12e53e9
https://hg.mozilla.org/mozilla-central/rev/01da392cf670
https://hg.mozilla.org/mozilla-central/rev/b6e69ee84ad3
https://hg.mozilla.org/mozilla-central/rev/8a1ecc6236c1
https://hg.mozilla.org/mozilla-central/rev/3ec0906fcf68
https://hg.mozilla.org/mozilla-central/rev/39fc7ef972b8
https://hg.mozilla.org/mozilla-central/rev/1f1718431c33
https://hg.mozilla.org/mozilla-central/rev/effaed213a6c
https://hg.mozilla.org/mozilla-central/rev/f034d7318487
https://hg.mozilla.org/mozilla-central/rev/92cdfc957668
https://hg.mozilla.org/mozilla-central/rev/7bc2e4b2bfc5
https://hg.mozilla.org/mozilla-central/rev/ba2e6e147d30
https://hg.mozilla.org/mozilla-central/rev/0820c5ec7117
https://hg.mozilla.org/mozilla-central/rev/c8619b95ee10
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•