gecko-dev/layout/style/nsIStyleRuleProcessor.h
Daniel Holbert 680815cd6e Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK

--HG--
extra : rebase_source : 3356d4b80ff6213935192e87cdbc9103fec6084c
2017-10-27 10:33:53 -07:00

142 lines
5.2 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* internal abstract interface for containers (roughly origins within
* the CSS cascade) that provide style rules matching an element or
* pseudo-element
*/
#ifndef nsIStyleRuleProcessor_h___
#define nsIStyleRuleProcessor_h___
#include "mozilla/MemoryReporting.h"
#include "nsISupports.h"
#include "nsChangeHint.h"
struct RuleProcessorData;
struct ElementRuleProcessorData;
struct PseudoElementRuleProcessorData;
struct AnonBoxRuleProcessorData;
#ifdef MOZ_XUL
struct XULTreeRuleProcessorData;
#endif
struct StateRuleProcessorData;
struct PseudoElementStateRuleProcessorData;
struct AttributeRuleProcessorData;
class nsPresContext;
// IID for the nsIStyleRuleProcessor interface
// {c1d6001e-4fcb-4c40-bce1-5eba80bfd8f3}
#define NS_ISTYLE_RULE_PROCESSOR_IID \
{ 0xc1d6001e, 0x4fcb, 0x4c40, \
{0xbc, 0xe1, 0x5e, 0xba, 0x80, 0xbf, 0xd8, 0xf3} }
/* The style rule processor interface is a mechanism to separate the matching
* of style rules from style sheet instances.
* Simple style sheets can and will act as their own processor.
* Sheets where rule ordering interlaces between multiple sheets, will need to
* share a single rule processor between them (CSS sheets do this for cascading order)
*
* @see nsIStyleRule (for significantly more detailed comments)
*/
class nsIStyleRuleProcessor : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLE_RULE_PROCESSOR_IID)
// Shorthand for:
// nsCOMArray<nsIStyleRuleProcessor>::nsCOMArrayEnumFunc
typedef bool (* EnumFunc)(nsIStyleRuleProcessor*, void*);
/**
* Find the |nsIStyleRule|s matching the given content node and
* position the given |nsRuleWalker| at the |nsRuleNode| in the rule
* tree representing that ordered list of rules (with higher
* precedence being farther from the root of the lexicographic tree).
*/
virtual void RulesMatching(ElementRuleProcessorData* aData) = 0;
/**
* Just like the previous |RulesMatching|, except for a given content
* node <em>and pseudo-element</em>.
*/
virtual void RulesMatching(PseudoElementRuleProcessorData* aData) = 0;
/**
* Just like the previous |RulesMatching|, except for a given anonymous box.
*/
virtual void RulesMatching(AnonBoxRuleProcessorData* aData) = 0;
#ifdef MOZ_XUL
/**
* Just like the previous |RulesMatching|, except for a given content
* node <em>and tree pseudo</em>.
*/
virtual void RulesMatching(XULTreeRuleProcessorData* aData) = 0;
#endif
/**
* Return whether style can depend on a change of the given document state.
*
* Document states are defined in nsIDocument.h.
*/
virtual bool
HasDocumentStateDependentStyle(StateRuleProcessorData* aData) = 0;
/**
* Return how (as described by nsRestyleHint) style can depend on a
* change of the given content state on the given content node. This
* test is used for optimization only, and may err on the side of
* reporting more dependencies than really exist.
*
* Event states are defined in mozilla/EventStates.h.
*/
virtual nsRestyleHint
HasStateDependentStyle(StateRuleProcessorData* aData) = 0;
virtual nsRestyleHint
HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData) = 0;
/**
* This method will be called twice for every attribute change.
* During the first call, aData->mAttrHasChanged will be false and
* the attribute change will not have happened yet. During the
* second call, aData->mAttrHasChanged will be true and the
* change will have already happened. The bitwise OR of the two
* return values must describe the style changes that are needed due
* to the attribute change. It's up to the rule processor
* implementation to decide how to split the bits up amongst the two
* return values. For example, it could return the bits needed by
* rules that might stop matching the node from the first call and
* the bits needed by rules that might have started matching the
* node from the second call. This test is used for optimization
* only, and may err on the side of reporting more dependencies than
* really exist.
*/
virtual nsRestyleHint HasAttributeDependentStyle(
AttributeRuleProcessorData* aData,
mozilla::RestyleHintData& aRestyleHintDataResult) = 0;
/**
* Do any processing that needs to happen as a result of a change in
* the characteristics of the medium, and return whether this rule
* processor's rules have changed (e.g., because of media queries).
*/
virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) = 0;
/**
* Report the size of this style rule processor to about:memory. A
* processor may return 0.
*/
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const = 0;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleRuleProcessor,
NS_ISTYLE_RULE_PROCESSOR_IID)
#endif /* nsIStyleRuleProcessor_h___ */