- 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.
This commit is contained in:
bryner%netscape.com 2002-03-07 03:34:29 +00:00
parent fefe11a9c3
commit d2229cbf68
58 changed files with 334 additions and 208 deletions

View File

@ -318,7 +318,8 @@ public:
// notify that one or two content nodes changed state // notify that one or two content nodes changed state
// either may be nsnull, but not both // either may be nsnull, but not both
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1, NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2) = 0; nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) = 0;
NS_IMETHOD AttributeWillChange(nsIContent* aChild, NS_IMETHOD AttributeWillChange(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute) = 0; nsIAtom* aAttribute) = 0;

View File

@ -138,7 +138,8 @@ public:
*/ */
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) = 0; nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) = 0;
/** /**
* Notification that the content model has changed. This method is called * Notification that the content model has changed. This method is called

View File

@ -90,9 +90,10 @@ struct RuleProcessorData {
PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false
PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink
PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
PRPackedBool mIsQuirkMode; // Possibly remove use of this in SelectorMatches? PRPackedBool mIsQuirkMode; // Possibly remove use of this in SelectorMatches?
PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0 PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0
PRPackedBool mIsChecked; // checked/selected attribute for option and select elements
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
PRInt32 mEventState; // if content, eventStateMgr->GetContentState() PRInt32 mEventState; // if content, eventStateMgr->GetContentState()
PRInt32 mNameSpaceID; // if content, content->GetNameSapce() PRInt32 mNameSpaceID; // if content, content->GetNameSapce()
RuleProcessorData* mPreviousSiblingData; RuleProcessorData* mPreviousSiblingData;

View File

@ -138,7 +138,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -1847,14 +1847,15 @@ nsDocument::ContentChanged(nsIContent* aContent,
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::ContentStatesChanged(nsIContent* aContent1, nsDocument::ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
PRInt32 i; PRInt32 i;
// Get new value of count for every iteration in case // Get new value of count for every iteration in case
// observers remove themselves during the loop. // observers remove themselves during the loop.
for (i = 0; i < mObservers.Count(); i++) { for (i = 0; i < mObservers.Count(); i++) {
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
observer->ContentStatesChanged(this, aContent1, aContent2); observer->ContentStatesChanged(this, aContent1, aContent2, aChangedPseudoClass);
// Make sure that the observer didn't remove itself during the // Make sure that the observer didn't remove itself during the
// notification. If it did, update our index and count. // notification. If it did, update our index and count.
if (i < mObservers.Count() && if (i < mObservers.Count() &&

View File

@ -162,7 +162,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
@ -452,7 +453,8 @@ public:
NS_IMETHOD ContentChanged(nsIContent* aContent, NS_IMETHOD ContentChanged(nsIContent* aContent,
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1, NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeWillChange(nsIContent* aChild, NS_IMETHOD AttributeWillChange(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -206,7 +206,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
@ -1476,9 +1477,11 @@ StyleSetImpl::ContentChanged(nsIPresContext* aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
StyleSetImpl::ContentStatesChanged(nsIPresContext* aPresContext, StyleSetImpl::ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
return mFrameConstructor->ContentStatesChanged(aPresContext, aContent1, aContent2); return mFrameConstructor->ContentStatesChanged(aPresContext, aContent1, aContent2,
aChangedPseudoClass);
} }

View File

@ -110,6 +110,7 @@
#include "nsLayoutCID.h" #include "nsLayoutCID.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
#include "nsCSSAtoms.h"
#if defined(DEBUG_rods) || defined(DEBUG_bryner) #if defined(DEBUG_rods) || defined(DEBUG_bryner)
//#define DEBUG_DOCSHELL_FOCUS //#define DEBUG_DOCSHELL_FOCUS
@ -3528,16 +3529,16 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
if (newHover) { if (newHover) {
nsCOMPtr<nsIContent> parent; nsCOMPtr<nsIContent> parent;
newHover->GetParent(*getter_AddRefs(parent)); newHover->GetParent(*getter_AddRefs(parent));
doc1->ContentStatesChanged(newHover, parent); doc1->ContentStatesChanged(newHover, parent, nsCSSAtoms::hoverPseudo);
while (parent && parent != commonHoverParent) { while (parent && parent != commonHoverParent) {
parent->GetParent(*getter_AddRefs(newHover)); parent->GetParent(*getter_AddRefs(newHover));
if (newHover && newHover != commonHoverParent) { if (newHover && newHover != commonHoverParent) {
newHover->GetParent(*getter_AddRefs(parent)); newHover->GetParent(*getter_AddRefs(parent));
if (parent == commonHoverParent) { if (parent == commonHoverParent) {
doc1->ContentStatesChanged(newHover, nsnull); doc1->ContentStatesChanged(newHover, nsnull, nsCSSAtoms::hoverPseudo);
} }
else { else {
doc1->ContentStatesChanged(newHover, parent); doc1->ContentStatesChanged(newHover, parent, nsCSSAtoms::hoverPseudo);
} }
} }
else { else {
@ -3549,16 +3550,16 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
if (oldHover) { if (oldHover) {
nsCOMPtr<nsIContent> parent; nsCOMPtr<nsIContent> parent;
oldHover->GetParent(*getter_AddRefs(parent)); oldHover->GetParent(*getter_AddRefs(parent));
doc1->ContentStatesChanged(oldHover, parent); doc1->ContentStatesChanged(oldHover, parent, nsCSSAtoms::hoverPseudo);
while (parent && parent != commonHoverParent) { while (parent && parent != commonHoverParent) {
parent->GetParent(*getter_AddRefs(oldHover)); parent->GetParent(*getter_AddRefs(oldHover));
if (oldHover && oldHover != commonHoverParent) { if (oldHover && oldHover != commonHoverParent) {
oldHover->GetParent(*getter_AddRefs(parent)); oldHover->GetParent(*getter_AddRefs(parent));
if (parent == commonHoverParent) { if (parent == commonHoverParent) {
doc1->ContentStatesChanged(oldHover, nsnull); doc1->ContentStatesChanged(oldHover, nsnull, nsCSSAtoms::hoverPseudo);
} }
else { else {
doc1->ContentStatesChanged(oldHover, parent); doc1->ContentStatesChanged(oldHover, parent, nsCSSAtoms::hoverPseudo);
} }
} }
else { else {
@ -3567,23 +3568,23 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
} }
} }
doc1->ContentStatesChanged(notifyContent[0], notifyContent[1]); doc1->ContentStatesChanged(notifyContent[0], notifyContent[1], nsnull);
if (notifyContent[2]) { // more that two notifications are needed (should be rare) if (notifyContent[2]) { // more that two notifications are needed (should be rare)
// XXX a further optimization here would be to group the notification pairs // XXX a further optimization here would be to group the notification pairs
// together by parent/child, only needed if more than two content changed // together by parent/child, only needed if more than two content changed
// (ie: if [0] and [2] are parent/child, then notify (0,2) (1,3)) // (ie: if [0] and [2] are parent/child, then notify (0,2) (1,3))
doc1->ContentStatesChanged(notifyContent[2], notifyContent[3]); doc1->ContentStatesChanged(notifyContent[2], notifyContent[3], nsnull);
if (notifyContent[4]) { // more that two notifications are needed (should be rare) if (notifyContent[4]) { // more that two notifications are needed (should be rare)
doc1->ContentStatesChanged(notifyContent[4], nsnull); doc1->ContentStatesChanged(notifyContent[4], nsnull, nsnull);
} }
} }
doc1->EndUpdate(); doc1->EndUpdate();
if (doc2) { if (doc2) {
doc2->BeginUpdate(); doc2->BeginUpdate();
doc2->ContentStatesChanged(notifyContent[1], notifyContent[2]); doc2->ContentStatesChanged(notifyContent[1], notifyContent[2], nsnull);
if (notifyContent[3]) { if (notifyContent[3]) {
doc1->ContentStatesChanged(notifyContent[3], notifyContent[4]); doc1->ContentStatesChanged(notifyContent[3], notifyContent[4], nsnull);
} }
doc2->EndUpdate(); doc2->EndUpdate();
} }

View File

@ -60,13 +60,6 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOPTIONELEMENT_IID) NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOPTIONELEMENT_IID)
/**
* Check whether the option element is selected from its own point
* of view. This should only be used by SelectElement, really.
* Everyone else is safe using GetSelected() on the DOMHTMLOptionElement.
*/
NS_IMETHOD GetSelectedInternal(PRBool* aValue) = 0;
/** /**
* Check whether the option element is selected from its own point * Check whether the option element is selected from its own point
* of view. This should only be used by SelectElement, really. * of view. This should only be used by SelectElement, really.

View File

@ -68,7 +68,7 @@
#include "nsNodeInfoManager.h" #include "nsNodeInfoManager.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsLayoutAtoms.h" #include "nsLayoutAtoms.h"
#include "nsCSSAtoms.h"
class nsHTMLOptionElement : public nsGenericHTMLContainerElement, class nsHTMLOptionElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLOptionElement, public nsIDOMHTMLOptionElement,
@ -108,7 +108,6 @@ public:
#endif #endif
// nsIOptionElement // nsIOptionElement
NS_IMETHOD GetSelectedInternal(PRBool* aValue);
NS_IMETHOD SetSelectedInternal(PRBool aValue, PRBool aNotify); NS_IMETHOD SetSelectedInternal(PRBool aValue, PRBool aNotify);
NS_IMETHOD GetValueOrText(nsAString& aValue); NS_IMETHOD GetValueOrText(nsAString& aValue);
@ -121,7 +120,8 @@ protected:
// there's a select associated with this option or not. // there's a select associated with this option or not.
void GetSelect(nsIDOMHTMLSelectElement **aSelectElement) const; void GetSelect(nsIDOMHTMLSelectElement **aSelectElement) const;
PRBool mIsInitialized; PRPackedBool mIsInitialized;
PRPackedBool mIsSelected;
}; };
nsresult nsresult
@ -170,8 +170,9 @@ NS_NewHTMLOptionElement(nsIHTMLContent** aInstancePtrResult,
nsHTMLOptionElement::nsHTMLOptionElement() nsHTMLOptionElement::nsHTMLOptionElement()
: mIsInitialized(PR_FALSE),
mIsSelected(PR_FALSE)
{ {
mIsInitialized = PR_FALSE;
} }
nsHTMLOptionElement::~nsHTMLOptionElement() nsHTMLOptionElement::~nsHTMLOptionElement()
@ -241,43 +242,16 @@ nsHTMLOptionElement::GetForm(nsIDOMHTMLFormElement** aForm)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsHTMLOptionElement::GetSelectedInternal(PRBool* aValue)
{
// If it's not initialized, initialize it.
if (!mIsInitialized) {
mIsInitialized = PR_TRUE;
PRBool selected;
GetDefaultSelected(&selected);
// This does not need to be SetSelected (which sets selected in the select)
// because we *will* be initialized when we are placed into a select. Plus
// it seems like that's just inviting an infinite loop.
SetSelectedInternal(selected, PR_TRUE);
}
nsAutoString tmpVal;
nsresult rv = GetAttr(kNameSpaceID_None,
nsLayoutAtoms::optionSelectedPseudo,
tmpVal);
*aValue = !(NS_FAILED(rv) || NS_CONTENT_ATTR_NOT_THERE == rv);
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLOptionElement::SetSelectedInternal(PRBool aValue, PRBool aNotify) nsHTMLOptionElement::SetSelectedInternal(PRBool aValue, PRBool aNotify)
{ {
mIsInitialized = PR_TRUE; mIsInitialized = PR_TRUE;
mIsSelected = aValue;
// This affects the display, but what the hey, it's a good place for it if (aNotify && mDocument)
if (aValue) { mDocument->ContentStatesChanged(this, nsnull, nsCSSAtoms::checkedPseudo);
return SetAttr(kNameSpaceID_None,
nsLayoutAtoms::optionSelectedPseudo, return NS_OK;
NS_LITERAL_STRING(""),
aNotify);
} else {
return UnsetAttr(kNameSpaceID_None,
nsLayoutAtoms::optionSelectedPseudo,
aNotify);
}
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -309,8 +283,19 @@ nsHTMLOptionElement::GetSelected(PRBool* aValue)
NS_ENSURE_ARG_POINTER(aValue); NS_ENSURE_ARG_POINTER(aValue);
*aValue = PR_FALSE; *aValue = PR_FALSE;
// If there is no select element, return the selected // If it's not initialized, initialize it.
return GetSelectedInternal(aValue); if (!mIsInitialized) {
mIsInitialized = PR_TRUE;
PRBool selected;
GetDefaultSelected(&selected);
// This does not need to be SetSelected (which sets selected in the select)
// because we *will* be initialized when we are placed into a select. Plus
// it seems like that's just inviting an infinite loop.
SetSelectedInternal(selected, PR_TRUE);
}
*aValue = mIsSelected;
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -438,7 +438,7 @@ nsHTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
// Actually select the options if the added options warrant it // Actually select the options if the added options warrant it
nsCOMPtr<nsIDOMNode> optionNode; nsCOMPtr<nsIDOMNode> optionNode;
nsCOMPtr<nsIOptionElement> option; nsCOMPtr<nsIDOMHTMLOptionElement> option;
for (PRInt32 i=aListIndex;i<insertIndex;i++) { for (PRInt32 i=aListIndex;i<insertIndex;i++) {
// Notify the frame that the option is added // Notify the frame that the option is added
if (selectFrame) { if (selectFrame) {
@ -449,7 +449,7 @@ nsHTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
option = do_QueryInterface(optionNode); option = do_QueryInterface(optionNode);
if (option) { if (option) {
PRBool selected; PRBool selected;
option->GetSelectedInternal(&selected); option->GetSelected(&selected);
if (selected) { if (selected) {
// Clear all other options // Clear all other options
PRBool isMultiple; PRBool isMultiple;

View File

@ -290,7 +290,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -70,6 +70,7 @@
#include "nsIDOMHTMLAnchorElement.h" #include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLLinkElement.h" #include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLAreaElement.h" #include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMStyleSheetList.h" #include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h" #include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h" #include "nsIDOMCSSStyleRule.h"
@ -3232,6 +3233,7 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
mIsHTMLContent = PR_FALSE; mIsHTMLContent = PR_FALSE;
mIsHTMLLink = PR_FALSE; mIsHTMLLink = PR_FALSE;
mIsSimpleXLink = PR_FALSE; mIsSimpleXLink = PR_FALSE;
mIsChecked = PR_FALSE;
mLinkState = eLinkState_Unknown; mLinkState = eLinkState_Unknown;
mEventState = NS_EVENT_STATE_UNSPECIFIED; mEventState = NS_EVENT_STATE_UNSPECIFIED;
mNameSpaceID = kNameSpaceID_Unknown; mNameSpaceID = kNameSpaceID_Unknown;
@ -3299,6 +3301,15 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
nsStyleUtil::IsSimpleXlink(aContent, mPresContext, &mLinkState)) { nsStyleUtil::IsSimpleXlink(aContent, mPresContext, &mLinkState)) {
mIsSimpleXLink = PR_TRUE; 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 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 { else {
result = localFalse; // unknown pseudo class result = localFalse; // unknown pseudo class
} }

View File

@ -87,7 +87,6 @@ LAYOUT_ATOM(popupList, "Popup-list")
LAYOUT_ATOM(canvasPseudo, ":canvas") LAYOUT_ATOM(canvasPseudo, ":canvas")
LAYOUT_ATOM(commentTagName, "__moz_comment") LAYOUT_ATOM(commentTagName, "__moz_comment")
LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option") LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option")
LAYOUT_ATOM(optionSelectedPseudo, "_moz-option-selected")
LAYOUT_ATOM(textTagName, "__moz_text") LAYOUT_ATOM(textTagName, "__moz_text")
LAYOUT_ATOM(pagePseudo, ":-moz-page") LAYOUT_ATOM(pagePseudo, ":-moz-page")
LAYOUT_ATOM(pageContentPseudo, ":-moz-pagecontent") LAYOUT_ATOM(pageContentPseudo, ":-moz-pagecontent")

View File

@ -304,7 +304,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument* aDocument, NS_IMETHOD AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -1933,11 +1933,13 @@ nsXULDocument::ContentChanged(nsIContent* aContent,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsXULDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2) nsXULDocument::ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) {
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
observer->ContentStatesChanged(this, aContent1, aContent2); observer->ContentStatesChanged(this, aContent1, aContent2, aChangedPseudoClass);
} }
return NS_OK; return NS_OK;
} }

View File

@ -278,7 +278,9 @@ public:
NS_IMETHOD ContentChanged(nsIContent* aContent, NS_IMETHOD ContentChanged(nsIContent* aContent,
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2); NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIContent* aChild, NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -337,7 +337,8 @@ nsXULTemplateBuilder::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
nsXULTemplateBuilder::ContentStatesChanged(nsIDocument* aDocument, nsXULTemplateBuilder::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -115,7 +115,8 @@ public:
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,

View File

@ -91,7 +91,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; } NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; } NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; } NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }

View File

@ -10064,7 +10064,8 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
NS_IMETHODIMP NS_IMETHODIMP
nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext, nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
nsresult result = NS_OK; nsresult result = NS_OK;

View File

@ -122,7 +122,8 @@ public:
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aContent, nsIContent* aContent,

View File

@ -87,7 +87,6 @@ LAYOUT_ATOM(popupList, "Popup-list")
LAYOUT_ATOM(canvasPseudo, ":canvas") LAYOUT_ATOM(canvasPseudo, ":canvas")
LAYOUT_ATOM(commentTagName, "__moz_comment") LAYOUT_ATOM(commentTagName, "__moz_comment")
LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option") LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option")
LAYOUT_ATOM(optionSelectedPseudo, "_moz-option-selected")
LAYOUT_ATOM(textTagName, "__moz_text") LAYOUT_ATOM(textTagName, "__moz_text")
LAYOUT_ATOM(pagePseudo, ":-moz-page") LAYOUT_ATOM(pagePseudo, ":-moz-page")
LAYOUT_ATOM(pageContentPseudo, ":-moz-pagecontent") LAYOUT_ATOM(pageContentPseudo, ":-moz-pagecontent")

View File

@ -1028,7 +1028,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
@ -5095,10 +5096,12 @@ PresShell::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
PresShell::ContentStatesChanged(nsIDocument* aDocument, PresShell::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
WillCauseReflow(); WillCauseReflow();
nsresult rv = mStyleSet->ContentStatesChanged(mPresContext, aContent1, aContent2); nsresult rv = mStyleSet->ContentStatesChanged(mPresContext, aContent1, aContent2,
aChangedPseudoClass);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
DidCauseReflow(); DidCauseReflow();

View File

@ -202,7 +202,8 @@ public:
*/ */
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) = 0; nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) = 0;
/** /**
* Notification that an attribute was changed for a content node * Notification that an attribute was changed for a content node

View File

@ -229,7 +229,8 @@ public:
nsISupports* aSubContent) = 0; nsISupports* aSubContent) = 0;
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) = 0; nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) = 0;
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -93,11 +93,7 @@ const PRInt32 kNothingSelected = -1;
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32 const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
const PRInt32 kNoSizeSpecified = -1; const PRInt32 kNoSizeSpecified = -1;
//XXX: This is temporary. It simulates psuedo states by using a attribute selector on // We now use the :checked pseudoclass for the option selected state
// -moz-option-selected in the ua.css style sheet. This will not be needed when
//The event state manager is functional. KMM
//const char * kMozSelected = "-moz-option-selected";
// it is now using "nsLayoutAtoms::optionSelectedPseudo"
//--------------------------------------------------------- //---------------------------------------------------------
nsresult nsresult
@ -1678,11 +1674,13 @@ nsListControlFrame::GetOption(nsIDOMHTMLCollection& aCollection, PRInt32 aIndex)
PRBool PRBool
nsListControlFrame::IsContentSelected(nsIContent* aContent) nsListControlFrame::IsContentSelected(nsIContent* aContent)
{ {
nsAutoString value; PRBool isSelected = PR_FALSE;
//nsIAtom * selectedAtom = NS_NewAtom("selected");
nsresult result = aContent->GetAttr(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, value);
return (NS_CONTENT_ATTR_NOT_THERE == result ? PR_FALSE : PR_TRUE); nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(aContent);
if (optEl)
optEl->GetSelected(&isSelected);
return isSelected;
} }

View File

@ -104,7 +104,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -1116,7 +1116,8 @@ nsImageMap::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
nsImageMap::ContentStatesChanged(nsIDocument* aDocument, nsImageMap::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -108,7 +108,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -104,7 +104,8 @@ public:
nsISupports* aSubContent) { return NS_OK; } nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) { return NS_OK; } nsIContent* aContent2,
nsIAtom* aChangedPseudoClass) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -1116,7 +1116,8 @@ nsImageMap::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
nsImageMap::ContentStatesChanged(nsIDocument* aDocument, nsImageMap::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -108,7 +108,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -1028,7 +1028,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
@ -5095,10 +5096,12 @@ PresShell::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
PresShell::ContentStatesChanged(nsIDocument* aDocument, PresShell::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
WillCauseReflow(); WillCauseReflow();
nsresult rv = mStyleSet->ContentStatesChanged(mPresContext, aContent1, aContent2); nsresult rv = mStyleSet->ContentStatesChanged(mPresContext, aContent1, aContent2,
aChangedPseudoClass);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
DidCauseReflow(); DidCauseReflow();

View File

@ -181,7 +181,7 @@ select > option {
padding: 0 5px 0 3px; padding: 0 5px 0 3px;
} }
option[_moz-option-selected] { option:checked {
color: HighlightText ! important; color: HighlightText ! important;
background-color: Highlight ! important; background-color: Highlight ! important;
} }

View File

@ -93,11 +93,7 @@ const PRInt32 kNothingSelected = -1;
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32 const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
const PRInt32 kNoSizeSpecified = -1; const PRInt32 kNoSizeSpecified = -1;
//XXX: This is temporary. It simulates psuedo states by using a attribute selector on // We now use the :checked pseudoclass for the option selected state
// -moz-option-selected in the ua.css style sheet. This will not be needed when
//The event state manager is functional. KMM
//const char * kMozSelected = "-moz-option-selected";
// it is now using "nsLayoutAtoms::optionSelectedPseudo"
//--------------------------------------------------------- //---------------------------------------------------------
nsresult nsresult
@ -1678,11 +1674,13 @@ nsListControlFrame::GetOption(nsIDOMHTMLCollection& aCollection, PRInt32 aIndex)
PRBool PRBool
nsListControlFrame::IsContentSelected(nsIContent* aContent) nsListControlFrame::IsContentSelected(nsIContent* aContent)
{ {
nsAutoString value; PRBool isSelected = PR_FALSE;
//nsIAtom * selectedAtom = NS_NewAtom("selected");
nsresult result = aContent->GetAttr(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, value);
return (NS_CONTENT_ATTR_NOT_THERE == result ? PR_FALSE : PR_TRUE); nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(aContent);
if (optEl)
optEl->GetSelected(&isSelected);
return isSelected;
} }

View File

@ -10064,7 +10064,8 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
NS_IMETHODIMP NS_IMETHODIMP
nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext, nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
nsresult result = NS_OK; nsresult result = NS_OK;

View File

@ -122,7 +122,8 @@ public:
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aContent, nsIContent* aContent,

View File

@ -181,7 +181,7 @@ select > option {
padding: 0 5px 0 3px; padding: 0 5px 0 3px;
} }
option[_moz-option-selected] { option:checked {
color: HighlightText ! important; color: HighlightText ! important;
background-color: Highlight ! important; background-color: Highlight ! important;
} }

View File

@ -70,6 +70,7 @@
#include "nsIDOMHTMLAnchorElement.h" #include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLLinkElement.h" #include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLAreaElement.h" #include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMStyleSheetList.h" #include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h" #include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSStyleRule.h" #include "nsIDOMCSSStyleRule.h"
@ -3232,6 +3233,7 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
mIsHTMLContent = PR_FALSE; mIsHTMLContent = PR_FALSE;
mIsHTMLLink = PR_FALSE; mIsHTMLLink = PR_FALSE;
mIsSimpleXLink = PR_FALSE; mIsSimpleXLink = PR_FALSE;
mIsChecked = PR_FALSE;
mLinkState = eLinkState_Unknown; mLinkState = eLinkState_Unknown;
mEventState = NS_EVENT_STATE_UNSPECIFIED; mEventState = NS_EVENT_STATE_UNSPECIFIED;
mNameSpaceID = kNameSpaceID_Unknown; mNameSpaceID = kNameSpaceID_Unknown;
@ -3299,6 +3301,15 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
nsStyleUtil::IsSimpleXlink(aContent, mPresContext, &mLinkState)) { nsStyleUtil::IsSimpleXlink(aContent, mPresContext, &mLinkState)) {
mIsSimpleXLink = PR_TRUE; 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 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 { else {
result = localFalse; // unknown pseudo class result = localFalse; // unknown pseudo class
} }

View File

@ -90,9 +90,10 @@ struct RuleProcessorData {
PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false
PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink
PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
PRPackedBool mIsQuirkMode; // Possibly remove use of this in SelectorMatches? PRPackedBool mIsQuirkMode; // Possibly remove use of this in SelectorMatches?
PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0 PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0
PRPackedBool mIsChecked; // checked/selected attribute for option and select elements
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
PRInt32 mEventState; // if content, eventStateMgr->GetContentState() PRInt32 mEventState; // if content, eventStateMgr->GetContentState()
PRInt32 mNameSpaceID; // if content, content->GetNameSapce() PRInt32 mNameSpaceID; // if content, content->GetNameSapce()
RuleProcessorData* mPreviousSiblingData; RuleProcessorData* mPreviousSiblingData;

View File

@ -206,7 +206,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
@ -1476,9 +1477,11 @@ StyleSetImpl::ContentChanged(nsIPresContext* aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
StyleSetImpl::ContentStatesChanged(nsIPresContext* aPresContext, StyleSetImpl::ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
return mFrameConstructor->ContentStatesChanged(aPresContext, aContent1, aContent2); return mFrameConstructor->ContentStatesChanged(aPresContext, aContent1, aContent2,
aChangedPseudoClass);
} }

View File

@ -41,6 +41,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsHTMLAtoms.h" #include "nsHTMLAtoms.h"
#include "nsXULAtoms.h" #include "nsXULAtoms.h"
#include "nsCSSAtoms.h"
#include "nsLayoutAtoms.h" #include "nsLayoutAtoms.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIBoxObject.h" #include "nsIBoxObject.h"
@ -221,8 +222,13 @@ nsOutlinerContentView::SetSelection(nsIOutlinerSelection* aSelection)
mSelection->SetSelectEventsSuppressed(PR_TRUE); mSelection->SetSelectEventsSuppressed(PR_TRUE);
for (PRInt32 i = 0; i < mRows.Count(); ++i) { for (PRInt32 i = 0; i < mRows.Count(); ++i) {
Row* row = (Row*)mRows[i]; Row* row = (Row*)mRows[i];
if (row->mContent->HasAttr(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo)) nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(row->mContent);
mSelection->ToggleSelect(i); if (optEl) {
PRBool isSelected;
optEl->GetSelected(&isSelected);
if (isSelected)
mSelection->ToggleSelect(i);
}
} }
mSelection->SetSelectEventsSuppressed(PR_FALSE); mSelection->SetSelectEventsSuppressed(PR_FALSE);
} }
@ -648,8 +654,22 @@ nsOutlinerContentView::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
nsOutlinerContentView::ContentStatesChanged(nsIDocument* aDocument, nsOutlinerContentView::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
if (!aContent1 || !mSelection || !aContent1->IsContentOfType(nsIContent::eHTML) ||
aChangedPseudoClass != nsCSSAtoms::checkedPseudo)
return NS_OK;
nsCOMPtr<nsIAtom> contentTag;
aContent1->GetTag(*getter_AddRefs(contentTag));
if (contentTag == nsHTMLAtoms::option) {
// update the selected state for this node
PRInt32 index = FindContent(aContent1);
if (index >= 0)
mSelection->ToggleSelect(index);
}
return NS_OK; return NS_OK;
} }
@ -663,6 +683,10 @@ nsOutlinerContentView::AttributeChanged(nsIDocument *aDocument,
{ {
// First, get the element on which the attribute has changed // First, get the element on which the attribute has changed
// and then try to find content item in our array of rows. // and then try to find content item in our array of rows.
if (!aContent->IsContentOfType(nsIContent::eXUL))
return NS_OK;
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
aContent->GetTag(*getter_AddRefs(tag)); aContent->GetTag(*getter_AddRefs(tag));
@ -734,16 +758,6 @@ nsOutlinerContentView::AttributeChanged(nsIDocument *aDocument,
} }
} }
} }
else if (tag == nsHTMLAtoms::option) {
if (aAttribute == nsLayoutAtoms::optionSelectedPseudo) {
PRInt32 index = FindContent(aContent);
if (index >= 0) {
NS_ASSERTION(mSelection, "Need to handle optionSelected change with no OutlinerSelection");
if (mSelection)
mSelection->ToggleSelect(index);
}
}
}
return NS_OK; return NS_OK;
} }
@ -771,12 +785,17 @@ nsOutlinerContentView::ContentInserted(nsIDocument *aDocument,
nsCOMPtr<nsIAtom> childTag; nsCOMPtr<nsIAtom> childTag;
aChild->GetTag(*getter_AddRefs(childTag)); aChild->GetTag(*getter_AddRefs(childTag));
if ((childTag != nsXULAtoms::outlineritem) && if (aChild->IsContentOfType(nsIContent::eHTML)) {
(childTag != nsXULAtoms::outlinerseparator) && if (childTag != nsHTMLAtoms::option)
(childTag != nsHTMLAtoms::option) && return NS_OK;
(childTag != nsXULAtoms::outlinerchildren) && } else if (aChild->IsContentOfType(nsIContent::eXUL)) {
(childTag != nsXULAtoms::outlinerrow) && if (childTag != nsXULAtoms::outlineritem &&
(childTag != nsXULAtoms::outlinercell)) childTag != nsXULAtoms::outlinerseparator &&
childTag != nsXULAtoms::outlinerchildren &&
childTag != nsXULAtoms::outlinerrow &&
childTag != nsXULAtoms::outlinercell)
return NS_OK;
} else
return NS_OK; return NS_OK;
// If we have a legal tag, go up to the outliner/select and make sure // If we have a legal tag, go up to the outliner/select and make sure
@ -786,7 +805,8 @@ nsOutlinerContentView::ContentInserted(nsIDocument *aDocument,
while (element) { while (element) {
element->GetTag(*getter_AddRefs(parentTag)); element->GetTag(*getter_AddRefs(parentTag));
if (parentTag == nsXULAtoms::outliner || parentTag == nsHTMLAtoms::select) if ((element->IsContentOfType(nsIContent::eXUL) && parentTag == nsXULAtoms::outliner) ||
(element->IsContentOfType(nsIContent::eHTML) && parentTag == nsHTMLAtoms::select))
if (element == mRoot) // this is for us, stop looking if (element == mRoot) // this is for us, stop looking
break; break;
else // this is not for us, we can bail out else // this is not for us, we can bail out
@ -874,12 +894,17 @@ nsOutlinerContentView::ContentRemoved(nsIDocument *aDocument,
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
aChild->GetTag(*getter_AddRefs(tag)); aChild->GetTag(*getter_AddRefs(tag));
if ((tag != nsXULAtoms::outlineritem) && if (aChild->IsContentOfType(nsIContent::eHTML)) {
(tag != nsXULAtoms::outlinerseparator) && if (tag != nsHTMLAtoms::option)
(tag != nsHTMLAtoms::option) && return NS_OK;
(tag != nsXULAtoms::outlinerchildren) && } else if (aChild->IsContentOfType(nsIContent::eXUL)) {
(tag != nsXULAtoms::outlinerrow) && if (tag != nsXULAtoms::outlineritem &&
(tag != nsXULAtoms::outlinercell)) tag != nsXULAtoms::outlinerseparator &&
tag != nsXULAtoms::outlinerchildren &&
tag != nsXULAtoms::outlinerrow &&
tag != nsXULAtoms::outlinercell)
return NS_OK;
} else
return NS_OK; return NS_OK;
// If we have a legal tag, go up to the outliner/select and make sure // If we have a legal tag, go up to the outliner/select and make sure
@ -889,7 +914,8 @@ nsOutlinerContentView::ContentRemoved(nsIDocument *aDocument,
while (element) { while (element) {
element->GetTag(*getter_AddRefs(parentTag)); element->GetTag(*getter_AddRefs(parentTag));
if (parentTag == nsXULAtoms::outliner || parentTag == nsHTMLAtoms::select) if ((element->IsContentOfType(nsIContent::eXUL) && parentTag == nsXULAtoms::outliner) ||
(element->IsContentOfType(nsIContent::eHTML) && parentTag == nsHTMLAtoms::select))
if (element == mRoot) // this is for us, stop looking if (element == mRoot) // this is for us, stop looking
break; break;
else // this is not for us, we can bail out else // this is not for us, we can bail out
@ -1010,12 +1036,15 @@ nsOutlinerContentView::Serialize(nsIContent* aContent, PRInt32 aParentIndex, PRI
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
content->GetTag(*getter_AddRefs(tag)); content->GetTag(*getter_AddRefs(tag));
PRInt32 count = aRows.Count(); PRInt32 count = aRows.Count();
if (tag == nsXULAtoms::outlineritem) if (content->IsContentOfType(nsIContent::eXUL)) {
SerializeItem(content, aParentIndex, aIndex, aRows); if (tag == nsXULAtoms::outlineritem)
else if (tag == nsXULAtoms::outlinerseparator) SerializeItem(content, aParentIndex, aIndex, aRows);
SerializeSeparator(content, aParentIndex, aIndex, aRows); else if (tag == nsXULAtoms::outlinerseparator)
else if (tag == nsHTMLAtoms::option) SerializeSeparator(content, aParentIndex, aIndex, aRows);
SerializeOption(content, aParentIndex, aIndex, aRows); } else if (content->IsContentOfType(nsIContent::eHTML)) {
if (tag == nsHTMLAtoms::option)
SerializeOption(content, aParentIndex, aIndex, aRows);
}
*aIndex += aRows.Count() - count; *aIndex += aRows.Count() - count;
} }
} }
@ -1074,7 +1103,10 @@ nsOutlinerContentView::SerializeOption(nsIContent* aContent, PRInt32 aParentInde
// This will happen before the OutlinerSelection is hooked up. So, cache the selected // This will happen before the OutlinerSelection is hooked up. So, cache the selected
// state in the row properties and update the selection when it is attached. // state in the row properties and update the selection when it is attached.
if (aContent->HasAttr(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo)) nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(aContent);
PRBool isSelected;
optEl->GetSelected(&isSelected);
if (isSelected)
mUpdateSelection = PR_TRUE; mUpdateSelection = PR_TRUE;
} }

View File

@ -91,7 +91,8 @@ class nsOutlinerContentView : public nsIOutlinerView,
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudo);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,

View File

@ -41,6 +41,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsHTMLAtoms.h" #include "nsHTMLAtoms.h"
#include "nsXULAtoms.h" #include "nsXULAtoms.h"
#include "nsCSSAtoms.h"
#include "nsLayoutAtoms.h" #include "nsLayoutAtoms.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIBoxObject.h" #include "nsIBoxObject.h"
@ -221,8 +222,13 @@ nsOutlinerContentView::SetSelection(nsIOutlinerSelection* aSelection)
mSelection->SetSelectEventsSuppressed(PR_TRUE); mSelection->SetSelectEventsSuppressed(PR_TRUE);
for (PRInt32 i = 0; i < mRows.Count(); ++i) { for (PRInt32 i = 0; i < mRows.Count(); ++i) {
Row* row = (Row*)mRows[i]; Row* row = (Row*)mRows[i];
if (row->mContent->HasAttr(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo)) nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(row->mContent);
mSelection->ToggleSelect(i); if (optEl) {
PRBool isSelected;
optEl->GetSelected(&isSelected);
if (isSelected)
mSelection->ToggleSelect(i);
}
} }
mSelection->SetSelectEventsSuppressed(PR_FALSE); mSelection->SetSelectEventsSuppressed(PR_FALSE);
} }
@ -648,8 +654,22 @@ nsOutlinerContentView::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
nsOutlinerContentView::ContentStatesChanged(nsIDocument* aDocument, nsOutlinerContentView::ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
if (!aContent1 || !mSelection || !aContent1->IsContentOfType(nsIContent::eHTML) ||
aChangedPseudoClass != nsCSSAtoms::checkedPseudo)
return NS_OK;
nsCOMPtr<nsIAtom> contentTag;
aContent1->GetTag(*getter_AddRefs(contentTag));
if (contentTag == nsHTMLAtoms::option) {
// update the selected state for this node
PRInt32 index = FindContent(aContent1);
if (index >= 0)
mSelection->ToggleSelect(index);
}
return NS_OK; return NS_OK;
} }
@ -663,6 +683,10 @@ nsOutlinerContentView::AttributeChanged(nsIDocument *aDocument,
{ {
// First, get the element on which the attribute has changed // First, get the element on which the attribute has changed
// and then try to find content item in our array of rows. // and then try to find content item in our array of rows.
if (!aContent->IsContentOfType(nsIContent::eXUL))
return NS_OK;
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
aContent->GetTag(*getter_AddRefs(tag)); aContent->GetTag(*getter_AddRefs(tag));
@ -734,16 +758,6 @@ nsOutlinerContentView::AttributeChanged(nsIDocument *aDocument,
} }
} }
} }
else if (tag == nsHTMLAtoms::option) {
if (aAttribute == nsLayoutAtoms::optionSelectedPseudo) {
PRInt32 index = FindContent(aContent);
if (index >= 0) {
NS_ASSERTION(mSelection, "Need to handle optionSelected change with no OutlinerSelection");
if (mSelection)
mSelection->ToggleSelect(index);
}
}
}
return NS_OK; return NS_OK;
} }
@ -771,12 +785,17 @@ nsOutlinerContentView::ContentInserted(nsIDocument *aDocument,
nsCOMPtr<nsIAtom> childTag; nsCOMPtr<nsIAtom> childTag;
aChild->GetTag(*getter_AddRefs(childTag)); aChild->GetTag(*getter_AddRefs(childTag));
if ((childTag != nsXULAtoms::outlineritem) && if (aChild->IsContentOfType(nsIContent::eHTML)) {
(childTag != nsXULAtoms::outlinerseparator) && if (childTag != nsHTMLAtoms::option)
(childTag != nsHTMLAtoms::option) && return NS_OK;
(childTag != nsXULAtoms::outlinerchildren) && } else if (aChild->IsContentOfType(nsIContent::eXUL)) {
(childTag != nsXULAtoms::outlinerrow) && if (childTag != nsXULAtoms::outlineritem &&
(childTag != nsXULAtoms::outlinercell)) childTag != nsXULAtoms::outlinerseparator &&
childTag != nsXULAtoms::outlinerchildren &&
childTag != nsXULAtoms::outlinerrow &&
childTag != nsXULAtoms::outlinercell)
return NS_OK;
} else
return NS_OK; return NS_OK;
// If we have a legal tag, go up to the outliner/select and make sure // If we have a legal tag, go up to the outliner/select and make sure
@ -786,7 +805,8 @@ nsOutlinerContentView::ContentInserted(nsIDocument *aDocument,
while (element) { while (element) {
element->GetTag(*getter_AddRefs(parentTag)); element->GetTag(*getter_AddRefs(parentTag));
if (parentTag == nsXULAtoms::outliner || parentTag == nsHTMLAtoms::select) if ((element->IsContentOfType(nsIContent::eXUL) && parentTag == nsXULAtoms::outliner) ||
(element->IsContentOfType(nsIContent::eHTML) && parentTag == nsHTMLAtoms::select))
if (element == mRoot) // this is for us, stop looking if (element == mRoot) // this is for us, stop looking
break; break;
else // this is not for us, we can bail out else // this is not for us, we can bail out
@ -874,12 +894,17 @@ nsOutlinerContentView::ContentRemoved(nsIDocument *aDocument,
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
aChild->GetTag(*getter_AddRefs(tag)); aChild->GetTag(*getter_AddRefs(tag));
if ((tag != nsXULAtoms::outlineritem) && if (aChild->IsContentOfType(nsIContent::eHTML)) {
(tag != nsXULAtoms::outlinerseparator) && if (tag != nsHTMLAtoms::option)
(tag != nsHTMLAtoms::option) && return NS_OK;
(tag != nsXULAtoms::outlinerchildren) && } else if (aChild->IsContentOfType(nsIContent::eXUL)) {
(tag != nsXULAtoms::outlinerrow) && if (tag != nsXULAtoms::outlineritem &&
(tag != nsXULAtoms::outlinercell)) tag != nsXULAtoms::outlinerseparator &&
tag != nsXULAtoms::outlinerchildren &&
tag != nsXULAtoms::outlinerrow &&
tag != nsXULAtoms::outlinercell)
return NS_OK;
} else
return NS_OK; return NS_OK;
// If we have a legal tag, go up to the outliner/select and make sure // If we have a legal tag, go up to the outliner/select and make sure
@ -889,7 +914,8 @@ nsOutlinerContentView::ContentRemoved(nsIDocument *aDocument,
while (element) { while (element) {
element->GetTag(*getter_AddRefs(parentTag)); element->GetTag(*getter_AddRefs(parentTag));
if (parentTag == nsXULAtoms::outliner || parentTag == nsHTMLAtoms::select) if ((element->IsContentOfType(nsIContent::eXUL) && parentTag == nsXULAtoms::outliner) ||
(element->IsContentOfType(nsIContent::eHTML) && parentTag == nsHTMLAtoms::select))
if (element == mRoot) // this is for us, stop looking if (element == mRoot) // this is for us, stop looking
break; break;
else // this is not for us, we can bail out else // this is not for us, we can bail out
@ -1010,12 +1036,15 @@ nsOutlinerContentView::Serialize(nsIContent* aContent, PRInt32 aParentIndex, PRI
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
content->GetTag(*getter_AddRefs(tag)); content->GetTag(*getter_AddRefs(tag));
PRInt32 count = aRows.Count(); PRInt32 count = aRows.Count();
if (tag == nsXULAtoms::outlineritem) if (content->IsContentOfType(nsIContent::eXUL)) {
SerializeItem(content, aParentIndex, aIndex, aRows); if (tag == nsXULAtoms::outlineritem)
else if (tag == nsXULAtoms::outlinerseparator) SerializeItem(content, aParentIndex, aIndex, aRows);
SerializeSeparator(content, aParentIndex, aIndex, aRows); else if (tag == nsXULAtoms::outlinerseparator)
else if (tag == nsHTMLAtoms::option) SerializeSeparator(content, aParentIndex, aIndex, aRows);
SerializeOption(content, aParentIndex, aIndex, aRows); } else if (content->IsContentOfType(nsIContent::eHTML)) {
if (tag == nsHTMLAtoms::option)
SerializeOption(content, aParentIndex, aIndex, aRows);
}
*aIndex += aRows.Count() - count; *aIndex += aRows.Count() - count;
} }
} }
@ -1074,7 +1103,10 @@ nsOutlinerContentView::SerializeOption(nsIContent* aContent, PRInt32 aParentInde
// This will happen before the OutlinerSelection is hooked up. So, cache the selected // This will happen before the OutlinerSelection is hooked up. So, cache the selected
// state in the row properties and update the selection when it is attached. // state in the row properties and update the selection when it is attached.
if (aContent->HasAttr(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo)) nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(aContent);
PRBool isSelected;
optEl->GetSelected(&isSelected);
if (isSelected)
mUpdateSelection = PR_TRUE; mUpdateSelection = PR_TRUE;
} }

View File

@ -91,7 +91,8 @@ class nsOutlinerContentView : public nsIOutlinerView,
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudo);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,

View File

@ -47,17 +47,17 @@ select {
border:2px inset rgb(192, 192, 192); border:2px inset rgb(192, 192, 192);
} }
select[size] option[_moz-option-selected] { select[size] option:checked {
background-color:rgb(0, 0, 128); background-color:rgb(0, 0, 128);
color: white; color: white;
} }
select option[_moz-option-selected] { select option:checked {
background-color:rgb(0, 0, 128); background-color:rgb(0, 0, 128);
color: white; color: white;
} }
select[size="1"] option[_moz-option-selected] { select[size="1"] option:checked {
background-color:rgb(0, 0, 128); background-color:rgb(0, 0, 128);
color: white; color: white;
} }

View File

@ -37,7 +37,7 @@ option {
padding-left:10px; padding-left:10px;
} }
option[_moz-option-selected] { option:checked {
color:black; color:black;
background-color:rgb(255, 221, 255); background-color:rgb(255, 221, 255);
padding-left:10px; padding-left:10px;

View File

@ -59,7 +59,7 @@ option {
background-color:green; background-color:green;
} }
option[_moz-option-selected] { option:checked {
color:red; color:red;
background-color:yellow; background-color:yellow;
} }

View File

@ -215,18 +215,18 @@ option {
} }
/* Combobox item style */ /* Combobox item style */
select option[_moz-option-selected] { select option:checked {
color:black; color:black;
background-color:white; background-color:white;
} }
/* List box item selected style */ /* List box item selected style */
select[size] option[_moz-option-selected] { select[size] option:checked {
color:white; color:white;
background-color:rgb(51,51,102); background-color:rgb(51,51,102);
} }
select[size="1"] option[_moz-option-selected] { select[size="1"] option:checked {
color:black; color:black;
background-color:white; background-color:white;
} }
@ -253,4 +253,4 @@ textarea {
border: 2px inset #c0c0c0; border: 2px inset #c0c0c0;
background-color:white; background-color:white;
color:black; color:black;
} }

View File

@ -770,7 +770,8 @@ nsMenuBarX::ContentChanged( nsIDocument * aDocument, nsIContent * aContent, nsIS
} }
NS_IMETHODIMP NS_IMETHODIMP
nsMenuBarX::ContentStatesChanged( nsIDocument * aDocument, nsIContent * aContent1, nsIContent * aContent2) nsMenuBarX::ContentStatesChanged( nsIDocument * aDocument, nsIContent * aContent1,
nsIContent * aContent2, nsIAtom * aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -112,7 +112,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -664,7 +664,8 @@ nsMenuBar::ContentChanged( nsIDocument * aDocument, nsIContent * aContent, nsISu
} }
NS_IMETHODIMP NS_IMETHODIMP
nsMenuBar::ContentStatesChanged( nsIDocument * aDocument, nsIContent * aContent1, nsIContent * aContent2) nsMenuBar::ContentStatesChanged( nsIDocument * aDocument, nsIContent * aContent1,
nsIContent * aContent2, nsIAtom * aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -115,7 +115,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -760,7 +760,8 @@ nsMenuBarX::ContentChanged( nsIDocument * aDocument, nsIContent * aContent, nsIS
} }
NS_IMETHODIMP NS_IMETHODIMP
nsMenuBarX::ContentStatesChanged( nsIDocument * aDocument, nsIContent * aContent1, nsIContent * aContent2) nsMenuBarX::ContentStatesChanged( nsIDocument * aDocument, nsIContent * aContent1,
nsIContent * aContent2, nsIAtom * aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -114,7 +114,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,

View File

@ -1550,7 +1550,8 @@ nsWebShellWindow::ContentChanged(nsIDocument *aDocument,
NS_IMETHODIMP NS_IMETHODIMP
nsWebShellWindow::ContentStatesChanged(nsIDocument *aDocument, nsWebShellWindow::ContentStatesChanged(nsIDocument *aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2) nsIContent* aContent2,
nsIAtom* aChangedPseudoClass)
{ {
return NS_OK; return NS_OK;
} }

View File

@ -124,7 +124,8 @@ public:
nsISupports* aSubContent); nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument, NS_IMETHOD ContentStatesChanged(nsIDocument *aDocument,
nsIContent* aContent1, nsIContent* aContent1,
nsIContent* aContent2); nsIContent* aContent2,
nsIAtom* aChangedPseudoClass);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,