DeCOMTaminate some methods on nsIStyledContent. Bug 244258, patch by jpl24

<jlurz24@gmail.com>, r+sr=bzbarsky
This commit is contained in:
bzbarsky%mit.edu 2004-10-24 17:10:32 +00:00
Родитель 5fd4dbb1a5
Коммит 65db654e10
22 изменённых файлов: 107 добавлений и 341 удалений

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

@ -48,7 +48,7 @@ class nsAttrValue;
// IID for the nsIStyledContent class
#define NS_ISTYLEDCONTENT_IID \
{ 0xc1e84e01, 0xcd15, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
{ 0x13cc12f1, 0x2892, 0x47e4, { 0xaa, 0x77, 0x24, 0xc, 0xa7, 0x49, 0x82, 0xde } };
// Abstract interface for all styled content (that supports ID, CLASS, STYLE, and
// the ability to specify style hints on an attribute change).
@ -66,7 +66,7 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule) = 0;
virtual nsICSSStyleRule* GetInlineStyleRule() = 0;
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify) = 0;
/**
@ -83,9 +83,8 @@ public:
* in response to the change *other* than the result of what is
* mapped into style data via any type of style rule.
*/
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const = 0;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const = 0;
};

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

@ -2137,11 +2137,10 @@ nsGenericElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK;
}
NS_IMETHODIMP
nsGenericElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
nsICSSStyleRule*
nsGenericElement::GetInlineStyleRule()
{
*aStyleRule = nsnull;
return NS_OK;
return nsnull;
}
NS_IMETHODIMP
@ -2158,13 +2157,11 @@ nsGenericElement::IsAttributeMapped(const nsIAtom* aAttribute) const
return PR_FALSE;
}
NS_IMETHODIMP
nsChangeHint
nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
aHint = nsChangeHint(0);
return NS_OK;
return nsChangeHint(0);
}
nsIAtom *

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

@ -433,13 +433,12 @@ public:
virtual const nsAttrValue* GetClasses() const;
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule);
virtual nsICSSStyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
NS_IMETHOD_(PRBool)
IsAttributeMapped(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
/*
* Attribute Mapping Helpers
*/

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

@ -1947,11 +1947,9 @@ nsGenericHTMLElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK;
}
nsresult
nsGenericHTMLElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
{
*aStyleRule = nsnull;
nsICSSStyleRule*
nsGenericHTMLElement::GetInlineStyleRule()
{
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsHTMLAtoms::style);
if (attrVal) {
@ -1962,11 +1960,11 @@ nsGenericHTMLElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
}
if (attrVal->Type() == nsAttrValue::eCSSStyleRule) {
NS_ADDREF(*aStyleRule = attrVal->GetCSSStyleRuleValue());
return attrVal->GetCSSStyleRuleValue();
}
}
return NS_OK;
return nsnull;
}
nsresult

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

@ -214,7 +214,7 @@ public:
virtual nsIAtom *GetClassAttributeName() const;
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule);
virtual nsICSSStyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
already_AddRefed<nsIURI> GetBaseURI() const;

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

@ -89,9 +89,8 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAString& aResult) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
private:
nsresult ParseRowCol(const nsAString& aValue,
PRInt32& aNumSpecs,
@ -316,18 +315,17 @@ nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute,
return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult);
}
NS_IMETHODIMP
nsChangeHint
nsHTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
nsresult rv =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType, aHint);
nsChangeHint retval =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::rows ||
aAttribute == nsHTMLAtoms::cols) {
NS_UpdateHint(aHint, mCurrentRowColHint);
NS_UpdateHint(retval, mCurrentRowColHint);
}
return rv;
return retval;
}
nsresult

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

@ -121,9 +121,8 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAString& aResult) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
@ -471,18 +470,17 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsChangeHint
nsHTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
nsresult rv =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType, aHint);
nsChangeHint retval =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::usemap ||
aAttribute == nsHTMLAtoms::ismap) {
NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE);
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
}
return rv;
return retval;
}
NS_IMETHODIMP_(PRBool)

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

@ -183,9 +183,8 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAString& aResult) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
@ -1871,24 +1870,22 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsChangeHint
nsHTMLInputElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
nsresult rv =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType,
aHint);
nsChangeHint retval =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::type) {
NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE);
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
} else if (aAttribute == nsHTMLAtoms::value) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
} else if (aAttribute == nsHTMLAtoms::size &&
(mType == NS_FORM_INPUT_TEXT ||
mType == NS_FORM_INPUT_PASSWORD)) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
}
return rv;
return retval;
}
NS_IMETHODIMP_(PRBool)

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

@ -81,9 +81,8 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAString& aResult) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
};
@ -166,18 +165,16 @@ nsHTMLLegendElement::AttributeToString(nsIAtom* aAttribute,
aResult);
}
NS_IMETHODIMP
nsChangeHint
nsHTMLLegendElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
nsresult rv =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType,
aHint);
nsChangeHint retval =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::align) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
}
return rv;
return retval;
}
nsresult

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

@ -105,9 +105,8 @@ public:
NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj,
PRUint32 argc, jsval *argv);
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
// nsIOptionElement
NS_IMETHOD SetSelectedInternal(PRBool aValue, PRBool aNotify);
@ -352,19 +351,18 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex)
return NS_OK;
}
NS_IMETHODIMP
nsChangeHint
nsHTMLOptionElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
nsresult rv =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType, aHint);
nsChangeHint retval =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::label ||
aAttribute == nsHTMLAtoms::text) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
}
return rv;
return retval;
}
NS_IMETHODIMP

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

@ -250,9 +250,8 @@ public:
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -1714,19 +1713,17 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsChangeHint
nsHTMLSelectElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
nsresult rv =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType,
aHint);
nsChangeHint retval =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::multiple ||
aAttribute == nsHTMLAtoms::size) {
NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE);
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
}
return rv;
return retval;
}
NS_IMETHODIMP_(PRBool)

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

@ -121,9 +121,8 @@ public:
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
nsEvent* aEvent, nsIDOMEvent** aDOMEvent,
@ -506,23 +505,17 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsChangeHint
nsHTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
// XXX Bug 50280 - It is unclear why we need to do this here for
// rows and cols and why the AttributeChanged method in
// nsTextControlFrame does take care of the entire problem, but
// it doesn't and this makes things better
nsresult rv =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType,
aHint);
nsChangeHint retval =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsHTMLAtoms::rows ||
aAttribute == nsHTMLAtoms::cols) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
}
return rv;
return retval;
}
NS_IMETHODIMP_(PRBool)

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

@ -1,196 +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 Communicator client 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 ***** */
#include "nsDOMCSSAttrDeclaration.h"
#include "nsCSSDeclaration.h"
#include "nsIDocument.h"
#include "nsHTMLAtoms.h"
#include "nsIStyledContent.h"
#include "nsIDOMMutationEvent.h"
#include "nsHTMLValue.h"
#include "nsICSSStyleRule.h"
#include "nsINodeInfo.h"
#include "nsICSSLoader.h"
#include "nsICSSParser.h"
#include "nsIURI.h"
#include "nsINameSpaceManager.h"
#include "nsStyleConsts.h"
#include "nsContentUtils.h"
MOZ_DECL_CTOR_COUNTER(nsDOMCSSAttributeDeclaration)
nsDOMCSSAttributeDeclaration::nsDOMCSSAttributeDeclaration(nsIStyledContent *aContent)
{
MOZ_COUNT_CTOR(nsDOMCSSAttributeDeclaration);
// This reference is not reference-counted. The content
// object tells us when its about to go away.
mContent = aContent;
}
nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration()
{
MOZ_COUNT_DTOR(nsDOMCSSAttributeDeclaration);
}
NS_IMPL_ADDREF(nsDOMCSSAttributeDeclaration)
NS_IMPL_RELEASE(nsDOMCSSAttributeDeclaration)
void
nsDOMCSSAttributeDeclaration::DropReference()
{
mContent = nsnull;
}
nsresult
nsDOMCSSAttributeDeclaration::DeclarationChanged()
{
NS_ASSERTION(mContent, "Must have content node to set the decl!");
nsCOMPtr<nsICSSStyleRule> oldRule;
mContent->GetInlineStyleRule(getter_AddRefs(oldRule));
NS_ASSERTION(oldRule, "content must have rule");
nsCOMPtr<nsICSSStyleRule> newRule = oldRule->DeclarationChanged(PR_FALSE);
if (!newRule) {
return NS_ERROR_OUT_OF_MEMORY;
}
return mContent->SetInlineStyleRule(newRule, PR_TRUE);
}
nsresult
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
PRBool aAllocate)
{
nsresult result = NS_OK;
*aDecl = nsnull;
if (mContent) {
nsCOMPtr<nsICSSStyleRule> cssRule;
mContent->GetInlineStyleRule(getter_AddRefs(cssRule));
if (cssRule) {
*aDecl = cssRule->GetDeclaration();
}
else if (aAllocate) {
nsCSSDeclaration *decl = new nsCSSDeclaration();
if (!decl)
return NS_ERROR_OUT_OF_MEMORY;
if (!decl->InitializeEmpty()) {
decl->RuleAbort();
return NS_ERROR_OUT_OF_MEMORY;
}
result = NS_NewCSSStyleRule(getter_AddRefs(cssRule), nsnull, decl);
if (NS_FAILED(result)) {
decl->RuleAbort();
return result;
}
result = mContent->SetInlineStyleRule(cssRule, PR_FALSE);
if (NS_SUCCEEDED(result)) {
*aDecl = decl;
}
}
}
return result;
}
/*
* This is a utility function. It will only fail if it can't get a
* parser. This means it can return NS_OK without aURI or aCSSLoader
* being initialized.
*/
nsresult
nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aSheetURI,
nsIURI** aBaseURI,
nsICSSLoader** aCSSLoader,
nsICSSParser** aCSSParser)
{
NS_ASSERTION(mContent, "Something is severely broken -- there should be an nsIContent here!");
// null out the out params since some of them may not get initialized below
*aSheetURI = nsnull;
*aBaseURI = nsnull;
*aCSSLoader = nsnull;
*aCSSParser = nsnull;
nsIDocument* doc = mContent->GetOwnerDoc();
if (!doc) {
// document has been destroyed
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsCOMPtr<nsIURI> sheetURI = doc->GetDocumentURI();
if (doc) {
NS_IF_ADDREF(*aCSSLoader = doc->GetCSSLoader());
NS_ASSERTION(*aCSSLoader, "Document with no CSS loader!");
}
nsresult rv = NS_OK;
if (*aCSSLoader) {
rv = (*aCSSLoader)->GetParserFor(nsnull, aCSSParser);
} else {
rv = NS_NewCSSParser(aCSSParser);
}
if (NS_FAILED(rv)) {
return rv;
}
// If we are not HTML, we need to be case-sensitive. Otherwise, Look up our
// namespace. If we're XHTML, we need to be case-sensitive Otherwise, we
// should not be
(*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) ||
mContent->GetNodeInfo()->NamespaceEquals(kNameSpaceID_XHTML));
baseURI.swap(*aBaseURI);
sheetURI.swap(*aSheetURI);
return NS_OK;
}
NS_IMETHODIMP
nsDOMCSSAttributeDeclaration::GetParentRule(nsIDOMCSSRule **aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nsnull;
return NS_OK;
}

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

@ -430,12 +430,11 @@ NS_IMPL_ISUPPORTS3(HTMLCSSStyleSheetImpl,
NS_IMETHODIMP
HTMLCSSStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData)
{
nsIStyledContent *styledContent = aData->mStyledContent;
nsIStyledContent* styledContent = aData->mStyledContent;
if (styledContent) {
// just get the one and only style rule from the content's STYLE attribute
nsCOMPtr<nsICSSStyleRule> rule;
styledContent->GetInlineStyleRule(getter_AddRefs(rule));
nsICSSStyleRule* rule = styledContent->GetInlineStyleRule();
if (rule)
aData->mRuleWalker->Forward(rule);
}

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

@ -342,18 +342,16 @@ nsSVGElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
aNotify);
}
NS_IMETHODIMP
nsSVGElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
nsICSSStyleRule*
nsSVGElement::GetInlineStyleRule()
{
*aStyleRule = nsnull;
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsSVGAtoms::style);
if (attrVal && attrVal->Type() == nsAttrValue::eCSSStyleRule) {
NS_ADDREF(*aStyleRule = attrVal->GetCSSStyleRuleValue());
return attrVal->GetCSSStyleRuleValue();
}
return NS_OK;
return nsnull;
}
// PresentationAttributes-FillStroke

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

@ -91,7 +91,7 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule);
virtual nsICSSStyleRule* GetInlineStyleRule();
static const MappedAttributeEntry sFillStrokeMap[];
static const MappedAttributeEntry sGraphicsMap[];

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

@ -3130,19 +3130,17 @@ nsXULElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK;
}
NS_IMETHODIMP
nsXULElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
nsICSSStyleRule*
nsXULElement::GetInlineStyleRule()
{
*aStyleRule = nsnull;
// Fetch the cached style rule from the attributes.
const nsAttrValue* attrVal = FindLocalOrProtoAttr(kNameSpaceID_None, nsXULAtoms::style);
if (attrVal && attrVal->Type() == nsAttrValue::eCSSStyleRule) {
NS_ADDREF(*aStyleRule = attrVal->GetCSSStyleRuleValue());
return attrVal->GetCSSStyleRuleValue();
}
return NS_OK;
return nsnull;
}
NS_IMETHODIMP
@ -3171,12 +3169,11 @@ nsXULElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
aNotify);
}
NS_IMETHODIMP
nsChangeHint
nsXULElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
PRInt32 aModType) const
{
aHint = NS_STYLE_HINT_NONE;
nsChangeHint retval(NS_STYLE_HINT_NONE);
if (aAttribute == nsXULAtoms::value &&
(aModType == nsIDOMMutationEvent::REMOVAL ||
@ -3188,16 +3185,16 @@ nsXULElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
// value attribute is being added or removed, then we need to
// return a hint of frame change. (See bugzilla bug 95475 for
// details.)
aHint = NS_STYLE_HINT_FRAMECHANGE;
retval = NS_STYLE_HINT_FRAMECHANGE;
} else {
// if left or top changes we reflow. This will happen in xul
// containers that manage positioned children such as a
// bulletinboard.
if (nsXULAtoms::left == aAttribute || nsXULAtoms::top == aAttribute)
aHint = NS_STYLE_HINT_REFLOW;
retval = NS_STYLE_HINT_REFLOW;
}
return NS_OK;
return retval;
}
NS_IMETHODIMP_(PRBool)

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

@ -524,11 +524,10 @@ public:
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule);
virtual nsICSSStyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
// nsIXULContent

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

@ -10279,7 +10279,7 @@ nsCSSFrameConstructor::AttributeChanged(nsPresContext* aPresContext,
nsCOMPtr<nsIStyledContent> styledContent = do_QueryInterface(aContent);
if (styledContent) {
// Get style hint from HTML content object.
styledContent->GetAttributeChangeHint(aAttribute, aModType, hint);
hint = styledContent->GetAttributeChangeHint(aAttribute, aModType);
}
PRBool reframe = (hint & nsChangeHint_ReconstructFrame) != 0;

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

@ -10279,7 +10279,7 @@ nsCSSFrameConstructor::AttributeChanged(nsPresContext* aPresContext,
nsCOMPtr<nsIStyledContent> styledContent = do_QueryInterface(aContent);
if (styledContent) {
// Get style hint from HTML content object.
styledContent->GetAttributeChangeHint(aAttribute, aModType, hint);
hint = styledContent->GetAttributeChangeHint(aAttribute, aModType);
}
PRBool reframe = (hint & nsChangeHint_ReconstructFrame) != 0;

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

@ -80,8 +80,7 @@ nsresult
nsDOMCSSAttributeDeclaration::DeclarationChanged()
{
NS_ASSERTION(mContent, "Must have content node to set the decl!");
nsCOMPtr<nsICSSStyleRule> oldRule;
mContent->GetInlineStyleRule(getter_AddRefs(oldRule));
nsICSSStyleRule* oldRule = mContent->GetInlineStyleRule();
NS_ASSERTION(oldRule, "content must have rule");
nsCOMPtr<nsICSSStyleRule> newRule = oldRule->DeclarationChanged(PR_FALSE);
@ -100,8 +99,7 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
*aDecl = nsnull;
if (mContent) {
nsCOMPtr<nsICSSStyleRule> cssRule;
mContent->GetInlineStyleRule(getter_AddRefs(cssRule));
nsICSSStyleRule* cssRule = mContent->GetInlineStyleRule();
if (cssRule) {
*aDecl = cssRule->GetDeclaration();
}
@ -113,14 +111,15 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
decl->RuleAbort();
return NS_ERROR_OUT_OF_MEMORY;
}
result = NS_NewCSSStyleRule(getter_AddRefs(cssRule), nsnull, decl);
nsCOMPtr<nsICSSStyleRule> newRule;
result = NS_NewCSSStyleRule(getter_AddRefs(newRule), nsnull, decl);
if (NS_FAILED(result)) {
decl->RuleAbort();
return result;
}
result = mContent->SetInlineStyleRule(cssRule, PR_FALSE);
result = mContent->SetInlineStyleRule(newRule, PR_FALSE);
if (NS_SUCCEEDED(result)) {
*aDecl = decl;
}

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

@ -430,12 +430,11 @@ NS_IMPL_ISUPPORTS3(HTMLCSSStyleSheetImpl,
NS_IMETHODIMP
HTMLCSSStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData)
{
nsIStyledContent *styledContent = aData->mStyledContent;
nsIStyledContent* styledContent = aData->mStyledContent;
if (styledContent) {
// just get the one and only style rule from the content's STYLE attribute
nsCOMPtr<nsICSSStyleRule> rule;
styledContent->GetInlineStyleRule(getter_AddRefs(rule));
nsICSSStyleRule* rule = styledContent->GetInlineStyleRule();
if (rule)
aData->mRuleWalker->Forward(rule);
}