Bug 528134. Hand out the style context with the rulenode. r=dbaron, a=dveditz
git-svn-id: svn://10.0.0.236/trunk@259235 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
c62d1dc472
commit
e6e615f9f5
@ -157,7 +157,9 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
|
|||||||
|
|
||||||
nsRuleNode* ruleNode = nsnull;
|
nsRuleNode* ruleNode = nsnull;
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||||
mCSSUtils->GetRuleNodeForContent(content, &ruleNode);
|
nsRefPtr<nsStyleContext> styleContext;
|
||||||
|
mCSSUtils->GetRuleNodeForContent(content, getter_AddRefs(styleContext),
|
||||||
|
&ruleNode);
|
||||||
if (!ruleNode) {
|
if (!ruleNode) {
|
||||||
// This can fail for content nodes that are not in the document or
|
// This can fail for content nodes that are not in the document or
|
||||||
// if the document they're in doesn't have a presshell. Bail out.
|
// if the document they're in doesn't have a presshell. Bail out.
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public:
|
|||||||
virtual ~inDOMUtils();
|
virtual ~inDOMUtils();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsCOMPtr<nsIInspectorCSSUtils> mCSSUtils;
|
nsCOMPtr<nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH> mCSSUtils;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ struct nsRect;
|
|||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsIDOMElement;
|
class nsIDOMElement;
|
||||||
class nsIArray;
|
class nsIArray;
|
||||||
|
class nsStyleContext;
|
||||||
|
|
||||||
// 35dfc2a6-b069-4014-ad4b-01927e77d828
|
// 35dfc2a6-b069-4014-ad4b-01927e77d828
|
||||||
#define NS_IINSPECTORCSSUTILS_IID \
|
#define NS_IINSPECTORCSSUTILS_IID \
|
||||||
@ -77,7 +78,8 @@ public:
|
|||||||
NS_IMETHOD GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule) = 0;
|
NS_IMETHOD GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule) = 0;
|
||||||
NS_IMETHOD IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot) = 0;
|
NS_IMETHOD IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot) = 0;
|
||||||
|
|
||||||
// Hooks to methods that need nsStyleContext
|
// Hooks to methods that need nsStyleContext. Don't call this.
|
||||||
|
// Use nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH instead.
|
||||||
NS_IMETHOD GetRuleNodeForContent(nsIContent* aContent,
|
NS_IMETHOD GetRuleNodeForContent(nsIContent* aContent,
|
||||||
nsRuleNode** aParent) = 0;
|
nsRuleNode** aParent) = 0;
|
||||||
|
|
||||||
@ -87,4 +89,21 @@ public:
|
|||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIInspectorCSSUtils, NS_IINSPECTORCSSUTILS_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIInspectorCSSUtils, NS_IINSPECTORCSSUTILS_IID)
|
||||||
|
|
||||||
|
|
||||||
|
#define NS_IINSPECTORCSSUTILS_MOZILLA_1_9_BRANCH_IID \
|
||||||
|
{ 0x0a03de47, 0x0b6d, 0x4cdb, \
|
||||||
|
{ 0xaa, 0xe3, 0xf4, 0x7f, 0x16, 0x1e, 0x54, 0x2a } }
|
||||||
|
|
||||||
|
class nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH : public nsIInspectorCSSUtils {
|
||||||
|
public:
|
||||||
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IINSPECTORCSSUTILS_MOZILLA_1_9_BRANCH_IID)
|
||||||
|
|
||||||
|
NS_IMETHOD GetRuleNodeForContent(nsIContent* aContent,
|
||||||
|
nsStyleContext** aStyleContext,
|
||||||
|
nsRuleNode** aRuleNode) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH,
|
||||||
|
NS_IINSPECTORCSSUTILS_MOZILLA_1_9_BRANCH_IID)
|
||||||
|
|
||||||
#endif /* nsIInspectorCSSUtils_h___ */
|
#endif /* nsIInspectorCSSUtils_h___ */
|
||||||
|
|||||||
@ -65,7 +65,8 @@ nsInspectorCSSUtils::~nsInspectorCSSUtils()
|
|||||||
nsCSSProps::ReleaseTable();
|
nsCSSProps::ReleaseTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsInspectorCSSUtils, nsIInspectorCSSUtils)
|
NS_IMPL_ISUPPORTS2(nsInspectorCSSUtils, nsIInspectorCSSUtils,
|
||||||
|
nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsInspectorCSSUtils::LookupCSSProperty(const nsAString& aName, nsCSSProperty *aProp)
|
nsInspectorCSSUtils::LookupCSSProperty(const nsAString& aName, nsCSSProperty *aProp)
|
||||||
@ -161,6 +162,16 @@ nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
|
nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
|
||||||
nsRuleNode** aRuleNode)
|
nsRuleNode** aRuleNode)
|
||||||
|
{
|
||||||
|
nsRefPtr<nsStyleContext> styleContext;
|
||||||
|
return GetRuleNodeForContent(aContent, getter_AddRefs(styleContext),
|
||||||
|
aRuleNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
|
||||||
|
nsStyleContext** aStyleContext,
|
||||||
|
nsRuleNode** aRuleNode)
|
||||||
{
|
{
|
||||||
*aRuleNode = nsnull;
|
*aRuleNode = nsnull;
|
||||||
|
|
||||||
@ -173,6 +184,7 @@ nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
|
|||||||
nsRefPtr<nsStyleContext> sContext =
|
nsRefPtr<nsStyleContext> sContext =
|
||||||
GetStyleContextForContent(aContent, nsnull, presShell);
|
GetStyleContextForContent(aContent, nsnull, presShell);
|
||||||
*aRuleNode = sContext->GetRuleNode();
|
*aRuleNode = sContext->GetRuleNode();
|
||||||
|
sContext.forget(aStyleContext);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
class nsIPresShell;
|
class nsIPresShell;
|
||||||
|
|
||||||
class nsInspectorCSSUtils : public nsIInspectorCSSUtils {
|
class nsInspectorCSSUtils : public nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -70,6 +70,11 @@ public:
|
|||||||
GetStyleContextForContent(nsIContent* aContent, nsIAtom* aPseudo,
|
GetStyleContextForContent(nsIContent* aContent, nsIAtom* aPseudo,
|
||||||
nsIPresShell* aPresShell);
|
nsIPresShell* aPresShell);
|
||||||
|
|
||||||
|
// nsIInspectorCSSUtils_MOZILLA_1_9_BRANCH
|
||||||
|
NS_IMETHOD GetRuleNodeForContent(nsIContent* aContent,
|
||||||
|
nsStyleContext** aStyleContext,
|
||||||
|
nsRuleNode** aRuleNode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static nsStyleContext* GetStyleContextForFrame(nsIFrame* aFrame);
|
static nsStyleContext* GetStyleContextForFrame(nsIFrame* aFrame);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user