зеркало из https://github.com/mozilla/pjs.git
deCOMify nsIStyledContent::GetID (make it return we a weak pointer to the ID
atom). Bug 244249, patch by jpl24 <jlurz24@gmail.com>, r=sicking, sr=bzbarsky
This commit is contained in:
Родитель
b4b6136a61
Коммит
ee3a61b53f
|
@ -1,205 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsIStyleRuleProcessor_h___
|
||||
#define nsIStyleRuleProcessor_h___
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsPresContext.h" // for nsCompatability
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsString.h"
|
||||
#include "nsChangeHint.h"
|
||||
|
||||
class nsIStyleSheet;
|
||||
class nsPresContext;
|
||||
class nsIContent;
|
||||
class nsIStyledContent;
|
||||
class nsISupportsArray;
|
||||
class nsIAtom;
|
||||
class nsICSSPseudoComparator;
|
||||
class nsRuleWalker;
|
||||
|
||||
// The implementation of the constructor and destructor are currently in
|
||||
// nsCSSStyleSheet.cpp.
|
||||
|
||||
struct RuleProcessorData {
|
||||
RuleProcessorData(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsRuleWalker* aRuleWalker,
|
||||
nsCompatibility* aCompat = nsnull);
|
||||
|
||||
// NOTE: not |virtual|
|
||||
~RuleProcessorData();
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->AllocateFromShell(sz);
|
||||
}
|
||||
void Destroy(nsPresContext* aContext) {
|
||||
this->~RuleProcessorData();
|
||||
aContext->FreeToShell(sizeof(RuleProcessorData), this);
|
||||
};
|
||||
|
||||
const nsString* GetLang();
|
||||
|
||||
nsPresContext* mPresContext;
|
||||
nsIContent* mContent; // weak ref
|
||||
nsIContent* mParentContent; // if content, content->GetParent(); weak ref
|
||||
nsRuleWalker* mRuleWalker; // Used to add rules to our results.
|
||||
nsIContent* mScopedRoot; // Root of scoped stylesheet (set and unset by the supplier of the scoped stylesheet
|
||||
|
||||
nsIAtom* mContentTag; // if content, then content->GetTag()
|
||||
nsIAtom* mContentID; // if styled content, then styledcontent->GetID()
|
||||
nsIStyledContent* mStyledContent; // if content, content->QI(nsIStyledContent)
|
||||
PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false
|
||||
PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink
|
||||
PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink
|
||||
nsCompatibility mCompatMode; // Possibly remove use of this in SelectorMatches?
|
||||
PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0
|
||||
PRPackedBool mIsChecked; // checked/selected attribute for option and select elements
|
||||
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
|
||||
PRInt32 mEventState; // if content, eventStateMgr->GetContentState()
|
||||
PRInt32 mNameSpaceID; // if content, content->GetNameSapce()
|
||||
RuleProcessorData* mPreviousSiblingData;
|
||||
RuleProcessorData* mParentData;
|
||||
|
||||
protected:
|
||||
nsAutoString *mLanguage; // NULL means we haven't found out the language yet
|
||||
};
|
||||
|
||||
struct ElementRuleProcessorData : public RuleProcessorData {
|
||||
ElementRuleProcessorData(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
: RuleProcessorData(aPresContext,aContent,aRuleWalker)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "null pointer");
|
||||
NS_PRECONDITION(aRuleWalker, "null pointer");
|
||||
}
|
||||
};
|
||||
|
||||
struct PseudoRuleProcessorData : public RuleProcessorData {
|
||||
PseudoRuleProcessorData(nsPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsICSSPseudoComparator* aComparator,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
: RuleProcessorData(aPresContext, aParentContent, aRuleWalker)
|
||||
{
|
||||
NS_PRECONDITION(aPseudoTag, "null pointer");
|
||||
NS_PRECONDITION(aRuleWalker, "null pointer");
|
||||
mPseudoTag = aPseudoTag;
|
||||
mComparator = aComparator;
|
||||
}
|
||||
|
||||
nsIAtom* mPseudoTag;
|
||||
nsICSSPseudoComparator* mComparator;
|
||||
};
|
||||
|
||||
struct StateRuleProcessorData : public RuleProcessorData {
|
||||
StateRuleProcessorData(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aStateMask)
|
||||
: RuleProcessorData(aPresContext, aContent, nsnull),
|
||||
mStateMask(aStateMask)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "null pointer");
|
||||
}
|
||||
const PRInt32 mStateMask; // |HasStateDependentStyle| for which state(s)?
|
||||
// Constants defined in nsIEventStateManager.h .
|
||||
};
|
||||
|
||||
struct AttributeRuleProcessorData : public RuleProcessorData {
|
||||
AttributeRuleProcessorData(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
: RuleProcessorData(aPresContext, aContent, nsnull),
|
||||
mAttribute(aAttribute),
|
||||
mModType(aModType)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "null pointer");
|
||||
}
|
||||
nsIAtom* mAttribute; // |HasAttributeDependentStyle| for which attribute?
|
||||
PRInt32 mModType; // The type of modification (see nsIDOMMutationEvent).
|
||||
};
|
||||
|
||||
|
||||
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
|
||||
#define NS_ISTYLE_RULE_PROCESSOR_IID \
|
||||
{0x015575fe, 0x7b6c, 0x11d3, {0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b}}
|
||||
|
||||
/* 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)
|
||||
*/
|
||||
class nsIStyleRuleProcessor : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_RULE_PROCESSOR_IID)
|
||||
|
||||
// Shorthand for:
|
||||
// nsCOMArray<nsIStyleRuleProcessor>::nsCOMArrayEnumFunc
|
||||
typedef PRBool (* PR_CALLBACK EnumFunc)(nsIStyleRuleProcessor*, void*);
|
||||
|
||||
// populate rule node tree with nsIStyleRule*
|
||||
// rules are ordered, those with higher precedence are farthest from the root of the tree
|
||||
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData) = 0;
|
||||
|
||||
NS_IMETHOD RulesMatching(PseudoRuleProcessorData* aData) = 0;
|
||||
|
||||
/**
|
||||
* Test whether style is dependent on content state. 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 nsIEventStateManager.h.
|
||||
*/
|
||||
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
|
||||
nsReStyleHint* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Test whether style is dependent the presence or value of an
|
||||
* attribute. This test is used for optimization only, and may err on
|
||||
* the side of reporting more dependencies than really exist.
|
||||
*/
|
||||
NS_IMETHOD HasAttributeDependentStyle(AttributeRuleProcessorData* aData,
|
||||
nsReStyleHint* aResult) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleRuleProcessor_h___ */
|
|
@ -60,7 +60,7 @@ public:
|
|||
// corresponds to the attribute nsHTMLAtoms::id and that the Class
|
||||
// corresponds to the attribute nsHTMLAtoms::kClass. If this becomes
|
||||
// incorrect, then new methods need to be added here.
|
||||
NS_IMETHOD GetID(nsIAtom** aResult) const = 0;
|
||||
virtual nsIAtom* GetID() const = 0;
|
||||
virtual const nsAttrValue* GetClasses() const = 0;
|
||||
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const = 0;
|
||||
|
||||
|
|
|
@ -2114,12 +2114,32 @@ nsGenericElement::MaybeTriggerAutoLink(nsIDocShell *aShell)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericElement::GetID(nsIAtom** aResult) const
|
||||
nsIAtom*
|
||||
nsGenericElement::GetID() const
|
||||
{
|
||||
*aResult = nsnull;
|
||||
nsIAtom* IDName = GetIDAttributeName();
|
||||
if (IDName) {
|
||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
|
||||
if (attrVal){
|
||||
if (attrVal->Type() == nsAttrValue::eAtom) {
|
||||
return attrVal->GetAtomValue();
|
||||
}
|
||||
if(attrVal->IsEmptyString()){
|
||||
return nsnull;
|
||||
}
|
||||
// Check if the ID has been stored as a string.
|
||||
// This would occur if the ID attribute name changed after
|
||||
// the ID was parsed.
|
||||
if (attrVal->Type() == nsAttrValue::eString) {
|
||||
nsAutoString idVal(attrVal->GetStringValue());
|
||||
|
||||
return NS_OK;
|
||||
// Create an atom from the value and set it into the attribute list.
|
||||
NS_CONST_CAST(nsAttrValue*, attrVal)->ParseAtom(idVal);
|
||||
return attrVal->GetAtomValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
|
@ -3370,8 +3390,18 @@ nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
|
||||
nsresult rv;
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
rv = mAttrsAndChildren.SetAttr(aName, aValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (aName == GetIDAttributeName() && !aValue.IsEmpty()) {
|
||||
// Store id as atom. id="" means that the element has no id, not that it has
|
||||
// an emptystring as the id.
|
||||
nsAttrValue attrValue;
|
||||
attrValue.ParseAtom(aValue);
|
||||
rv = mAttrsAndChildren.SetAndTakeAttr(aName, attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else {
|
||||
rv = mAttrsAndChildren.SetAttr(aName, aValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
|
@ -3564,7 +3594,7 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent) const
|
|||
{
|
||||
NS_PRECONDITION(IsInDoc(), "bad content");
|
||||
|
||||
PRInt32 index;
|
||||
PRUint32 index;
|
||||
for (index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
nsAutoString buf;
|
||||
|
@ -3593,7 +3623,7 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent) const
|
|||
fprintf(out, " refcount=%d<", mRefCnt.get());
|
||||
|
||||
fputs("\n", out);
|
||||
PRInt32 kids = GetChildCount();
|
||||
PRUint32 kids = GetChildCount();
|
||||
|
||||
for (index = 0; index < kids; index++) {
|
||||
nsIContent *kid = GetChildAt(index);
|
||||
|
|
|
@ -429,7 +429,7 @@ public:
|
|||
#endif
|
||||
|
||||
// nsIStyledContent interface methods
|
||||
NS_IMETHOD GetID(nsIAtom** aResult) const;
|
||||
virtual nsIAtom* GetID() const;
|
||||
virtual const nsAttrValue* GetClasses() const;
|
||||
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
|
|
|
@ -233,12 +233,8 @@ nsXMLEventsListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetTarget(getter_AddRefs(target));
|
||||
nsCOMPtr<nsIStyledContent> targetEl(do_QueryInterface(target));
|
||||
if (targetEl) {
|
||||
nsCOMPtr<nsIAtom> id;
|
||||
targetEl->GetID(getter_AddRefs(id));
|
||||
if (id == mTarget)
|
||||
if (targetEl && targetEl->GetID() == mTarget)
|
||||
targetMatched = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (!targetMatched)
|
||||
return NS_OK;
|
||||
|
|
|
@ -1882,24 +1882,6 @@ nsGenericHTMLElement::GetHTMLAttribute(nsIAtom* aAttribute,
|
|||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetID(nsIAtom** aResult) const
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsHTMLAtoms::id);
|
||||
NS_ASSERTION(!attrVal ||
|
||||
attrVal->Type() == nsAttrValue::eAtom ||
|
||||
(attrVal->Type() == nsAttrValue::eString &&
|
||||
attrVal->GetStringValue().IsEmpty()),
|
||||
"unexpected attribute type");
|
||||
if (attrVal && attrVal->Type() == nsAttrValue::eAtom) {
|
||||
NS_ADDREF(*aResult = attrVal->GetAtomValue());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsGenericHTMLElement::GetClasses() const
|
||||
{
|
||||
|
|
|
@ -211,7 +211,6 @@ public:
|
|||
|
||||
// Implementation for nsIHTMLContent
|
||||
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, nsHTMLValue& aValue) const;
|
||||
NS_IMETHOD GetID(nsIAtom** aResult) const;
|
||||
virtual const nsAttrValue* GetClasses() const;
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
|
|
|
@ -2859,7 +2859,7 @@ RuleProcessorData::RuleProcessorData(nsPresContext* aPresContext,
|
|||
// get the styledcontent interface and the ID
|
||||
if (NS_SUCCEEDED(aContent->QueryInterface(NS_GET_IID(nsIStyledContent), (void**)&mStyledContent))) {
|
||||
NS_ASSERTION(mStyledContent, "Succeeded but returned null");
|
||||
mStyledContent->GetID(&mContentID);
|
||||
mContentID = mStyledContent->GetID();
|
||||
}
|
||||
|
||||
// see if there are attributes for the content
|
||||
|
@ -2910,7 +2910,6 @@ RuleProcessorData::~RuleProcessorData()
|
|||
if (mParentData)
|
||||
mParentData->Destroy(mPresContext);
|
||||
|
||||
NS_IF_RELEASE(mContentID);
|
||||
NS_IF_RELEASE(mStyledContent);
|
||||
|
||||
delete mLanguage;
|
||||
|
|
|
@ -202,8 +202,11 @@ nsSVGElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName, nsIAtom* aPrefix,
|
|||
else if (aName == nsSVGAtoms::style && aNamespaceID == kNameSpaceID_None) {
|
||||
nsGenericHTMLElement::ParseStyleAttribute(this, PR_TRUE, aValue, attrValue);
|
||||
}
|
||||
// We don't have an nsISVGValue attribute.
|
||||
else if (aName == nsSVGAtoms::id && aNamespaceID == kNameSpaceID_None){
|
||||
attrValue.ParseAtom(aValue);
|
||||
}
|
||||
else {
|
||||
// We don't have an nsISVGValue attribute.
|
||||
attrValue.SetTo(aValue);
|
||||
}
|
||||
|
||||
|
@ -278,21 +281,6 @@ nsSVGElement::IsContentOfType(PRUint32 aFlags) const
|
|||
//----------------------------------------------------------------------
|
||||
// nsIStyledContent methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::GetID(nsIAtom** aId)const
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
nsresult rv = NS_CONST_CAST(nsSVGElement*,this)->
|
||||
GetAttribute(NS_LITERAL_STRING("id"), value);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aId = NS_NewAtom(value);
|
||||
else
|
||||
*aId = nsnull;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
|
|
@ -85,9 +85,6 @@ public:
|
|||
|
||||
virtual nsresult SetBindingParent(nsIContent* aParent);
|
||||
virtual PRBool IsContentOfType(PRUint32 aFlags) const;
|
||||
|
||||
// nsIStyledContent
|
||||
NS_IMETHOD GetID(nsIAtom** aResult) const;
|
||||
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
|
||||
|
|
|
@ -437,22 +437,3 @@ nsXMLElement::IsFocusable(PRInt32 *aTabIndex)
|
|||
|
||||
NS_IMPL_DOM_CLONENODE(nsXMLElement)
|
||||
|
||||
// nsIStyledContent implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLElement::GetID(nsIAtom** aResult) const
|
||||
{
|
||||
nsIAtom* atom = GetIDAttributeName();
|
||||
|
||||
*aResult = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
if (atom) {
|
||||
nsAutoString value;
|
||||
rv = nsGenericElement::GetAttr(kNameSpaceID_None, atom, value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aResult = NS_NewAtom(value);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,6 @@ public:
|
|||
// nsIXMLContent
|
||||
NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell);
|
||||
|
||||
// nsIStyledContent
|
||||
NS_IMETHOD GetID(nsIAtom** aResult) const;
|
||||
|
||||
// nsIContent
|
||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, PRBool aNotify)
|
||||
|
|
|
@ -1039,6 +1039,17 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
|
|||
}
|
||||
content->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||
|
||||
// Set the ID attribute atom on the node info object for this node
|
||||
// This must occur before the attributes are added so the name
|
||||
// of the id attribute is known.
|
||||
if (aIndex != -1 && NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIAtom> IDAttr = do_GetAtom(aAtts[aIndex]);
|
||||
|
||||
if (IDAttr) {
|
||||
nodeInfo->SetIDAttributeAtom(IDAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the attributes on the new content element
|
||||
result = AddAttributes(aAtts, content);
|
||||
|
||||
|
@ -1054,15 +1065,6 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
|
|||
PushContent(content);
|
||||
}
|
||||
|
||||
// Set the ID attribute atom on the node info object for this node
|
||||
if (aIndex != -1 && NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIAtom> IDAttr = do_GetAtom(aAtts[aIndex]);
|
||||
|
||||
if (IDAttr) {
|
||||
nodeInfo->SetIDAttributeAtom(IDAttr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
if (nameSpaceID > kNameSpaceID_LastBuiltin)
|
||||
content->BeginAddingChildren();
|
||||
|
|
|
@ -735,9 +735,8 @@ MatchElementId(nsIContent *aContent, const nsACString& aUTF8Id, const nsAString&
|
|||
nsCOMPtr<nsIXMLContent> xmlContent = do_QueryInterface(aContent);
|
||||
|
||||
if (xmlContent) {
|
||||
nsCOMPtr<nsIAtom> value;
|
||||
if (NS_SUCCEEDED(xmlContent->GetID(getter_AddRefs(value))) &&
|
||||
value && value->EqualsUTF8(aUTF8Id)) {
|
||||
nsIAtom* value = xmlContent->GetID();
|
||||
if (value && value->EqualsUTF8(aUTF8Id)) {
|
||||
return aContent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3083,10 +3083,10 @@ nsXULElement::EnsureContentsGenerated(void) const
|
|||
}
|
||||
|
||||
// nsIStyledContent Implementation
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetID(nsIAtom** aResult) const
|
||||
/// XXX GetID must be defined here because nsXUL element does not inherit from nsGenericElement.
|
||||
nsIAtom*
|
||||
nsXULElement::GetID() const
|
||||
{
|
||||
*aResult = nsnull;
|
||||
const nsAttrValue* attrVal = FindLocalOrProtoAttr(kNameSpaceID_None, nsXULAtoms::id);
|
||||
|
||||
NS_ASSERTION(!attrVal ||
|
||||
|
@ -3096,10 +3096,9 @@ nsXULElement::GetID(nsIAtom** aResult) const
|
|||
"unexpected attribute type");
|
||||
|
||||
if (attrVal && attrVal->Type() == nsAttrValue::eAtom) {
|
||||
NS_ADDREF(*aResult = attrVal->GetAtomValue());
|
||||
return attrVal->GetAtomValue();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
|
|
|
@ -519,7 +519,7 @@ public:
|
|||
NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell);
|
||||
|
||||
// nsIStyledContent
|
||||
NS_IMETHOD GetID(nsIAtom** aResult) const;
|
||||
virtual nsIAtom* GetID() const;
|
||||
virtual const nsAttrValue* GetClasses() const;
|
||||
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
|
||||
|
||||
|
|
|
@ -2859,7 +2859,7 @@ RuleProcessorData::RuleProcessorData(nsPresContext* aPresContext,
|
|||
// get the styledcontent interface and the ID
|
||||
if (NS_SUCCEEDED(aContent->QueryInterface(NS_GET_IID(nsIStyledContent), (void**)&mStyledContent))) {
|
||||
NS_ASSERTION(mStyledContent, "Succeeded but returned null");
|
||||
mStyledContent->GetID(&mContentID);
|
||||
mContentID = mStyledContent->GetID();
|
||||
}
|
||||
|
||||
// see if there are attributes for the content
|
||||
|
@ -2910,7 +2910,6 @@ RuleProcessorData::~RuleProcessorData()
|
|||
if (mParentData)
|
||||
mParentData->Destroy(mPresContext);
|
||||
|
||||
NS_IF_RELEASE(mContentID);
|
||||
NS_IF_RELEASE(mStyledContent);
|
||||
|
||||
delete mLanguage;
|
||||
|
|
|
@ -83,7 +83,7 @@ struct RuleProcessorData {
|
|||
nsIContent* mScopedRoot; // Root of scoped stylesheet (set and unset by the supplier of the scoped stylesheet
|
||||
|
||||
nsIAtom* mContentTag; // if content, then content->GetTag()
|
||||
nsIAtom* mContentID; // if styled content, then styledcontent->GetID()
|
||||
nsIAtom* mContentID; // if styled content, then weak reference to styledcontent->GetID()
|
||||
nsIStyledContent* mStyledContent; // if content, content->QI(nsIStyledContent)
|
||||
PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false
|
||||
PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink
|
||||
|
|
Загрузка…
Ссылка в новой задаче