Backout bug 394442

git-svn-id: svn://10.0.0.236/trunk@233545 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi 2007-09-01 16:14:53 +00:00
parent 9b469ca354
commit 22735bb104
3 changed files with 2 additions and 34 deletions

View File

@ -92,14 +92,8 @@ enum {
NODE_IS_EDITABLE = 0x00000100U,
// Optimizations to quickly check whether element may have ID, class or style
// attributes. Not all element implementations may use these!
NODE_MAY_HAVE_ID = 0x00000200U,
NODE_MAY_HAVE_CLASS = 0x00000400U,
NODE_MAY_HAVE_STYLE = 0x00000800U,
// Four bits for the script-type ID
NODE_SCRIPT_TYPE_OFFSET = 12,
NODE_SCRIPT_TYPE_OFFSET = 9,
NODE_SCRIPT_TYPE_SIZE = 4,

View File

@ -2265,10 +2265,6 @@ nsGenericElement::DispatchDOMEvent(nsEvent* aEvent,
nsIAtom*
nsGenericElement::GetID() const
{
if (!HasFlag(NODE_MAY_HAVE_ID)) {
return nsnull;
}
nsIAtom* IDName = GetIDAttributeName();
if (IDName) {
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
@ -2291,9 +2287,6 @@ nsGenericElement::GetID() const
}
}
}
nsINode* node = const_cast<nsINode*>(static_cast<const nsINode*>(this));
node->UnsetFlags(NODE_MAY_HAVE_ID);
return nsnull;
}
@ -3687,7 +3680,6 @@ nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
{
if (aNamespaceID == kNameSpaceID_None &&
aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
SetFlags(NODE_MAY_HAVE_ID);
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
aResult.ParseAtom(aValue);

View File

@ -73,15 +73,7 @@ nsStyledElement::GetIDAttributeName() const
const nsAttrValue*
nsStyledElement::GetClasses() const
{
if (!HasFlag(NODE_MAY_HAVE_CLASS)) {
return nsnull;
}
const nsAttrValue* clazz = mAttrsAndChildren.GetAttr(nsGkAtoms::_class);
if (!clazz) {
nsINode* node = const_cast<nsINode*>(static_cast<const nsINode*>(this));
node->UnsetFlags(NODE_MAY_HAVE_CLASS);
}
return clazz;
return mAttrsAndChildren.GetAttr(nsGkAtoms::_class);
}
PRBool
@ -90,12 +82,10 @@ nsStyledElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::style) {
SetFlags(NODE_MAY_HAVE_STYLE);
ParseStyleAttribute(this, aValue, aResult);
return PR_TRUE;
}
if (aAttribute == nsGkAtoms::_class) {
SetFlags(NODE_MAY_HAVE_CLASS);
#ifdef MOZ_SVG
NS_ASSERTION(!nsCOMPtr<nsIDOMSVGStylable>(do_QueryInterface(this)),
"SVG code should have handled this 'class' attribute!");
@ -112,7 +102,6 @@ nsStyledElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
NS_IMETHODIMP
nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
{
SetFlags(NODE_MAY_HAVE_STYLE);
PRBool modification = PR_FALSE;
nsAutoString oldValueStr;
@ -146,16 +135,12 @@ nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
nsICSSStyleRule*
nsStyledElement::GetInlineStyleRule()
{
if (!HasFlag(NODE_MAY_HAVE_STYLE)) {
return nsnull;
}
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
if (attrVal && attrVal->Type() == nsAttrValue::eCSSStyleRule) {
return attrVal->GetCSSStyleRuleValue();
}
UnsetFlags(NODE_MAY_HAVE_STYLE);
return nsnull;
}
@ -211,9 +196,6 @@ nsStyledElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
nsresult
nsStyledElement::ReparseStyleAttribute()
{
if (!HasFlag(NODE_MAY_HAVE_STYLE)) {
return NS_OK;
}
const nsAttrValue* oldVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
if (oldVal && oldVal->Type() != nsAttrValue::eCSSStyleRule) {