Bug 557087 (3/6) - Make layout aware of the new disabled state rule. r=dbaron a=sicking
authorMounir Lamouri <mounir.lamouri@gmail.com>
Sun, 19 Sep 2010 03:43:15 +0200
changeset 54343 a89e21dcff9a
parent 54342 b15d9c989201
child 54344 d0024dcc9731
push id15858
push usermlamouri@mozilla.com
push dateMon, 20 Sep 2010 03:35:23 +0000
treeherdermozilla-central@8b47f3cabf9f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, sicking
bugs557087
milestone2.0b7pre
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 557087 (3/6) - Make layout aware of the new disabled state rule. r=dbaron a=sicking
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/resources/content/xbl-forms.css
layout/forms/resources/skin/button.css
layout/forms/resources/skin/checkbox.css
layout/forms/resources/skin/radio.css
layout/forms/resources/skin/select-dropdown.css
layout/reftests/css-disabled/select/reftest.list
layout/reftests/css-disabled/select/select-fieldset-ref-disabled.html
layout/reftests/css-disabled/select/style.css
layout/reftests/css-enabled/select/reftest.list
layout/reftests/css-enabled/select/select-fieldset-ref-disabled.html
layout/reftests/css-invalid/select/select-fieldset-ref.html
layout/reftests/css-valid/select/select-fieldset-ref.html
layout/style/contenteditable.css
layout/style/forms.css
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -40,16 +40,17 @@
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSPseudoElements.h"
 #include "nsINameSpaceManager.h"
 #include "nsStyleSet.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
 #include "nsThemeConstants.h"
+#include "nsIEventStateManager.h"
 
 #define ACTIVE   "active"
 #define HOVER    "hover"
 #define FOCUS    "focus"
 
 nsButtonFrameRenderer::nsButtonFrameRenderer()
 {
   MOZ_COUNT_CTOR(nsButtonFrameRenderer);
@@ -81,19 +82,19 @@ nsButtonFrameRenderer::SetDisabled(PRBoo
                                   notify);
   else
     mFrame->GetContent()->UnsetAttr(kNameSpaceID_None, nsGkAtoms::disabled, notify);
 }
 
 PRBool
 nsButtonFrameRenderer::isDisabled() 
 {
-  // get the content
-  return mFrame->GetContent()->HasAttr(kNameSpaceID_None,
-                                       nsGkAtoms::disabled);
+  // NOTE: we might want to remove this method to prevent calling too often
+  // IntrinsicState().
+  return (mFrame->GetContent()->IntrinsicState() & NS_EVENT_STATE_DISABLED) != 0;
 }
 
 class nsDisplayButtonBoxShadowOuter : public nsDisplayItem {
 public:
   nsDisplayButtonBoxShadowOuter(nsDisplayListBuilder* aBuilder,
                                 nsButtonFrameRenderer* aRenderer)
     : nsDisplayItem(aBuilder, aRenderer->GetFrame()), mBFR(aRenderer) {
     MOZ_COUNT_CTOR(nsDisplayButtonBoxShadowOuter);
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -723,17 +723,18 @@ nsComboboxControlFrame::GetFrameName(nsA
 
 
 //----------------------------------------------------------------------
 // nsIComboboxControlFrame
 //----------------------------------------------------------------------
 void
 nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown) 
 {
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if (eventStates & NS_EVENT_STATE_DISABLED) {
     return;
   }
 
   if (!mDroppedDown && aDoDropDown) {
     if (mListControlFrame) {
       mListControlFrame->SyncViewWithFrame();
     }
     ShowList(aDoDropDown); // might destroy us
@@ -921,17 +922,19 @@ nsComboboxControlFrame::HandleEvent(nsPr
                                        nsGUIEvent*     aEvent,
                                        nsEventStatus*  aEventStatus)
 {
   NS_ENSURE_ARG_POINTER(aEventStatus);
 
   if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
     return NS_OK;
   }
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
+
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if (eventStates & NS_EVENT_STATE_DISABLED) {
     return NS_OK;
   }
 
   // If we have style that affects how we are selected, feed event down to
   // nsFrame::HandleEvent so that selection takes place when appropriate.
   const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
   if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
     return nsBlockFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
@@ -1377,18 +1380,18 @@ nsComboboxControlFrame::BuildDisplayList
 
   return DisplaySelectionOverlay(aBuilder, aLists.Content());
 }
 
 void nsComboboxControlFrame::PaintFocus(nsIRenderingContext& aRenderingContext,
                                         nsPoint aPt)
 {
   /* Do we need to do anything? */
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) ||
-      mFocused != this)
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if ((eventStates & NS_EVENT_STATE_DISABLED) || mFocused != this)
     return;
 
   aRenderingContext.PushState();
   nsRect clipRect = mDisplayFrame->GetRect() + aPt;
   aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
 
   // REVIEW: Why does the old code paint mDisplayFrame again? We've
   // already painted it in the children above. So clipping it here won't do
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -86,16 +86,17 @@
 #include "nsIVariant.h"
 #include "mozilla/Services.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsHTMLInputElement.h"
 #include "nsICapturePicker.h"
 #include "nsIFileURL.h"
 #include "nsDOMFile.h"
+#include "nsIEventStateManager.h"
 
 #define SYNC_TEXT 0x1
 #define SYNC_BUTTON 0x2
 #define SYNC_BOTH 0x3
 
 nsIFrame*
 NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
@@ -674,18 +675,18 @@ nsFileControlFrame::BuildDisplayList(nsD
   clipRect.width = GetOverflowRect().XMost();
   nscoord radii[8] = {0, 0, 0, 0, 0, 0, 0, 0};
   rv = OverflowClip(aBuilder, tempList, aLists, clipRect, radii);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Disabled file controls don't pass mouse events to their children, so we
   // put an invisible item in the display list above the children
   // just to catch events
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) && 
-      IsVisibleForPainting(aBuilder)) {
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if ((eventStates & NS_EVENT_STATE_DISABLED) && IsVisibleForPainting(aBuilder)) {
     rv = aLists.Content()->AppendNewToTop(
         new (aBuilder) nsDisplayEventReceiver(aBuilder, this));
     if (NS_FAILED(rv))
       return rv;
   }
 
   return DisplaySelectionOverlay(aBuilder, aLists.Content());
 }
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -83,16 +83,17 @@
 #include "nsIPrivateDOMEvent.h"
 #include "nsCSSRendering.h"
 #include "nsITheme.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMMouseMotionListener.h"
 #include "nsIDOMKeyListener.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
+#include "nsIEventStateManager.h"
 
 // Constants
 const nscoord kMaxDropDownRows          = 20; // This matches the setting for 4.x browsers
 const PRInt32 kNothingSelected          = -1;
 
 // Static members
 nsListControlFrame * nsListControlFrame::mFocused = nsnull;
 nsString * nsListControlFrame::sIncrementalString = nsnull;
@@ -1095,17 +1096,18 @@ nsListControlFrame::HandleEvent(nsPresCo
     return NS_OK;
 
   // do we have style that affects how we are selected?
   // do we have user-input style?
   const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
   if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
     return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
 
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled))
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if (eventStates & NS_EVENT_STATE_DISABLED)
     return NS_OK;
 
   return nsHTMLScrollFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
 }
 
 
 //---------------------------------------------------------
 NS_IMETHODIMP
@@ -1976,17 +1978,18 @@ nsresult
 nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
 {
   NS_ASSERTION(aMouseEvent != nsnull, "aMouseEvent is null.");
 
   UpdateInListState(aMouseEvent);
 
   mButtonDown = PR_FALSE;
 
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if (eventStates & NS_EVENT_STATE_DISABLED) {
     return NS_OK;
   }
 
   // only allow selection with the left button
   // if a right button click is on the combobox itself
   // or on the select when in listbox mode, then let the click through
   if (!IsLeftButton(aMouseEvent)) {
     if (IsInDropDownMode()) {
@@ -2185,17 +2188,18 @@ nsListControlFrame::GetIndexFromDOMEvent
 
 nsresult
 nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
 {
   NS_ASSERTION(aMouseEvent != nsnull, "aMouseEvent is null.");
 
   UpdateInListState(aMouseEvent);
 
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if (eventStates & NS_EVENT_STATE_DISABLED) {
     return NS_OK;
   }
 
   // only allow selection with the left button
   // if a right button click is on the combobox itself
   // or on the select when in listbox mode, then let the click through
   if (!IsLeftButton(aMouseEvent)) {
     if (IsInDropDownMode()) {
@@ -2491,17 +2495,18 @@ nsListControlFrame::DropDownToggleKey(ns
   }
 }
 
 nsresult
 nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
 {
   NS_ASSERTION(aKeyEvent, "keyEvent is null.");
 
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled))
+  PRInt32 eventStates = mContent->IntrinsicState();
+  if (eventStates & NS_EVENT_STATE_DISABLED)
     return NS_OK;
 
   // Start by making sure we can query for a key event
   nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_FAILURE);
 
   PRUint32 keycode = 0;
   PRUint32 charcode = 0;
--- a/layout/forms/resources/content/xbl-forms.css
+++ b/layout/forms/resources/content/xbl-forms.css
@@ -236,22 +236,22 @@ input > .anonymous-div {
   border: 0px !important;
   padding: 0px;
   margin: 0px;
   /* XXXldb I'm not sure if we really want the 'text-decoration: inherit',
      but it's needed to make 'text-decoration' "work" on text inputs. */
   text-decoration: inherit;
 }
 
-input[disabled],
-textarea[disabled],
-option[disabled],
-optgroup[disabled],
-select[disabled],
-select[disabled]::-moz-display-comboboxcontrol-frame {
+input:disabled,
+textarea:disabled,
+option:disabled,
+optgroup:disabled,
+select:disabled,
+select:disabled::-moz-display-comboboxcontrol-frame {
   color: GrayText;
   cursor: inherit; 
 }
 
 /* hidden inputs */
 input[type="hidden"] {
   display: none;
   -moz-binding: none;
@@ -264,17 +264,17 @@ input[type="image"] {
   background-color: transparent;
   cursor: pointer;
   font-family: sans-serif;
   font-size: small;
   -moz-binding: none;
   padding: 0;
 }
 
-input[type="image"][disabled] {
+input[type="image"]:disabled {
   cursor: inherit;
 }
 
 input[type="image"]:focus {
   outline: 1px dotted -moz-FieldText;
 }
 
 /* file selector */
--- a/layout/forms/resources/skin/button.css
+++ b/layout/forms/resources/skin/button.css
@@ -104,26 +104,26 @@ button:focus > xul|*.button-box,
 input[type="button"]:focus > xul|*.button-box,
 input[type="submit"]:focus > xul|*.button-box,
 input[type="reset"]:focus > xul|*.button-box {
   border: 1px dotted ThreeDDarkShadow;
 }
 
 /* .......... disabled state .......... */
 
-button[disabled="true"],
-input[type="button"][disabled="true"],
-input[type="submit"][disabled="true"],
-input[type="reset"][disabled="true"] {
+button:disabled,
+input[type="button"]:disabled,
+input[type="submit"]:disabled,
+input[type="reset"]:disabled {
   -moz-border-top-colors: transparent ThreeDHighlight ThreeDLightShadow !important;
   -moz-border-right-colors: transparent ThreeDDarkShadow ThreeDShadow !important;
   -moz-border-bottom-colors: transparent ThreeDDarkShadow ThreeDShadow !important;
   -moz-border-left-colors: transparent ThreeDHighlight ThreeDLightShadow !important;
   color: GrayText;
 }
 
-button[disabled="true"] > xul|*.button-box,
-input[type="button"][disabled="true"] > xul|*.button-box,
-input[type="submit"][disabled="true"] > xul|*.button-box,
-input[type="reset"][diasbled="true"] > xul|*.button-box {
+button:disabled > xul|*.button-box,
+input[type="button"]:disabled > xul|*.button-box,
+input[type="submit"]:disabled > xul|*.button-box,
+input[type="reset"]:disabled > xul|*.button-box {
   padding: 0px 4px 1px 3px !important;
 }
 
--- a/layout/forms/resources/skin/checkbox.css
+++ b/layout/forms/resources/skin/checkbox.css
@@ -66,22 +66,22 @@ input[type="checkbox"]:focus {
   -moz-border-top-colors: ThreeDDarkShadow ThreeDShadow;
   -moz-border-right-colors: ThreeDDarkShadow ThreeDHighlight;
   -moz-border-bottom-colors: ThreeDDarkShadow ThreeDHighlight;
   -moz-border-left-colors: ThreeDDarkShadow ThreeDShadow;
 }
 
 /* ..... disabled state ..... */
 
-input[type="checkbox"][disabled="true"] {
+input[type="checkbox"]:disabled {
   background-color: -moz-Dialog;
 }
 
 /* ..... checked state ..... */
 
 input[type="checkbox"]:checked {
   list-style-image: url("chrome://forms/skin/cbox-check.gif");
 }
 
-input[type="checkbox"][disabled="true"]:checked {
+input[type="checkbox"]:disabled:checked {
   list-style-image: url("chrome://forms/skin/cbox-check-dis.gif") !important;
 }
 
--- a/layout/forms/resources/skin/radio.css
+++ b/layout/forms/resources/skin/radio.css
@@ -39,17 +39,17 @@
   == Styles used by the XUL radio element.
   ======================================================================= */
 
 @namespace url(http://www.w3.org/1999/xhtml);
 @namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 /* ..... disabled state ..... */
 
-input[type="radio"][disabled="true"] {
+input[type="radio"]:disabled {
   background-color: -moz-Dialog;
 }
 
 /* ::::: checkmark image ::::: */
 
 input[type="radio"] {
 /*  -moz-appearance: radio; */
   margin: 1px 0px;
@@ -84,11 +84,11 @@ input[type="radio"]:focus > xul|*.input-
 }
 
 /* ..... selected state ..... */
 
 input[type="radio"]:checked > xul|*.input-radio-check-box2 {
   list-style-image: url("chrome://forms/skin/radio-check.gif");
 }
 
-input[type="radio"][disabled="true"]:checked {
+input[type="radio"]:disabled:checked {
   list-style-image: url("chrome://forms/skin/radio-check-dis.gif") !important
 }
--- a/layout/forms/resources/skin/select-dropdown.css
+++ b/layout/forms/resources/skin/select-dropdown.css
@@ -67,17 +67,17 @@ xul|*.select-dropmarker {
   -moz-box-align: center;
   -moz-box-pack: center;
   border: 2px solid;
   background-color: -moz-Dialog;
   list-style-image: url("chrome://forms/skin/arrow-dn.gif");
 }
 
 xul|*.select-dropmarker,
-select[disabled="true"]:hover:active > xul|*.select-dropmarker {
+select:disabled:hover:active > xul|*.select-dropmarker {
   -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;
   -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
   -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
   -moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;
   padding: 1px;
 }
 
 select:hover:active > xul|*.select-dropmarker {
@@ -114,22 +114,22 @@ select > option {
 }
 
 xul|*.select-menuitem > xul|*.menu-text {
   margin-left: 0px !important;
 }
 
 /* ..... disabled state ..... */
  
-select[disabled="true"] {
+select:disabled {
   background-color: -moz-Dialog;
   color: GrayText;
 }
 
-select[disabled="true"] > xul|*.select-dropmarker {
+select:disabled > xul|*.select-dropmarker {
   list-style-image: url("chrome://forms/skin/arrow-dn-dis.gif");
 }
 
 option[_moz-menuactive="true"],
 xul|*.select-menuitem[_moz-menuactive="true"] {
   background-color: Highlight;
   color: HighlightText !important;
 }
--- a/layout/reftests/css-disabled/select/reftest.list
+++ b/layout/reftests/css-disabled/select/reftest.list
@@ -1,4 +1,4 @@
 == select-fieldset-1.html select-fieldset-ref.html
-== select-fieldset-2.html select-fieldset-ref.html
-== select-fieldset-3.html select-fieldset-ref.html
+== select-fieldset-2.html select-fieldset-ref-disabled.html
+== select-fieldset-3.html select-fieldset-ref-disabled.html
 == select-fieldset-4.html select-fieldset-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-disabled/select/select-fieldset-ref-disabled.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <link rel='stylesheet' type='text/css' href='style.css'>
+  <body>
+    <fieldset class="ref">
+      <fieldset class="ref">
+        <select disabled class="ref"></select>
+      </fieldset>
+    </fieldset>
+  </body>
+</html>
--- a/layout/reftests/css-disabled/select/style.css
+++ b/layout/reftests/css-disabled/select/style.css
@@ -1,12 +1,8 @@
-select {
-  -moz-appearance: none;
-}
-
 .ref {
   background-color: green;
 }
 
 .disabled {
   background-color: red;
 }
 
--- a/layout/reftests/css-enabled/select/reftest.list
+++ b/layout/reftests/css-enabled/select/reftest.list
@@ -1,4 +1,4 @@
 == select-fieldset-1.html select-fieldset-ref.html
-== select-fieldset-2.html select-fieldset-ref.html
-== select-fieldset-3.html select-fieldset-ref.html
+== select-fieldset-2.html select-fieldset-ref-disabled.html
+== select-fieldset-3.html select-fieldset-ref-disabled.html
 == select-fieldset-4.html select-fieldset-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-enabled/select/select-fieldset-ref-disabled.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <link rel='stylesheet' type='text/css' href='style.css'>
+  <body>
+    <fieldset class="ref">
+      <fieldset class="ref">
+        <select disabled class="ref"></select>
+      </fieldset>
+    </fieldset>
+  </body>
+</html>
--- a/layout/reftests/css-invalid/select/select-fieldset-ref.html
+++ b/layout/reftests/css-invalid/select/select-fieldset-ref.html
@@ -1,10 +1,10 @@
 <!DOCTYPE html>
 <html>
   <body>
     <fieldset>
       <fieldset>
-        <select style="background-color: green;" disabled></select>
+        <select disabled style="background-color: green;"></select>
       </fieldset>
     </fieldset>
   </body>
 </html>
--- a/layout/reftests/css-valid/select/select-fieldset-ref.html
+++ b/layout/reftests/css-valid/select/select-fieldset-ref.html
@@ -1,10 +1,10 @@
 <!DOCTYPE html>
 <html>
   <body>
     <fieldset>
       <fieldset>
-        <select style="background-color: green;" disabled></select>
+        <select disabled style="background-color: green;"></select>
       </fieldset>
     </fieldset>
   </body>
 </html>
--- a/layout/style/contenteditable.css
+++ b/layout/style/contenteditable.css
@@ -94,21 +94,21 @@ a:link:-moz-read-write {
 *|*:-moz-read-write > textarea:-moz-read-only {
   -moz-user-select: all !important;
   -moz-user-input: auto !important;
   -moz-user-focus: none !important;
 }
 
 /* XXX Still need a better way of blocking other events to these widgets */
 select:-moz-read-write,
-*|*:-moz-read-write > input[disabled],
+*|*:-moz-read-write > input:disabled,
 *|*:-moz-read-write > input[type="checkbox"],
 *|*:-moz-read-write > input[type="radio"],
 *|*:-moz-read-write > input[type="file"],
-input[contenteditable="true"][disabled],
+input[contenteditable="true"]:disabled,
 input[contenteditable="true"][type="checkbox"],
 input[contenteditable="true"][type="radio"],
 input[contenteditable="true"][type="file"] {
   -moz-user-select: all !important;
   -moz-user-input: none !important;
   -moz-user-focus: none !important;
 }
 
--- a/layout/style/forms.css
+++ b/layout/style/forms.css
@@ -351,32 +351,32 @@ optgroup:before {
    * to make sure that our left border+padding matches the left
    * border+padding of a combobox so that our scrollbar will line up
    * with the dropmarker.  So set our left border to 2px.
    */
   border: 1px outset black !important;
   border-left-width: 2px ! important;
 } 
 
-input[disabled],
-textarea[disabled],
-option[disabled],
-optgroup[disabled],
-select[disabled][disabled] /* Need the attr twice to have the specificity be at
-                              least the same as select[size][multiple] above */
+input:disabled,
+textarea:disabled,
+option:disabled,
+optgroup:disabled,
+select:disabled:disabled /* Need the pseudo-class twice to have the specificity
+                            be at least the same as select[size][multiple] above */
 {
   -moz-user-input: disabled;
   -moz-user-focus: ignore;
   color: GrayText;
   background-color: ThreeDFace;
   cursor: inherit;
 }
 
-option[disabled],
-optgroup[disabled] {
+option:disabled,
+optgroup:disabled {
   background-color: transparent;
 }
 
 /* hidden inputs */
 input[type="hidden"] {
   -moz-appearance: none;
   display: none !important;
   padding: 0;
@@ -393,17 +393,17 @@ input[type="image"] {
   border: none;
   background-color: transparent;
   font-family: sans-serif;
   font-size: small;
   cursor: pointer;
   -moz-binding: none;
 }
 
-input[type="image"][disabled] {
+input[type="image"]:disabled {
   cursor: inherit;
 }
 
 input[type="image"]:-moz-focusring {
   /* Don't specify the outline-color, we should always use initial value. */
   outline: 1px dotted;
 }
 
@@ -464,24 +464,24 @@ input[type="checkbox"] {
   padding: 0 !important;
   -moz-binding: none;
   /* same colors as |input| rule, but |!important| this time. */
   background-color: -moz-Field ! important;
   color: -moz-FieldText ! important;
   border: 2px inset ThreeDFace ! important;
 }
 
-input[type="radio"][disabled],
-input[type="radio"][disabled]:active,
-input[type="radio"][disabled]:hover,
-input[type="radio"][disabled]:hover:active,
-input[type="checkbox"][disabled],
-input[type="checkbox"][disabled]:active,
-input[type="checkbox"][disabled]:hover,
-input[type="checkbox"][disabled]:hover:active {
+input[type="radio"]:disabled,
+input[type="radio"]:disabled:active,
+input[type="radio"]:disabled:hover,
+input[type="radio"]:disabled:hover:active,
+input[type="checkbox"]:disabled,
+input[type="checkbox"]:disabled:active,
+input[type="checkbox"]:disabled:hover,
+input[type="checkbox"]:disabled:hover:active {
   padding: 1px;
   border: 1px inset ThreeDShadow ! important;
   /* same as above, but !important */
   color: GrayText ! important;
   background-color: ThreeDFace ! important;
   cursor: inherit; 
 }
 
@@ -564,25 +564,25 @@ input[type="file"] > input[type="button"
 button:-moz-focusring::-moz-focus-inner,
 input[type="reset"]:-moz-focusring::-moz-focus-inner,
 input[type="button"]:-moz-focusring::-moz-focus-inner,
 input[type="submit"]:-moz-focusring::-moz-focus-inner,
 input[type="file"] > input[type="button"]:-moz-focusring::-moz-focus-inner {
   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,
-input[type="submit"][disabled]:active,
-input[type="submit"][disabled] {
+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,
+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; 
 }