PRBool disabled; nsresult rv = GetDisabled(&disabled); if (NS_FAILED(rv) || disabled) {
PRBool bDisabled; nsresult rv = GetDisabled(&bDisabled); if (NS_FAILED(rv) || bDisabled) {
nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,                                    nsEvent* aEvent,                                    nsIDOMEvent** aDOMEvent,                                    PRUint32 aFlags,                                    nsEventStatus* aEventStatus){  NS_ENSURE_ARG(aPresContext);  NS_ENSURE_ARG_POINTER(aEventStatus);  // Do not process any DOM events if the element is disabled  PRBool disabled;  nsresult rv = GetDisabled(&disabled);  if (NS_FAILED(rv) || disabled) {    return rv;  }  // Try script event handlers first  nsresult ret = mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,                                       aFlags, aEventStatus);  if ((NS_OK == ret) && (nsEventStatus_eIgnore == *aEventStatus) &&      !(aFlags & NS_EVENT_FLAG_CAPTURE)) {    switch (aEvent->message) {    case NS_MOUSE_LEFT_BUTTON_DOWN:      {        nsIEventStateManager *stateManager;        if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {          stateManager->SetContentState(this, NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS);          NS_RELEASE(stateManager);        }        *aEventStatus = nsEventStatus_eConsumeNoDefault;       }      break;    case NS_MOUSE_LEFT_BUTTON_UP:      {        nsIEventStateManager *stateManager;        nsIContent *activeLink = nsnull;        if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {          //stateManager->GetActiveLink(&activeLink);          NS_RELEASE(stateManager);        }        if (activeLink == this) {          if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {            nsAutoString href, target, disabled;            nsIURI* baseURL = nsnull;            GetBaseURL(baseURL);            GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::href, href);            GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::target, target);            GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, disabled);                         if (target.Length() == 0) {              GetBaseTarget(target);            }            mInner.TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, href, target, PR_TRUE);            NS_IF_RELEASE(baseURL);            *aEventStatus = nsEventStatus_eConsumeNoDefault;           }        }      }      break;    case NS_MOUSE_RIGHT_BUTTON_DOWN:      // XXX Bring up a contextual menu provided by the application      break;    case NS_MOUSE_ENTER:      {        nsIEventStateManager *stateManager;        if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {          stateManager->SetContentState(this, NS_EVENT_STATE_HOVER);          NS_RELEASE(stateManager);        }        *aEventStatus = nsEventStatus_eConsumeNoDefault;       }      break;      // XXX this doesn't seem to do anything yet    case NS_MOUSE_EXIT:      {        nsIEventStateManager *stateManager;        if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {          stateManager->SetContentState(nsnull, NS_EVENT_STATE_HOVER);          NS_RELEASE(stateManager);        }        *aEventStatus = nsEventStatus_eConsumeNoDefault;       }      break;    default:      break;    }  }  return ret;}