2009-08-01 19:53:40 +04:00
|
|
|
/* -*- 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.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation
|
|
|
|
*
|
|
|
|
* 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 ***** */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* data structures passed to nsIStyleRuleProcessor methods (to pull loop
|
|
|
|
* invariant computations out of the loop)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsRuleProcessorData_h_
|
|
|
|
#define nsRuleProcessorData_h_
|
|
|
|
|
2011-09-07 04:20:35 +04:00
|
|
|
#include "nsPresContext.h" // for nsCompatibility
|
2009-08-01 19:53:40 +04:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsChangeHint.h"
|
|
|
|
#include "nsIContent.h"
|
2009-12-11 10:37:40 +03:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2010-04-03 05:58:27 +04:00
|
|
|
#include "nsRuleWalker.h"
|
2011-03-29 21:29:21 +04:00
|
|
|
#include "nsNthIndexCache.h"
|
2012-03-30 10:16:22 +04:00
|
|
|
#include "nsILoadContext.h"
|
2012-03-13 07:54:15 +04:00
|
|
|
#include "mozilla/BloomFilter.h"
|
|
|
|
#include "mozilla/GuardObjects.h"
|
2009-08-01 19:53:40 +04:00
|
|
|
|
|
|
|
class nsIStyleSheet;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsICSSPseudoComparator;
|
|
|
|
class nsAttrValue;
|
|
|
|
|
2012-03-13 07:54:15 +04:00
|
|
|
/**
|
|
|
|
* An AncestorFilter is used to keep track of ancestors so that we can
|
|
|
|
* quickly tell that a particular selector is not relevant to a given
|
|
|
|
* element.
|
|
|
|
*/
|
|
|
|
class NS_STACK_CLASS AncestorFilter {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Initialize the filter. If aElement is not null, it and all its
|
|
|
|
* ancestors will be passed to PushAncestor, starting from the root
|
|
|
|
* and going down the tree.
|
|
|
|
*/
|
|
|
|
void Init(mozilla::dom::Element *aElement);
|
|
|
|
|
|
|
|
/* Maintenance of our ancestor state */
|
|
|
|
void PushAncestor(mozilla::dom::Element *aElement);
|
|
|
|
void PopAncestor();
|
|
|
|
|
|
|
|
/* Helper class for maintaining the ancestor state */
|
|
|
|
class NS_STACK_CLASS AutoAncestorPusher {
|
|
|
|
public:
|
|
|
|
AutoAncestorPusher(bool aDoPush,
|
|
|
|
AncestorFilter &aFilter,
|
|
|
|
mozilla::dom::Element *aElement
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
|
|
|
: mPushed(aDoPush && aElement), mFilter(aFilter)
|
|
|
|
{
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
|
|
|
if (mPushed) {
|
|
|
|
mFilter.PushAncestor(aElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~AutoAncestorPusher() {
|
|
|
|
if (mPushed) {
|
|
|
|
mFilter.PopAncestor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mPushed;
|
|
|
|
AncestorFilter &mFilter;
|
|
|
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Check whether we might have an ancestor matching one of the given
|
|
|
|
atom hashes. |hashes| must have length hashListLength */
|
|
|
|
template<size_t hashListLength>
|
|
|
|
bool MightHaveMatchingAncestor(const uint32_t* aHashes) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mFilter);
|
|
|
|
for (size_t i = 0; i < hashListLength && aHashes[i]; ++i) {
|
|
|
|
if (!mFilter->mightContain(aHashes[i])) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasFilter() const { return mFilter; }
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void AssertHasAllAncestors(mozilla::dom::Element *aElement) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Using 2^12 slots makes the Bloom filter a nice round page in
|
|
|
|
// size, so let's do that. We get a false positive rate of 1% or
|
|
|
|
// less even with several hundred things in the filter. Note that
|
|
|
|
// we allocate the filter lazily, because not all tree match
|
|
|
|
// contexts can use one effectively.
|
|
|
|
typedef mozilla::BloomFilter<12, nsIAtom> Filter;
|
|
|
|
nsAutoPtr<Filter> mFilter;
|
|
|
|
|
|
|
|
// Stack of indices to pop to. These are indices into mHashes.
|
|
|
|
nsTArray<PRUint32> mPopTargets;
|
|
|
|
|
|
|
|
// List of hashes; this is what we pop using mPopTargets. We store
|
|
|
|
// hashes of our ancestor element tag names, ids, and classes in
|
|
|
|
// here.
|
|
|
|
nsTArray<uint32_t> mHashes;
|
|
|
|
|
|
|
|
// A debug-only stack of Elements for use in assertions
|
|
|
|
#ifdef DEBUG
|
|
|
|
nsTArray<mozilla::dom::Element*> mElements;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2011-03-29 21:29:20 +04:00
|
|
|
/**
|
|
|
|
* A |TreeMatchContext| has data about a matching operation. The
|
|
|
|
* data are not node-specific but are invariants of the DOM tree the
|
|
|
|
* nodes being matched against are in.
|
|
|
|
*
|
|
|
|
* Most of the members are in parameters to selector matching. The
|
|
|
|
* one out parameter is mHaveRelevantLink. Consumers that use a
|
2011-03-29 21:29:21 +04:00
|
|
|
* TreeMatchContext for more than one matching operation and care
|
|
|
|
* about :visited and mHaveRelevantLink need to
|
|
|
|
* ResetForVisitedMatching() and ResetForUnvisitedMatching() as
|
|
|
|
* needed.
|
2011-03-29 21:29:20 +04:00
|
|
|
*/
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS TreeMatchContext {
|
2011-03-29 21:29:21 +04:00
|
|
|
// Reset this context for matching for the style-if-:visited.
|
|
|
|
void ResetForVisitedMatching() {
|
|
|
|
NS_PRECONDITION(mForStyling, "Why is this being called?");
|
2011-10-17 18:59:28 +04:00
|
|
|
mHaveRelevantLink = false;
|
2011-03-29 21:29:21 +04:00
|
|
|
mVisitedHandling = nsRuleWalker::eRelevantLinkVisited;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResetForUnvisitedMatching() {
|
|
|
|
NS_PRECONDITION(mForStyling, "Why is this being called?");
|
2011-10-17 18:59:28 +04:00
|
|
|
mHaveRelevantLink = false;
|
2011-03-29 21:29:21 +04:00
|
|
|
mVisitedHandling = nsRuleWalker::eRelevantLinkUnvisited;
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
void SetHaveRelevantLink() { mHaveRelevantLink = true; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HaveRelevantLink() const { return mHaveRelevantLink; }
|
2011-03-29 21:29:21 +04:00
|
|
|
|
|
|
|
nsRuleWalker::VisitedHandlingType VisitedHandling() const
|
|
|
|
{
|
|
|
|
return mVisitedHandling;
|
|
|
|
}
|
|
|
|
|
2011-03-29 21:29:20 +04:00
|
|
|
// Is this matching operation for the creation of a style context?
|
|
|
|
// (If it is, we need to set slow selector bits on nodes indicating
|
|
|
|
// that certain restyling needs to happen.)
|
2011-09-29 10:19:26 +04:00
|
|
|
const bool mForStyling;
|
2011-03-29 21:29:20 +04:00
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
private:
|
|
|
|
// When mVisitedHandling is eRelevantLinkUnvisited, this is set to true if a
|
|
|
|
// relevant link (see explanation in definition of VisitedHandling enum) was
|
|
|
|
// encountered during the matching process, which means that matching needs
|
|
|
|
// to be rerun with eRelevantLinkVisited. Otherwise, its behavior is
|
|
|
|
// undefined (it might get set appropriately, or might not).
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHaveRelevantLink;
|
2011-03-29 21:29:20 +04:00
|
|
|
|
|
|
|
// How matching should be performed. See the documentation for
|
|
|
|
// nsRuleWalker::VisitedHandlingType.
|
|
|
|
nsRuleWalker::VisitedHandlingType mVisitedHandling;
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
public:
|
2011-03-29 21:29:21 +04:00
|
|
|
// The document we're working with.
|
|
|
|
nsIDocument* const mDocument;
|
|
|
|
|
2011-03-29 21:29:20 +04:00
|
|
|
// Root of scoped stylesheet (set and unset by the supplier of the
|
|
|
|
// scoped stylesheet).
|
|
|
|
nsIContent* mScopedRoot;
|
|
|
|
|
2011-03-29 21:29:20 +04:00
|
|
|
// Whether our document is HTML (as opposed to XML of some sort,
|
|
|
|
// including XHTML).
|
2011-03-29 21:29:21 +04:00
|
|
|
// XXX XBL2 issue: Should we be caching this? What should it be for XBL2?
|
2011-09-29 10:19:26 +04:00
|
|
|
const bool mIsHTMLDocument;
|
2011-03-29 21:29:20 +04:00
|
|
|
|
2011-03-29 21:29:20 +04:00
|
|
|
// Possibly remove use of mCompatMode in SelectorMatches?
|
2011-03-29 21:29:21 +04:00
|
|
|
// XXX XBL2 issue: Should we be caching this? What should it be for XBL2?
|
2011-03-29 21:29:20 +04:00
|
|
|
const nsCompatibility mCompatMode;
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
// The nth-index cache we should use
|
|
|
|
nsNthIndexCache mNthIndexCache;
|
|
|
|
|
2012-03-13 07:54:15 +04:00
|
|
|
// An ancestor filter
|
|
|
|
AncestorFilter mAncestorFilter;
|
|
|
|
|
2012-03-30 10:16:22 +04:00
|
|
|
// Whether this document is using PB mode
|
|
|
|
bool mUsingPrivateBrowsing;
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
// Constructor to use when creating a tree match context for styling
|
2011-09-29 10:19:26 +04:00
|
|
|
TreeMatchContext(bool aForStyling,
|
2011-03-29 21:29:20 +04:00
|
|
|
nsRuleWalker::VisitedHandlingType aVisitedHandling,
|
2011-03-29 21:29:20 +04:00
|
|
|
nsIDocument* aDocument)
|
2011-03-29 21:29:20 +04:00
|
|
|
: mForStyling(aForStyling)
|
2011-10-17 18:59:28 +04:00
|
|
|
, mHaveRelevantLink(false)
|
2011-03-29 21:29:20 +04:00
|
|
|
, mVisitedHandling(aVisitedHandling)
|
2011-03-29 21:29:21 +04:00
|
|
|
, mDocument(aDocument)
|
2011-03-29 21:29:20 +04:00
|
|
|
, mScopedRoot(nsnull)
|
2011-03-29 21:29:20 +04:00
|
|
|
, mIsHTMLDocument(aDocument->IsHTML())
|
|
|
|
, mCompatMode(aDocument->GetCompatibilityMode())
|
2012-03-30 10:16:22 +04:00
|
|
|
, mUsingPrivateBrowsing(false)
|
2011-03-29 21:29:20 +04:00
|
|
|
{
|
2012-03-30 10:16:22 +04:00
|
|
|
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
|
|
|
|
if (container) {
|
|
|
|
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
|
|
|
|
NS_ASSERTION(loadContext, "Couldn't get loadContext from container; assuming no private browsing.");
|
|
|
|
if (loadContext) {
|
|
|
|
mUsingPrivateBrowsing = loadContext->UsePrivateBrowsing();
|
|
|
|
}
|
|
|
|
}
|
2011-03-29 21:29:20 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-08-01 19:53:40 +04:00
|
|
|
// The implementation of the constructor and destructor are currently in
|
|
|
|
// nsCSSRuleProcessor.cpp.
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS RuleProcessorData {
|
2009-08-01 19:53:40 +04:00
|
|
|
RuleProcessorData(nsPresContext* aPresContext,
|
2010-04-30 17:12:06 +04:00
|
|
|
mozilla::dom::Element* aElement,
|
2009-08-01 19:53:40 +04:00
|
|
|
nsRuleWalker* aRuleWalker,
|
2011-03-29 21:29:21 +04:00
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
: mPresContext(aPresContext)
|
2011-03-29 21:29:21 +04:00
|
|
|
, mElement(aElement)
|
|
|
|
, mRuleWalker(aRuleWalker)
|
2011-03-29 21:29:21 +04:00
|
|
|
, mTreeMatchContext(aTreeMatchContext)
|
2009-08-01 19:53:40 +04:00
|
|
|
{
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_ASSERTION(aElement, "null element leaked into SelectorMatches");
|
2011-10-18 14:53:36 +04:00
|
|
|
NS_ASSERTION(aElement->OwnerDoc(), "Document-less node here?");
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_PRECONDITION(aTreeMatchContext.mForStyling == !!aRuleWalker,
|
|
|
|
"Should be styling if and only if we have a rule walker");
|
2011-03-29 21:29:20 +04:00
|
|
|
}
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
nsPresContext* const mPresContext;
|
|
|
|
mozilla::dom::Element* const mElement; // weak ref, must not be null
|
|
|
|
nsRuleWalker* const mRuleWalker; // Used to add rules to our results.
|
2011-03-29 21:29:21 +04:00
|
|
|
TreeMatchContext& mTreeMatchContext;
|
2009-08-01 19:53:40 +04:00
|
|
|
};
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS ElementRuleProcessorData : public RuleProcessorData {
|
2009-08-01 19:53:40 +04:00
|
|
|
ElementRuleProcessorData(nsPresContext* aPresContext,
|
2010-04-30 17:12:06 +04:00
|
|
|
mozilla::dom::Element* aElement,
|
2011-03-29 21:29:21 +04:00
|
|
|
nsRuleWalker* aRuleWalker,
|
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
: RuleProcessorData(aPresContext, aElement, aRuleWalker, aTreeMatchContext)
|
2009-08-01 19:53:40 +04:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPresContext, "null pointer");
|
|
|
|
NS_PRECONDITION(aRuleWalker, "null pointer");
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_PRECONDITION(aTreeMatchContext.mForStyling, "Styling here!");
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS PseudoElementRuleProcessorData : public RuleProcessorData {
|
2009-12-11 10:37:40 +03:00
|
|
|
PseudoElementRuleProcessorData(nsPresContext* aPresContext,
|
2010-04-30 17:12:06 +04:00
|
|
|
mozilla::dom::Element* aParentElement,
|
2009-12-11 10:37:40 +03:00
|
|
|
nsRuleWalker* aRuleWalker,
|
2011-03-29 21:29:21 +04:00
|
|
|
nsCSSPseudoElements::Type aPseudoType,
|
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
: RuleProcessorData(aPresContext, aParentElement, aRuleWalker,
|
|
|
|
aTreeMatchContext),
|
2009-12-11 10:37:40 +03:00
|
|
|
mPseudoType(aPseudoType)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPresContext, "null pointer");
|
|
|
|
NS_PRECONDITION(aPseudoType <
|
|
|
|
nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
|
|
|
"null pointer");
|
|
|
|
NS_PRECONDITION(aRuleWalker, "null pointer");
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_PRECONDITION(aTreeMatchContext.mForStyling, "Styling here!");
|
2009-12-11 10:37:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCSSPseudoElements::Type mPseudoType;
|
|
|
|
};
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS AnonBoxRuleProcessorData {
|
2009-12-11 10:37:40 +03:00
|
|
|
AnonBoxRuleProcessorData(nsPresContext* aPresContext,
|
|
|
|
nsIAtom* aPseudoTag,
|
|
|
|
nsRuleWalker* aRuleWalker)
|
|
|
|
: mPresContext(aPresContext),
|
|
|
|
mPseudoTag(aPseudoTag),
|
|
|
|
mRuleWalker(aRuleWalker)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(mPresContext, "Must have prescontext");
|
|
|
|
NS_PRECONDITION(aPseudoTag, "Must have pseudo tag");
|
|
|
|
NS_PRECONDITION(aRuleWalker, "Must have rule walker");
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPresContext* mPresContext;
|
|
|
|
nsIAtom* mPseudoTag;
|
|
|
|
nsRuleWalker* mRuleWalker;
|
|
|
|
};
|
|
|
|
|
2009-12-11 10:37:40 +03:00
|
|
|
#ifdef MOZ_XUL
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS XULTreeRuleProcessorData : public RuleProcessorData {
|
2009-12-11 10:37:40 +03:00
|
|
|
XULTreeRuleProcessorData(nsPresContext* aPresContext,
|
2010-04-30 17:12:06 +04:00
|
|
|
mozilla::dom::Element* aParentElement,
|
2009-12-11 10:37:40 +03:00
|
|
|
nsRuleWalker* aRuleWalker,
|
|
|
|
nsIAtom* aPseudoTag,
|
2011-03-29 21:29:21 +04:00
|
|
|
nsICSSPseudoComparator* aComparator,
|
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
: RuleProcessorData(aPresContext, aParentElement, aRuleWalker,
|
|
|
|
aTreeMatchContext),
|
2009-12-11 10:37:40 +03:00
|
|
|
mPseudoTag(aPseudoTag),
|
|
|
|
mComparator(aComparator)
|
2009-08-01 19:53:40 +04:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPresContext, "null pointer");
|
|
|
|
NS_PRECONDITION(aPseudoTag, "null pointer");
|
|
|
|
NS_PRECONDITION(aRuleWalker, "null pointer");
|
2009-12-11 10:37:40 +03:00
|
|
|
NS_PRECONDITION(aComparator, "must have a comparator");
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_PRECONDITION(aTreeMatchContext.mForStyling, "Styling here!");
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIAtom* mPseudoTag;
|
|
|
|
nsICSSPseudoComparator* mComparator;
|
|
|
|
};
|
2009-12-11 10:37:40 +03:00
|
|
|
#endif
|
2009-08-01 19:53:40 +04:00
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS StateRuleProcessorData : public RuleProcessorData {
|
2009-08-01 19:53:40 +04:00
|
|
|
StateRuleProcessorData(nsPresContext* aPresContext,
|
2010-04-30 17:12:06 +04:00
|
|
|
mozilla::dom::Element* aElement,
|
2011-03-29 21:29:21 +04:00
|
|
|
nsEventStates aStateMask,
|
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
: RuleProcessorData(aPresContext, aElement, nsnull, aTreeMatchContext),
|
2009-08-01 19:53:40 +04:00
|
|
|
mStateMask(aStateMask)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPresContext, "null pointer");
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_PRECONDITION(!aTreeMatchContext.mForStyling, "Not styling here!");
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
2010-10-20 15:26:32 +04:00
|
|
|
const nsEventStates mStateMask; // |HasStateDependentStyle| for which state(s)?
|
|
|
|
// Constants defined in nsEventStates.h .
|
2009-08-01 19:53:40 +04:00
|
|
|
};
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
struct NS_STACK_CLASS AttributeRuleProcessorData : public RuleProcessorData {
|
2009-08-01 19:53:40 +04:00
|
|
|
AttributeRuleProcessorData(nsPresContext* aPresContext,
|
2010-04-30 17:12:06 +04:00
|
|
|
mozilla::dom::Element* aElement,
|
2009-08-01 19:53:40 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aAttrHasChanged,
|
2011-03-29 21:29:21 +04:00
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
: RuleProcessorData(aPresContext, aElement, nsnull, aTreeMatchContext),
|
2009-08-01 19:53:40 +04:00
|
|
|
mAttribute(aAttribute),
|
|
|
|
mModType(aModType),
|
2009-12-11 01:36:03 +03:00
|
|
|
mAttrHasChanged(aAttrHasChanged)
|
2009-08-01 19:53:40 +04:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPresContext, "null pointer");
|
2011-03-29 21:29:21 +04:00
|
|
|
NS_PRECONDITION(!aTreeMatchContext.mForStyling, "Not styling here!");
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
|
|
|
nsIAtom* mAttribute; // |HasAttributeDependentStyle| for which attribute?
|
|
|
|
PRInt32 mModType; // The type of modification (see nsIDOMMutationEvent).
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mAttrHasChanged; // Whether the attribute has already changed.
|
2009-08-01 19:53:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !defined(nsRuleProcessorData_h_) */
|