mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 595036 (2/2) - Introduce nsEventStates class to represent event states. r+a=bz
This commit is contained in:
parent
12794928a0
commit
06426cc202
@ -686,16 +686,16 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
PRInt32 intrinsicState = mContent->IntrinsicState();
|
||||
nsEventStates intrinsicState = mContent->IntrinsicState();
|
||||
|
||||
if (intrinsicState & NS_EVENT_STATE_INVALID)
|
||||
if (intrinsicState.HasState(NS_EVENT_STATE_INVALID))
|
||||
*aState |= nsIAccessibleStates::STATE_INVALID;
|
||||
|
||||
if (intrinsicState & NS_EVENT_STATE_REQUIRED)
|
||||
if (intrinsicState.HasState(NS_EVENT_STATE_REQUIRED))
|
||||
*aState |= nsIAccessibleStates::STATE_REQUIRED;
|
||||
|
||||
PRBool disabled = mContent->IsHTML() ?
|
||||
(intrinsicState & NS_EVENT_STATE_DISABLED) :
|
||||
(intrinsicState.HasState(NS_EVENT_STATE_DISABLED)) :
|
||||
(mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::disabled,
|
||||
nsAccessibilityAtoms::_true,
|
||||
|
@ -1249,9 +1249,9 @@ void nsDocAccessible::ContentAppended(nsIDocument *aDocument,
|
||||
void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
if (0 == (aStateMask & NS_EVENT_STATE_CHECKED)) {
|
||||
if (!aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1260,7 +1260,7 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
|
||||
}
|
||||
|
||||
void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,8 @@ enum nsLinkState {
|
||||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x64ef8589, 0xbd19, 0x40f4, \
|
||||
{ 0xa9, 0x61, 0x47, 0x89, 0xe0, 0x8d, 0xb0, 0x49 } }
|
||||
{ 0x71afb9e6, 0xe8a7, 0x475d, \
|
||||
{ 0x89, 0xc4, 0xe4, 0x62, 0x21, 0xeb, 0xe1, 0xa4 } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
@ -787,9 +787,7 @@ public:
|
||||
* content state, use nsIEventStateManager. Also see nsIEventStateManager
|
||||
* for the possible bits that could be set here.
|
||||
*/
|
||||
// XXXbz this is PRInt32 because all the ESM content state APIs use
|
||||
// PRInt32. We should really use PRUint32 instead.
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
/**
|
||||
* Get the ID of this content node (the atom corresponding to the
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIAnimationFrameListener.h"
|
||||
#include "nsEventStates.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsPresContext;
|
||||
@ -120,8 +121,8 @@ class Element;
|
||||
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x73d79167, 0xacba, 0x46eb, \
|
||||
{ 0xad, 0x45, 0xa3, 0x4b, 0x92, 0xf6, 0x01, 0x5b } }
|
||||
{ 0x7fb1e97d, 0xbd2c, 0x47cf, \
|
||||
{ 0xa3, 0x05, 0x5b, 0x31, 0xd4, 0x1d, 0x3a, 0x52 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -129,9 +130,9 @@ class Element;
|
||||
// Document states
|
||||
|
||||
// RTL locale: specific to the XUL localedir attribute
|
||||
#define NS_DOCUMENT_STATE_RTL_LOCALE (1 << 0)
|
||||
#define NS_DOCUMENT_STATE_RTL_LOCALE NS_DEFINE_EVENT_STATE_MACRO(0)
|
||||
// Window activation status
|
||||
#define NS_DOCUMENT_STATE_WINDOW_INACTIVE (1 << 1)
|
||||
#define NS_DOCUMENT_STATE_WINDOW_INACTIVE NS_DEFINE_EVENT_STATE_MACRO(1)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@ -723,12 +724,12 @@ public:
|
||||
// either may be nsnull, but not both
|
||||
virtual void ContentStatesChanged(nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask) = 0;
|
||||
nsEventStates aStateMask) = 0;
|
||||
|
||||
// Notify that a document state has changed.
|
||||
// This should only be called by callers whose state is also reflected in the
|
||||
// implementation of nsDocument::GetDocumentState.
|
||||
virtual void DocumentStatesChanged(PRInt32 aStateMask) = 0;
|
||||
virtual void DocumentStatesChanged(nsEventStates aStateMask) = 0;
|
||||
|
||||
// Observation hooks for style data to propagate notifications
|
||||
// to document observers
|
||||
@ -1415,7 +1416,7 @@ public:
|
||||
* Document state bits have the form NS_DOCUMENT_STATE_* and are declared in
|
||||
* nsIDocument.h.
|
||||
*/
|
||||
virtual PRInt32 GetDocumentState() = 0;
|
||||
virtual nsEventStates GetDocumentState() = 0;
|
||||
|
||||
virtual nsISupports* GetCurrentContentSink() = 0;
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
#include "nsEventStates.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
@ -48,8 +49,8 @@ class nsString;
|
||||
class nsIDocument;
|
||||
|
||||
#define NS_IDOCUMENT_OBSERVER_IID \
|
||||
{ 0x4e14e321, 0xa4bb, 0x49f8, \
|
||||
{ 0xa5, 0x7a, 0x23, 0x63, 0x66, 0x8d, 0x14, 0xd0 } }
|
||||
{ 0x3d005225, 0x210f, 0x4b07, \
|
||||
{ 0xb1, 0xd9, 0x96, 0x02, 0x05, 0x74, 0xc4, 0x37 } }
|
||||
|
||||
typedef PRUint32 nsUpdateType;
|
||||
|
||||
@ -115,7 +116,7 @@ public:
|
||||
virtual void ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask) = 0;
|
||||
nsEventStates aStateMask) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the state of the document has changed.
|
||||
@ -124,7 +125,7 @@ public:
|
||||
* @param aStateMask the state that changed
|
||||
*/
|
||||
virtual void DocumentStatesChanged(nsIDocument* aDocument,
|
||||
PRInt32 aStateMask) = 0;
|
||||
nsEventStates aStateMask) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just been added to the document. This method is
|
||||
@ -250,11 +251,11 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
|
||||
virtual void ContentStatesChanged(nsIDocument* aDocument, \
|
||||
nsIContent* aContent1, \
|
||||
nsIContent* aContent2, \
|
||||
PRInt32 aStateMask);
|
||||
nsEventStates aStateMask);
|
||||
|
||||
#define NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED \
|
||||
virtual void DocumentStatesChanged(nsIDocument* aDocument, \
|
||||
PRInt32 aStateMask);
|
||||
nsEventStates aStateMask);
|
||||
|
||||
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED \
|
||||
virtual void StyleSheetAdded(nsIDocument* aDocument, \
|
||||
@ -329,13 +330,13 @@ void \
|
||||
_class::ContentStatesChanged(nsIDocument* aDocument, \
|
||||
nsIContent* aContent1, \
|
||||
nsIContent* aContent2, \
|
||||
PRInt32 aStateMask) \
|
||||
nsEventStates aStateMask) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
_class::DocumentStatesChanged(nsIDocument* aDocument, \
|
||||
PRInt32 aStateMask) \
|
||||
nsEventStates aStateMask) \
|
||||
{ \
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ interface nsIDocument;
|
||||
* sufficient, when combined with the imageBlockingStatus information.)
|
||||
*/
|
||||
|
||||
[scriptable, uuid(7974082c-3267-4ab1-96fa-bd47d7e3a093)]
|
||||
[scriptable, uuid(95c74255-df9a-4060-b5a0-0d111fcafe08)]
|
||||
interface nsIImageLoadingContent : imgIDecoderObserver
|
||||
{
|
||||
/**
|
||||
@ -174,7 +174,7 @@ interface nsIImageLoadingContent : imgIDecoderObserver
|
||||
* nsImageLoadingContent::ImageState() to return |aState|. Call again with |aForce|
|
||||
* as PR_FALSE to revert ImageState() to its original behaviour.
|
||||
*/
|
||||
void forceImageState(in boolean aForce, in long aState);
|
||||
void forceImageState(in boolean aForce, in unsigned long long aState);
|
||||
|
||||
/**
|
||||
* We need to be notified when our document changes.
|
||||
|
@ -84,7 +84,7 @@ Link::SetLinkState(nsLinkState aState)
|
||||
"Setting state to the currently set state!");
|
||||
|
||||
// Remember our old link state for when we notify.
|
||||
PRInt32 oldLinkState = LinkState();
|
||||
nsEventStates oldLinkState = LinkState();
|
||||
|
||||
// Set our current state as appropriate.
|
||||
mLinkState = aState;
|
||||
@ -96,7 +96,7 @@ Link::SetLinkState(nsLinkState aState)
|
||||
nsIContent *content = Content();
|
||||
nsIDocument *doc = content->GetCurrentDoc();
|
||||
NS_ASSERTION(doc, "Registered but we have no document?!");
|
||||
PRInt32 newLinkState = LinkState();
|
||||
nsEventStates newLinkState = LinkState();
|
||||
NS_ASSERTION(newLinkState == NS_EVENT_STATE_VISITED ||
|
||||
newLinkState == NS_EVENT_STATE_UNVISITED,
|
||||
"Unexpected state obtained from LinkState()!");
|
||||
@ -104,7 +104,7 @@ Link::SetLinkState(nsLinkState aState)
|
||||
doc->ContentStatesChanged(content, nsnull, oldLinkState ^ newLinkState);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
Link::LinkState() const
|
||||
{
|
||||
// We are a constant method, but we are just lazily doing things and have to
|
||||
@ -124,7 +124,7 @@ Link::LinkState() const
|
||||
nsCOMPtr<nsIURI> hrefURI(GetURI());
|
||||
if (!hrefURI) {
|
||||
self->mLinkState = eLinkState_NotLink;
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
}
|
||||
|
||||
// We have a good href, so register with History.
|
||||
@ -153,7 +153,7 @@ Link::LinkState() const
|
||||
return NS_EVENT_STATE_UNVISITED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
@ -491,7 +491,7 @@ Link::ResetLinkState(bool aNotify)
|
||||
// not before. In particular, we need to make sure that our LinkState() is
|
||||
// called so that we'll start a new history query as needed.
|
||||
if (aNotify && doc) {
|
||||
PRUint32 changedState = NS_EVENT_STATE_VISITED ^ NS_EVENT_STATE_UNVISITED;
|
||||
nsEventStates changedState = NS_EVENT_STATE_VISITED ^ NS_EVENT_STATE_UNVISITED;
|
||||
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, aNotify);
|
||||
doc->ContentStatesChanged(content, nsnull, changedState);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
* NS_EVENT_STATE_UNVISTED if this link is not visited, or 0 if this
|
||||
* link is not actually a link.
|
||||
*/
|
||||
PRInt32 LinkState() const;
|
||||
nsEventStates LinkState() const;
|
||||
|
||||
/**
|
||||
* @return the URI this link is for, if available.
|
||||
|
@ -4206,14 +4206,14 @@ nsDocument::EndLoad()
|
||||
|
||||
void
|
||||
nsDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStatesChanged,
|
||||
(this, aContent1, aContent2, aStateMask));
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::DocumentStatesChanged(PRInt32 aStateMask)
|
||||
nsDocument::DocumentStatesChanged(nsEventStates aStateMask)
|
||||
{
|
||||
// Invalidate our cached state.
|
||||
mGotDocumentState &= ~aStateMask;
|
||||
@ -7734,16 +7734,16 @@ nsDocument::MaybePreLoadImage(nsIURI* uri)
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsDocument::GetDocumentState()
|
||||
{
|
||||
if (!(mGotDocumentState & NS_DOCUMENT_STATE_RTL_LOCALE)) {
|
||||
if (!mGotDocumentState.HasState(NS_DOCUMENT_STATE_RTL_LOCALE)) {
|
||||
if (IsDocumentRightToLeft()) {
|
||||
mDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE;
|
||||
}
|
||||
mGotDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE;
|
||||
}
|
||||
if (!(mGotDocumentState & NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
|
||||
if (!mGotDocumentState.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
|
||||
nsIPresShell* shell = GetShell();
|
||||
if (shell && shell->GetPresContext() &&
|
||||
shell->GetPresContext()->IsTopLevelWindowInactive()) {
|
||||
|
@ -710,8 +710,8 @@ public:
|
||||
|
||||
virtual void ContentStatesChanged(nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask);
|
||||
virtual void DocumentStatesChanged(PRInt32 aStateMask);
|
||||
nsEventStates aStateMask);
|
||||
virtual void DocumentStatesChanged(nsEventStates aStateMask);
|
||||
|
||||
virtual void StyleRuleChanged(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aOldStyleRule,
|
||||
@ -952,7 +952,7 @@ public:
|
||||
|
||||
virtual nsISupports* GetCurrentContentSink();
|
||||
|
||||
virtual PRInt32 GetDocumentState();
|
||||
virtual nsEventStates GetDocumentState();
|
||||
|
||||
virtual void RegisterFileDataUri(const nsACString& aUri);
|
||||
virtual void UnregisterFileDataUri(const nsACString& aUri);
|
||||
@ -1171,8 +1171,8 @@ protected:
|
||||
|
||||
nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
|
||||
|
||||
PRInt32 mDocumentState;
|
||||
PRInt32 mGotDocumentState;
|
||||
nsEventStates mDocumentState;
|
||||
nsEventStates mGotDocumentState;
|
||||
|
||||
private:
|
||||
friend class nsUnblockOnloadEvent;
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
}
|
||||
|
||||
// nsIContent overrides
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
private:
|
||||
virtual ~nsGenConImageContent();
|
||||
@ -96,13 +96,13 @@ nsGenConImageContent::~nsGenConImageContent()
|
||||
DestroyImageLoadingContent();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsGenConImageContent::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsXMLElement::IntrinsicState();
|
||||
nsEventStates state = nsXMLElement::IntrinsicState();
|
||||
|
||||
PRInt32 imageState = nsImageLoadingContent::ImageState();
|
||||
if (imageState & (NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED)) {
|
||||
nsEventStates imageState = nsImageLoadingContent::ImageState();
|
||||
if (imageState.HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED)) {
|
||||
// We should never be in an error state; if the image fails to load, we
|
||||
// just go to the suppressed state.
|
||||
imageState |= NS_EVENT_STATE_SUPPRESSED;
|
||||
|
@ -771,7 +771,7 @@ nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix,
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsIContent::IntrinsicState() const
|
||||
{
|
||||
return IsEditable() ? NS_EVENT_STATE_MOZ_READWRITE :
|
||||
@ -4675,9 +4675,9 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||
|
||||
// When notifying, make sure to keep track of states whose value
|
||||
// depends solely on the value of an attribute.
|
||||
PRUint32 stateMask;
|
||||
nsEventStates stateMask;
|
||||
if (aNotify) {
|
||||
stateMask = PRUint32(IntrinsicState());
|
||||
stateMask = IntrinsicState();
|
||||
}
|
||||
|
||||
nsMutationGuard::DidMutate();
|
||||
@ -4712,8 +4712,8 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||
}
|
||||
|
||||
if (aNotify) {
|
||||
stateMask = stateMask ^ PRUint32(IntrinsicState());
|
||||
if (stateMask && document) {
|
||||
stateMask ^= IntrinsicState();
|
||||
if (document && !stateMask.IsEmpty()) {
|
||||
MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, aNotify);
|
||||
document->ContentStatesChanged(this, nsnull, stateMask);
|
||||
}
|
||||
@ -4914,10 +4914,10 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
|
||||
// When notifying, make sure to keep track of states whose value
|
||||
// depends solely on the value of an attribute.
|
||||
PRUint32 stateMask;
|
||||
nsEventStates stateMask;
|
||||
if (aNotify) {
|
||||
stateMask = PRUint32(IntrinsicState());
|
||||
}
|
||||
stateMask = IntrinsicState();
|
||||
}
|
||||
|
||||
PRBool hasMutationListeners = aNotify &&
|
||||
nsContentUtils::HasMutationListeners(this,
|
||||
@ -4959,8 +4959,8 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
}
|
||||
|
||||
if (aNotify) {
|
||||
stateMask = stateMask ^ PRUint32(IntrinsicState());
|
||||
if (stateMask && document) {
|
||||
stateMask ^= IntrinsicState();
|
||||
if (document && !stateMask.IsEmpty()) {
|
||||
MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, aNotify);
|
||||
document->ContentStatesChanged(this, nsnull, stateMask);
|
||||
}
|
||||
|
@ -699,21 +699,36 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsImageLoadingContent::ForceImageState(PRBool aForce, PRInt32 aState)
|
||||
nsImageLoadingContent::ForceImageState(PRBool aForce, nsEventStates::InternalType aState)
|
||||
{
|
||||
mIsImageStateForced = aForce;
|
||||
mForcedImageState = aState;
|
||||
mForcedImageState = nsEventStates(aState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsImageLoadingContent::ImageState() const
|
||||
{
|
||||
return mIsImageStateForced ? mForcedImageState :
|
||||
(mBroken * NS_EVENT_STATE_BROKEN) |
|
||||
(mUserDisabled * NS_EVENT_STATE_USERDISABLED) |
|
||||
(mSuppressed * NS_EVENT_STATE_SUPPRESSED) |
|
||||
(mLoading * NS_EVENT_STATE_LOADING);
|
||||
if (mIsImageStateForced) {
|
||||
return mForcedImageState;
|
||||
}
|
||||
|
||||
nsEventStates states;
|
||||
|
||||
if (mBroken) {
|
||||
states |= NS_EVENT_STATE_BROKEN;
|
||||
}
|
||||
if (mUserDisabled) {
|
||||
states |= NS_EVENT_STATE_USERDISABLED;
|
||||
}
|
||||
if (mSuppressed) {
|
||||
states |= NS_EVENT_STATE_SUPPRESSED;
|
||||
}
|
||||
if (mLoading) {
|
||||
states |= NS_EVENT_STATE_LOADING;
|
||||
}
|
||||
|
||||
return states;
|
||||
}
|
||||
|
||||
void
|
||||
@ -734,7 +749,7 @@ nsImageLoadingContent::UpdateImageState(PRBool aNotify)
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 oldState = ImageState();
|
||||
nsEventStates oldState = ImageState();
|
||||
|
||||
mLoading = mBroken = mUserDisabled = mSuppressed = PR_FALSE;
|
||||
|
||||
@ -762,8 +777,8 @@ nsImageLoadingContent::UpdateImageState(PRBool aNotify)
|
||||
nsIDocument* doc = thisContent->GetCurrentDoc();
|
||||
if (doc) {
|
||||
NS_ASSERTION(thisContent->IsInDoc(), "Something is confused");
|
||||
PRInt32 changedBits = oldState ^ ImageState();
|
||||
if (changedBits) {
|
||||
nsEventStates changedBits = oldState ^ ImageState();
|
||||
if (!changedBits.IsEmpty()) {
|
||||
mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
doc->ContentStatesChanged(thisContent, nsnull, changedBits);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ protected:
|
||||
* be an image (eg an HTML <input> of type other than "image") should just
|
||||
* not call this method when computing their intrinsic state.
|
||||
*/
|
||||
PRInt32 ImageState() const;
|
||||
nsEventStates ImageState() const;
|
||||
|
||||
/**
|
||||
* LoadImage is called by subclasses when the appropriate
|
||||
@ -315,7 +315,7 @@ private:
|
||||
* When mIsImageStateForced is true, this holds the ImageState that we'll
|
||||
* return in ImageState().
|
||||
*/
|
||||
PRInt32 mForcedImageState;
|
||||
nsEventStates mForcedImageState;
|
||||
|
||||
PRInt16 mImageBlockingStatus;
|
||||
PRPackedBool mLoadingEnabled : 1;
|
||||
|
@ -359,7 +359,7 @@ class AutoNotifier {
|
||||
nsObjectLoadingContent* mContent;
|
||||
PRBool mNotify;
|
||||
nsObjectLoadingContent::ObjectType mOldType;
|
||||
PRInt32 mOldState;
|
||||
nsEventStates mOldState;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1043,7 +1043,7 @@ nsObjectLoadingContent::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
||||
}
|
||||
|
||||
// <public>
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsObjectLoadingContent::ObjectState() const
|
||||
{
|
||||
switch (mType) {
|
||||
@ -1056,7 +1056,7 @@ nsObjectLoadingContent::ObjectState() const
|
||||
// These are OK. If documents start to load successfully, they display
|
||||
// something, and are thus not broken in this sense. The same goes for
|
||||
// plugins.
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
case eType_Null:
|
||||
if (mSuppressed)
|
||||
return NS_EVENT_STATE_SUPPRESSED;
|
||||
@ -1064,7 +1064,7 @@ nsObjectLoadingContent::ObjectState() const
|
||||
return NS_EVENT_STATE_USERDISABLED;
|
||||
|
||||
// Otherwise, broken
|
||||
PRInt32 state = NS_EVENT_STATE_BROKEN;
|
||||
nsEventStates state = NS_EVENT_STATE_BROKEN;
|
||||
switch (mFallbackReason) {
|
||||
case ePluginDisabled:
|
||||
state |= NS_EVENT_STATE_HANDLER_DISABLED;
|
||||
@ -1083,7 +1083,7 @@ nsObjectLoadingContent::ObjectState() const
|
||||
};
|
||||
NS_NOTREACHED("unknown type?");
|
||||
// this return statement only exists to avoid a compile warning
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
}
|
||||
|
||||
// <protected>
|
||||
@ -1634,11 +1634,11 @@ nsObjectLoadingContent::UnloadContent()
|
||||
|
||||
void
|
||||
nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||
PRInt32 aOldState,
|
||||
PRBool aSync)
|
||||
nsEventStates aOldState, PRBool aSync)
|
||||
{
|
||||
LOG(("OBJLC [%p]: Notifying about state change: (%u, %x) -> (%u, %x) (sync=%i)\n",
|
||||
this, aOldType, aOldState, mType, ObjectState(), aSync));
|
||||
LOG(("OBJLC [%p]: Notifying about state change: (%u, %lx) -> (%u, %lx) (sync=%i)\n",
|
||||
this, aOldType, aOldState.GetInternalValue(), mType,
|
||||
ObjectState().GetInternalValue(), aSync));
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
@ -1649,12 +1649,12 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||
return; // Nothing to do
|
||||
}
|
||||
|
||||
PRInt32 newState = ObjectState();
|
||||
nsEventStates newState = ObjectState();
|
||||
|
||||
if (newState != aOldState) {
|
||||
// This will trigger frame construction
|
||||
NS_ASSERTION(thisContent->IsInDoc(), "Something is confused");
|
||||
PRInt32 changedBits = aOldState ^ newState;
|
||||
nsEventStates changedBits = aOldState ^ newState;
|
||||
|
||||
{
|
||||
mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
|
@ -132,7 +132,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
* NS_EVENT_STATE_BROKEN, NS_EVENT_STATE_USERDISABLED and
|
||||
* NS_EVENT_STATE_SUPPRESSED representing the current state of the object.
|
||||
*/
|
||||
PRInt32 ObjectState() const;
|
||||
nsEventStates ObjectState() const;
|
||||
|
||||
void SetIsNetworkCreated(PRBool aNetworkCreated)
|
||||
{
|
||||
@ -259,7 +259,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
* @param aSync If a synchronous frame construction is required. If false,
|
||||
* the construction may either be sync or async.
|
||||
*/
|
||||
void NotifyStateChanged(ObjectType aOldType, PRInt32 aOldState,
|
||||
void NotifyStateChanged(ObjectType aOldType, nsEventStates aOldState,
|
||||
PRBool aSync);
|
||||
|
||||
/**
|
||||
|
@ -55,6 +55,7 @@ EXPORTS = \
|
||||
nsPLDOMEvent.h \
|
||||
nsEventDispatcher.h \
|
||||
nsPIDOMEventTarget.h \
|
||||
nsEventStates.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
266
content/events/public/nsEventStates.h
Normal file
266
content/events/public/nsEventStates.h
Normal file
@ -0,0 +1,266 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsEventStates_h__
|
||||
#define nsEventStates_h__
|
||||
|
||||
/**
|
||||
* nsEventStates is the class used to represent the event states of nsIContent
|
||||
* instances. These states are calculated by IntrinsicState() and
|
||||
* ContentStatesChanged() has to be called when one of them changes thus
|
||||
* informing the layout/style engine of the change.
|
||||
* Event states are associated with pseudo-classes.
|
||||
*/
|
||||
class nsEventStates
|
||||
{
|
||||
public:
|
||||
typedef PRUint64 InternalType;
|
||||
|
||||
nsEventStates()
|
||||
: mStates(0)
|
||||
{ }
|
||||
|
||||
// NOTE: the ideal scenario would be to have the default constructor public
|
||||
// setting mStates to 0 and this constructor (without = 0) private.
|
||||
// In that case, we could be sure that only macros at the end were creating
|
||||
// nsEventStates instances with mStates set to something else than 0.
|
||||
// Unfortunately, this constructor is needed at at least two places now.
|
||||
explicit nsEventStates(InternalType aStates)
|
||||
: mStates(aStates)
|
||||
{ }
|
||||
|
||||
nsEventStates(const nsEventStates& aEventStates) {
|
||||
mStates = aEventStates.mStates;
|
||||
}
|
||||
|
||||
nsEventStates& operator=(const nsEventStates& aEventStates) {
|
||||
mStates = aEventStates.mStates;
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsEventStates operator|(const nsEventStates& aEventStates) const {
|
||||
return nsEventStates(mStates | aEventStates.mStates);
|
||||
}
|
||||
|
||||
nsEventStates& operator|=(const nsEventStates& aEventStates) {
|
||||
mStates |= aEventStates.mStates;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// NOTE: calling if (eventStates1 & eventStates2) will not build.
|
||||
// This might work correctly if operator bool() is defined
|
||||
// but using HasState, HasAllStates or HasAtLeastOneOfStates is recommended.
|
||||
nsEventStates operator&(const nsEventStates& aEventStates) const {
|
||||
return nsEventStates(mStates & aEventStates.mStates);
|
||||
}
|
||||
|
||||
nsEventStates& operator&=(const nsEventStates& aEventStates) {
|
||||
mStates &= aEventStates.mStates;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const nsEventStates& aEventStates) const {
|
||||
return mStates == aEventStates.mStates;
|
||||
}
|
||||
|
||||
bool operator!=(const nsEventStates& aEventStates) const {
|
||||
return mStates != aEventStates.mStates;
|
||||
}
|
||||
|
||||
nsEventStates operator~() const {
|
||||
return nsEventStates(~mStates);
|
||||
}
|
||||
|
||||
nsEventStates operator^(const nsEventStates& aEventStates) const {
|
||||
return nsEventStates(mStates ^ aEventStates.mStates);
|
||||
}
|
||||
|
||||
nsEventStates& operator^=(const nsEventStates& aEventStates) {
|
||||
mStates ^= aEventStates.mStates;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the nsEventStates instance is empty.
|
||||
* A nsEventStates instance is empty if it contains no state.
|
||||
*
|
||||
* @return Whether if the object is empty.
|
||||
*/
|
||||
bool IsEmpty() const {
|
||||
return mStates == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the nsEventStates instance contains the state
|
||||
* contained in aEventStates.
|
||||
* @note aEventStates should contain only one state.
|
||||
*
|
||||
* @param aEventStates The state to check.
|
||||
*
|
||||
* @return Whether the object has the state from aEventStates
|
||||
*/
|
||||
bool HasState(nsEventStates aEventStates) const {
|
||||
#ifdef DEBUG
|
||||
// If aEventStates.mStates is a power of two, it contains only one state
|
||||
// (or none, but we don't really care).
|
||||
if ((aEventStates.mStates & (aEventStates.mStates - 1))) {
|
||||
NS_ERROR("When calling HasState, "
|
||||
"nsEventStates object has to contain only one state!");
|
||||
}
|
||||
#endif // DEBUG
|
||||
return mStates & aEventStates.mStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the nsEventStates instance contains one of the states
|
||||
* contained in aEventStates.
|
||||
*
|
||||
* @param aEventStates The states to check.
|
||||
*
|
||||
* @return Whether the object has at least one state from aEventStates
|
||||
*/
|
||||
bool HasAtLeastOneOfStates(nsEventStates aEventStates) const {
|
||||
return mStates & aEventStates.mStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the nsEventStates instance contains all states
|
||||
* contained in aEventStates.
|
||||
*
|
||||
* @param aEventStates The states to check.
|
||||
*
|
||||
* @return Whether the object has all states from aEventStates
|
||||
*/
|
||||
bool HasAllStates(nsEventStates aEventStates) const {
|
||||
return (mStates & aEventStates.mStates) == aEventStates.mStates;
|
||||
}
|
||||
|
||||
// We only need that method for inDOMUtils::GetContentState.
|
||||
// If inDOMUtils::GetContentState is removed, this method should be removed.
|
||||
InternalType GetInternalValue() const {
|
||||
return mStates;
|
||||
}
|
||||
|
||||
private:
|
||||
InternalType mStates;
|
||||
};
|
||||
|
||||
/**
|
||||
* The following macros are creating nsEventStates instance with different
|
||||
* values depending of their meaning.
|
||||
* Ideally, nsEventStates instance with values different than 0 should only be
|
||||
* created that way.
|
||||
*/
|
||||
|
||||
// Helper to define a new nsEventStates macro.
|
||||
#define NS_DEFINE_EVENT_STATE_MACRO(_val) \
|
||||
(nsEventStates(nsEventStates::InternalType(1) << _val))
|
||||
|
||||
// Mouse is down on content.
|
||||
#define NS_EVENT_STATE_ACTIVE NS_DEFINE_EVENT_STATE_MACRO(0)
|
||||
// Content has focus.
|
||||
#define NS_EVENT_STATE_FOCUS NS_DEFINE_EVENT_STATE_MACRO(1)
|
||||
// Mouse is hovering over content.
|
||||
#define NS_EVENT_STATE_HOVER NS_DEFINE_EVENT_STATE_MACRO(2)
|
||||
// Drag is hovering over content.
|
||||
#define NS_EVENT_STATE_DRAGOVER NS_DEFINE_EVENT_STATE_MACRO(3)
|
||||
// Content is URL's target (ref).
|
||||
#define NS_EVENT_STATE_URLTARGET NS_DEFINE_EVENT_STATE_MACRO(4)
|
||||
// Content is checked.
|
||||
#define NS_EVENT_STATE_CHECKED NS_DEFINE_EVENT_STATE_MACRO(5)
|
||||
// Content is enabled (and can be disabled).
|
||||
#define NS_EVENT_STATE_ENABLED NS_DEFINE_EVENT_STATE_MACRO(6)
|
||||
// Content is disabled.
|
||||
#define NS_EVENT_STATE_DISABLED NS_DEFINE_EVENT_STATE_MACRO(7)
|
||||
// Content is required.
|
||||
#define NS_EVENT_STATE_REQUIRED NS_DEFINE_EVENT_STATE_MACRO(8)
|
||||
// Content is optional (and can be required).
|
||||
#define NS_EVENT_STATE_OPTIONAL NS_DEFINE_EVENT_STATE_MACRO(9)
|
||||
// Link has been visited.
|
||||
#define NS_EVENT_STATE_VISITED NS_DEFINE_EVENT_STATE_MACRO(10)
|
||||
// Link hasn't been visited.
|
||||
#define NS_EVENT_STATE_UNVISITED NS_DEFINE_EVENT_STATE_MACRO(11)
|
||||
// Content is valid (and can be invalid).
|
||||
#define NS_EVENT_STATE_VALID NS_DEFINE_EVENT_STATE_MACRO(12)
|
||||
// Content is invalid.
|
||||
#define NS_EVENT_STATE_INVALID NS_DEFINE_EVENT_STATE_MACRO(13)
|
||||
// Content value is in-range (and can be out-of-range).
|
||||
#define NS_EVENT_STATE_INRANGE NS_DEFINE_EVENT_STATE_MACRO(14)
|
||||
// Content value is out-of-range.
|
||||
#define NS_EVENT_STATE_OUTOFRANGE NS_DEFINE_EVENT_STATE_MACRO(15)
|
||||
// These two are temporary (see bug 302188)
|
||||
// Content is read-only.
|
||||
#define NS_EVENT_STATE_MOZ_READONLY NS_DEFINE_EVENT_STATE_MACRO(16)
|
||||
// Content is editable.
|
||||
#define NS_EVENT_STATE_MOZ_READWRITE NS_DEFINE_EVENT_STATE_MACRO(17)
|
||||
// Content is the default one (meaning depends of the context).
|
||||
#define NS_EVENT_STATE_DEFAULT NS_DEFINE_EVENT_STATE_MACRO(18)
|
||||
// Content could not be rendered (image/object/etc).
|
||||
#define NS_EVENT_STATE_BROKEN NS_DEFINE_EVENT_STATE_MACRO(19)
|
||||
// Content disabled by the user (images turned off, say).
|
||||
#define NS_EVENT_STATE_USERDISABLED NS_DEFINE_EVENT_STATE_MACRO(20)
|
||||
// Content suppressed by the user (ad blocking, etc).
|
||||
#define NS_EVENT_STATE_SUPPRESSED NS_DEFINE_EVENT_STATE_MACRO(21)
|
||||
// Content is still loading such that there is nothing to show the
|
||||
// user (eg an image which hasn't started coming in yet).
|
||||
#define NS_EVENT_STATE_LOADING NS_DEFINE_EVENT_STATE_MACRO(22)
|
||||
// Content is of a type that gecko can't handle.
|
||||
#define NS_EVENT_STATE_TYPE_UNSUPPORTED NS_DEFINE_EVENT_STATE_MACRO(23)
|
||||
#ifdef MOZ_MATHML
|
||||
#define NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL NS_DEFINE_EVENT_STATE_MACRO(24)
|
||||
#endif
|
||||
// Handler for the content has been blocked.
|
||||
#define NS_EVENT_STATE_HANDLER_BLOCKED NS_DEFINE_EVENT_STATE_MACRO(25)
|
||||
// Handler for the content has been disabled.
|
||||
#define NS_EVENT_STATE_HANDLER_DISABLED NS_DEFINE_EVENT_STATE_MACRO(26)
|
||||
// Content is in the indeterminate state.
|
||||
#define NS_EVENT_STATE_INDETERMINATE NS_DEFINE_EVENT_STATE_MACRO(27)
|
||||
// Handler for the content has crashed
|
||||
#define NS_EVENT_STATE_HANDLER_CRASHED NS_DEFINE_EVENT_STATE_MACRO(28)
|
||||
// Content has focus and should show a ring.
|
||||
#define NS_EVENT_STATE_FOCUSRING NS_DEFINE_EVENT_STATE_MACRO(29)
|
||||
// Content shows its placeholder
|
||||
#define NS_EVENT_STATE_MOZ_PLACEHOLDER NS_DEFINE_EVENT_STATE_MACRO(30)
|
||||
// Content is a submit control and the form isn't valid.
|
||||
#define NS_EVENT_STATE_MOZ_SUBMITINVALID NS_DEFINE_EVENT_STATE_MACRO(31)
|
||||
|
||||
/**
|
||||
* NOTE: do not go over 63 without updating nsEventStates::InternalType!
|
||||
*/
|
||||
|
||||
#endif // nsEventStates_h__
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "nsEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsEventStates.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
@ -53,10 +54,9 @@ class imgIContainer;
|
||||
/*
|
||||
* Event state manager interface.
|
||||
*/
|
||||
// {92EDD580-062E-4471-ADEB-68329B0EC2E4}
|
||||
#define NS_IEVENTSTATEMANAGER_IID \
|
||||
{ 0x92edd580, 0x062e, 0x4471, \
|
||||
{ 0xad, 0xeb, 0x68, 0x32, 0x9b, 0x0e, 0xc2, 0xe4 } }
|
||||
{0x69ab5b16, 0x6690, 0x42fc, \
|
||||
{ 0xa9, 0xe5, 0xa3, 0xb4, 0xf8, 0x0f, 0xcb, 0xa6 } }
|
||||
|
||||
#define NS_EVENT_NEEDS_FRAME(event) (!NS_IS_ACTIVATION_EVENT(event))
|
||||
|
||||
@ -95,8 +95,8 @@ public:
|
||||
* will pretend that those states are also set on aContent.
|
||||
* @return The content state.
|
||||
*/
|
||||
virtual PRInt32 GetContentState(nsIContent *aContent,
|
||||
PRBool aFollowLabels = PR_FALSE) = 0;
|
||||
virtual nsEventStates GetContentState(nsIContent *aContent,
|
||||
PRBool aFollowLabels = PR_FALSE) = 0;
|
||||
|
||||
/**
|
||||
* Notify that the given NS_EVENT_STATE_* bit has changed for this content.
|
||||
@ -110,7 +110,7 @@ public:
|
||||
* frame reconstructions that may occur, but this does not
|
||||
* affect the return value.
|
||||
*/
|
||||
virtual PRBool SetContentState(nsIContent *aContent, PRInt32 aState) = 0;
|
||||
virtual PRBool SetContentState(nsIContent *aContent, nsEventStates aState) = 0;
|
||||
|
||||
NS_IMETHOD ContentRemoved(nsIDocument* aDocument, nsIContent* aContent) = 0;
|
||||
NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK) = 0;
|
||||
@ -161,75 +161,4 @@ public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventStateManager, NS_IEVENTSTATEMANAGER_IID)
|
||||
|
||||
#define NS_EVENT_STATE_ACTIVE (1 << 0) // mouse is down on content
|
||||
#define NS_EVENT_STATE_FOCUS (1 << 1) // content has focus
|
||||
#define NS_EVENT_STATE_HOVER (1 << 2) // mouse is hovering over content
|
||||
#define NS_EVENT_STATE_DRAGOVER (1 << 3) // drag is hovering over content
|
||||
#define NS_EVENT_STATE_URLTARGET (1 << 4) // content is URL's target (ref)
|
||||
|
||||
// The following states are used only for ContentStatesChanged
|
||||
|
||||
#define NS_EVENT_STATE_CHECKED (1 << 5) // CSS3-Selectors
|
||||
#define NS_EVENT_STATE_ENABLED (1 << 6) // CSS3-Selectors
|
||||
#define NS_EVENT_STATE_DISABLED (1 << 7) // CSS3-Selectors
|
||||
#define NS_EVENT_STATE_REQUIRED (1 << 8) // CSS3-UI
|
||||
#define NS_EVENT_STATE_OPTIONAL (1 << 9) // CSS3-UI
|
||||
#define NS_EVENT_STATE_VISITED (1 << 10) // CSS2
|
||||
#define NS_EVENT_STATE_UNVISITED (1 << 11)
|
||||
#define NS_EVENT_STATE_VALID (1 << 12) // CSS3-UI
|
||||
#define NS_EVENT_STATE_INVALID (1 << 13) // CSS3-UI
|
||||
#define NS_EVENT_STATE_INRANGE (1 << 14) // CSS3-UI
|
||||
#define NS_EVENT_STATE_OUTOFRANGE (1 << 15) // CSS3-UI
|
||||
// these two are temporary (see bug 302188)
|
||||
#define NS_EVENT_STATE_MOZ_READONLY (1 << 16) // CSS3-UI
|
||||
#define NS_EVENT_STATE_MOZ_READWRITE (1 << 17) // CSS3-UI
|
||||
#define NS_EVENT_STATE_DEFAULT (1 << 18) // CSS3-UI
|
||||
|
||||
// Content could not be rendered (image/object/etc).
|
||||
#define NS_EVENT_STATE_BROKEN (1 << 19)
|
||||
// Content disabled by the user (images turned off, say)
|
||||
#define NS_EVENT_STATE_USERDISABLED (1 << 20)
|
||||
// Content suppressed by the user (ad blocking, etc)
|
||||
#define NS_EVENT_STATE_SUPPRESSED (1 << 21)
|
||||
// Content is still loading such that there is nothing to show the
|
||||
// user (eg an image which hasn't started coming in yet)
|
||||
#define NS_EVENT_STATE_LOADING (1 << 22)
|
||||
// Content is of a type that gecko can't handle
|
||||
#define NS_EVENT_STATE_TYPE_UNSUPPORTED \
|
||||
(1 << 23)
|
||||
#ifdef MOZ_MATHML
|
||||
#define NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL \
|
||||
(1 << 24)
|
||||
#endif
|
||||
// Handler for the content has been blocked
|
||||
#define NS_EVENT_STATE_HANDLER_BLOCKED \
|
||||
(1 << 25)
|
||||
// Handler for the content has been disabled
|
||||
#define NS_EVENT_STATE_HANDLER_DISABLED \
|
||||
(1 << 26)
|
||||
|
||||
#define NS_EVENT_STATE_INDETERMINATE (1 << 27) // CSS3-Selectors
|
||||
|
||||
// Handler for the content has crashed
|
||||
#define NS_EVENT_STATE_HANDLER_CRASHED \
|
||||
(1 << 28)
|
||||
|
||||
// content has focus and should show a ring
|
||||
#define NS_EVENT_STATE_FOCUSRING (1 << 29)
|
||||
|
||||
// Content shows its placeholder
|
||||
#define NS_EVENT_STATE_MOZ_PLACEHOLDER (1 << 30)
|
||||
|
||||
// Content is a submit control and the form isn't valid.
|
||||
#define NS_EVENT_STATE_MOZ_SUBMITINVALID (1U << 31)
|
||||
|
||||
/**
|
||||
* WARNING:
|
||||
* (1U << 31) should work but we currently handle event states with PRInt32
|
||||
* so it's an edge case.
|
||||
* DO NOT ADD AN EVENT STATE after NS_EVENT_STATE_MOZ_SUBMITINVALID until we
|
||||
* move to PRUint64 and we introduce a type to handle event states.
|
||||
* See bug 595036.
|
||||
*/
|
||||
|
||||
#endif // nsIEventStateManager_h__
|
||||
|
@ -4159,10 +4159,10 @@ IsAncestorOf(nsIContent* aPossibleAncestor, nsIContent* aPossibleDescendant,
|
||||
return false;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsEventStateManager::GetContentState(nsIContent *aContent, PRBool aFollowLabels)
|
||||
{
|
||||
PRInt32 state = aContent->IntrinsicState();
|
||||
nsEventStates state = aContent->IntrinsicState();
|
||||
|
||||
if (IsAncestorOf(aContent, mActiveContent, aFollowLabels)) {
|
||||
state |= NS_EVENT_STATE_ACTIVE;
|
||||
@ -4239,7 +4239,7 @@ static nsIContent* FindCommonAncestor(nsIContent *aNode1, nsIContent *aNode2)
|
||||
|
||||
static void
|
||||
NotifyAncestors(nsIDocument* aDocument, nsIContent* aStartNode,
|
||||
nsIContent* aStopBefore, PRInt32 aState)
|
||||
nsIContent* aStopBefore, nsEventStates aState)
|
||||
{
|
||||
while (aStartNode && aStartNode != aStopBefore) {
|
||||
aDocument->ContentStatesChanged(aStartNode, nsnull, aState);
|
||||
@ -4252,7 +4252,7 @@ NotifyAncestors(nsIDocument* aDocument, nsIContent* aStartNode,
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
||||
nsEventStateManager::SetContentState(nsIContent *aContent, nsEventStates aState)
|
||||
{
|
||||
const PRInt32 maxNotify = 5;
|
||||
// We must initialize this array with memset for the sake of the boneheaded
|
||||
@ -4270,20 +4270,20 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if ((aState & NS_EVENT_STATE_DRAGOVER) && (aContent != mDragOverContent)) {
|
||||
if (aState.HasState(NS_EVENT_STATE_DRAGOVER) && aContent != mDragOverContent) {
|
||||
notifyContent[3] = mDragOverContent; // notify dragover first, since more common case
|
||||
NS_IF_ADDREF(notifyContent[3]);
|
||||
mDragOverContent = aContent;
|
||||
}
|
||||
|
||||
if ((aState & NS_EVENT_STATE_URLTARGET) && (aContent != mURLTargetContent)) {
|
||||
if (aState.HasState(NS_EVENT_STATE_URLTARGET) && aContent != mURLTargetContent) {
|
||||
notifyContent[4] = mURLTargetContent;
|
||||
NS_IF_ADDREF(notifyContent[4]);
|
||||
mURLTargetContent = aContent;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> commonActiveAncestor, oldActive, newActive;
|
||||
if ((aState & NS_EVENT_STATE_ACTIVE) && (aContent != mActiveContent)) {
|
||||
if (aState.HasState(NS_EVENT_STATE_ACTIVE) && aContent != mActiveContent) {
|
||||
oldActive = mActiveContent;
|
||||
newActive = aContent;
|
||||
commonActiveAncestor = FindCommonAncestor(mActiveContent, aContent);
|
||||
@ -4291,7 +4291,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> commonHoverAncestor, oldHover, newHover;
|
||||
if ((aState & NS_EVENT_STATE_HOVER) && (aContent != mHoverContent)) {
|
||||
if (aState.HasState(NS_EVENT_STATE_HOVER) && aContent != mHoverContent) {
|
||||
oldHover = mHoverContent;
|
||||
|
||||
if (!mPresContext || mPresContext->IsDynamic()) {
|
||||
@ -4315,15 +4315,16 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
||||
mHoverContent = aContent;
|
||||
}
|
||||
|
||||
if (aState & NS_EVENT_STATE_FOCUS) {
|
||||
if (aState.HasState(NS_EVENT_STATE_FOCUS)) {
|
||||
aState |= NS_EVENT_STATE_FOCUSRING;
|
||||
notifyContent[2] = aContent;
|
||||
NS_IF_ADDREF(notifyContent[2]);
|
||||
}
|
||||
|
||||
PRInt32 simpleStates = aState & ~(NS_EVENT_STATE_ACTIVE|NS_EVENT_STATE_HOVER);
|
||||
nsEventStates simpleStates = aState;
|
||||
simpleStates &= ~(NS_EVENT_STATE_ACTIVE|NS_EVENT_STATE_HOVER);
|
||||
|
||||
if (aContent && simpleStates != 0) {
|
||||
if (aContent && !simpleStates.IsEmpty()) {
|
||||
// notify about new content too
|
||||
notifyContent[0] = aContent;
|
||||
NS_ADDREF(aContent); // everything in notify array has a ref
|
||||
|
@ -118,9 +118,9 @@ public:
|
||||
NS_IMETHOD GetEventTarget(nsIFrame **aFrame);
|
||||
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
|
||||
|
||||
virtual PRInt32 GetContentState(nsIContent *aContent,
|
||||
PRBool aFollowLabels = PR_FALSE);
|
||||
virtual PRBool SetContentState(nsIContent *aContent, PRInt32 aState);
|
||||
virtual nsEventStates GetContentState(nsIContent *aContent,
|
||||
PRBool aFollowLabels = PR_FALSE);
|
||||
virtual PRBool SetContentState(nsIContent *aContent, nsEventStates aState);
|
||||
NS_IMETHOD ContentRemoved(nsIDocument* aDocument, nsIContent* aContent);
|
||||
NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK);
|
||||
|
||||
|
@ -2730,13 +2730,13 @@ nsGenericHTMLFormElement::IsSubmittableControl() const
|
||||
type & NS_FORM_INPUT_ELEMENT;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsGenericHTMLFormElement::IntrinsicState() const
|
||||
{
|
||||
// If you add attribute-dependent states here, you need to add them them to
|
||||
// AfterSetAttr too. And add them to AfterSetAttr for all subclasses that
|
||||
// implement IntrinsicState() and are affected by that attribute.
|
||||
PRInt32 state = nsGenericHTMLElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLElement::IntrinsicState();
|
||||
|
||||
if (CanBeDisabled()) {
|
||||
// :enabled/:disabled
|
||||
@ -2949,7 +2949,7 @@ nsGenericHTMLFormElement::UpdateFieldSet()
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLFormElement::FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify)
|
||||
nsGenericHTMLFormElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
|
||||
{
|
||||
if (!aNotify) {
|
||||
return;
|
||||
@ -3457,7 +3457,7 @@ nsGenericHTMLElement::IsEditableRoot() const
|
||||
static void
|
||||
MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
|
||||
{
|
||||
PRInt32 stateBefore = aContent->IntrinsicState();
|
||||
nsEventStates stateBefore = aContent->IntrinsicState();
|
||||
|
||||
aContent->UpdateEditableState();
|
||||
|
||||
|
@ -846,7 +846,7 @@ public:
|
||||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||
PRBool aNullParent = PR_TRUE);
|
||||
virtual PRUint32 GetDesiredIMEState();
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
|
||||
@ -864,14 +864,14 @@ public:
|
||||
* @note Classes redefining this method should not call ContentStatesChanged
|
||||
* but they should pass aStates instead.
|
||||
*/
|
||||
virtual void FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify);
|
||||
virtual void FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify);
|
||||
|
||||
void FieldSetFirstLegendChanged(PRBool aNotify) {
|
||||
UpdateFieldSet();
|
||||
|
||||
// The disabled state may have change because the element might not be in
|
||||
// the first legend anymore.
|
||||
FieldSetDisabledChanged(0, aNotify);
|
||||
FieldSetDisabledChanged(nsEventStates(), aNotify);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
};
|
||||
@ -479,7 +479,7 @@ nsHTMLAnchorElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
aResult);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLAnchorElement::IntrinsicState() const
|
||||
{
|
||||
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
};
|
||||
@ -331,7 +331,7 @@ nsHTMLAreaElement::GetHrefURI() const
|
||||
return GetHrefURIForAnchors();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLAreaElement::IntrinsicState() const
|
||||
{
|
||||
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
||||
|
@ -110,9 +110,9 @@ public:
|
||||
NS_IMETHOD SaveState();
|
||||
PRBool RestoreState(nsPresState* aState);
|
||||
|
||||
virtual void FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify);
|
||||
virtual void FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify);
|
||||
|
||||
PRInt32 IntrinsicState() const;
|
||||
nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
@ -639,7 +639,7 @@ nsresult
|
||||
nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, PRBool aNotify)
|
||||
{
|
||||
PRInt32 states = 0;
|
||||
nsEventStates states;
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::type) {
|
||||
@ -655,7 +655,7 @@ nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
states |= NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID;
|
||||
}
|
||||
|
||||
if (aNotify && states) {
|
||||
if (aNotify && !states.IsEmpty()) {
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
@ -696,10 +696,10 @@ nsHTMLButtonElement::RestoreState(nsPresState* aState)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLButtonElement::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
|
||||
if (IsCandidateForConstraintValidation()) {
|
||||
state |= IsValid() ? NS_EVENT_STATE_VALID : NS_EVENT_STATE_INVALID;
|
||||
@ -738,7 +738,7 @@ nsHTMLButtonElement::UpdateBarredFromConstraintValidation()
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLButtonElement::FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify)
|
||||
nsHTMLButtonElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
|
||||
{
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
||||
|
@ -122,7 +122,7 @@ nsHTMLFieldSetElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
PRUint32 length = mElements->Length(PR_TRUE);
|
||||
for (PRUint32 i=0; i<length; ++i) {
|
||||
static_cast<nsGenericHTMLFormElement*>(mElements->GetNodeAt(i))
|
||||
->FieldSetDisabledChanged(0, aNotify);
|
||||
->FieldSetDisabledChanged(nsEventStates(), aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
nsIContent* aBindingParent,
|
||||
PRBool aCompileEventHandlers);
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
nsresult CopyInnerTo(nsGenericElement* aDest) const;
|
||||
@ -583,7 +583,7 @@ nsHTMLImageElement::MaybeLoadImage()
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLImageElement::IntrinsicState() const
|
||||
{
|
||||
return nsGenericHTMLElement::IntrinsicState() |
|
||||
|
@ -799,7 +799,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
PRBool aNotify)
|
||||
{
|
||||
// States changes that have to be passed to ContentStatesChanged().
|
||||
PRInt32 states = 0;
|
||||
nsEventStates states;
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
//
|
||||
@ -932,7 +932,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
states |= NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_MOZ_READWRITE;
|
||||
}
|
||||
|
||||
if (doc && states) {
|
||||
if (doc && !states.IsEmpty()) {
|
||||
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
doc->ContentStatesChanged(this, nsnull, states);
|
||||
}
|
||||
@ -3257,13 +3257,13 @@ nsHTMLInputElement::DoneCreatingElement()
|
||||
SET_BOOLBIT(mBitField, BF_SHOULD_INIT_CHECKED, PR_FALSE);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLInputElement::IntrinsicState() const
|
||||
{
|
||||
// If you add states here, and they're type-dependent, you need to add them
|
||||
// to the type case in AfterSetAttr.
|
||||
|
||||
PRInt32 state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
if (mType == NS_FORM_INPUT_CHECKBOX || mType == NS_FORM_INPUT_RADIO) {
|
||||
// Check current checked state (:checked)
|
||||
if (GET_BOOLBIT(mBitField, BF_CHECKED)) {
|
||||
@ -4413,7 +4413,7 @@ nsHTMLInputElement::OnValueChanged(PRBool aNotify)
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLInputElement::FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify)
|
||||
nsHTMLInputElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
|
||||
{
|
||||
UpdateValueMissingValidityState();
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
@ -159,7 +159,7 @@ public:
|
||||
virtual PRBool RestoreState(nsPresState* aState);
|
||||
virtual PRBool AllowDrop();
|
||||
|
||||
virtual void FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify);
|
||||
virtual void FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify);
|
||||
|
||||
// nsIContent
|
||||
virtual PRBool IsHTMLFocusable(PRBool aWithMouse, PRBool *aIsFocusable, PRInt32 *aTabIndex);
|
||||
@ -184,7 +184,7 @@ public:
|
||||
|
||||
virtual void DoneCreatingElement();
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
// nsITextControlElement
|
||||
NS_IMETHOD SetValueChanged(PRBool aValueChanged);
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
protected:
|
||||
@ -444,7 +444,7 @@ nsHTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLLinkElement::IntrinsicState() const
|
||||
{
|
||||
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
nsAttrValue &aResult);
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom *aAttribute) const;
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
virtual void DestroyContent();
|
||||
|
||||
// nsObjectLoadingContent
|
||||
@ -524,7 +524,7 @@ nsHTMLObjectElement::StartObjectLoad(PRBool aNotify)
|
||||
SetIsNetworkCreated(PR_FALSE);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLObjectElement::IntrinsicState() const
|
||||
{
|
||||
return nsGenericHTMLFormElement::IntrinsicState() | ObjectState();
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
// nsIContent
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
@ -194,10 +194,10 @@ nsHTMLOptGroupElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMu
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLOptGroupElement::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsGenericHTMLElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLElement::IntrinsicState();
|
||||
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
|
||||
state |= NS_EVENT_STATE_DISABLED;
|
||||
|
@ -338,10 +338,10 @@ nsHTMLOptionElement::SetText(const nsAString& aText)
|
||||
return nsContentUtils::SetNodeTextContent(this, aText, PR_TRUE);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLOptionElement::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsGenericHTMLElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLElement::IntrinsicState();
|
||||
// Nasty hack because we need to call an interface method, and one that
|
||||
// toggles some of our hidden internal state at that! Would that we could
|
||||
// use |mutable|.
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
void SetSelectedInternal(PRBool aValue, PRBool aNotify);
|
||||
|
||||
// nsIContent
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
|
@ -1490,10 +1490,10 @@ nsHTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
return nsGenericHTMLFormElement::PreHandleEvent(aVisitor);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLSelectElement::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
|
||||
if (IsCandidateForConstraintValidation()) {
|
||||
state |= IsValid() ? NS_EVENT_STATE_VALID : NS_EVENT_STATE_INVALID;
|
||||
@ -2098,7 +2098,7 @@ nsHTMLSelectElement::UpdateBarredFromConstraintValidation()
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLSelectElement::FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify)
|
||||
nsHTMLSelectElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
|
||||
{
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
||||
|
@ -277,9 +277,9 @@ public:
|
||||
NS_IMETHOD SaveState();
|
||||
virtual PRBool RestoreState(nsPresState* aState);
|
||||
|
||||
virtual void FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify);
|
||||
virtual void FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify);
|
||||
|
||||
PRInt32 IntrinsicState() const;
|
||||
nsEventStates IntrinsicState() const;
|
||||
|
||||
// nsISelectElement
|
||||
NS_DECL_NSISELECTELEMENT
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
nsAttrValue &aResult);
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom *aAttribute) const;
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
virtual void DestroyContent();
|
||||
|
||||
// nsObjectLoadingContent
|
||||
@ -455,7 +455,7 @@ nsHTMLSharedObjectElement::StartObjectLoad(PRBool aNotify)
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLSharedObjectElement::IntrinsicState() const
|
||||
{
|
||||
return nsGenericHTMLElement::IntrinsicState() | ObjectState();
|
||||
|
@ -131,9 +131,9 @@ public:
|
||||
NS_IMETHOD SaveState();
|
||||
virtual PRBool RestoreState(nsPresState* aState);
|
||||
|
||||
virtual void FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify);
|
||||
virtual void FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify);
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
// nsITextControlElemet
|
||||
NS_IMETHOD SetValueChanged(PRBool aValueChanged);
|
||||
@ -989,10 +989,10 @@ nsHTMLTextAreaElement::RestoreState(nsPresState* aState)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsHTMLTextAreaElement::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
|
||||
state |= NS_EVENT_STATE_REQUIRED;
|
||||
@ -1109,7 +1109,7 @@ nsresult
|
||||
nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, PRBool aNotify)
|
||||
{
|
||||
PRInt32 states = 0;
|
||||
nsEventStates states;
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||
|
||||
@ -1136,7 +1136,7 @@ nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
states |= NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_MOZ_READWRITE;
|
||||
}
|
||||
|
||||
if (doc && states) {
|
||||
if (doc && !states.IsEmpty()) {
|
||||
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
doc->ContentStatesChanged(this, nsnull, states);
|
||||
}
|
||||
@ -1405,7 +1405,7 @@ nsHTMLTextAreaElement::OnValueChanged(PRBool aNotify)
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLTextAreaElement::FieldSetDisabledChanged(PRInt32 aStates, PRBool aNotify)
|
||||
nsHTMLTextAreaElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
|
||||
{
|
||||
UpdateValueMissingValidityState();
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
@ -436,11 +436,11 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsMathMLElement)
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsMathMLElement::IntrinsicState() const
|
||||
{
|
||||
return nsMathMLElementBase::IntrinsicState() |
|
||||
(mIncrementScriptLevel ? NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : 0);
|
||||
(mIncrementScriptLevel ? NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : nsEventStates());
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
nsRuleData* aRuleData);
|
||||
|
||||
nsresult Clone(nsINodeInfo*, nsINode**) const;
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
||||
// Set during reflow as necessary. Does a style change notification,
|
||||
|
@ -276,7 +276,7 @@ nsSVGAElement::GetLinkTarget(nsAString& aTarget)
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsSVGAElement::IntrinsicState() const
|
||||
{
|
||||
return Link::LinkState() | nsSVGAElementBase::IntrinsicState();
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
virtual void GetLinkTarget(nsAString& aTarget);
|
||||
virtual nsLinkState GetLinkState() const;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const;
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, PRBool aNotify)
|
||||
{
|
||||
|
@ -5337,7 +5337,7 @@ public:
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
PRBool aCompileEventHandlers);
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
// imgIDecoderObserver
|
||||
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
|
||||
@ -5488,7 +5488,7 @@ nsSVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsSVGFEImageElement::IntrinsicState() const
|
||||
{
|
||||
return nsSVGFEImageElementBase::IntrinsicState() |
|
||||
|
@ -212,7 +212,7 @@ nsSVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsSVGImageElement::IntrinsicState() const
|
||||
{
|
||||
return nsSVGImageElementBase::IntrinsicState() |
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
nsIContent* aBindingParent,
|
||||
PRBool aCompileEventHandlers);
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
|
@ -543,13 +543,13 @@ nsXTFElementWrapper::GetExistingAttrNameFromQName(const nsAString& aStr) const
|
||||
return nodeInfo;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsXTFElementWrapper::IntrinsicState() const
|
||||
{
|
||||
PRInt32 retState = nsXTFElementWrapperBase::IntrinsicState();
|
||||
if (mIntrinsicState & NS_EVENT_STATE_MOZ_READONLY) {
|
||||
nsEventStates retState = nsXTFElementWrapperBase::IntrinsicState();
|
||||
if (mIntrinsicState.HasState(NS_EVENT_STATE_MOZ_READONLY)) {
|
||||
retState &= ~NS_EVENT_STATE_MOZ_READWRITE;
|
||||
} else if (mIntrinsicState & NS_EVENT_STATE_MOZ_READWRITE) {
|
||||
} else if (mIntrinsicState.HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
|
||||
retState &= ~NS_EVENT_STATE_MOZ_READONLY;
|
||||
}
|
||||
|
||||
@ -901,21 +901,22 @@ nsXTFElementWrapper::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXTFElementWrapper::SetIntrinsicState(PRUint64 aNewState)
|
||||
nsXTFElementWrapper::SetIntrinsicState(nsEventStates::InternalType aNewState)
|
||||
{
|
||||
nsIDocument *doc = GetCurrentDoc();
|
||||
PRUint64 bits = mIntrinsicState ^ aNewState;
|
||||
|
||||
if (!doc || !bits)
|
||||
nsEventStates newStates(aNewState);
|
||||
nsEventStates bits = mIntrinsicState ^ newStates;
|
||||
|
||||
if (!doc || bits.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
NS_WARN_IF_FALSE(!((aNewState & NS_EVENT_STATE_MOZ_READONLY) &&
|
||||
(aNewState & NS_EVENT_STATE_MOZ_READWRITE)),
|
||||
NS_WARN_IF_FALSE(!newStates.HasAllStates(NS_EVENT_STATE_MOZ_READONLY |
|
||||
NS_EVENT_STATE_MOZ_READWRITE),
|
||||
"Both READONLY and READWRITE are being set. Yikes!!!");
|
||||
|
||||
mIntrinsicState = aNewState;
|
||||
mIntrinsicState = newStates;
|
||||
mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
doc->ContentStatesChanged(this, nsnull, (PRInt32)bits);
|
||||
doc->ContentStatesChanged(this, nsnull, bits);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
PRUint32 GetAttrCount() const;
|
||||
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual void BeginAddingChildren();
|
||||
virtual nsresult DoneAddingChildren(PRBool aHaveNotified);
|
||||
@ -187,7 +187,7 @@ protected:
|
||||
* The intrinsic state of the element.
|
||||
* @see nsIContent::IntrinsicState()
|
||||
*/
|
||||
PRUint64 mIntrinsicState;
|
||||
nsEventStates mIntrinsicState;
|
||||
|
||||
// Temporary owner used by GetAttrNameAt
|
||||
nsAttrName mTmpAttrName;
|
||||
|
@ -1355,9 +1355,9 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify)
|
||||
|
||||
// When notifying, make sure to keep track of states whose value
|
||||
// depends solely on the value of an attribute.
|
||||
PRUint32 stateMask;
|
||||
nsEventStates stateMask;
|
||||
if (aNotify) {
|
||||
stateMask = PRUint32(IntrinsicState());
|
||||
stateMask = IntrinsicState();
|
||||
|
||||
nsNodeUtils::AttributeWillChange(this, aNameSpaceID, aName,
|
||||
nsIDOMMutationEvent::REMOVAL);
|
||||
@ -1459,8 +1459,8 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify)
|
||||
}
|
||||
|
||||
if (aNotify) {
|
||||
stateMask = stateMask ^ PRUint32(IntrinsicState());
|
||||
if (stateMask && doc) {
|
||||
stateMask ^= IntrinsicState();
|
||||
if (doc && !stateMask.IsEmpty()) {
|
||||
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, aNotify);
|
||||
doc->ContentStatesChanged(this, nsnull, stateMask);
|
||||
}
|
||||
@ -2239,10 +2239,10 @@ nsXULElement::AddPopupListener(nsIAtom* aName)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsXULElement::IntrinsicState() const
|
||||
{
|
||||
PRInt32 state = nsStyledElement::IntrinsicState();
|
||||
nsEventStates state = nsStyledElement::IntrinsicState();
|
||||
|
||||
const nsIAtom* tag = Tag();
|
||||
if (GetNameSpaceID() == kNameSpaceID_XUL &&
|
||||
|
@ -564,7 +564,7 @@ public:
|
||||
NS_DECL_NSIDOMXULELEMENT
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
nsresult EnsureLocalStyle();
|
||||
|
||||
|
@ -3909,7 +3909,7 @@ nsHTMLEditor::IsModifiableNode(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
|
||||
return !content || !(content->IntrinsicState() & NS_EVENT_STATE_MOZ_READONLY);
|
||||
return !content || !content->IntrinsicState().HasState(NS_EVENT_STATE_MOZ_READONLY);
|
||||
}
|
||||
|
||||
static nsresult SetSelectionAroundHeadChildren(nsCOMPtr<nsISelection> aSelection, nsWeakPtr aDocWeak)
|
||||
|
@ -1160,7 +1160,7 @@ mozInlineSpellChecker::SkipSpellCheckForNode(nsIEditor* aEditor,
|
||||
else {
|
||||
// XXX Do we really want this for all read-write content?
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
*checkSpelling = !!(content->IntrinsicState() & NS_EVENT_STATE_MOZ_READWRITE);
|
||||
*checkSpelling = content->IntrinsicState().HasState(NS_EVENT_STATE_MOZ_READWRITE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1883,7 +1883,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
|
||||
nsIContent* const content = aItem.mContent;
|
||||
nsStyleContext* const styleContext = aItem.mStyleContext;
|
||||
const PRUint32 nameSpaceID = aItem.mNameSpaceID;
|
||||
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// create the pseudo SC for the outer table as a child of the inner SC
|
||||
@ -3650,9 +3650,9 @@ nsCSSFrameConstructor::FindObjectData(nsIContent* aContent,
|
||||
// cases when the object is broken/suppressed/etc (e.g. a broken image), but
|
||||
// we want to treat those cases as TYPE_NULL
|
||||
PRUint32 type;
|
||||
if (aContent->IntrinsicState() &
|
||||
(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED)) {
|
||||
if (aContent->IntrinsicState().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
|
||||
NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED)) {
|
||||
type = nsIObjectLoadingContent::TYPE_NULL;
|
||||
} else {
|
||||
nsCOMPtr<nsIObjectLoadingContent> objContent(do_QueryInterface(aContent));
|
||||
@ -8035,7 +8035,7 @@ nsCSSFrameConstructor::RestyleElement(Element *aElement,
|
||||
nsresult
|
||||
nsCSSFrameConstructor::ContentStatesChanged(nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
// XXXbz it would be good if this function only took Elements, but
|
||||
// we'd have to make ESM guarantee that usefully.
|
||||
@ -8050,7 +8050,7 @@ nsCSSFrameConstructor::ContentStatesChanged(nsIContent* aContent1,
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::DoContentStateChanged(Element* aElement,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
nsStyleSet *styleSet = mPresShell->StyleSet();
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
@ -8067,8 +8067,10 @@ nsCSSFrameConstructor::DoContentStateChanged(Element* aElement,
|
||||
if (primaryFrame) {
|
||||
// If it's generated content, ignore LOADING/etc state changes on it.
|
||||
if (!primaryFrame->IsGeneratedContentFrame() &&
|
||||
(aStateMask & (NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED | NS_EVENT_STATE_LOADING))) {
|
||||
aStateMask.HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
|
||||
NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED |
|
||||
NS_EVENT_STATE_LOADING)) {
|
||||
hint = nsChangeHint_ReconstructFrame;
|
||||
} else {
|
||||
PRUint8 app = primaryFrame->GetStyleDisplay()->mAppearance;
|
||||
@ -8089,11 +8091,11 @@ nsCSSFrameConstructor::DoContentStateChanged(Element* aElement,
|
||||
nsRestyleHint rshint =
|
||||
styleSet->HasStateDependentStyle(presContext, aElement, aStateMask);
|
||||
|
||||
if ((aStateMask & NS_EVENT_STATE_HOVER) && rshint != 0) {
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_HOVER) && rshint != 0) {
|
||||
++mHoverGeneration;
|
||||
}
|
||||
|
||||
if (aStateMask & NS_EVENT_STATE_VISITED) {
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
// Exposing information to the page about whether the link is
|
||||
// visited or not isn't really something we can worry about here.
|
||||
// FIXME: We could probably do this a bit better.
|
||||
|
@ -235,9 +235,9 @@ public:
|
||||
nsresult CharacterDataChanged(nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo);
|
||||
|
||||
nsresult ContentStatesChanged(nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask);
|
||||
nsresult ContentStatesChanged(nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
nsEventStates aStateMask);
|
||||
|
||||
// generate the child frames and process bindings
|
||||
nsresult GenerateChildFrames(nsIFrame* aFrame);
|
||||
@ -416,7 +416,7 @@ private:
|
||||
nsIFrame*& aCanvasFrame);
|
||||
|
||||
void DoContentStateChanged(Element* aElement,
|
||||
PRInt32 aStateMask);
|
||||
nsEventStates aStateMask);
|
||||
|
||||
/* aMinHint is the minimal change that should be made to the element */
|
||||
// XXXbz do we really need the aPrimaryFrame argument here?
|
||||
|
@ -4953,7 +4953,7 @@ void
|
||||
PresShell::ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentStatesChanged");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
@ -4967,7 +4967,7 @@ PresShell::ContentStatesChanged(nsIDocument* aDocument,
|
||||
|
||||
void
|
||||
PresShell::DocumentStatesChanged(nsIDocument* aDocument,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
@ -4981,7 +4981,7 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
|
||||
VERIFY_STYLE_TREE;
|
||||
}
|
||||
|
||||
if (aStateMask & NS_DOCUMENT_STATE_WINDOW_INACTIVE) {
|
||||
if (aStateMask.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
|
||||
nsIFrame* root = FrameManager()->GetRootFrame();
|
||||
if (root) {
|
||||
// It's a display root. So, invalidate the layer contents of
|
||||
|
@ -89,7 +89,7 @@ nsButtonFrameRenderer::isDisabled()
|
||||
{
|
||||
// NOTE: we might want to remove this method to prevent calling too often
|
||||
// IntrinsicState().
|
||||
return (mFrame->GetContent()->IntrinsicState() & NS_EVENT_STATE_DISABLED) != 0;
|
||||
return mFrame->GetContent()->IntrinsicState().HasState(NS_EVENT_STATE_DISABLED);
|
||||
}
|
||||
|
||||
class nsDisplayButtonBoxShadowOuter : public nsDisplayItem {
|
||||
|
@ -728,8 +728,8 @@ nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
|
||||
void
|
||||
nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
|
||||
{
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if (eventStates & NS_EVENT_STATE_DISABLED) {
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -928,8 +928,8 @@ nsComboboxControlFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if (eventStates & NS_EVENT_STATE_DISABLED) {
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1386,8 +1386,8 @@ void nsComboboxControlFrame::PaintFocus(nsIRenderingContext& aRenderingContext,
|
||||
nsPoint aPt)
|
||||
{
|
||||
/* Do we need to do anything? */
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if ((eventStates & NS_EVENT_STATE_DISABLED) || mFocused != this)
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || mFocused != this)
|
||||
return;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
|
@ -681,8 +681,8 @@ nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// 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
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if ((eventStates & NS_EVENT_STATE_DISABLED) && IsVisibleForPainting(aBuilder)) {
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) && IsVisibleForPainting(aBuilder)) {
|
||||
rv = aLists.Content()->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayEventReceiver(aBuilder, this));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -1101,8 +1101,8 @@ nsListControlFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if (eventStates & NS_EVENT_STATE_DISABLED)
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED))
|
||||
return NS_OK;
|
||||
|
||||
return nsHTMLScrollFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
@ -1962,8 +1962,8 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
mButtonDown = PR_FALSE;
|
||||
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if (eventStates & NS_EVENT_STATE_DISABLED) {
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2172,8 +2172,8 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
UpdateInListState(aMouseEvent);
|
||||
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if (eventStates & NS_EVENT_STATE_DISABLED) {
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2479,8 +2479,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
NS_ASSERTION(aKeyEvent, "keyEvent is null.");
|
||||
|
||||
PRInt32 eventStates = mContent->IntrinsicState();
|
||||
if (eventStates & NS_EVENT_STATE_DISABLED)
|
||||
nsEventStates eventStates = mContent->IntrinsicState();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED))
|
||||
return NS_OK;
|
||||
|
||||
// Start by making sure we can query for a key event
|
||||
|
@ -448,17 +448,17 @@ nsImageFrame::SourceRectToDest(const nsIntRect& aRect)
|
||||
|
||||
// This is a macro so that we don't evaluate the boolean last arg
|
||||
// unless we have to; it can be expensive
|
||||
#define IMAGE_OK(_state, _loadingOK) \
|
||||
(((_state) & BAD_STATES) == 0 || \
|
||||
(((_state) & BAD_STATES) == NS_EVENT_STATE_LOADING && \
|
||||
(_loadingOK)))
|
||||
#define IMAGE_OK(_state, _loadingOK) \
|
||||
(!(_state).HasAtLeastOneOfStates(BAD_STATES) || \
|
||||
(!(_state).HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED) && \
|
||||
(_state).HasState(NS_EVENT_STATE_LOADING) && (_loadingOK)))
|
||||
|
||||
/* static */
|
||||
PRBool
|
||||
nsImageFrame::ShouldCreateImageFrameFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
PRInt32 state = aContent->IntrinsicState();
|
||||
nsEventStates state = aContent->IntrinsicState();
|
||||
if (IMAGE_OK(state,
|
||||
HaveFixedSize(aStyleContext->GetStylePosition()))) {
|
||||
// Image is fine; do the image frame thing
|
||||
@ -1261,7 +1261,7 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
getter_AddRefs(currentRequest));
|
||||
}
|
||||
|
||||
PRInt32 contentState = mContent->IntrinsicState();
|
||||
nsEventStates contentState = mContent->IntrinsicState();
|
||||
PRBool imageOK = IMAGE_OK(contentState, PR_TRUE);
|
||||
|
||||
nsCOMPtr<imgIContainer> imgCon;
|
||||
|
@ -232,7 +232,7 @@ inDOMUtils::GetBindingURLs(nsIDOMElement *aElement, nsIArray **_retval)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::SetContentState(nsIDOMElement *aElement, PRUint64 aState)
|
||||
inDOMUtils::SetContentState(nsIDOMElement *aElement, nsEventStates::InternalType aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
@ -241,14 +241,14 @@ inDOMUtils::SetContentState(nsIDOMElement *aElement, PRUint64 aState)
|
||||
nsCOMPtr<nsIContent> content;
|
||||
content = do_QueryInterface(aElement);
|
||||
|
||||
return esm->SetContentState(content, (PRInt32)aState);
|
||||
return esm->SetContentState(content, nsEventStates(aState));
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::GetContentState(nsIDOMElement *aElement, PRUint64* aState)
|
||||
inDOMUtils::GetContentState(nsIDOMElement *aElement, nsEventStates::InternalType* aState)
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
@ -258,7 +258,9 @@ inDOMUtils::GetContentState(nsIDOMElement *aElement, PRUint64* aState)
|
||||
if (esm) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
content = do_QueryInterface(aElement);
|
||||
*aState = esm->GetContentState(content);
|
||||
// NOTE: if this method is removed,
|
||||
// please remove GetInternalValue from nsEventStates
|
||||
*aState = esm->GetContentState(content).GetInternalValue();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ struct RuleCascadeData {
|
||||
RuleHash*
|
||||
mPseudoElementRuleHashes[nsCSSPseudoElements::ePseudo_PseudoElementCount];
|
||||
nsTArray<nsCSSSelector*> mStateSelectors;
|
||||
PRUint32 mSelectorDocumentStates;
|
||||
nsEventStates mSelectorDocumentStates;
|
||||
PLDHashTable mClassSelectors;
|
||||
nsTArray<nsCSSSelector*> mPossiblyNegatedClassSelectors;
|
||||
nsTArray<nsCSSSelector*> mIDSelectors;
|
||||
@ -1228,7 +1228,7 @@ const nsString* RuleProcessorData::GetLang()
|
||||
return mLanguage;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsEventStates
|
||||
RuleProcessorData::ContentState()
|
||||
{
|
||||
if (!mGotContentState) {
|
||||
@ -1243,15 +1243,15 @@ RuleProcessorData::ContentState()
|
||||
// expose that :visited support is disabled to the Web page.
|
||||
if ((!gSupportVisitedPseudo ||
|
||||
gPrivateBrowsingObserver->InPrivateBrowsing()) &&
|
||||
(mContentState & NS_EVENT_STATE_VISITED)) {
|
||||
mContentState = (mContentState & ~PRUint32(NS_EVENT_STATE_VISITED)) |
|
||||
NS_EVENT_STATE_UNVISITED;
|
||||
mContentState.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
mContentState &= ~NS_EVENT_STATE_VISITED;
|
||||
mContentState |= NS_EVENT_STATE_UNVISITED;
|
||||
}
|
||||
}
|
||||
return mContentState;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsEventStates
|
||||
RuleProcessorData::DocumentState()
|
||||
{
|
||||
return mElement->GetOwnerDoc()->GetDocumentState();
|
||||
@ -1260,20 +1260,19 @@ RuleProcessorData::DocumentState()
|
||||
PRBool
|
||||
RuleProcessorData::IsLink()
|
||||
{
|
||||
PRUint32 state = ContentState();
|
||||
return (state & (NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) != 0;
|
||||
nsEventStates state = ContentState();
|
||||
return state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED);
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsEventStates
|
||||
RuleProcessorData::GetContentStateForVisitedHandling(
|
||||
nsRuleWalker::VisitedHandlingType aVisitedHandling,
|
||||
PRBool aIsRelevantLink)
|
||||
{
|
||||
PRUint32 contentState = ContentState();
|
||||
if (contentState & (NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) {
|
||||
nsEventStates contentState = ContentState();
|
||||
if (contentState.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) {
|
||||
NS_ABORT_IF_FALSE(IsLink(), "IsLink() should match state");
|
||||
contentState &=
|
||||
~PRUint32(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED);
|
||||
contentState &= ~(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED);
|
||||
if (aIsRelevantLink) {
|
||||
switch (aVisitedHandling) {
|
||||
case nsRuleWalker::eRelevantLinkUnvisited:
|
||||
@ -1415,7 +1414,7 @@ struct NodeMatchContext {
|
||||
// we do separate notifications then we might determine the style is
|
||||
// not state-dependent when it really is (e.g., determining that a
|
||||
// :hover:active rule no longer matches when both states are unset).
|
||||
const PRInt32 mStateMask;
|
||||
const nsEventStates mStateMask;
|
||||
|
||||
// Is this link the unique link whose visitedness can affect the style
|
||||
// of the node being matched? (That link is the nearest link to the
|
||||
@ -1428,7 +1427,7 @@ struct NodeMatchContext {
|
||||
// mForStyling is false, we have to assume we don't know.)
|
||||
const PRBool mIsRelevantLink;
|
||||
|
||||
NodeMatchContext(PRInt32 aStateMask, PRBool aIsRelevantLink)
|
||||
NodeMatchContext(nsEventStates aStateMask, PRBool aIsRelevantLink)
|
||||
: mStateMask(aStateMask)
|
||||
, mIsRelevantLink(aIsRelevantLink)
|
||||
{
|
||||
@ -1630,21 +1629,21 @@ checkGenericEmptyMatches(RuleProcessorData& data,
|
||||
return (child == nsnull);
|
||||
}
|
||||
|
||||
// An array of the bits that are relevant for various pseudoclasses.
|
||||
static const PRUint32 sPseudoClassBits[] = {
|
||||
// An array of the states that are relevant for various pseudoclasses.
|
||||
static const nsEventStates sPseudoClassStates[] = {
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||
0,
|
||||
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _bit) \
|
||||
_bit,
|
||||
nsEventStates(),
|
||||
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _states) \
|
||||
_states,
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_STATE_PSEUDO_CLASS
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
// Add more entries for our fake values to make sure we can't
|
||||
// index out of bounds into this array no matter what.
|
||||
0,
|
||||
0
|
||||
nsEventStates(),
|
||||
nsEventStates()
|
||||
};
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassBits) ==
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassStates) ==
|
||||
nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1);
|
||||
|
||||
// |aDependence| has two functions:
|
||||
@ -1741,7 +1740,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
// generally quick to test, and thus earlier). If they were later,
|
||||
// we'd probably avoid setting those bits in more cases where setting
|
||||
// them is unnecessary.
|
||||
NS_ASSERTION(aNodeMatchContext.mStateMask == 0 ||
|
||||
NS_ASSERTION(aNodeMatchContext.mStateMask.IsEmpty() ||
|
||||
!aTreeMatchContext.mForStyling,
|
||||
"mForStyling must be false if we're just testing for "
|
||||
"state-dependence");
|
||||
@ -1749,8 +1748,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
// test for pseudo class match
|
||||
for (nsPseudoClassList* pseudoClass = aSelector->mPseudoClassList;
|
||||
pseudoClass; pseudoClass = pseudoClass->mNext) {
|
||||
PRInt32 statesToCheck = sPseudoClassBits[pseudoClass->mType];
|
||||
if (!statesToCheck) {
|
||||
nsEventStates statesToCheck = sPseudoClassStates[pseudoClass->mType];
|
||||
if (statesToCheck.IsEmpty()) {
|
||||
// keep the cases here in the same order as the list in
|
||||
// nsCSSPseudoClassList.h
|
||||
switch (pseudoClass->mType) {
|
||||
@ -2026,7 +2025,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
case nsCSSPseudoClasses::ePseudoClass_mozLocaleDir:
|
||||
{
|
||||
PRBool docIsRTL =
|
||||
(data.DocumentState() & NS_DOCUMENT_STATE_RTL_LOCALE) != 0;
|
||||
data.DocumentState().HasState(NS_DOCUMENT_STATE_RTL_LOCALE);
|
||||
|
||||
nsDependentString dirString(pseudoClass->u.mString);
|
||||
NS_ASSERTION(dirString.EqualsLiteral("ltr") ||
|
||||
@ -2070,7 +2069,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
break;
|
||||
|
||||
case nsCSSPseudoClasses::ePseudoClass_mozWindowInactive:
|
||||
if ((data.DocumentState() & NS_DOCUMENT_STATE_WINDOW_INACTIVE) == 0) {
|
||||
if (!data.DocumentState().HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
break;
|
||||
@ -2095,7 +2094,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
}
|
||||
} else {
|
||||
// Bit-based pseudo-classes
|
||||
if ((statesToCheck & (NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE)) &&
|
||||
if (statesToCheck.HasAtLeastOneOfStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE) &&
|
||||
data.mCompatMode == eCompatibility_NavQuirks &&
|
||||
// global selector (but don't check .class):
|
||||
!aSelector->HasTagSelector() && !aSelector->mIDList &&
|
||||
@ -2112,14 +2111,14 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
// selectors ":hover" and ":active".
|
||||
return PR_FALSE;
|
||||
} else {
|
||||
if (aNodeMatchContext.mStateMask & statesToCheck) {
|
||||
if (aNodeMatchContext.mStateMask.HasAtLeastOneOfStates(statesToCheck)) {
|
||||
if (aDependence)
|
||||
*aDependence = PR_TRUE;
|
||||
} else {
|
||||
PRUint32 contentState = data.GetContentStateForVisitedHandling(
|
||||
aTreeMatchContext.mVisitedHandling,
|
||||
aNodeMatchContext.mIsRelevantLink);
|
||||
if (!(contentState & statesToCheck)) {
|
||||
nsEventStates contentState = data.GetContentStateForVisitedHandling(
|
||||
aTreeMatchContext.mVisitedHandling,
|
||||
aNodeMatchContext.mIsRelevantLink);
|
||||
if (!contentState.HasAtLeastOneOfStates(statesToCheck)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
@ -2296,7 +2295,8 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
|
||||
if (! data) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
NodeMatchContext nodeContext(0, aLookForRelevantLink && data->IsLink());
|
||||
NodeMatchContext nodeContext(nsEventStates(), aLookForRelevantLink &&
|
||||
data->IsLink());
|
||||
if (nodeContext.mIsRelevantLink) {
|
||||
// If we find an ancestor of the matched node that is a link
|
||||
// during the matching process, then it's the relevant link (see
|
||||
@ -2353,7 +2353,7 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
|
||||
RuleProcessorData* data = (RuleProcessorData*)aData;
|
||||
|
||||
TreeMatchContext treeContext(PR_TRUE, data->mRuleWalker->VisitedHandling());
|
||||
NodeMatchContext nodeContext(0, data->IsLink());
|
||||
NodeMatchContext nodeContext(nsEventStates(), data->IsLink());
|
||||
if (nodeContext.mIsRelevantLink) {
|
||||
treeContext.mHaveRelevantLink = PR_TRUE;
|
||||
}
|
||||
@ -2522,7 +2522,7 @@ nsCSSRuleProcessor::HasDocumentStateDependentStyle(StateRuleProcessorData* aData
|
||||
{
|
||||
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
|
||||
|
||||
return cascade && (cascade->mSelectorDocumentStates & aData->mStateMask) != 0;
|
||||
return cascade && cascade->mSelectorDocumentStates.HasAtLeastOneOfStates(aData->mStateMask);
|
||||
}
|
||||
|
||||
struct AttributeEnumData {
|
||||
@ -2546,7 +2546,7 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData)
|
||||
// enumData->change won't change.
|
||||
TreeMatchContext treeContext(PR_FALSE,
|
||||
nsRuleWalker::eLinksVisitedOrUnvisited);
|
||||
NodeMatchContext nodeContext(0, PR_FALSE);
|
||||
NodeMatchContext nodeContext(nsEventStates(), PR_FALSE);
|
||||
if ((possibleChange & ~(aData->change)) &&
|
||||
SelectorMatches(*data, aSelector, nodeContext, treeContext) &&
|
||||
SelectorMatchesTree(*data, aSelector->mNext, treeContext, PR_FALSE)) {
|
||||
@ -2698,7 +2698,7 @@ PRBool IsStateSelector(nsCSSSelector& aSelector)
|
||||
if (pseudoClass->mType >= nsCSSPseudoClasses::ePseudoClass_Count) {
|
||||
continue;
|
||||
}
|
||||
if (sPseudoClassBits[pseudoClass->mType]) {
|
||||
if (!sPseudoClassStates[pseudoClass->mType].IsEmpty()) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -3160,7 +3160,7 @@ nsCSSRuleProcessor::SelectorListMatches(RuleProcessorData& aData,
|
||||
NS_ASSERTION(!sel->IsPseudoElement(), "Shouldn't have been called");
|
||||
TreeMatchContext treeContext(PR_FALSE,
|
||||
nsRuleWalker::eRelevantLinkUnvisited);
|
||||
NodeMatchContext nodeContext(0, PR_FALSE);
|
||||
NodeMatchContext nodeContext(nsEventStates(), PR_FALSE);
|
||||
if (SelectorMatches(aData, sel, nodeContext, treeContext)) {
|
||||
nsCSSSelector* next = sel->mNext;
|
||||
if (!next || SelectorMatchesTree(aData, next, treeContext, PR_FALSE)) {
|
||||
|
@ -220,23 +220,23 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
|
||||
// if we have anchor colors, check if this is an anchor with an href
|
||||
if (tag == nsGkAtoms::a) {
|
||||
if (mLinkRule || mVisitedRule || mActiveRule) {
|
||||
PRUint32 state = aData->GetContentStateForVisitedHandling(
|
||||
nsEventStates state = aData->GetContentStateForVisitedHandling(
|
||||
ruleWalker->VisitedHandling(),
|
||||
// If the node being matched is a link,
|
||||
// it's the relevant link.
|
||||
aData->IsLink());
|
||||
if (mLinkRule && (state & NS_EVENT_STATE_UNVISITED)) {
|
||||
if (mLinkRule && state.HasState(NS_EVENT_STATE_UNVISITED)) {
|
||||
ruleWalker->Forward(mLinkRule);
|
||||
ruleWalker->SetHaveRelevantLink();
|
||||
}
|
||||
else if (mVisitedRule && (state & NS_EVENT_STATE_VISITED)) {
|
||||
else if (mVisitedRule && state.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
ruleWalker->Forward(mVisitedRule);
|
||||
ruleWalker->SetHaveRelevantLink();
|
||||
}
|
||||
|
||||
// No need to add to the active rule if it's not a link
|
||||
if (mActiveRule && aData->IsLink() &&
|
||||
(state & NS_EVENT_STATE_ACTIVE)) {
|
||||
state.HasState(NS_EVENT_STATE_ACTIVE)) {
|
||||
ruleWalker->Forward(mActiveRule);
|
||||
}
|
||||
} // end link/visited/active rules
|
||||
@ -275,9 +275,9 @@ nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||
if (aData->mIsHTMLContent &&
|
||||
aData->mContentTag == nsGkAtoms::a &&
|
||||
aData->IsLink() &&
|
||||
((mActiveRule && (aData->mStateMask & NS_EVENT_STATE_ACTIVE)) ||
|
||||
(mLinkRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)) ||
|
||||
(mVisitedRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)))) {
|
||||
((mActiveRule && aData->mStateMask.HasState(NS_EVENT_STATE_ACTIVE)) ||
|
||||
(mLinkRule && aData->mStateMask.HasState(NS_EVENT_STATE_VISITED)) ||
|
||||
(mVisitedRule && aData->mStateMask.HasState(NS_EVENT_STATE_VISITED)))) {
|
||||
return eRestyle_Self;
|
||||
}
|
||||
|
||||
|
@ -106,13 +106,13 @@ private:
|
||||
}
|
||||
public:
|
||||
const nsString* GetLang();
|
||||
PRUint32 ContentState();
|
||||
PRUint32 DocumentState();
|
||||
nsEventStates ContentState();
|
||||
nsEventStates DocumentState();
|
||||
PRBool IsLink();
|
||||
|
||||
PRUint32 GetContentStateForVisitedHandling(
|
||||
nsRuleWalker::VisitedHandlingType aVisitedHandling,
|
||||
PRBool aIsRelevantLink);
|
||||
nsEventStates GetContentStateForVisitedHandling(
|
||||
nsRuleWalker::VisitedHandlingType aVisitedHandling,
|
||||
PRBool aIsRelevantLink);
|
||||
|
||||
// Returns a 1-based index of the child in its parent. If the child
|
||||
// is not in its parent's child list (i.e., it is anonymous content),
|
||||
@ -155,10 +155,11 @@ private:
|
||||
PRInt32 mNthIndices[2][2];
|
||||
|
||||
// mContentState is initialized lazily.
|
||||
PRInt32 mContentState; // eventStateMgr->GetContentState() or
|
||||
// mElement->IntrinsicState() if we have no ESM
|
||||
// adjusted for not supporting :visited (but with
|
||||
// visitedness information when we support it)
|
||||
nsEventStates mContentState; // eventStateMgr->GetContentState() or
|
||||
// mElement->IntrinsicState() if we have no ESM
|
||||
// adjusted for not supporting :visited (but
|
||||
// with visitedness information when we support
|
||||
// it).
|
||||
PRPackedBool mGotContentState;
|
||||
};
|
||||
|
||||
@ -234,14 +235,14 @@ struct XULTreeRuleProcessorData : public RuleProcessorData {
|
||||
struct StateRuleProcessorData : public RuleProcessorData {
|
||||
StateRuleProcessorData(nsPresContext* aPresContext,
|
||||
mozilla::dom::Element* aElement,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
: RuleProcessorData(aPresContext, aElement, nsnull),
|
||||
mStateMask(aStateMask)
|
||||
{
|
||||
NS_PRECONDITION(aPresContext, "null pointer");
|
||||
}
|
||||
const PRInt32 mStateMask; // |HasStateDependentStyle| for which state(s)?
|
||||
// Constants defined in nsIEventStateManager.h .
|
||||
const nsEventStates mStateMask; // |HasStateDependentStyle| for which state(s)?
|
||||
// Constants defined in nsEventStates.h .
|
||||
};
|
||||
|
||||
struct AttributeRuleProcessorData : public RuleProcessorData {
|
||||
|
@ -805,7 +805,7 @@ nsStyleSet::ResolveStyleFor(Element* aElement,
|
||||
|
||||
return GetContext(aParentContext, ruleNode, visitedRuleNode,
|
||||
data.IsLink(),
|
||||
(data.ContentState() & NS_EVENT_STATE_VISITED) != 0,
|
||||
data.ContentState().HasState(NS_EVENT_STATE_VISITED),
|
||||
nsnull, nsCSSPseudoElements::ePseudo_NotPseudoElement);
|
||||
}
|
||||
|
||||
@ -1212,7 +1212,7 @@ nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
|
||||
|
||||
struct StatefulData : public StateRuleProcessorData {
|
||||
StatefulData(nsPresContext* aPresContext,
|
||||
Element* aElement, PRInt32 aStateMask)
|
||||
Element* aElement, nsEventStates aStateMask)
|
||||
: StateRuleProcessorData(aPresContext, aElement, aStateMask),
|
||||
mHint(nsRestyleHint(0))
|
||||
{}
|
||||
@ -1234,7 +1234,7 @@ static PRBool SheetHasDocumentStateStyle(nsIStyleRuleProcessor* aProcessor,
|
||||
PRBool
|
||||
nsStyleSet::HasDocumentStateDependentStyle(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
if (!aContent || !aContent->IsElement())
|
||||
return PR_FALSE;
|
||||
@ -1255,9 +1255,9 @@ static PRBool SheetHasStatefulStyle(nsIStyleRuleProcessor* aProcessor,
|
||||
|
||||
// Test if style is dependent on content state
|
||||
nsRestyleHint
|
||||
nsStyleSet::HasStateDependentStyle(nsPresContext* aPresContext,
|
||||
Element* aElement,
|
||||
PRInt32 aStateMask)
|
||||
nsStyleSet::HasStateDependentStyle(nsPresContext* aPresContext,
|
||||
Element* aElement,
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
StatefulData data(aPresContext, aElement, aStateMask);
|
||||
WalkRuleProcessors(SheetHasStatefulStyle, &data, PR_FALSE);
|
||||
|
@ -185,12 +185,12 @@ class nsStyleSet
|
||||
// Test if style is dependent on a document state.
|
||||
PRBool HasDocumentStateDependentStyle(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aStateMask);
|
||||
nsEventStates aStateMask);
|
||||
|
||||
// Test if style is dependent on content state
|
||||
nsRestyleHint HasStateDependentStyle(nsPresContext* aPresContext,
|
||||
mozilla::dom::Element* aElement,
|
||||
PRInt32 aStateMask);
|
||||
nsEventStates aStateMask);
|
||||
|
||||
// Test if style is dependent on the presence of an attribute.
|
||||
nsRestyleHint HasAttributeDependentStyle(nsPresContext* aPresContext,
|
||||
|
@ -121,10 +121,10 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
|
||||
if (NS_VK_SPACE == keyEvent->keyCode) {
|
||||
// only activate on keyup if we're already in the :hover:active state
|
||||
const PRInt32 activeHover = NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER;
|
||||
const nsEventStates activeHover = NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER;
|
||||
nsIEventStateManager *esm = aPresContext->EventStateManager();
|
||||
PRInt32 buttonState = esm->GetContentState(mContent);
|
||||
if ((buttonState & activeHover) == activeHover) {
|
||||
nsEventStates buttonState = esm->GetContentState(mContent);
|
||||
if (buttonState.HasAllStates(activeHover)) {
|
||||
esm->SetContentState(nsnull, activeHover); // return to normal state
|
||||
MouseClicked(aPresContext, aEvent);
|
||||
}
|
||||
|
@ -818,9 +818,9 @@ nsMenuPopupFrame::HidePopup(PRBool aDeselectMenu, nsPopupState aNewState)
|
||||
// This code may not the best solution, but we can leave it here until we find the better approach.
|
||||
nsIEventStateManager *esm = PresContext()->EventStateManager();
|
||||
|
||||
PRInt32 state = esm->GetContentState(mContent);
|
||||
nsEventStates state = esm->GetContentState(mContent);
|
||||
|
||||
if (state & NS_EVENT_STATE_HOVER)
|
||||
if (state.HasState(NS_EVENT_STATE_HOVER))
|
||||
esm->SetContentState(nsnull, NS_EVENT_STATE_HOVER);
|
||||
|
||||
nsMenuFrame* menuFrame = GetParentMenu();
|
||||
|
@ -823,11 +823,11 @@ void
|
||||
nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask)
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
if (!aContent1 || !mSelection ||
|
||||
!aContent1->IsHTML() ||
|
||||
!(aStateMask & NS_EVENT_STATE_CHECKED))
|
||||
!aStateMask.HasState(NS_EVENT_STATE_CHECKED))
|
||||
return;
|
||||
|
||||
if (aContent1->Tag() == nsGkAtoms::option) {
|
||||
|
@ -360,7 +360,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
|
||||
// the manual notification code is based on nsGenericElement
|
||||
|
||||
PRUint32 stateMask = PRUint32(node->IntrinsicState());
|
||||
nsEventStates stateMask = node->IntrinsicState();
|
||||
nsNodeUtils::AttributeWillChange(node,
|
||||
nsuri,
|
||||
localName,
|
||||
@ -382,8 +382,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
}
|
||||
}
|
||||
|
||||
stateMask ^= PRUint32(node->IntrinsicState());
|
||||
if (stateMask && document) {
|
||||
stateMask ^= node->IntrinsicState();
|
||||
if (!stateMask.IsEmpty() && document) {
|
||||
MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
document->ContentStatesChanged(node, nsnull, stateMask);
|
||||
}
|
||||
|
@ -103,34 +103,35 @@ protected:
|
||||
|
||||
// HITheme drawing routines
|
||||
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inReadOnly, PRInt32 inState);
|
||||
const HIRect& inBoxRect, PRBool inReadOnly,
|
||||
nsEventStates inState);
|
||||
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
|
||||
PRBool inIsIndeterminate, PRBool inIsHorizontal,
|
||||
PRInt32 inValue, PRInt32 inMaxValue, nsIFrame* aFrame);
|
||||
void DrawTab(CGContextRef context, HIRect inBoxRect, PRInt32 inState,
|
||||
void DrawTab(CGContextRef context, HIRect inBoxRect, nsEventStates inState,
|
||||
nsIFrame* aFrame);
|
||||
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
|
||||
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
|
||||
PRInt32 inState, PRBool inDirection, PRBool inIsReverse,
|
||||
PRInt32 inCurrentValue, PRInt32 inMinValue, PRInt32 inMaxValue,
|
||||
nsIFrame* aFrame);
|
||||
nsEventStates inState, PRBool inDirection,
|
||||
PRBool inIsReverse, PRInt32 inCurrentValue, PRInt32 inMinValue,
|
||||
PRInt32 inMaxValue, nsIFrame* aFrame);
|
||||
void DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbox,
|
||||
const HIRect& inBoxRect, PRBool inSelected,
|
||||
PRInt32 inState, nsIFrame* aFrame);
|
||||
nsEventStates inState, nsIFrame* aFrame);
|
||||
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
nsIFrame* aFrame, PRInt32 inState);
|
||||
nsIFrame* aFrame, nsEventStates inState);
|
||||
void DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRInt32 inState, nsIFrame* aFrame);
|
||||
nsEventStates inState, nsIFrame* aFrame);
|
||||
void DrawButton(CGContextRef context, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inIsDefault,
|
||||
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState, nsIFrame* aFrame);
|
||||
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect, PRInt32 inState,
|
||||
PRUint8 aWidgetType, nsIFrame* aFrame);
|
||||
nsEventStates inState, nsIFrame* aFrame);
|
||||
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
|
||||
nsEventStates inState, PRUint8 aWidgetType,
|
||||
nsIFrame* aFrame);
|
||||
void DrawSpinButtons(CGContextRef context, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect,
|
||||
ThemeDrawState inDrawState,
|
||||
ThemeButtonAdornment inAdornment, PRInt32 inState,
|
||||
const HIRect& inBoxRect, ThemeDrawState inDrawState,
|
||||
ThemeButtonAdornment inAdornment, nsEventStates inState,
|
||||
nsIFrame* aFrame);
|
||||
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
NSWindow* aWindow);
|
||||
@ -140,7 +141,7 @@ protected:
|
||||
|
||||
// Scrollbars
|
||||
void DrawScrollbar(CGContextRef aCGContext, const HIRect& aBoxRect, nsIFrame *aFrame);
|
||||
void GetScrollbarPressStates (nsIFrame *aFrame, PRInt32 aButtonStates[]);
|
||||
void GetScrollbarPressStates (nsIFrame *aFrame, nsEventStates aButtonStates[]);
|
||||
void GetScrollbarDrawInfo (HIThemeTrackDrawInfo& aTdi, nsIFrame *aFrame,
|
||||
const CGSize& aSize, PRBool aShouldGetButtonStates);
|
||||
nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame);
|
||||
|
@ -610,7 +610,7 @@ static const CellRenderSettings checkboxSettings = {
|
||||
void
|
||||
nsNativeThemeCocoa::DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbox,
|
||||
const HIRect& inBoxRect, PRBool inSelected,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
nsEventStates inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -622,9 +622,9 @@ nsNativeThemeCocoa::DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbo
|
||||
state = NSMixedState;
|
||||
|
||||
[cell setEnabled:!IsDisabled(aFrame, inState)];
|
||||
[cell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS)];
|
||||
[cell setShowsFirstResponder:inState.HasState(NS_EVENT_STATE_FOCUS)];
|
||||
[cell setState:state];
|
||||
[cell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))];
|
||||
[cell setHighlighted:inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)];
|
||||
[cell setControlTint:(FrameIsInActiveWindow(aFrame) ? [NSColor currentControlTint] : NSClearControlTint)];
|
||||
|
||||
// Ensure that the control is square.
|
||||
@ -667,7 +667,7 @@ static const CellRenderSettings searchFieldSettings = {
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
nsIFrame* aFrame, PRInt32 inState)
|
||||
nsIFrame* aFrame, nsEventStates inState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -715,7 +715,7 @@ static const CellRenderSettings pushButtonSettings = {
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
nsEventStates inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -723,10 +723,9 @@ nsNativeThemeCocoa::DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRe
|
||||
BOOL isDisabled = IsDisabled(aFrame, inState);
|
||||
|
||||
[mPushButtonCell setEnabled:!isDisabled];
|
||||
[mPushButtonCell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) &&
|
||||
(inState & NS_EVENT_STATE_HOVER) &&
|
||||
isActive)];
|
||||
[mPushButtonCell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS) && !isDisabled && isActive];
|
||||
[mPushButtonCell setHighlighted:isActive &&
|
||||
inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)];
|
||||
[mPushButtonCell setShowsFirstResponder:inState.HasState(NS_EVENT_STATE_FOCUS) && !isDisabled && isActive];
|
||||
|
||||
// If the button is tall enough, draw the square button style so that buttons with
|
||||
// non-standard content look good. Otherwise draw normal rounded aqua buttons.
|
||||
@ -831,7 +830,7 @@ void
|
||||
nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inIsDefault,
|
||||
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
nsEventStates inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -847,7 +846,7 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
||||
if (isDisabled) {
|
||||
bdi.state = kThemeStateUnavailable;
|
||||
}
|
||||
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) {
|
||||
else if (inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) {
|
||||
bdi.state = kThemeStatePressed;
|
||||
}
|
||||
else {
|
||||
@ -859,11 +858,11 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
||||
bdi.state = kThemeStateActive;
|
||||
}
|
||||
|
||||
if (inState & NS_EVENT_STATE_FOCUS && isActive)
|
||||
if (inState.HasState(NS_EVENT_STATE_FOCUS) && isActive)
|
||||
bdi.adornment |= kThemeAdornmentFocus;
|
||||
|
||||
if (inIsDefault && !isDisabled && isActive &&
|
||||
!(inState & NS_EVENT_STATE_ACTIVE)) {
|
||||
!inState.HasState(NS_EVENT_STATE_ACTIVE)) {
|
||||
bdi.adornment |= kThemeAdornmentDefault;
|
||||
bdi.animation.time.start = 0;
|
||||
bdi.animation.time.current = CFAbsoluteTimeGetCurrent();
|
||||
@ -960,7 +959,8 @@ static const CellRenderSettings editableMenulistSettings = {
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawDropdown(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRInt32 inState, PRUint8 aWidgetType, nsIFrame* aFrame)
|
||||
nsEventStates inState, PRUint8 aWidgetType,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -970,7 +970,7 @@ nsNativeThemeCocoa::DrawDropdown(CGContextRef cgContext, const HIRect& inBoxRect
|
||||
NSCell* cell = isEditable ? (NSCell*)mComboBoxCell : (NSCell*)mDropdownCell;
|
||||
|
||||
[cell setEnabled:!IsDisabled(aFrame, inState)];
|
||||
[cell setShowsFirstResponder:(IsFocused(aFrame) || (inState & NS_EVENT_STATE_FOCUS))];
|
||||
[cell setShowsFirstResponder:(IsFocused(aFrame) || inState.HasState(NS_EVENT_STATE_FOCUS))];
|
||||
[cell setHighlighted:IsOpenButton(aFrame)];
|
||||
[cell setControlTint:(FrameIsInActiveWindow(aFrame) ? [NSColor currentControlTint] : NSClearControlTint)];
|
||||
|
||||
@ -985,7 +985,7 @@ void
|
||||
nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect, ThemeDrawState inDrawState,
|
||||
ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
nsEventStates inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -1007,7 +1007,8 @@ nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKi
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inDisabled, PRInt32 inState)
|
||||
const HIRect& inBoxRect, PRBool inDisabled,
|
||||
nsEventStates inState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -1023,7 +1024,7 @@ nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
|
||||
if (inKind == kHIThemeFrameListBox)
|
||||
fdi.isFocused = 0;
|
||||
else
|
||||
fdi.isFocused = (inState & NS_EVENT_STATE_FOCUS) != 0;
|
||||
fdi.isFocused = inState.HasState(NS_EVENT_STATE_FOCUS);
|
||||
|
||||
// HIThemeDrawFrame takes the rect for the content area of the frame, not
|
||||
// the bounding rect for the frame. Here we reduce the size of the rect we
|
||||
@ -1115,7 +1116,7 @@ nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext, const HIRect& inBoxRect
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRInt32 inState, PRBool inIsVertical,
|
||||
nsEventStates inState, PRBool inIsVertical,
|
||||
PRBool inIsReverse, PRInt32 inCurrentValue,
|
||||
PRInt32 inMinValue, PRInt32 inMaxValue,
|
||||
nsIFrame* aFrame)
|
||||
@ -1135,7 +1136,7 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
tdi.attributes |= kThemeTrackHorizontal;
|
||||
if (inIsReverse)
|
||||
tdi.attributes |= kThemeTrackRightToLeft;
|
||||
if (inState & NS_EVENT_STATE_FOCUS)
|
||||
if (inState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
tdi.attributes |= kThemeTrackHasFocus;
|
||||
if (IsDisabled(aFrame, inState))
|
||||
tdi.enableState = kThemeTrackDisabled;
|
||||
@ -1155,7 +1156,7 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
nsEventStates inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -1174,7 +1175,7 @@ nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
|
||||
} else {
|
||||
if (isDisabled)
|
||||
tdi.style = kThemeTabNonFrontUnavailable;
|
||||
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
|
||||
else if (inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER))
|
||||
tdi.style = kThemeTabNonFrontPressed;
|
||||
else
|
||||
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive;
|
||||
@ -1223,7 +1224,7 @@ nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
|
||||
inBoxRect.size.width += 1;
|
||||
}
|
||||
|
||||
if (inState & NS_EVENT_STATE_FOCUS)
|
||||
if (inState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
tdi.adornment |= kThemeAdornmentFocus;
|
||||
|
||||
HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL);
|
||||
@ -1232,14 +1233,14 @@ nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
|
||||
}
|
||||
|
||||
static inline UInt8
|
||||
ConvertToPressState(PRInt32 aButtonState, UInt8 aPressState)
|
||||
ConvertToPressState(nsEventStates aButtonState, UInt8 aPressState)
|
||||
{
|
||||
// If the button is pressed, return the press state passed in. Otherwise, return 0.
|
||||
return ((aButtonState & NS_EVENT_STATE_ACTIVE) && (aButtonState & NS_EVENT_STATE_HOVER)) ? aPressState : 0;
|
||||
return aButtonState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER) ? aPressState : 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, PRInt32 aButtonStates[])
|
||||
nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, nsEventStates aButtonStates[])
|
||||
{
|
||||
static nsIContent::AttrValuesArray attributeValues[] = {
|
||||
&nsWidgetAtoms::scrollbarUpTop,
|
||||
@ -1260,8 +1261,7 @@ nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, PRInt32 aButtonSta
|
||||
attributeValues, eCaseMatters);
|
||||
if (attrIndex < 0) continue;
|
||||
|
||||
PRInt32 currentState = GetContentState(childFrame, NS_THEME_BUTTON);
|
||||
aButtonStates[attrIndex] = currentState;
|
||||
aButtonStates[attrIndex] = GetContentState(childFrame, NS_THEME_BUTTON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1325,7 +1325,7 @@ nsNativeThemeCocoa::GetScrollbarDrawInfo(HIThemeTrackDrawInfo& aTdi, nsIFrame *a
|
||||
// Only go get these scrollbar button states if we need it. For example, there's no reaon to look up scrollbar button
|
||||
// states when we're only creating a TrackDrawInfo to determine the size of the thumb.
|
||||
if (aShouldGetButtonStates) {
|
||||
PRInt32 buttonStates[] = {0, 0, 0, 0};
|
||||
nsEventStates buttonStates[4];
|
||||
GetScrollbarPressStates(aFrame, buttonStates);
|
||||
NSString *buttonPlacement = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollBarVariant"];
|
||||
// It seems that unless all four buttons are showing, kThemeTopOutsideArrowPressed is the correct constant for
|
||||
@ -1601,7 +1601,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
||||
//CGContextFillRect(cgContext, bounds);
|
||||
#endif
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
switch (aWidgetType) {
|
||||
case NS_THEME_DIALOG: {
|
||||
@ -1927,7 +1927,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
||||
CGContextStrokePath(cgContext);
|
||||
|
||||
// draw a focus ring
|
||||
if (eventState & NS_EVENT_STATE_FOCUS) {
|
||||
if (eventState.HasState(NS_EVENT_STATE_FOCUS)) {
|
||||
// We need to bring the rectangle in by 1 pixel on each side.
|
||||
CGRect cgr = CGRectMake(macRect.origin.x + 1,
|
||||
macRect.origin.y + 1,
|
||||
|
@ -255,12 +255,12 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
||||
stateFrame = aFrame = aFrame->GetParent();
|
||||
}
|
||||
|
||||
PRInt32 eventState = GetContentState(stateFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(stateFrame, aWidgetType);
|
||||
|
||||
aState->disabled = IsDisabled(aFrame, eventState) || IsReadOnly(aFrame);
|
||||
aState->active = (eventState & NS_EVENT_STATE_ACTIVE) == NS_EVENT_STATE_ACTIVE;
|
||||
aState->focused = (eventState & NS_EVENT_STATE_FOCUS) == NS_EVENT_STATE_FOCUS;
|
||||
aState->inHover = (eventState & NS_EVENT_STATE_HOVER) == NS_EVENT_STATE_HOVER;
|
||||
aState->active = eventState.HasState(NS_EVENT_STATE_ACTIVE);
|
||||
aState->focused = eventState.HasState(NS_EVENT_STATE_FOCUS);
|
||||
aState->inHover = eventState.HasState(NS_EVENT_STATE_HOVER);
|
||||
aState->isDefault = IsDefaultButton(aFrame);
|
||||
aState->canDefault = FALSE; // XXX fix me
|
||||
aState->depressed = FALSE;
|
||||
|
@ -314,7 +314,7 @@ nsNativeThemeQt::DrawWidgetBackground(QPainter *qPainter,
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_LISTBOX: {
|
||||
QStyleOptionFrameV2 frameOpt;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (!IsDisabled(aFrame, eventState))
|
||||
frameOpt.state |= QStyle::State_Enabled;
|
||||
@ -638,7 +638,7 @@ nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType,
|
||||
QRect rect,
|
||||
QStyleOptionButton &opt)
|
||||
{
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
opt.rect = rect;
|
||||
opt.palette = mNoBackgroundPalette;
|
||||
@ -647,11 +647,11 @@ nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType,
|
||||
|
||||
if (!isDisabled)
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
opt.state |= QStyle::State_MouseOver;
|
||||
if (eventState & NS_EVENT_STATE_FOCUS)
|
||||
if (eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
opt.state |= QStyle::State_HasFocus;
|
||||
if (!isDisabled && (eventState & NS_EVENT_STATE_ACTIVE))
|
||||
if (!isDisabled && eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
// Don't allow sunken when disabled
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
|
||||
@ -665,7 +665,7 @@ nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType,
|
||||
|
||||
break;
|
||||
default:
|
||||
if (!(eventState & NS_EVENT_STATE_ACTIVE))
|
||||
if (!eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
opt.state |= QStyle::State_Raised;
|
||||
break;
|
||||
}
|
||||
@ -678,15 +678,15 @@ nsNativeThemeQt::InitPlainStyle(PRUint8 aWidgetType,
|
||||
QStyleOption &opt,
|
||||
QStyle::State extraFlags)
|
||||
{
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
opt.rect = rect;
|
||||
|
||||
if (!IsDisabled(aFrame, eventState))
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
opt.state |= QStyle::State_MouseOver;
|
||||
if (eventState & NS_EVENT_STATE_FOCUS)
|
||||
if (eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
opt.state |= QStyle::State_HasFocus;
|
||||
|
||||
opt.state |= extraFlags;
|
||||
@ -698,18 +698,18 @@ nsNativeThemeQt::InitComboStyle(PRUint8 aWidgetType,
|
||||
QRect rect,
|
||||
QStyleOptionComboBox &opt)
|
||||
{
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
PRBool isDisabled = IsDisabled(aFrame, eventState);
|
||||
|
||||
if (!isDisabled)
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
opt.state |= QStyle::State_MouseOver;
|
||||
if (eventState & NS_EVENT_STATE_FOCUS)
|
||||
if (eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
opt.state |= QStyle::State_HasFocus;
|
||||
if (!(eventState & NS_EVENT_STATE_ACTIVE))
|
||||
if (!eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
opt.state |= QStyle::State_Raised;
|
||||
if (!isDisabled && (eventState & NS_EVENT_STATE_ACTIVE))
|
||||
if (!isDisabled && eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
// Don't allow sunken when disabled
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
|
||||
|
@ -137,28 +137,28 @@ static PRInt32 GetTopLevelWindowActiveState(nsIFrame *aFrame)
|
||||
return mozilla::widget::themeconst::FS_INACTIVE;
|
||||
}
|
||||
|
||||
static PRInt32 GetWindowFrameButtonState(nsIFrame *aFrame, PRInt32 eventState)
|
||||
static PRInt32 GetWindowFrameButtonState(nsIFrame *aFrame, nsEventStates eventState)
|
||||
{
|
||||
if (GetTopLevelWindowActiveState(aFrame) ==
|
||||
mozilla::widget::themeconst::FS_INACTIVE) {
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
return mozilla::widget::themeconst::BS_HOT;
|
||||
return mozilla::widget::themeconst::BS_INACTIVE;
|
||||
}
|
||||
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE)
|
||||
if (eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
return mozilla::widget::themeconst::BS_PUSHED;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
return mozilla::widget::themeconst::BS_HOT;
|
||||
else
|
||||
return mozilla::widget::themeconst::BS_NORMAL;
|
||||
}
|
||||
|
||||
static PRInt32 GetClassicWindowFrameButtonState(PRInt32 eventState)
|
||||
static PRInt32 GetClassicWindowFrameButtonState(nsEventStates eventState)
|
||||
{
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE)
|
||||
if (eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
return DFCS_BUTTONPUSH|DFCS_PUSHED;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
return DFCS_BUTTONPUSH|DFCS_HOT;
|
||||
else
|
||||
return DFCS_BUTTONPUSH;
|
||||
@ -440,12 +440,12 @@ PRInt32
|
||||
nsNativeThemeWin::StandardGetState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
PRBool wantFocused)
|
||||
{
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
return TS_ACTIVE;
|
||||
if (wantFocused && eventState & NS_EVENT_STATE_FOCUS)
|
||||
if (wantFocused && eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
return TS_FOCUSED;
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
return TS_HOVER;
|
||||
|
||||
return TS_NORMAL;
|
||||
@ -487,7 +487,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (IsDisabled(aFrame, eventState)) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
@ -525,8 +525,8 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
inputState = INDETERMINATE;
|
||||
}
|
||||
|
||||
PRInt32 eventState = GetContentState(isXULCheckboxRadio ? aFrame->GetParent()
|
||||
: aFrame,
|
||||
nsEventStates eventState = GetContentState(isXULCheckboxRadio ? aFrame->GetParent()
|
||||
: aFrame,
|
||||
aWidgetType);
|
||||
if (IsDisabled(aFrame, eventState)) {
|
||||
aState = TS_DISABLED;
|
||||
@ -548,7 +548,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
}
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE: {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (nsUXThemeData::sIsVistaOrLater) {
|
||||
/* Note: the NOSCROLL type has a rounded corner in each
|
||||
@ -576,9 +576,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
*/
|
||||
if (content && content->IsXUL() && IsFocused(aFrame))
|
||||
aState = TFS_EDITBORDER_FOCUSED;
|
||||
else if (eventState & NS_EVENT_STATE_ACTIVE || eventState & NS_EVENT_STATE_FOCUS)
|
||||
else if (eventState.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS))
|
||||
aState = TFS_EDITBORDER_FOCUSED;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
aState = TFS_EDITBORDER_HOVER;
|
||||
else
|
||||
aState = TFS_EDITBORDER_NORMAL;
|
||||
@ -630,7 +630,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (IsDisabled(aFrame, eventState)) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
@ -640,9 +640,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
if (eventState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER) {
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER)) {
|
||||
if (IsCheckedButton(aFrame))
|
||||
aState = TB_HOVER_CHECKED;
|
||||
else
|
||||
@ -668,19 +668,19 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
|
||||
aPart = SP_BUTTON;
|
||||
aState = (aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP)*4;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState += TS_NORMAL;
|
||||
else if (IsDisabled(aFrame, eventState))
|
||||
aState += TS_DISABLED;
|
||||
else {
|
||||
nsIFrame *parent = aFrame->GetParent();
|
||||
PRInt32 parentState = GetContentState(parent, parent->GetStyleDisplay()->mAppearance);
|
||||
if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
nsEventStates parentState = GetContentState(parent, parent->GetStyleDisplay()->mAppearance);
|
||||
if (eventState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
aState += TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
aState += TS_HOVER;
|
||||
else if (nsUXThemeData::sIsVistaOrLater && parentState & NS_EVENT_STATE_HOVER)
|
||||
else if (nsUXThemeData::sIsVistaOrLater && parentState.HasState(NS_EVENT_STATE_HOVER))
|
||||
aState = (aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP) + SP_BUTTON_IMPLICIT_HOVER_BASE;
|
||||
else
|
||||
aState += TS_NORMAL;
|
||||
@ -698,17 +698,17 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_SCROLLBAR_THUMB_VERTICAL: {
|
||||
aPart = (aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) ?
|
||||
SP_THUMBHOR : SP_THUMBVERT;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame, eventState))
|
||||
aState = TS_DISABLED;
|
||||
else {
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
|
||||
// the thumb, since the drag is not canceled
|
||||
// when you move outside the thumb.
|
||||
if (eventState.HasState(NS_EVENT_STATE_ACTIVE)) // Hover is not also a requirement for
|
||||
// the thumb, since the drag is not canceled
|
||||
// when you move outside the thumb.
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
aState = TS_HOVER;
|
||||
else
|
||||
aState = TS_NORMAL;
|
||||
@ -727,20 +727,20 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_SCALE_THUMB_VERTICAL: {
|
||||
aPart = (aWidgetType == NS_THEME_SCALE_THUMB_HORIZONTAL) ?
|
||||
TKP_THUMB : TKP_THUMBVERT;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame, eventState)) {
|
||||
aState = TKP_DISABLED;
|
||||
}
|
||||
else {
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
|
||||
// the thumb, since the drag is not canceled
|
||||
// when you move outside the thumb.
|
||||
if (eventState.HasState(NS_EVENT_STATE_ACTIVE)) // Hover is not also a requirement for
|
||||
// the thumb, since the drag is not canceled
|
||||
// when you move outside the thumb.
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_FOCUS)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
aState = TKP_FOCUSED;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
aState = TS_HOVER;
|
||||
else
|
||||
aState = TS_NORMAL;
|
||||
@ -751,7 +751,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_SPINNER_DOWN_BUTTON: {
|
||||
aPart = (aWidgetType == NS_THEME_SPINNER_UP_BUTTON) ?
|
||||
SPNP_UP : SPNP_DOWN;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame, eventState))
|
||||
@ -824,7 +824,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (IsDisabled(aFrame, eventState)) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
@ -859,7 +859,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_DROPDOWN: {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
PRBool isHTML = content && content->IsHTML();
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
/* On vista, in HTML, we use CBP_DROPBORDER instead of DROPFRAME for HTML content;
|
||||
* this gives us the thin outline in HTML content, instead of the gradient-filled
|
||||
@ -876,11 +876,11 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
} else if (IsOpenButton(aFrame)) {
|
||||
aState = TS_ACTIVE;
|
||||
} else {
|
||||
if (isHTML && eventState & NS_EVENT_STATE_FOCUS)
|
||||
if (isHTML && eventState.HasState(NS_EVENT_STATE_FOCUS))
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
else if (eventState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER)
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
|
||||
aState = TS_HOVER;
|
||||
else
|
||||
aState = TS_NORMAL;
|
||||
@ -898,7 +898,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
if (isHTML || isMenulist)
|
||||
aFrame = parentFrame;
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
aPart = nsUXThemeData::sIsVistaOrLater ? CBP_DROPMARKER_VISTA : CBP_DROPMARKER;
|
||||
|
||||
// For HTML controls with author styling, we should fall
|
||||
@ -946,7 +946,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
aState = TS_NORMAL;
|
||||
|
||||
// Dropdown button active state doesn't need :hover.
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE) {
|
||||
if (eventState.HasState(NS_EVENT_STATE_ACTIVE)) {
|
||||
if (isOpen && (isHTML || isMenulist)) {
|
||||
// XXX Button should look active until the mouse is released, but
|
||||
// without making it look active when the popup is clicked.
|
||||
@ -954,7 +954,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
}
|
||||
aState = TS_ACTIVE;
|
||||
}
|
||||
else if (eventState & NS_EVENT_STATE_HOVER) {
|
||||
else if (eventState.HasState(NS_EVENT_STATE_HOVER)) {
|
||||
// No hover effect for XUL menulists and autocomplete dropdown buttons
|
||||
// while the dropdown menu is open.
|
||||
if (isOpen) {
|
||||
@ -978,7 +978,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
PRBool isOpen = PR_FALSE;
|
||||
PRBool isHover = PR_FALSE;
|
||||
nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
isTopLevel = IsTopLevelMenu(aFrame);
|
||||
|
||||
@ -1022,7 +1022,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_MENUARROW:
|
||||
{
|
||||
aPart = MENU_POPUPSUBMENU;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
aState = IsDisabled(aFrame, eventState) ? MSM_DISABLED : MSM_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
case NS_THEME_MENURADIO:
|
||||
{
|
||||
PRBool isChecked;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// NOTE: we can probably use NS_EVENT_STATE_CHECKED
|
||||
isChecked = CheckBooleanAttr(aFrame, nsWidgetAtoms::checked);
|
||||
@ -1258,7 +1258,7 @@ RENDER_AGAIN:
|
||||
if (isChecked)
|
||||
{
|
||||
int bgState = MCB_NORMAL;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// the disabled states are offset by 1
|
||||
if (IsDisabled(aFrame, eventState))
|
||||
@ -1349,10 +1349,9 @@ RENDER_AGAIN:
|
||||
aFrame->GetContent()->IsHTML()) ||
|
||||
aWidgetType == NS_THEME_SCALE_HORIZONTAL ||
|
||||
aWidgetType == NS_THEME_SCALE_VERTICAL) {
|
||||
PRInt32 contentState;
|
||||
contentState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates contentState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (contentState & NS_EVENT_STATE_FOCUS) {
|
||||
if (contentState.HasState(NS_EVENT_STATE_FOCUS)) {
|
||||
POINT vpOrg;
|
||||
HPEN hPen = nsnull;
|
||||
|
||||
@ -1375,7 +1374,7 @@ RENDER_AGAIN:
|
||||
::SelectObject(hdc, hPen);
|
||||
|
||||
// If pressed, draw the upper left corner of the dotted rect.
|
||||
if (contentState & NS_EVENT_STATE_ACTIVE) {
|
||||
if (contentState.HasState(NS_EVENT_STATE_ACTIVE)) {
|
||||
::MoveToEx(hdc, widgetRect.left, widgetRect.bottom-1, NULL);
|
||||
::LineTo(hdc, widgetRect.left, widgetRect.top);
|
||||
::LineTo(hdc, widgetRect.right-1, widgetRect.top);
|
||||
@ -2489,7 +2488,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
{
|
||||
switch (aWidgetType) {
|
||||
case NS_THEME_BUTTON: {
|
||||
PRInt32 contentState;
|
||||
nsEventStates contentState;
|
||||
|
||||
aPart = DFC_BUTTON;
|
||||
aState = DFCS_BUTTONPUSH;
|
||||
@ -2503,7 +2502,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
else if (IsCheckedButton(aFrame))
|
||||
aState |= DFCS_CHECKED;
|
||||
else {
|
||||
if (contentState & NS_EVENT_STATE_ACTIVE && contentState & NS_EVENT_STATE_HOVER) {
|
||||
if (contentState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) {
|
||||
aState |= DFCS_PUSHED;
|
||||
const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
|
||||
// The down state is flat if the button is focusable
|
||||
@ -2515,9 +2514,9 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
aFocused = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((contentState & NS_EVENT_STATE_FOCUS) ||
|
||||
(aState == DFCS_BUTTONPUSH && IsDefaultButton(aFrame))) {
|
||||
aFocused = PR_TRUE;
|
||||
if (contentState.HasState(NS_EVENT_STATE_FOCUS) ||
|
||||
(aState == DFCS_BUTTONPUSH && IsDefaultButton(aFrame))) {
|
||||
aFocused = PR_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2526,7 +2525,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
}
|
||||
case NS_THEME_CHECKBOX:
|
||||
case NS_THEME_RADIO: {
|
||||
PRInt32 contentState;
|
||||
nsEventStates contentState;
|
||||
aFocused = PR_FALSE;
|
||||
|
||||
aPart = DFC_BUTTON;
|
||||
@ -2552,14 +2551,14 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
|
||||
contentState = GetContentState(aFrame, aWidgetType);
|
||||
if (!content->IsXUL() &&
|
||||
(contentState & NS_EVENT_STATE_FOCUS)) {
|
||||
contentState.HasState(NS_EVENT_STATE_FOCUS)) {
|
||||
aFocused = PR_TRUE;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame, contentState)) {
|
||||
aState |= DFCS_INACTIVE;
|
||||
} else if (contentState & NS_EVENT_STATE_ACTIVE &&
|
||||
contentState & NS_EVENT_STATE_HOVER) {
|
||||
} else if (contentState.HasAllStates(NS_EVENT_STATE_ACTIVE |
|
||||
NS_EVENT_STATE_HOVER)) {
|
||||
aState |= DFCS_PUSHED;
|
||||
}
|
||||
|
||||
@ -2572,7 +2571,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
PRBool isOpen = PR_FALSE;
|
||||
PRBool isContainer = PR_FALSE;
|
||||
nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// We indicate top-level-ness using aPart. 0 is a normal menu item,
|
||||
// 1 is a top-level menu item. The state of the item is composed of
|
||||
@ -2607,7 +2606,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
case NS_THEME_MENURADIO:
|
||||
case NS_THEME_MENUARROW: {
|
||||
aState = 0;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (IsDisabled(aFrame, eventState))
|
||||
aState |= DFCS_INACTIVE;
|
||||
@ -2666,7 +2665,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
if (isHTML || isMenulist)
|
||||
aFrame = parentFrame;
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (IsDisabled(aFrame, eventState)) {
|
||||
aState |= DFCS_INACTIVE;
|
||||
@ -2687,7 +2686,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
return NS_OK;
|
||||
|
||||
// Dropdown button active state doesn't need :hover.
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE)
|
||||
if (eventState.HasState(NS_EVENT_STATE_ACTIVE))
|
||||
aState |= DFCS_PUSHED | DFCS_FLAT;
|
||||
#endif
|
||||
|
||||
@ -2697,7 +2696,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_LEFT:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
|
||||
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates contentState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
aPart = DFC_SCROLL;
|
||||
switch (aWidgetType) {
|
||||
@ -2719,8 +2718,8 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
aState |= DFCS_INACTIVE;
|
||||
else {
|
||||
#ifndef WINCE
|
||||
if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
|
||||
aState |= DFCS_PUSHED | DFCS_FLAT;
|
||||
if (contentState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
aState |= DFCS_PUSHED | DFCS_FLAT;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2728,7 +2727,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
}
|
||||
case NS_THEME_SPINNER_UP_BUTTON:
|
||||
case NS_THEME_SPINNER_DOWN_BUTTON: {
|
||||
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates contentState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
aPart = DFC_SCROLL;
|
||||
switch (aWidgetType) {
|
||||
@ -2743,7 +2742,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
||||
if (IsDisabled(aFrame, contentState))
|
||||
aState |= DFCS_INACTIVE;
|
||||
else {
|
||||
if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
|
||||
if (contentState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE))
|
||||
aState |= DFCS_PUSHED;
|
||||
}
|
||||
|
||||
@ -3072,7 +3071,7 @@ RENDER_AGAIN:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD: {
|
||||
// Draw inset edge
|
||||
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// Fill in background
|
||||
if (IsDisabled(aFrame, eventState) ||
|
||||
@ -3135,7 +3134,7 @@ RENDER_AGAIN:
|
||||
break;
|
||||
case NS_THEME_SCALE_THUMB_VERTICAL:
|
||||
case NS_THEME_SCALE_THUMB_HORIZONTAL: {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT | BF_SOFT | BF_MIDDLE | BF_ADJUST);
|
||||
if (IsDisabled(aFrame, eventState)) {
|
||||
|
@ -68,11 +68,11 @@ nsNativeTheme::GetPresShell(nsIFrame* aFrame)
|
||||
return context ? context->GetPresShell() : nsnull;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStates
|
||||
nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
|
||||
{
|
||||
if (!aFrame)
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
|
||||
PRBool isXULCheckboxRadio =
|
||||
(aWidgetType == NS_THEME_CHECKBOX ||
|
||||
@ -82,14 +82,14 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
|
||||
aFrame = aFrame->GetParent();
|
||||
|
||||
if (!aFrame->GetContent())
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
|
||||
nsIPresShell *shell = GetPresShell(aFrame);
|
||||
if (!shell)
|
||||
return 0;
|
||||
return nsEventStates();
|
||||
|
||||
nsIEventStateManager* esm = shell->GetPresContext()->EventStateManager();
|
||||
PRInt32 flags = esm->GetContentState(aFrame->GetContent(), PR_TRUE);
|
||||
nsEventStates flags = esm->GetContentState(aFrame->GetContent(), PR_TRUE);
|
||||
|
||||
if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) {
|
||||
if (IsFocused(aFrame))
|
||||
@ -260,7 +260,7 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
bool
|
||||
nsNativeTheme::IsDisabled(nsIFrame* aFrame, PRInt32 aEventStates)
|
||||
nsNativeTheme::IsDisabled(nsIFrame* aFrame, nsEventStates aEventStates)
|
||||
{
|
||||
if (!aFrame) {
|
||||
return false;
|
||||
@ -272,7 +272,7 @@ nsNativeTheme::IsDisabled(nsIFrame* aFrame, PRInt32 aEventStates)
|
||||
}
|
||||
|
||||
if (content->IsHTML()) {
|
||||
return (aEventStates & NS_EVENT_STATE_DISABLED);
|
||||
return aEventStates.HasState(NS_EVENT_STATE_DISABLED);
|
||||
}
|
||||
|
||||
// For XML/XUL elements, an attribute must be equal to the literal
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "nsMargin.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsWidgetAtoms.h"
|
||||
#include "nsEventStates.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
@ -70,7 +71,7 @@ class nsNativeTheme
|
||||
nsNativeTheme();
|
||||
|
||||
// Returns the content state (hover, focus, etc), see nsIEventStateManager.h
|
||||
PRInt32 GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType);
|
||||
nsEventStates GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType);
|
||||
|
||||
// Returns whether the widget is already styled by content
|
||||
// Normally called from ThemeSupportsWidget to turn off native theming
|
||||
@ -80,7 +81,7 @@ class nsNativeTheme
|
||||
|
||||
// Accessors to widget-specific state information
|
||||
|
||||
bool IsDisabled(nsIFrame* aFrame, PRInt32 aEventStates);
|
||||
bool IsDisabled(nsIFrame* aFrame, nsEventStates aEventStates);
|
||||
|
||||
// RTL chrome direction
|
||||
PRBool IsFrameRTL(nsIFrame* aFrame);
|
||||
|
Loading…
Reference in New Issue
Block a user