зеркало из https://github.com/mozilla/pjs.git
Separate sheet URI and base URI for style attributes and for CSS parsing from DOM APIs. b=258707 r+sr=bzbarsky
This commit is contained in:
Родитель
841d71848f
Коммит
c61563f77e
|
@ -2707,7 +2707,8 @@ nsGenericHTMLElement::ParseStyleAttribute(nsIContent* aContent,
|
|||
nsCOMPtr<nsIURI> baseURI = aContent->GetBaseURI();
|
||||
|
||||
nsCOMPtr<nsICSSStyleRule> rule;
|
||||
result = cssParser->ParseStyleAttribute(aValue, baseURI,
|
||||
result = cssParser->ParseStyleAttribute(aValue, doc->GetDocumentURI(),
|
||||
baseURI,
|
||||
getter_AddRefs(rule));
|
||||
if (cssLoader) {
|
||||
cssLoader->RecycleParser(cssParser);
|
||||
|
@ -3032,7 +3033,7 @@ nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttri
|
|||
&aData->mDisplayData->mOverflowX,
|
||||
&aData->mDisplayData->mOverflowY,
|
||||
};
|
||||
for (PRInt32 i = 0; i < NS_ARRAY_LENGTH(overflowValues); ++i) {
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(overflowValues); ++i) {
|
||||
if (overflowValues[i]->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::scrolling);
|
||||
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||
|
|
|
@ -1,117 +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 nsCSS1Parser_h___
|
||||
#define nsCSS1Parser_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
class nsICSSStyleRule;
|
||||
class nsICSSStyleSheet;
|
||||
class nsIUnicharInputStream;
|
||||
class nsIURI;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSLoader;
|
||||
class nsICSSRule;
|
||||
class nsISupportsArray;
|
||||
|
||||
#define NS_ICSS_PARSER_IID \
|
||||
{ 0xcc9c0610, 0x968c, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// Rule processing function
|
||||
typedef void (*PR_CALLBACK RuleAppendFunc) (nsICSSRule* aRule, void* aData);
|
||||
|
||||
// Interface to the css parser.
|
||||
class nsICSSParser : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_PARSER_IID)
|
||||
|
||||
// Set a style sheet for the parser to fill in. The style sheet must
|
||||
// implement the nsICSSStyleSheet interface
|
||||
NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet) = 0;
|
||||
|
||||
// Set whether or not tags & classes are case sensitive or uppercased
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
|
||||
|
||||
// Set whether or not to emulate Nav quirks
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode) = 0;
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// Set whether or not we are in an SVG element
|
||||
NS_IMETHOD SetSVGMode(PRBool aSVGMode) = 0;
|
||||
#endif
|
||||
|
||||
// Set loader to use for child sheets
|
||||
NS_IMETHOD SetChildLoader(nsICSSLoader* aChildLoader) = 0;
|
||||
|
||||
NS_IMETHOD Parse(nsIUnicharInputStream* aInput,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURI,
|
||||
PRUint32 aLineNumber,
|
||||
nsICSSStyleSheet*& aResult) = 0;
|
||||
|
||||
// Parse HTML style attribute or its equivalent in other markup
|
||||
// languages. aBaseURL is the base url to use for relative links in
|
||||
// the declaration.
|
||||
NS_IMETHOD ParseStyleAttribute(const nsAString& aAttributeValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSStyleRule** aResult) = 0;
|
||||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRBool* aChanged,
|
||||
PRBool aClearOldDecl) = 0;
|
||||
|
||||
NS_IMETHOD ParseRule(const nsAString& aRule,
|
||||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult) = 0;
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool* aChanged) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewCSSParser(nsICSSParser** aInstancePtrResult);
|
||||
|
||||
#endif /* nsCSS1Parser_h___ */
|
|
@ -112,10 +112,12 @@ public:
|
|||
nsICSSStyleSheet*& aResult);
|
||||
|
||||
NS_IMETHOD ParseStyleAttribute(const nsAString& aAttributeValue,
|
||||
nsIURI* aDocURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSStyleRule** aResult);
|
||||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAString& aBuffer,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
|
@ -123,11 +125,13 @@ public:
|
|||
PRBool aClearOldDecl);
|
||||
|
||||
NS_IMETHOD ParseRule(const nsAString& aRule,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool* aChanged);
|
||||
|
@ -629,6 +633,7 @@ CSSParserImpl::Parse(nsIUnicharInputStream* aInput,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
|
||||
nsIURI* aDocURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSStyleRule** aResult)
|
||||
{
|
||||
|
@ -647,7 +652,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aDocURL, 0, aBaseURL); // XXX line number
|
||||
NS_RELEASE(input);
|
||||
if (! NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
|
@ -692,6 +697,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseAndAppendDeclaration(const nsAString& aBuffer,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
|
@ -712,7 +718,7 @@ CSSParserImpl::ParseAndAppendDeclaration(const nsAString& aBuffer,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aSheetURL, 0, aBaseURL);
|
||||
NS_RELEASE(input);
|
||||
if (! NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
|
@ -753,6 +759,7 @@ CSSParserImpl::ParseAndAppendDeclaration(const nsAString& aBuffer,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseRule(const nsAString& aRule,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult)
|
||||
{
|
||||
|
@ -770,7 +777,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aSheetURL, 0, aBaseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -809,6 +816,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
|||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool* aChanged)
|
||||
|
@ -829,7 +837,7 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aSheetURL, 0, aBaseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,9 @@ PRInt32 nsCSSScanner::Read(nsresult& aErrorCode)
|
|||
}
|
||||
rv = PRInt32(mBuffer[mOffset++]);
|
||||
if (((rv == '\n') && (mLastRead != '\r')) || (rv == '\r')) {
|
||||
mLineNumber++;
|
||||
// 0 is a magical line number meaning that we don't know (i.e., script)
|
||||
if (mLineNumber != 0)
|
||||
++mLineNumber;
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
mColNumber = 0;
|
||||
#endif
|
||||
|
|
|
@ -124,6 +124,8 @@ class nsCSSScanner {
|
|||
~nsCSSScanner();
|
||||
|
||||
// Init the scanner.
|
||||
// |aLineNumber == 1| is the beginning of a file, use |aLineNumber == 0|
|
||||
// when the line number is unknown.
|
||||
void Init(nsIUnicharInputStream* aInput, nsIURI* aURI, PRUint32 aLineNumber);
|
||||
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
|
|
|
@ -901,7 +901,8 @@ public:
|
|||
virtual void DropReference(void);
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser);
|
||||
virtual nsresult DeclarationChanged();
|
||||
|
@ -1003,11 +1004,13 @@ DOMCSSDeclarationImpl::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
|||
* being initialized.
|
||||
*/
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser)
|
||||
{
|
||||
// null out the out params since some of them may not get initialized below
|
||||
*aSheetURI = nsnull;
|
||||
*aBaseURI = nsnull;
|
||||
*aCSSLoader = nsnull;
|
||||
*aCSSParser = nsnull;
|
||||
|
@ -1016,6 +1019,7 @@ DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
if (mRule) {
|
||||
mRule->GetStyleSheet(*getter_AddRefs(sheet));
|
||||
if (sheet) {
|
||||
sheet->GetSheetURI(aSheetURI);
|
||||
sheet->GetBaseURI(aBaseURI);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
sheet->GetOwningDocument(*getter_AddRefs(document));
|
||||
|
|
|
@ -2411,7 +2411,8 @@ nsCSSStyleSheet::InsertRule(const nsAString& aRule,
|
|||
mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
result = css->ParseRule(aRule, mInner->mBaseURI, getter_AddRefs(rules));
|
||||
result = css->ParseRule(aRule, mInner->mSheetURI, mInner->mBaseURI,
|
||||
getter_AddRefs(rules));
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
@ -2655,7 +2656,8 @@ nsCSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule, nsICSSGroupRule* a
|
|||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
result = css->ParseRule(aRule, mInner->mBaseURI, getter_AddRefs(rules));
|
||||
result = css->ParseRule(aRule, mInner->mSheetURI, mInner->mBaseURI,
|
||||
getter_AddRefs(rules));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
PRUint32 rulecount = 0;
|
||||
|
|
|
@ -137,12 +137,14 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
|||
* being initialized.
|
||||
*/
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
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;
|
||||
|
@ -152,7 +154,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
// XXXbz GetOwnerDocument
|
||||
nsIDocument* doc = nsContentUtils::GetDocument(nodeInfo);
|
||||
|
||||
nsCOMPtr<nsIURI> base = mContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> sheetURI = doc->GetDocumentURI();
|
||||
|
||||
if (doc) {
|
||||
NS_IF_ADDREF(*aCSSLoader = doc->GetCSSLoader());
|
||||
|
@ -176,7 +179,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
(*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) ||
|
||||
nodeInfo->NamespaceEquals(kNameSpaceID_XHTML));
|
||||
|
||||
base.swap(*aBaseURI);
|
||||
baseURI.swap(*aBaseURI);
|
||||
sheetURI.swap(*aSheetURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1,80 +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 ***** */
|
||||
|
||||
#ifndef nsDOMCSSAttributeDeclaration_h___
|
||||
#define nsDOMCSSAttributeDeclaration_h___
|
||||
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIStyledContent;
|
||||
class nsICSSLoader;
|
||||
class nsICSSParser;
|
||||
|
||||
class nsDOMCSSAttributeDeclaration : public nsDOMCSSDeclaration
|
||||
{
|
||||
public:
|
||||
nsDOMCSSAttributeDeclaration(nsIStyledContent *aContent);
|
||||
~nsDOMCSSAttributeDeclaration();
|
||||
|
||||
// impl AddRef/Release; QI is implemented by our parent class
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
virtual void DropReference();
|
||||
// If GetCSSDeclaration returns non-null, then the decl it returns
|
||||
// is owned by our current style rule.
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser);
|
||||
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent);
|
||||
|
||||
protected:
|
||||
virtual nsresult DeclarationChanged();
|
||||
|
||||
nsAutoRefCnt mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
|
||||
nsIStyledContent *mContent;
|
||||
};
|
||||
|
||||
#endif /* nsDOMCSSAttributeDeclaration_h___ */
|
|
@ -249,9 +249,10 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
|||
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
nsCOMPtr<nsICSSParser> cssParser;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIURI> baseURI, sheetURI;
|
||||
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(baseURI),
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(sheetURI),
|
||||
getter_AddRefs(baseURI),
|
||||
getter_AddRefs(cssLoader),
|
||||
getter_AddRefs(cssParser));
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -259,8 +260,8 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
|||
}
|
||||
|
||||
PRBool changed;
|
||||
result = cssParser->ParseProperty(aPropID, aPropValue, baseURI, decl,
|
||||
&changed);
|
||||
result = cssParser->ParseProperty(aPropID, aPropValue, sheetURI, baseURI,
|
||||
decl, &changed);
|
||||
if (NS_SUCCEEDED(result) && changed) {
|
||||
result = DeclarationChanged();
|
||||
}
|
||||
|
@ -285,9 +286,10 @@ nsDOMCSSDeclaration::ParseDeclaration(const nsAString& aDecl,
|
|||
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
nsCOMPtr<nsICSSParser> cssParser;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIURI> baseURI, sheetURI;
|
||||
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(baseURI),
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(sheetURI),
|
||||
getter_AddRefs(baseURI),
|
||||
getter_AddRefs(cssLoader),
|
||||
getter_AddRefs(cssParser));
|
||||
|
||||
|
@ -296,7 +298,7 @@ nsDOMCSSDeclaration::ParseDeclaration(const nsAString& aDecl,
|
|||
}
|
||||
|
||||
PRBool changed;
|
||||
result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,
|
||||
result = cssParser->ParseAndAppendDeclaration(aDecl, sheetURI, baseURI, decl,
|
||||
aParseOnlyOneDecl,
|
||||
&changed,
|
||||
aClearOldDecl);
|
||||
|
|
|
@ -1,124 +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 ***** */
|
||||
#ifndef nsDOMCSSDeclaration_h___
|
||||
#define nsDOMCSSDeclaration_h___
|
||||
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIDOMCSS2Properties.h"
|
||||
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSParser;
|
||||
class nsICSSLoader;
|
||||
class nsIURI;
|
||||
|
||||
class CSS2PropertiesTearoff : public nsIDOMNSCSS2Properties
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSIDOMCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
CSS2PropertiesTearoff(nsICSSDeclaration *aOuter);
|
||||
virtual ~CSS2PropertiesTearoff();
|
||||
|
||||
private:
|
||||
nsICSSDeclaration* mOuter;
|
||||
};
|
||||
|
||||
class nsDOMCSSDeclaration : public nsICSSDeclaration
|
||||
{
|
||||
public:
|
||||
nsDOMCSSDeclaration();
|
||||
|
||||
// Only implement QueryInterface; subclasses have the responsibility
|
||||
// of implementing AddRef/Release.
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
NS_DECL_NSICSSDECLARATION
|
||||
|
||||
// Require subclasses to implement |GetParentRule|.
|
||||
//NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
||||
NS_IMETHOD GetCssText(nsAString & aCssText);
|
||||
NS_IMETHOD SetCssText(const nsAString & aCssText);
|
||||
NS_IMETHOD GetPropertyValue(const nsAString & propertyName,
|
||||
nsAString & _retval);
|
||||
NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName,
|
||||
nsIDOMCSSValue **_retval);
|
||||
NS_IMETHOD RemoveProperty(const nsAString & propertyName,
|
||||
nsAString & _retval);
|
||||
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName,
|
||||
nsAString & _retval);
|
||||
NS_IMETHOD SetProperty(const nsAString & propertyName,
|
||||
const nsAString & value, const nsAString & priority);
|
||||
NS_IMETHOD GetLength(PRUint32 *aLength);
|
||||
NS_IMETHOD Item(PRUint32 index, nsAString & _retval);
|
||||
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0;
|
||||
|
||||
virtual void DropReference() = 0;
|
||||
protected:
|
||||
// Always fills in the out parameter, even on failure, and if the out
|
||||
// parameter is null the nsresult will be the correct thing to
|
||||
// propagate.
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate) = 0;
|
||||
virtual nsresult DeclarationChanged() = 0;
|
||||
|
||||
// This will only fail if it can't get a parser. This means it can
|
||||
// return NS_OK without aURI or aCSSLoader being initialized.
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser) = 0;
|
||||
|
||||
nsresult ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue);
|
||||
nsresult ParseDeclaration(const nsAString& aDecl,
|
||||
PRBool aParseOnlyOneDecl, PRBool aClearOldDecl);
|
||||
|
||||
// Prop-id based version of RemoveProperty. Note that this does not
|
||||
// return the old value; it just does a straight removal.
|
||||
nsresult RemoveProperty(const nsCSSProperty aPropID);
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsDOMCSSDeclaration();
|
||||
|
||||
private:
|
||||
CSS2PropertiesTearoff mInner;
|
||||
};
|
||||
|
||||
#endif // nsDOMCSSDeclaration_h___
|
|
@ -735,6 +735,7 @@ nsSVGElement::UpdateContentStyleRule()
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsIURI *docURI = GetOwnerDoc()->GetDocumentURI();
|
||||
nsCOMPtr<nsICSSParser> parser;
|
||||
NS_NewCSSParser(getter_AddRefs(parser));
|
||||
if (!parser)
|
||||
|
@ -763,7 +764,8 @@ nsSVGElement::UpdateContentStyleRule()
|
|||
mAttrsAndChildren.AttrAt(i)->ToString(value);
|
||||
|
||||
PRBool changed;
|
||||
parser->ParseProperty(nsCSSProps::LookupProperty(name), value, baseURI,
|
||||
parser->ParseProperty(nsCSSProps::LookupProperty(name), value,
|
||||
docURI, baseURI,
|
||||
declaration, &changed);
|
||||
}
|
||||
|
||||
|
|
|
@ -4360,7 +4360,8 @@ nsXULPrototypeElement::SetAttrAt(PRUint32 aPos, const nsAString& aValue,
|
|||
nsICSSParser* parser = GetCSSParser();
|
||||
NS_ENSURE_TRUE(parser, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
parser->ParseStyleAttribute(aValue, aDocumentURI,
|
||||
// XXX Get correct Base URI (need GetBaseURI on *prototype* element)
|
||||
parser->ParseStyleAttribute(aValue, aDocumentURI, aDocumentURI,
|
||||
getter_AddRefs(rule));
|
||||
if (rule) {
|
||||
mAttributes[aPos].mValue.SetTo(rule);
|
||||
|
|
|
@ -112,10 +112,12 @@ public:
|
|||
nsICSSStyleSheet*& aResult);
|
||||
|
||||
NS_IMETHOD ParseStyleAttribute(const nsAString& aAttributeValue,
|
||||
nsIURI* aDocURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSStyleRule** aResult);
|
||||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAString& aBuffer,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
|
@ -123,11 +125,13 @@ public:
|
|||
PRBool aClearOldDecl);
|
||||
|
||||
NS_IMETHOD ParseRule(const nsAString& aRule,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool* aChanged);
|
||||
|
@ -629,6 +633,7 @@ CSSParserImpl::Parse(nsIUnicharInputStream* aInput,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
|
||||
nsIURI* aDocURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSStyleRule** aResult)
|
||||
{
|
||||
|
@ -647,7 +652,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aDocURL, 0, aBaseURL); // XXX line number
|
||||
NS_RELEASE(input);
|
||||
if (! NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
|
@ -692,6 +697,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseAndAppendDeclaration(const nsAString& aBuffer,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
|
@ -712,7 +718,7 @@ CSSParserImpl::ParseAndAppendDeclaration(const nsAString& aBuffer,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aSheetURL, 0, aBaseURL);
|
||||
NS_RELEASE(input);
|
||||
if (! NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
|
@ -753,6 +759,7 @@ CSSParserImpl::ParseAndAppendDeclaration(const nsAString& aBuffer,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseRule(const nsAString& aRule,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult)
|
||||
{
|
||||
|
@ -770,7 +777,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aSheetURL, 0, aBaseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -809,6 +816,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
|||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool* aChanged)
|
||||
|
@ -829,7 +837,7 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = InitScanner(input, aBaseURL, 1, aBaseURL); // XXX line number & URLs
|
||||
rv = InitScanner(input, aSheetURL, 0, aBaseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,9 @@ PRInt32 nsCSSScanner::Read(nsresult& aErrorCode)
|
|||
}
|
||||
rv = PRInt32(mBuffer[mOffset++]);
|
||||
if (((rv == '\n') && (mLastRead != '\r')) || (rv == '\r')) {
|
||||
mLineNumber++;
|
||||
// 0 is a magical line number meaning that we don't know (i.e., script)
|
||||
if (mLineNumber != 0)
|
||||
++mLineNumber;
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
mColNumber = 0;
|
||||
#endif
|
||||
|
|
|
@ -124,6 +124,8 @@ class nsCSSScanner {
|
|||
~nsCSSScanner();
|
||||
|
||||
// Init the scanner.
|
||||
// |aLineNumber == 1| is the beginning of a file, use |aLineNumber == 0|
|
||||
// when the line number is unknown.
|
||||
void Init(nsIUnicharInputStream* aInput, nsIURI* aURI, PRUint32 aLineNumber);
|
||||
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
|
|
|
@ -901,7 +901,8 @@ public:
|
|||
virtual void DropReference(void);
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser);
|
||||
virtual nsresult DeclarationChanged();
|
||||
|
@ -1003,11 +1004,13 @@ DOMCSSDeclarationImpl::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
|||
* being initialized.
|
||||
*/
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser)
|
||||
{
|
||||
// null out the out params since some of them may not get initialized below
|
||||
*aSheetURI = nsnull;
|
||||
*aBaseURI = nsnull;
|
||||
*aCSSLoader = nsnull;
|
||||
*aCSSParser = nsnull;
|
||||
|
@ -1016,6 +1019,7 @@ DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
if (mRule) {
|
||||
mRule->GetStyleSheet(*getter_AddRefs(sheet));
|
||||
if (sheet) {
|
||||
sheet->GetSheetURI(aSheetURI);
|
||||
sheet->GetBaseURI(aBaseURI);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
sheet->GetOwningDocument(*getter_AddRefs(document));
|
||||
|
|
|
@ -2411,7 +2411,8 @@ nsCSSStyleSheet::InsertRule(const nsAString& aRule,
|
|||
mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
result = css->ParseRule(aRule, mInner->mBaseURI, getter_AddRefs(rules));
|
||||
result = css->ParseRule(aRule, mInner->mSheetURI, mInner->mBaseURI,
|
||||
getter_AddRefs(rules));
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
@ -2655,7 +2656,8 @@ nsCSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule, nsICSSGroupRule* a
|
|||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
result = css->ParseRule(aRule, mInner->mBaseURI, getter_AddRefs(rules));
|
||||
result = css->ParseRule(aRule, mInner->mSheetURI, mInner->mBaseURI,
|
||||
getter_AddRefs(rules));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
PRUint32 rulecount = 0;
|
||||
|
|
|
@ -137,12 +137,14 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
|||
* being initialized.
|
||||
*/
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
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;
|
||||
|
@ -152,7 +154,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
// XXXbz GetOwnerDocument
|
||||
nsIDocument* doc = nsContentUtils::GetDocument(nodeInfo);
|
||||
|
||||
nsCOMPtr<nsIURI> base = mContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> sheetURI = doc->GetDocumentURI();
|
||||
|
||||
if (doc) {
|
||||
NS_IF_ADDREF(*aCSSLoader = doc->GetCSSLoader());
|
||||
|
@ -176,7 +179,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
(*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) ||
|
||||
nodeInfo->NamespaceEquals(kNameSpaceID_XHTML));
|
||||
|
||||
base.swap(*aBaseURI);
|
||||
baseURI.swap(*aBaseURI);
|
||||
sheetURI.swap(*aSheetURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ public:
|
|||
// is owned by our current style rule.
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser);
|
||||
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent);
|
||||
|
|
|
@ -249,9 +249,10 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
|||
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
nsCOMPtr<nsICSSParser> cssParser;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIURI> baseURI, sheetURI;
|
||||
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(baseURI),
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(sheetURI),
|
||||
getter_AddRefs(baseURI),
|
||||
getter_AddRefs(cssLoader),
|
||||
getter_AddRefs(cssParser));
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -259,8 +260,8 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
|||
}
|
||||
|
||||
PRBool changed;
|
||||
result = cssParser->ParseProperty(aPropID, aPropValue, baseURI, decl,
|
||||
&changed);
|
||||
result = cssParser->ParseProperty(aPropID, aPropValue, sheetURI, baseURI,
|
||||
decl, &changed);
|
||||
if (NS_SUCCEEDED(result) && changed) {
|
||||
result = DeclarationChanged();
|
||||
}
|
||||
|
@ -285,9 +286,10 @@ nsDOMCSSDeclaration::ParseDeclaration(const nsAString& aDecl,
|
|||
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
nsCOMPtr<nsICSSParser> cssParser;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIURI> baseURI, sheetURI;
|
||||
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(baseURI),
|
||||
result = GetCSSParsingEnvironment(getter_AddRefs(sheetURI),
|
||||
getter_AddRefs(baseURI),
|
||||
getter_AddRefs(cssLoader),
|
||||
getter_AddRefs(cssParser));
|
||||
|
||||
|
@ -296,7 +298,7 @@ nsDOMCSSDeclaration::ParseDeclaration(const nsAString& aDecl,
|
|||
}
|
||||
|
||||
PRBool changed;
|
||||
result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,
|
||||
result = cssParser->ParseAndAppendDeclaration(aDecl, sheetURI, baseURI, decl,
|
||||
aParseOnlyOneDecl,
|
||||
&changed,
|
||||
aClearOldDecl);
|
||||
|
|
|
@ -100,7 +100,8 @@ protected:
|
|||
|
||||
// This will only fail if it can't get a parser. This means it can
|
||||
// return NS_OK without aURI or aCSSLoader being initialized.
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser) = 0;
|
||||
|
||||
|
|
|
@ -90,10 +90,12 @@ public:
|
|||
// languages. aBaseURL is the base url to use for relative links in
|
||||
// the declaration.
|
||||
NS_IMETHOD ParseStyleAttribute(const nsAString& aAttributeValue,
|
||||
nsIURI* aDocURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSStyleRule** aResult) = 0;
|
||||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAString& aBuffer,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
|
@ -101,11 +103,13 @@ public:
|
|||
PRBool aClearOldDecl) = 0;
|
||||
|
||||
NS_IMETHOD ParseRule(const nsAString& aRule,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult) = 0;
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aSheetURL,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool* aChanged) = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче