Remove InspectorCSSUtils, part 3: Remove the trivial methods and replace their callers with appropriate internal calls. (Bug 371655) r=bzbarsky

This commit is contained in:
L. David Baron 2009-08-10 15:52:29 -07:00
Родитель 0777df2200
Коммит a97b2f066a
6 изменённых файлов: 10 добавлений и 70 удалений

Просмотреть файл

@ -66,6 +66,7 @@ inCSSValueSearch::inCSSValueSearch()
mReturnRelativeURLs(PR_TRUE),
mNormalizeChromeURLs(PR_FALSE)
{
nsCSSProps::AddRefTable();
mProperties = new nsCSSProperty[100];
mCSSUtils = do_GetService(kInspectorCSSUtilsCID);
}
@ -74,6 +75,7 @@ inCSSValueSearch::~inCSSValueSearch()
{
delete[] mProperties;
delete mResults;
nsCSSProps::ReleaseTable();
}
NS_IMPL_ISUPPORTS2(inCSSValueSearch, inISearchProcess, inICSSValueSearch)
@ -259,8 +261,8 @@ inCSSValueSearch::SetNormalizeChromeURLs(PRBool aNormalizeChromeURLs)
NS_IMETHODIMP
inCSSValueSearch::AddPropertyCriteria(const PRUnichar *aPropName)
{
nsCSSProperty prop;
mCSSUtils->LookupCSSProperty(nsDependentString(aPropName), &prop);
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentString(aPropName));
mProperties[mPropertyCount] = prop;
mPropertyCount++;
return NS_OK;

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsIDOMDocument.h"
#include "inISearchObserver.h"
#include "nsTArray.h"
#include "nsCSSProps.h"
#include "nsIInspectorCSSUtils.h"
class nsIDOMCSSStyleSheet;

Просмотреть файл

@ -178,15 +178,10 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
NS_NewISupportsArray(getter_AddRefs(rules));
if (!rules) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIStyleRule> srule;
nsCOMPtr<nsICSSStyleRule> cssRule;
nsCOMPtr<nsIDOMCSSRule> domRule;
for (PRBool isRoot;
mCSSUtils->IsRuleNodeRoot(ruleNode, &isRoot), !isRoot;
mCSSUtils->GetRuleNodeParent(ruleNode, &ruleNode))
{
mCSSUtils->GetRuleNodeRule(ruleNode, getter_AddRefs(srule));
cssRule = do_QueryInterface(srule);
for ( ; !ruleNode->IsRoot(); ruleNode = ruleNode->GetParent()) {
cssRule = do_QueryInterface(ruleNode->GetRule());
if (cssRule) {
cssRule->GetDOMRule(getter_AddRefs(domRule));
if (domRule)

Просмотреть файл

@ -52,10 +52,10 @@ class nsIContent;
class nsIDOMElement;
class nsIArray;
// 5cfdb02f-0962-454c-b015-b05123927021
// afb608b5-96ac-440e-a203-52cac9f188e1
#define NS_IINSPECTORCSSUTILS_IID \
{ 0x5cfdb02f, 0x0962, 0x454c, \
{ 0xb0, 0x15, 0xb0, 0x51, 0x23, 0x92, 0x70, 0x21 } }
{ 0xafb608b5, 0x96ac, 0x440e, \
{ 0xa2, 0x03, 0x52, 0xca, 0xc9, 0xf1, 0x88, 0xe1 } }
// 7ef2f07f-6e34-410b-8336-88acd1cd16b7
#define NS_INSPECTORCSSUTILS_CID \
@ -65,17 +65,6 @@ class nsIArray;
class nsIInspectorCSSUtils : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IINSPECTORCSSUTILS_IID)
// Hooks to nsCSSProps static methods from another library (the
// AddRefTable and ReleaseTable should be handled by the
// implementation of this interface).
NS_IMETHOD LookupCSSProperty(const nsAString& aName, nsCSSProperty *aProp) = 0;
// Hooks to inline methods on nsRuleNode that have trouble linking
// on certain debug builds (MacOSX Mach-O with gcc).
NS_IMETHOD GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent) = 0;
NS_IMETHOD GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule) = 0;
NS_IMETHOD IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIInspectorCSSUtils, NS_IINSPECTORCSSUTILS_IID)

Просмотреть файл

@ -40,51 +40,13 @@
/* XPCOM interface to provide some internal information to DOM inspector */
#include "nsInspectorCSSUtils.h"
#include "nsIStyleRule.h"
#include "nsRuleNode.h"
#include "nsString.h"
#include "nsGkAtoms.h"
#include "nsAutoPtr.h"
#include "nsIFrame.h"
#include "nsStyleSet.h"
nsInspectorCSSUtils::nsInspectorCSSUtils()
{
nsCSSProps::AddRefTable();
}
nsInspectorCSSUtils::~nsInspectorCSSUtils()
{
nsCSSProps::ReleaseTable();
}
NS_IMPL_ISUPPORTS1(nsInspectorCSSUtils, nsIInspectorCSSUtils)
NS_IMETHODIMP
nsInspectorCSSUtils::LookupCSSProperty(const nsAString& aName, nsCSSProperty *aProp)
{
*aProp = nsCSSProps::LookupProperty(aName);
return NS_OK;
}
NS_IMETHODIMP
nsInspectorCSSUtils::GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent)
{
*aParent = aNode->GetParent();
return NS_OK;
}
NS_IMETHODIMP
nsInspectorCSSUtils::GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule)
{
*aRule = aNode->GetRule();
NS_IF_ADDREF(*aRule);
return NS_OK;
}
NS_IMETHODIMP
nsInspectorCSSUtils::IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot)
{
*aIsRoot = aNode->IsRoot();
return NS_OK;
}

Просмотреть файл

@ -43,10 +43,6 @@
#define nsInspectorCSSUtils_h___
#include "nsIInspectorCSSUtils.h"
#include "nsStyleContext.h"
#include "nsAutoPtr.h"
class nsIPresShell;
class nsInspectorCSSUtils : public nsIInspectorCSSUtils {
@ -57,11 +53,6 @@ public:
NS_DECL_ISUPPORTS
// nsIInspectorCSSUtils
NS_IMETHOD LookupCSSProperty(const nsAString& aName, nsCSSProperty *aProp);
NS_IMETHOD GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent);
NS_IMETHOD GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule);
NS_IMETHOD IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot);
};
#endif /* nsInspectorCSSUtils_h___ */