Bug 643945. Use a <button type='button'>, not an <input type='button'>, for the dropmarker in a <select>. r=ehsan
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 25 Mar 2011 21:05:56 -0400
changeset 63940 256d72a8245c50e4c4b038ac4417ec140eaa508a
parent 63939 30e38f8752c196303b0b329826b2f16759bfe36a
child 63941 9be05c62b6ce59a5269cc6f4eb965b101b5b303c
push id19286
push userbzbarsky@mozilla.com
push dateSat, 26 Mar 2011 01:06:25 +0000
treeherdermozilla-central@256d72a8245c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs643945
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 643945. Use a <button type='button'>, not an <input type='button'>, for the dropmarker in a <select>. r=ehsan
layout/forms/nsComboboxControlFrame.cpp
layout/style/forms.css
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1024,17 +1024,17 @@ nsComboboxControlFrame::CreateAnonymousC
     mListControlFrame->GetOptionText(mDisplayedIndex, mDisplayedOptionText);
   }
   ActuallyDisplayText(PR_FALSE);
 
   if (!aElements.AppendElement(mDisplayContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsCOMPtr<nsINodeInfo> nodeInfo;
-  nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
+  nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::button, nsnull, kNameSpaceID_XHTML);
 
   // create button which drops the list down
   NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo.forget(),
                     dom::NOT_FROM_PARSER);
   if (!mButtonContent)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // make someone to listen to the button. If its pressed by someone like Accessibility
@@ -1260,17 +1260,17 @@ nsComboboxControlFrame::SetInitialChildL
 {
   nsresult rv = NS_OK;
   if (nsGkAtoms::selectPopupList == aListName) {
     mPopupFrames.SetFrames(aChildList);
   } else {
     for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
       nsCOMPtr<nsIFormControl> formControl =
         do_QueryInterface(e.get()->GetContent());
-      if (formControl && formControl->GetType() == NS_FORM_INPUT_BUTTON) {
+      if (formControl && formControl->GetType() == NS_FORM_BUTTON_BUTTON) {
         mButtonFrame = e.get();
         break;
       }
     }
     NS_ASSERTION(mButtonFrame, "missing button frame in initial child list");
     rv = nsBlockFrame::SetInitialChildList(aListName, aChildList);
   }
   return rv;
--- a/layout/style/forms.css
+++ b/layout/style/forms.css
@@ -244,17 +244,17 @@ select[size="1"] {
   /* Except this is not a listbox */
   background-color: -moz-Combobox;
   color: -moz-ComboboxText;
   vertical-align: baseline;
   padding: 0;
   -moz-appearance: menulist;
 }
 
-select > input[type="button"] {
+select > button {
   width: 12px;
   height: 12px;
   white-space: nowrap;
   position: static !important;
   background-image: url("arrow.gif") !important;
   background-repeat: no-repeat !important;
   background-position: center !important;
   -moz-appearance: menulist-button;
@@ -266,17 +266,17 @@ select > input[type="button"] {
   /*
     Make sure to align properly with the display frame.  Note that we
     want the baseline of the combobox to match the baseline of the
     display frame, so the dropmarker is what gets the vertical-align.
   */
   vertical-align: top !important;
 }
 
-select > input[type="button"]:active {
+select > button:active {
   background-image: url("arrowd.gif") !important;
 }
 
 select:empty {
   width: 2.5em;
 }
 
 *|*::-moz-display-comboboxcontrol-frame {
@@ -583,18 +583,18 @@ input[type="file"] > input[type="button"
   border-color: ButtonText;
 }
 
 button:disabled:active, button:disabled,
 input[type="reset"]:disabled:active,
 input[type="reset"]:disabled,
 input[type="button"]:disabled:active,
 input[type="button"]:disabled,
-select:disabled > input[type="button"],
-select:disabled > input[type="button"]:active,
+select:disabled > button,
+select:disabled > button,
 input[type="submit"]:disabled:active,
 input[type="submit"]:disabled {
   /* The sum of border-top, border-bottom, padding-top, padding-bottom
      must be the same here and for text inputs */
   padding: 0px 6px 0px 6px;
   border: 2px outset ButtonFace;
   color: GrayText;
   cursor: inherit;