mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 977991 patch 1 - Expose variant of RulesMatching on nsHTMLCSSStyleSheet that is less work to call. r=birtles
This allows nsStyleSet::RuleNodeWithReplacement to call it without constructing an entire (and unnecessary) ElementRuleProcessorData, which will happen in patch 3.
This commit is contained in:
parent
86f1147a3a
commit
fbfb854963
@ -54,29 +54,36 @@ NS_IMPL_ISUPPORTS(nsHTMLCSSStyleSheet, nsIStyleRuleProcessor)
|
||||
/* virtual */ void
|
||||
nsHTMLCSSStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
|
||||
{
|
||||
Element* element = aData->mElement;
|
||||
|
||||
// just get the one and only style rule from the content's STYLE attribute
|
||||
css::StyleRule* rule = element->GetInlineStyleRule();
|
||||
if (rule) {
|
||||
rule->RuleMatched();
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
ElementRulesMatching(aData->mPresContext, aData->mElement,
|
||||
aData->mRuleWalker);
|
||||
}
|
||||
|
||||
rule = element->GetSMILOverrideStyleRule();
|
||||
void
|
||||
nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
|
||||
Element* aElement,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
// just get the one and only style rule from the content's STYLE attribute
|
||||
css::StyleRule* rule = aElement->GetInlineStyleRule();
|
||||
if (rule) {
|
||||
if (aData->mPresContext->IsProcessingRestyles() &&
|
||||
!aData->mPresContext->IsProcessingAnimationStyleChange()) {
|
||||
rule->RuleMatched();
|
||||
aRuleWalker->Forward(rule);
|
||||
}
|
||||
|
||||
rule = aElement->GetSMILOverrideStyleRule();
|
||||
if (rule) {
|
||||
if (aPresContext->IsProcessingRestyles() &&
|
||||
!aPresContext->IsProcessingAnimationStyleChange()) {
|
||||
// Non-animation restyle -- don't process SMIL override style, because we
|
||||
// don't want SMIL animation to trigger new CSS transitions. Instead,
|
||||
// request an Animation restyle, so we still get noticed.
|
||||
aData->mPresContext->PresShell()->RestyleForAnimation(element,
|
||||
aPresContext->PresShell()->RestyleForAnimation(aElement,
|
||||
eRestyle_Self);
|
||||
} else {
|
||||
// Animation restyle (or non-restyle traversal of rules)
|
||||
// Now we can walk SMIL overrride style, without triggering transitions.
|
||||
rule->RuleMatched();
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aRuleWalker->Forward(rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,15 @@
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
|
||||
class nsRuleWalker;
|
||||
struct MiscContainer;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
}
|
||||
|
||||
class nsHTMLCSSStyleSheet MOZ_FINAL : public nsIStyleRuleProcessor
|
||||
{
|
||||
public:
|
||||
@ -43,6 +50,12 @@ public:
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE MOZ_OVERRIDE;
|
||||
|
||||
// Variant of RulesMatching method above that is specific to this
|
||||
// rule processor.
|
||||
void ElementRulesMatching(nsPresContext* aPresContext,
|
||||
mozilla::dom::Element* aElement,
|
||||
nsRuleWalker* aRuleWalker);
|
||||
|
||||
void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
|
||||
void EvictStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
|
||||
MiscContainer* LookupStyleAttr(const nsAString& aSerialized);
|
||||
|
Loading…
Reference in New Issue
Block a user