зеркало из https://github.com/mozilla/pjs.git
Bug 562688 part 13. Eliminate eELEMENT usage in layout/style, except the rule processor. r=dbaron
This commit is contained in:
Родитель
9b6c3b34d0
Коммит
e107e963f1
|
@ -2021,8 +2021,8 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
|
|||
|
||||
if (content && content->IsInDoc()) {
|
||||
// inherit from the canvas element
|
||||
parentContext = nsComputedDOMStyle::GetStyleContextForContent(
|
||||
content,
|
||||
parentContext = nsComputedDOMStyle::GetStyleContextForElement(
|
||||
content->AsElement(),
|
||||
nsnull,
|
||||
presShell);
|
||||
} else {
|
||||
|
@ -2372,7 +2372,7 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
if (content && content->IsInDoc()) {
|
||||
// try to find the closest context
|
||||
nsRefPtr<nsStyleContext> canvasStyle =
|
||||
nsComputedDOMStyle::GetStyleContextForContent(content,
|
||||
nsComputedDOMStyle::GetStyleContextForElement(content->AsElement(),
|
||||
nsnull,
|
||||
presShell);
|
||||
if (!canvasStyle)
|
||||
|
|
|
@ -379,6 +379,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
|
|||
PRBool aUseSVGMode,
|
||||
nsSMILValue& aValue)
|
||||
{
|
||||
// XXXbz aTargetElement should be an Element
|
||||
NS_ABORT_IF_FALSE(aValue.IsNull(), "Outparam should be null-typed");
|
||||
nsPresContext* presContext = GetPresContextForElement(aTargetElement);
|
||||
if (!presContext) {
|
||||
|
|
|
@ -509,13 +509,13 @@ float nsSVGLength::AxisLength()
|
|||
float nsSVGLength::EmLength()
|
||||
{
|
||||
nsCOMPtr<nsIContent> element = do_QueryReferent(mElement);
|
||||
return nsSVGUtils::GetFontSize(element);
|
||||
return nsSVGUtils::GetFontSize(element->AsElement());
|
||||
}
|
||||
|
||||
float nsSVGLength::ExLength()
|
||||
{
|
||||
nsCOMPtr<nsIContent> element = do_QueryReferent(mElement);
|
||||
return nsSVGUtils::GetFontXHeight(element);
|
||||
return nsSVGUtils::GetFontXHeight(element->AsElement());
|
||||
}
|
||||
|
||||
PRBool nsSVGLength::IsValidUnitType(PRUint16 unit)
|
||||
|
|
|
@ -348,7 +348,8 @@ public:
|
|||
nsRefPtr<nsStyleContext> pseudoContext;
|
||||
if (aContent) {
|
||||
pseudoContext = aPresContext->StyleSet()->
|
||||
ProbePseudoElementStyle(aContent, aPseudoElement, aStyleContext);
|
||||
ProbePseudoElementStyle(aContent->AsElement(), aPseudoElement,
|
||||
aStyleContext);
|
||||
}
|
||||
return pseudoContext != nsnull;
|
||||
}
|
||||
|
|
|
@ -273,6 +273,10 @@ inDOMUtils::GetRuleNodeForContent(nsIContent* aContent,
|
|||
*aRuleNode = nsnull;
|
||||
*aStyleContext = nsnull;
|
||||
|
||||
if (!aContent->IsElement()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsIDocument* doc = aContent->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
@ -286,7 +290,8 @@ inDOMUtils::GetRuleNodeForContent(nsIContent* aContent,
|
|||
NS_ENSURE_TRUE(safe, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsStyleContext> sContext =
|
||||
nsComputedDOMStyle::GetStyleContextForContent(aContent, nsnull, presShell);
|
||||
nsComputedDOMStyle::GetStyleContextForElement(aContent->AsElement(),
|
||||
nsnull, presShell);
|
||||
*aRuleNode = sContext->GetRuleNode();
|
||||
sContext.forget(aStyleContext);
|
||||
return NS_OK;
|
||||
|
|
|
@ -80,6 +80,9 @@
|
|||
#include "nsStyleCoord.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
#include "Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
#if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
|
||||
#define DEBUG_ComputedDOMStyle
|
||||
|
@ -324,42 +327,39 @@ nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
|
|||
|
||||
/* static */
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsComputedDOMStyle::GetStyleContextForContent(nsIContent* aContent,
|
||||
nsComputedDOMStyle::GetStyleContextForElement(Element* aElement,
|
||||
nsIAtom* aPseudo,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eELEMENT),
|
||||
"aContent must be an element");
|
||||
|
||||
// If there's no pres shell, get it from the content
|
||||
if (!aPresShell) {
|
||||
aPresShell = GetPresShellForContent(aContent);
|
||||
aPresShell = GetPresShellForContent(aElement);
|
||||
if (!aPresShell)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
aPresShell->FlushPendingNotifications(Flush_Style);
|
||||
|
||||
return GetStyleContextForContentNoFlush(aContent, aPseudo, aPresShell);
|
||||
return GetStyleContextForElementNoFlush(aElement, aPseudo, aPresShell);
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsComputedDOMStyle::GetStyleContextForContentNoFlush(nsIContent* aContent,
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
|
||||
nsIAtom* aPseudo,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aContent, "NULL content node");
|
||||
NS_ABORT_IF_FALSE(aElement, "NULL element");
|
||||
|
||||
// If there's no pres shell, get it from the content
|
||||
if (!aPresShell) {
|
||||
aPresShell = GetPresShellForContent(aContent);
|
||||
aPresShell = GetPresShellForContent(aElement);
|
||||
if (!aPresShell)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (!aPseudo) {
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
nsIFrame* frame = aElement->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsStyleContext* result =
|
||||
nsLayoutUtils::GetStyleFrame(frame)->GetStyleContext();
|
||||
|
@ -377,10 +377,11 @@ nsComputedDOMStyle::GetStyleContextForContentNoFlush(nsIContent* aContent,
|
|||
// No frame has been created or we have a pseudo, so resolve the
|
||||
// style ourselves
|
||||
nsRefPtr<nsStyleContext> parentContext;
|
||||
nsIContent* parent = aPseudo ? aContent : aContent->GetParent();
|
||||
nsIContent* parent = aPseudo ? aElement : aElement->GetParent();
|
||||
// Don't resolve parent context for document fragments.
|
||||
if (parent && parent->IsNodeOfType(nsINode::eELEMENT))
|
||||
parentContext = GetStyleContextForContentNoFlush(parent, nsnull, aPresShell);
|
||||
if (parent && parent->IsElement())
|
||||
parentContext = GetStyleContextForElementNoFlush(parent->AsElement(),
|
||||
nsnull, aPresShell);
|
||||
|
||||
nsPresContext *presContext = aPresShell->GetPresContext();
|
||||
if (!presContext)
|
||||
|
@ -393,10 +394,10 @@ nsComputedDOMStyle::GetStyleContextForContentNoFlush(nsIContent* aContent,
|
|||
if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
||||
return nsnull;
|
||||
}
|
||||
return styleSet->ResolvePseudoElementStyle(aContent, type, parentContext);
|
||||
return styleSet->ResolvePseudoElementStyle(aElement, type, parentContext);
|
||||
}
|
||||
|
||||
return styleSet->ResolveStyleFor(aContent, parentContext);
|
||||
return styleSet->ResolveStyleFor(aElement, parentContext);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -495,7 +496,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
|||
#endif
|
||||
// Need to resolve a style context
|
||||
mStyleContextHolder =
|
||||
nsComputedDOMStyle::GetStyleContextForContent(mContent,
|
||||
nsComputedDOMStyle::GetStyleContextForElement(mContent->AsElement(),
|
||||
mPseudo,
|
||||
mPresShell);
|
||||
NS_ENSURE_TRUE(mStyleContextHolder, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
|
|
@ -83,11 +83,12 @@ public:
|
|||
}
|
||||
|
||||
static already_AddRefed<nsStyleContext>
|
||||
GetStyleContextForContent(nsIContent* aContent, nsIAtom* aPseudo,
|
||||
GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
|
||||
nsIPresShell* aPresShell);
|
||||
|
||||
static already_AddRefed<nsStyleContext>
|
||||
GetStyleContextForContentNoFlush(nsIContent* aContent, nsIAtom* aPseudo,
|
||||
GetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aPseudo,
|
||||
nsIPresShell* aPresShell);
|
||||
|
||||
static nsIPresShell*
|
||||
|
|
|
@ -63,7 +63,7 @@ nsDOMCSSAttributeDeclaration::nsDOMCSSAttributeDeclaration(nsIContent *aContent
|
|||
{
|
||||
MOZ_COUNT_CTOR(nsDOMCSSAttributeDeclaration);
|
||||
|
||||
NS_ASSERTION(aContent && aContent->IsNodeOfType(nsINode::eELEMENT),
|
||||
NS_ASSERTION(aContent && aContent->IsElement(),
|
||||
"Inline style for non-element content?");
|
||||
}
|
||||
|
||||
|
|
|
@ -981,7 +981,8 @@ LookupStyleContext(nsIContent* aElement)
|
|||
if (!shell) {
|
||||
return nsnull;
|
||||
}
|
||||
return nsComputedDOMStyle::GetStyleContextForContent(aElement, nsnull, shell);
|
||||
return nsComputedDOMStyle::GetStyleContextForElement(aElement->AsElement(),
|
||||
nsnull, shell);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1044,6 +1045,7 @@ nsStyleAnimation::ComputeValue(nsCSSProperty aProperty,
|
|||
PRBool aUseSVGMode,
|
||||
Value& aComputedValue)
|
||||
{
|
||||
// XXXbz aTargetElement should be an Element
|
||||
NS_ABORT_IF_FALSE(aTargetElement, "null target element");
|
||||
NS_ABORT_IF_FALSE(aTargetElement->GetCurrentDoc(),
|
||||
"we should only be able to actively animate nodes that "
|
||||
|
|
|
@ -60,6 +60,9 @@
|
|||
#include "nsRuleProcessorData.h"
|
||||
#include "nsTransitionManager.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsEmptyStyleRule, nsIStyleRule)
|
||||
|
||||
|
@ -793,16 +796,15 @@ PRBool nsStyleSet::BuildDefaultStyleData(nsPresContext* aPresContext)
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolveStyleFor(nsIContent* aContent,
|
||||
nsStyleSet::ResolveStyleFor(Element* aElement,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
NS_ENSURE_FALSE(mInShutdown, nsnull);
|
||||
NS_ASSERTION(aContent && aContent->IsNodeOfType(nsINode::eELEMENT),
|
||||
"aContent must be element");
|
||||
NS_ASSERTION(aElement, "aElement must not be null");
|
||||
|
||||
nsRuleWalker ruleWalker(mRuleTree);
|
||||
ElementRuleProcessorData data(PresContext(), aContent, &ruleWalker);
|
||||
FileRules(EnumRulesMatching<ElementRuleProcessorData>, &data, aContent,
|
||||
ElementRuleProcessorData data(PresContext(), aElement, &ruleWalker);
|
||||
FileRules(EnumRulesMatching<ElementRuleProcessorData>, &data, aElement,
|
||||
&ruleWalker);
|
||||
|
||||
nsRuleNode *ruleNode = ruleWalker.CurrentNode();
|
||||
|
@ -810,7 +812,7 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
|
|||
|
||||
if (ruleWalker.HaveRelevantLink()) {
|
||||
ruleWalker.ResetForVisitedMatching();
|
||||
FileRules(EnumRulesMatching<ElementRuleProcessorData>, &data, aContent,
|
||||
FileRules(EnumRulesMatching<ElementRuleProcessorData>, &data, aElement,
|
||||
&ruleWalker);
|
||||
visitedRuleNode = ruleWalker.CurrentNode();
|
||||
}
|
||||
|
@ -896,7 +898,7 @@ nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
|
||||
nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
|
||||
nsCSSPseudoElements::Type aType,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
|
@ -904,16 +906,14 @@ nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
|
|||
|
||||
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
||||
"must have pseudo element type");
|
||||
NS_ASSERTION(aParentContent &&
|
||||
aParentContent->IsNodeOfType(nsINode::eELEMENT),
|
||||
"aParentContent must be element");
|
||||
NS_ASSERTION(aParentElement, "Must have parent element");
|
||||
|
||||
nsRuleWalker ruleWalker(mRuleTree);
|
||||
PseudoElementRuleProcessorData data(PresContext(), aParentContent,
|
||||
PseudoElementRuleProcessorData data(PresContext(), aParentElement,
|
||||
&ruleWalker, aType);
|
||||
WalkRestrictionRule(aType, &ruleWalker);
|
||||
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
|
||||
aParentContent, &ruleWalker);
|
||||
aParentElement, &ruleWalker);
|
||||
|
||||
nsRuleNode *ruleNode = ruleWalker.CurrentNode();
|
||||
nsRuleNode *visitedRuleNode = nsnull;
|
||||
|
@ -921,7 +921,7 @@ nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
|
|||
if (ruleWalker.HaveRelevantLink()) {
|
||||
ruleWalker.ResetForVisitedMatching();
|
||||
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
|
||||
aParentContent, &ruleWalker);
|
||||
aParentElement, &ruleWalker);
|
||||
visitedRuleNode = ruleWalker.CurrentNode();
|
||||
}
|
||||
|
||||
|
@ -933,7 +933,7 @@ nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ProbePseudoElementStyle(nsIContent* aParentContent,
|
||||
nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
|
||||
nsCSSPseudoElements::Type aType,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
|
@ -941,19 +941,17 @@ nsStyleSet::ProbePseudoElementStyle(nsIContent* aParentContent,
|
|||
|
||||
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
||||
"must have pseudo element type");
|
||||
NS_ASSERTION(aParentContent &&
|
||||
aParentContent->IsNodeOfType(nsINode::eELEMENT),
|
||||
"aParentContent must be element");
|
||||
NS_ASSERTION(aParentElement, "aParentElement must not be null");
|
||||
|
||||
nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
|
||||
nsRuleWalker ruleWalker(mRuleTree);
|
||||
PseudoElementRuleProcessorData data(PresContext(), aParentContent,
|
||||
PseudoElementRuleProcessorData data(PresContext(), aParentElement,
|
||||
&ruleWalker, aType);
|
||||
WalkRestrictionRule(aType, &ruleWalker);
|
||||
// not the root if there was a restriction rule
|
||||
nsRuleNode *adjustedRoot = ruleWalker.CurrentNode();
|
||||
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
|
||||
aParentContent, &ruleWalker);
|
||||
aParentElement, &ruleWalker);
|
||||
|
||||
nsRuleNode *ruleNode = ruleWalker.CurrentNode();
|
||||
if (ruleNode == adjustedRoot) {
|
||||
|
@ -965,7 +963,7 @@ nsStyleSet::ProbePseudoElementStyle(nsIContent* aParentContent,
|
|||
if (ruleWalker.HaveRelevantLink()) {
|
||||
ruleWalker.ResetForVisitedMatching();
|
||||
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
|
||||
aParentContent, &ruleWalker);
|
||||
aParentElement, &ruleWalker);
|
||||
visitedRuleNode = ruleWalker.CurrentNode();
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1019,7 @@ nsStyleSet::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
|
|||
|
||||
#ifdef MOZ_XUL
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolveXULTreePseudoStyle(nsIContent* aParentContent,
|
||||
nsStyleSet::ResolveXULTreePseudoStyle(Element* aParentElement,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator)
|
||||
|
@ -1029,15 +1027,13 @@ nsStyleSet::ResolveXULTreePseudoStyle(nsIContent* aParentContent,
|
|||
NS_ENSURE_FALSE(mInShutdown, nsnull);
|
||||
|
||||
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
|
||||
NS_ASSERTION(aParentContent->IsNodeOfType(nsINode::eELEMENT),
|
||||
"content (if non-null) must be element");
|
||||
NS_ASSERTION(nsCSSAnonBoxes::IsTreePseudoElement(aPseudoTag),
|
||||
"Unexpected pseudo");
|
||||
|
||||
nsRuleWalker ruleWalker(mRuleTree);
|
||||
XULTreeRuleProcessorData data(PresContext(), aParentContent, &ruleWalker,
|
||||
XULTreeRuleProcessorData data(PresContext(), aParentElement, &ruleWalker,
|
||||
aPseudoTag, aComparator);
|
||||
FileRules(EnumRulesMatching<XULTreeRuleProcessorData>, &data, aParentContent,
|
||||
FileRules(EnumRulesMatching<XULTreeRuleProcessorData>, &data, aParentElement,
|
||||
&ruleWalker);
|
||||
|
||||
nsRuleNode *ruleNode = ruleWalker.CurrentNode();
|
||||
|
@ -1046,7 +1042,7 @@ nsStyleSet::ResolveXULTreePseudoStyle(nsIContent* aParentContent,
|
|||
if (ruleWalker.HaveRelevantLink()) {
|
||||
ruleWalker.ResetForVisitedMatching();
|
||||
FileRules(EnumRulesMatching<XULTreeRuleProcessorData>, &data,
|
||||
aParentContent, &ruleWalker);
|
||||
aParentElement, &ruleWalker);
|
||||
visitedRuleNode = ruleWalker.CurrentNode();
|
||||
}
|
||||
|
||||
|
@ -1209,10 +1205,10 @@ nsStyleSet::HasDocumentStateDependentStyle(nsPresContext* aPresContext,
|
|||
nsIContent* aContent,
|
||||
PRInt32 aStateMask)
|
||||
{
|
||||
if (!aContent || !aContent->IsNodeOfType(nsINode::eELEMENT))
|
||||
if (!aContent || !aContent->IsElement())
|
||||
return PR_FALSE;
|
||||
|
||||
StatefulData data(aPresContext, aContent, aStateMask);
|
||||
StatefulData data(aPresContext, aContent->AsElement(), aStateMask);
|
||||
WalkRuleProcessors(SheetHasDocumentStateStyle, &data, PR_TRUE);
|
||||
return data.mHint != 0;
|
||||
}
|
||||
|
@ -1234,8 +1230,8 @@ nsStyleSet::HasStateDependentStyle(nsPresContext* aPresContext,
|
|||
{
|
||||
nsRestyleHint result = nsRestyleHint(0);
|
||||
|
||||
if (aContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
StatefulData data(aPresContext, aContent, aStateMask);
|
||||
if (aContent->IsElement()) {
|
||||
StatefulData data(aPresContext, aContent->AsElement(), aStateMask);
|
||||
WalkRuleProcessors(SheetHasStatefulStyle, &data, PR_FALSE);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
@ -1273,9 +1269,9 @@ nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
|
|||
{
|
||||
nsRestyleHint result = nsRestyleHint(0);
|
||||
|
||||
if (aContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
AttributeData data(aPresContext, aContent, aAttribute, aModType,
|
||||
aAttrHasChanged);
|
||||
if (aContent->IsElement()) {
|
||||
AttributeData data(aPresContext, aContent->AsElement(), aAttribute,
|
||||
aModType, aAttrHasChanged);
|
||||
WalkRuleProcessors(SheetHasAttributeStyle, &data, PR_FALSE);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,8 @@ class nsStyleSet
|
|||
|
||||
// get a style context for a non-pseudo frame.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleFor(nsIContent* aContent, nsStyleContext* aParentContext);
|
||||
ResolveStyleFor(mozilla::dom::Element* aElement,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
// Get a style context (with the given parent) for the
|
||||
// sequence of style rules in the |aRules| array.
|
||||
|
@ -122,11 +123,11 @@ class nsStyleSet
|
|||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForNonElement(nsStyleContext* aParentContext);
|
||||
|
||||
// Get a style context for a pseudo-element. aParentContent must be
|
||||
// Get a style context for a pseudo-element. aParentElement must be
|
||||
// non-null. aPseudoID is the nsCSSPseudoElements::Type for the
|
||||
// pseudo-element.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoElementStyle(nsIContent* aParentContent,
|
||||
ResolvePseudoElementStyle(mozilla::dom::Element* aParentElement,
|
||||
nsCSSPseudoElements::Type aType,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
|
@ -134,7 +135,7 @@ class nsStyleSet
|
|||
// return nsnull if there are no explicit style rules for that
|
||||
// pseudo element.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ProbePseudoElementStyle(nsIContent* aParentContent,
|
||||
ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
|
||||
nsCSSPseudoElements::Type aType,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
|
@ -148,7 +149,7 @@ class nsStyleSet
|
|||
// pseudo-tag to use and must be non-null. aParentContent must be
|
||||
// non-null. aComparator must be non-null.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveXULTreePseudoStyle(nsIContent* aParentContent,
|
||||
ResolveXULTreePseudoStyle(mozilla::dom::Element* aParentElement,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator);
|
||||
|
|
|
@ -89,6 +89,9 @@
|
|||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsSVGPathGeometryFrame.h"
|
||||
#include "prdtoa.h"
|
||||
#include "Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
gfxASurface *nsSVGUtils::mThebesComputationalSurface = nsnull;
|
||||
|
||||
|
@ -256,14 +259,14 @@ nsSVGUtils::GetParentElement(nsIContent *aContent)
|
|||
}
|
||||
|
||||
float
|
||||
nsSVGUtils::GetFontSize(nsIContent *aContent)
|
||||
nsSVGUtils::GetFontSize(Element *aElement)
|
||||
{
|
||||
if (!aContent)
|
||||
if (!aElement)
|
||||
return 1.0f;
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForContentNoFlush(aContent, nsnull,
|
||||
nsnull);
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
|
||||
nsnull, nsnull);
|
||||
if (!styleContext) {
|
||||
NS_WARNING("Couldn't get style context for content in GetFontStyle");
|
||||
return 1.0f;
|
||||
|
@ -293,14 +296,14 @@ nsSVGUtils::GetFontSize(nsStyleContext *aStyleContext)
|
|||
}
|
||||
|
||||
float
|
||||
nsSVGUtils::GetFontXHeight(nsIContent *aContent)
|
||||
nsSVGUtils::GetFontXHeight(Element *aElement)
|
||||
{
|
||||
if (!aContent)
|
||||
if (!aElement)
|
||||
return 1.0f;
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForContentNoFlush(aContent, nsnull,
|
||||
nsnull);
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
|
||||
nsnull, nsnull);
|
||||
if (!styleContext) {
|
||||
NS_WARNING("Couldn't get style context for content in GetFontStyle");
|
||||
return 1.0f;
|
||||
|
|
|
@ -80,6 +80,12 @@ class nsISVGChildFrame;
|
|||
class nsSVGGeometryFrame;
|
||||
class nsSVGDisplayContainerFrame;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
@ -209,13 +215,13 @@ public:
|
|||
/*
|
||||
* Get a font-size (em) of an nsIContent
|
||||
*/
|
||||
static float GetFontSize(nsIContent *aContent);
|
||||
static float GetFontSize(mozilla::dom::Element *aElement);
|
||||
static float GetFontSize(nsIFrame *aFrame);
|
||||
static float GetFontSize(nsStyleContext *aStyleContext);
|
||||
/*
|
||||
* Get an x-height of of an nsIContent
|
||||
*/
|
||||
static float GetFontXHeight(nsIContent *aContent);
|
||||
static float GetFontXHeight(mozilla::dom::Element *aElement);
|
||||
static float GetFontXHeight(nsIFrame *aFrame);
|
||||
static float GetFontXHeight(nsStyleContext *aStyleContext);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче