- Implement the :checked CSS pseudoclass which maps to the "selected" property on option elements.

- Eliminate the _moz-option-selected attribute; move the actual selected state into the option content node.
- Change all users of _moz-option-selected to use :checked.
- Add a third parameter to nsIDocument[Observer]::ContentStatesChanged to indicate which pseudoclass changed, this is used for optimizing handling of :checked state changes.

Bug 128947, r=dbaron, sr=jst, a=asa.


git-svn-id: svn://10.0.0.236/trunk@116029 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%netscape.com
2002-03-07 03:34:29 +00:00
parent d575f67e84
commit 01634657fa
58 changed files with 334 additions and 208 deletions

View File

@@ -70,6 +70,7 @@
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h"
@@ -3232,6 +3233,7 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
mIsHTMLContent = PR_FALSE;
mIsHTMLLink = PR_FALSE;
mIsSimpleXLink = PR_FALSE;
mIsChecked = PR_FALSE;
mLinkState = eLinkState_Unknown;
mEventState = NS_EVENT_STATE_UNSPECIFIED;
mNameSpaceID = kNameSpaceID_Unknown;
@@ -3299,6 +3301,15 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
nsStyleUtil::IsSimpleXlink(aContent, mPresContext, &mLinkState)) {
mIsSimpleXLink = PR_TRUE;
}
if (mIsHTMLContent) {
PRBool isChecked = PR_FALSE;
if (mContentTag == nsHTMLAtoms::option) {
nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(mContent);
optEl->GetSelected(&isChecked);
}
mIsChecked = isChecked;
}
}
}
@@ -3590,6 +3601,14 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse; // not a link
}
}
else if (nsCSSAtoms::checkedPseudo == pseudoClass->mAtom) {
// This pseudoclass matches the selected state on the following elements:
// <option>
// <input type=checkbox>
// <input type=radio>
if (aTestState)
result = data.mIsChecked ? localTrue : localFalse;
}
else {
result = localFalse; // unknown pseudo class
}