Merge backout of bug 221820

This commit is contained in:
Ehsan Akhgari 2010-04-06 21:10:47 -04:00
commit 2989d30bcc
25 changed files with 678 additions and 315 deletions

View File

@ -600,7 +600,7 @@ nsAttrAndChildArray::SetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
void
nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
{
if (mImpl && mImpl->mMappedAttrs && aRuleWalker) {
if (mImpl && mImpl->mMappedAttrs) {
aRuleWalker->Forward(mImpl->mMappedAttrs);
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg"
class="reftest-wait"
onload="go()">
<script>
function go() {
// setCurrentTime to force a sample
document.documentElement.setCurrentTime(1);
document.documentElement.removeAttribute("class");
}
</script>
<rect id="myRect" fill="blue" height="40" width="40">
<!-- The "keyTimes" values below are invalid, but they should be ignored
(and definitely shouldn't trigger any assertion failures) since we're
in paced calcMode. -->
<animate attributeName="x" by="50" calcMode="paced" dur="2s"
keyTimes="0; -1"/>
<animate attributeName="x" by="50" calcMode="paced" dur="2s"
keyTimes=""/>
<animate attributeName="x" by="50" calcMode="paced" dur="2s"
keyTimes="abc"/>
<animate attributeName="x" by="50" calcMode="paced" dur="2s"
keyTimes="5"/>
</rect>
</svg>

After

Width:  |  Height:  |  Size: 944 B

View File

@ -9,4 +9,5 @@ load 529387-1.xhtml
load 537157-1.svg
load 547333-1.svg
load 548899-1.svg
load 555026-1.svg
load 556841-1.svg

View File

@ -412,7 +412,8 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
// Handle bad keytimes (where first != 0 and/or last != 1)
// See http://brian.sol1.net/svg/range-for-keytimes for more info.
if (HasAttr(nsGkAtoms::keyTimes)) {
if (HasAttr(nsGkAtoms::keyTimes) &&
GetCalcMode() != CALC_PACED) {
double first = mKeyTimes[0];
if (first > 0.0 && simpleProgress < first) {
if (!IsToAnimation())
@ -429,20 +430,22 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
}
}
ScaleSimpleProgress(simpleProgress);
if (GetCalcMode() != CALC_DISCRETE) {
// Get the normalised progress between adjacent values
const nsSMILValue* from = nsnull;
const nsSMILValue* to = nsnull;
double intervalProgress;
if (IsToAnimation()) {
// Note: Don't need to do any special-casing for CALC_PACED here,
// because To-Animation doesn't use a values list, by definition.
from = &aBaseValue;
to = &aValues[0];
intervalProgress = simpleProgress;
ScaleIntervalProgress(intervalProgress, 0, 1);
if (GetCalcMode() == CALC_PACED) {
// Note: key[Times/Splines/Points] are ignored for calcMode="paced"
intervalProgress = simpleProgress;
} else {
ScaleSimpleProgress(simpleProgress);
intervalProgress = simpleProgress;
ScaleIntervalProgress(intervalProgress, 0, 1);
}
} else {
if (GetCalcMode() == CALC_PACED) {
rv = ComputePacedPosition(aValues, simpleProgress,
@ -452,6 +455,7 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
// instead. (as the spec says we should, because our failure was
// presumably due to the values being non-additive)
} else { // GetCalcMode() == CALC_LINEAR or GetCalcMode() == CALC_SPLINE
ScaleSimpleProgress(simpleProgress);
PRUint32 index = (PRUint32)floor(simpleProgress *
(aValues.Length() - 1));
from = &aValues[index];

View File

@ -70,6 +70,7 @@ _TEST_FILES = \
test_smilGetStartTime.xhtml \
test_smilGetSimpleDuration.xhtml \
test_smilKeySplines.xhtml \
test_smilKeyTimesPacedMode.xhtml \
test_smilSetCurrentTime.xhtml \
test_smilSync.xhtml \
test_smilSyncbaseTarget.xhtml \

View File

@ -0,0 +1,124 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tests updated intervals</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=555026">Mozilla Bug 555026</a>
<p id="display"></p>
<div id="content" style="display: none">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle r="10" id="circle"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test that we ignore keyTimes attr when calcMode="paced" **/
/* Global Variables */
const SVGNS = "http://www.w3.org/2000/svg";
const ANIM_DUR = "2s";
const HALF_TIME = "1";
const ATTR_NAME = "cx"
const KEYTIMES_TO_TEST = [
// potentially-valid values (depending on number of values in animation)
"0; 0.2; 1",
"0; 0.5",
"0; 1",
// invalid values:
"", "abc", "-0.5", "0; 0.5; 1.01", "5"
];
const gSvg = document.getElementById("svg");
const gCircle = document.getElementById("circle");
SimpleTest.waitForExplicitFinish();
// MAIN FUNCTIONS
function main() {
ok(gSvg.animationsPaused(), "should be paused by <svg> load handler");
is(gSvg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
testByAnimation();
testToAnimation();
testValuesAnimation();
SimpleTest.finish();
}
function testByAnimation() {
for (var i = 0; i < KEYTIMES_TO_TEST.length; i++) {
setupTest();
var anim = createAnim();
anim.setAttribute("by", "200");
var curKeyTimes = KEYTIMES_TO_TEST[i];
anim.setAttribute("keyTimes", curKeyTimes);
gSvg.setCurrentTime(HALF_TIME);
is(gCircle.cx.animVal.value, 100,
"Checking animVal with 'by' and keyTimes='" + curKeyTimes + "'");
removeElement(anim); // clean up
}
}
function testToAnimation() {
for (var i = 0; i < KEYTIMES_TO_TEST.length; i++) {
setupTest();
var anim = createAnim();
anim.setAttribute("to", "200");
var curKeyTimes = KEYTIMES_TO_TEST[i];
anim.setAttribute("keyTimes", curKeyTimes);
gSvg.setCurrentTime(HALF_TIME);
is(gCircle.cx.animVal.value, 100,
"Checking animVal with 'to' and keyTimes='" + curKeyTimes + "'");
removeElement(anim); // clean up
}
}
function testValuesAnimation() {
for (var i = 0; i < KEYTIMES_TO_TEST.length; i++) {
setupTest();
var anim = createAnim();
anim.setAttribute("values", "100; 110; 200");
var curKeyTimes = KEYTIMES_TO_TEST[i];
anim.setAttribute("keyTimes", curKeyTimes);
gSvg.setCurrentTime(HALF_TIME);
is(gCircle.cx.animVal.value, 150,
"Checking animVal with 'values' and keyTimes='" + curKeyTimes + "'");
removeElement(anim); // clean up
}
}
// HELPER FUNCTIONS
// Common setup code for each test function: seek to 0, and make sure
// the previous test cleaned up its animations.
function setupTest() {
gSvg.setCurrentTime(0);
if (gCircle.firstChild) {
ok(false, "Previous test didn't clean up after itself.");
}
}
function createAnim() {
var anim = document.createElementNS(SVGNS,"animate");
anim.setAttribute("attributeName", ATTR_NAME);
anim.setAttribute("dur", ANIM_DUR);
anim.setAttribute("begin", "0s");
anim.setAttribute("calcMode", "paced");
return gCircle.appendChild(anim);
}
window.addEventListener("load", main, false);
]]>
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!doctype html>
<html><head><title>Dynamic manipulation of !important</title>
<style>
div { float: left; width: 50px; height: 50px; margin: 5px;
background-color: green }
div#control { width: 230px }
p { clear: left }
</style>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<p></p>
<div></div>
<div></div>
<div></div>
<div></div>
<p></p>
<div id="control"></div>
<p>There should be two rows of four green squares and one solid green
bar above.</p>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!doctype html>
<html><head><title>Dynamic manipulation of !important</title>
<style>
div { float: left; width: 50px; height: 50px; margin: 5px }
div#control {
width: 230px;
background-color: green !important;
background-color: red;
}
div#a { background-color: green }
div#b { background-color: orange }
div.c { background-color: orange }
div#d { background-color: orange }
div#e { background-color: green }
div#f { background-color: orange }
div.g { background-color: orange }
div#h { background-color: orange }
p { clear: left }
</style>
<style>
div.a { background-color: red !important }
div.b { background-color: red !important }
div#c { background-color: red }
div.d { background-color: red }
div.e { background-color: red !important }
div.f { background-color: red !important }
div#g { background-color: red }
div.h { background-color: red }
</style>
<script>
window.onload = function() {
var r = document.styleSheets[1].cssRules;
r[0].style.setProperty("background-color", "yellow", "");
r[1].style.setProperty("background-color", "green", "important");
r[2].style.setProperty("background-color", "green", "");
r[3].style.setProperty("background-color", "green", "important");
r[4].style.removeProperty("background-color");
r[4].style.setProperty("background-color", "yellow", "");
r[5].style.removeProperty("background-color");
r[5].style.setProperty("background-color", "green", "important");
r[6].style.removeProperty("background-color");
r[6].style.setProperty("background-color", "green", "");
r[7].style.removeProperty("background-color");
r[7].style.setProperty("background-color", "green", "important");
}
</script>
<body>
<div class="a" id="a"></div>
<div class="b" id="b"></div>
<div class="c" id="c"></div>
<div class="d" id="d"></div>
<p></p>
<div class="e" id="e"></div>
<div class="f" id="f"></div>
<div class="g" id="g"></div>
<div class="h" id="h"></div>
<p></p>
<div id="control"></div>
<p>There should be two rows of four green squares and one solid green
bar above.</p>
</body>
</html>

View File

@ -1419,5 +1419,6 @@ random-if(!haveTestPlugin) == 546071-1.html 546071-1-ref.html
== 549184-1.html 549184-1-ref.html
== 550716-1.html 550716-1-ref.html
== 551463-1.html 551463-1-ref.html
== 552334-1.html 552334-1-ref.html
== 551699-1.html 551699-1-ref.html
== 552334-1.html 552334-1-ref.html
== 556661-1.html 556661-1-ref.html

View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<title>Test for privacy restrictions on :visited (Bug 147777)</title>
<style type="text/css">
body { background: white; color: black }
span { background: #ccc; }
</style>
<span>unvisited</span>
<span>visited</span>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<title>Test for privacy restrictions on :visited (Bug 147777)</title>
<style type="text/css">
body { background: white; color: black }
a { text-decoration: none; color: black }
:link { background: #ccc; }
:visited { background: transparent }
</style>
<a href="unvisited-page.html">unvisited</a>
<a href="visited-page.html">visited</a>

View File

@ -403,13 +403,19 @@ protected:
// |mTempData| to |mData|. Set |*aChanged| to true if something
// changed, but leave it unmodified otherwise. If aMustCallValueAppended
// is false, will not call ValueAppended on aDeclaration if the property
// is already set in it.
// is already set in it. If aOverrideImportant is true, new data will
// replace old settings of the same properties, even if the old settings
// are !important and the new data aren't.
void TransferTempData(nsCSSDeclaration* aDeclaration,
nsCSSProperty aPropID, PRBool aIsImportant,
nsCSSProperty aPropID,
PRBool aIsImportant,
PRBool aOverrideImportant,
PRBool aMustCallValueAppended,
PRBool* aChanged);
void DoTransferTempData(nsCSSDeclaration* aDeclaration,
nsCSSProperty aPropID, PRBool aIsImportant,
nsCSSProperty aPropID,
PRBool aIsImportant,
PRBool aOverrideImportant,
PRBool aMustCallValueAppended,
PRBool* aChanged);
// Used to do a fast copy of a property value from source location to
@ -1144,7 +1150,8 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
CopyValue(mTempData.PropertyAt(aPropID), valueSlot, aPropID, aChanged);
mTempData.ClearPropertyBit(aPropID);
} else {
TransferTempData(aDeclaration, aPropID, aIsImportant, PR_FALSE, aChanged);
TransferTempData(aDeclaration, aPropID, aIsImportant,
PR_TRUE, PR_FALSE, aChanged);
}
} else {
if (parsedOK) {
@ -3983,7 +3990,7 @@ CSSParserImpl::ParseDeclaration(nsCSSDeclaration* aDeclaration,
PRBool isImportant = PR_FALSE;
if (!GetToken(PR_TRUE)) {
// EOF is a perfectly good way to end a declaration and declaration block
TransferTempData(aDeclaration, propID, isImportant,
TransferTempData(aDeclaration, propID, isImportant, PR_FALSE,
aMustCallValueAppended, aChanged);
return PR_TRUE;
}
@ -4016,13 +4023,13 @@ CSSParserImpl::ParseDeclaration(nsCSSDeclaration* aDeclaration,
// aCheckForBraces is true).
if (!GetToken(PR_TRUE)) {
// EOF is a perfectly good way to end a declaration and declaration block
TransferTempData(aDeclaration, propID, isImportant,
TransferTempData(aDeclaration, propID, isImportant, PR_FALSE,
aMustCallValueAppended, aChanged);
return PR_TRUE;
}
if (eCSSToken_Symbol == tk->mType) {
if (';' == tk->mSymbol) {
TransferTempData(aDeclaration, propID, isImportant,
TransferTempData(aDeclaration, propID, isImportant, PR_FALSE,
aMustCallValueAppended, aChanged);
return PR_TRUE;
}
@ -4030,7 +4037,7 @@ CSSParserImpl::ParseDeclaration(nsCSSDeclaration* aDeclaration,
// Unget the '}' so we'll be able to tell that this is the end
// of the declaration block when we unwind from here.
UngetToken();
TransferTempData(aDeclaration, propID, isImportant,
TransferTempData(aDeclaration, propID, isImportant, PR_FALSE,
aMustCallValueAppended, aChanged);
return PR_TRUE;
}
@ -4060,17 +4067,19 @@ CSSParserImpl::ClearTempData(nsCSSProperty aPropID)
void
CSSParserImpl::TransferTempData(nsCSSDeclaration* aDeclaration,
nsCSSProperty aPropID, PRBool aIsImportant,
nsCSSProperty aPropID,
PRBool aIsImportant,
PRBool aOverrideImportant,
PRBool aMustCallValueAppended,
PRBool* aChanged)
{
if (nsCSSProps::IsShorthand(aPropID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID) {
DoTransferTempData(aDeclaration, *p, aIsImportant,
DoTransferTempData(aDeclaration, *p, aIsImportant, aOverrideImportant,
aMustCallValueAppended, aChanged);
}
} else {
DoTransferTempData(aDeclaration, aPropID, aIsImportant,
DoTransferTempData(aDeclaration, aPropID, aIsImportant, aOverrideImportant,
aMustCallValueAppended, aChanged);
}
mTempData.AssertInitialState();
@ -4081,7 +4090,9 @@ CSSParserImpl::TransferTempData(nsCSSDeclaration* aDeclaration,
// can't think of why).
void
CSSParserImpl::DoTransferTempData(nsCSSDeclaration* aDeclaration,
nsCSSProperty aPropID, PRBool aIsImportant,
nsCSSProperty aPropID,
PRBool aIsImportant,
PRBool aOverrideImportant,
PRBool aMustCallValueAppended,
PRBool* aChanged)
{
@ -4092,8 +4103,17 @@ CSSParserImpl::DoTransferTempData(nsCSSDeclaration* aDeclaration,
mData.SetImportantBit(aPropID);
} else {
if (mData.HasImportantBit(aPropID)) {
mTempData.ClearProperty(aPropID);
return;
// When parsing a declaration block, an !important declaration
// is not overwritten by an ordinary declaration of the same
// property later in the block. However, CSSOM manipulations
// come through here too, and in that case we do want to
// overwrite the property.
if (!aOverrideImportant) {
mTempData.ClearProperty(aPropID);
return;
}
*aChanged = PR_TRUE;
mData.ClearImportantBit(aPropID);
}
}

View File

@ -65,9 +65,9 @@ namespace css {
class NS_STACK_CLASS nsCSSParser {
public:
NS_HIDDEN nsCSSParser(mozilla::css::Loader* aLoader = nsnull,
nsICSSStyleSheet* aSheet = nsnull);
NS_HIDDEN ~nsCSSParser();
nsCSSParser(mozilla::css::Loader* aLoader = nsnull,
nsICSSStyleSheet* aSheet = nsnull);
~nsCSSParser();
static void Shutdown();
@ -79,24 +79,24 @@ private:
public:
// If this is false, memory allocation failed in the constructor
// and all other methods will crash.
NS_HIDDEN operator bool() const
operator bool() const
{ return !!mImpl; }
// Set a style sheet for the parser to fill in. The style sheet must
// implement the nsICSSStyleSheet interface. Null can be passed in to clear
// out an existing stylesheet reference.
NS_HIDDEN_(nsresult) SetStyleSheet(nsICSSStyleSheet* aSheet);
nsresult SetStyleSheet(nsICSSStyleSheet* aSheet);
// Set whether or not to emulate Nav quirks
NS_HIDDEN_(nsresult) SetQuirkMode(PRBool aQuirkMode);
nsresult SetQuirkMode(PRBool aQuirkMode);
#ifdef MOZ_SVG
// Set whether or not we are in an SVG element
NS_HIDDEN_(nsresult) SetSVGMode(PRBool aSVGMode);
nsresult SetSVGMode(PRBool aSVGMode);
#endif
// Set loader to use for child sheets
NS_HIDDEN_(nsresult) SetChildLoader(mozilla::css::Loader* aChildLoader);
nsresult SetChildLoader(mozilla::css::Loader* aChildLoader);
/**
* Parse aInput into the stylesheet that was previously set by calling
@ -114,45 +114,45 @@ public:
* @param aAllowUnsafeRules see aEnableUnsafeRules in
* mozilla::css::Loader::LoadSheetSync
*/
NS_HIDDEN_(nsresult) Parse(nsIUnicharInputStream* aInput,
nsIURI* aSheetURL,
nsIURI* aBaseURI,
nsIPrincipal* aSheetPrincipal,
PRUint32 aLineNumber,
PRBool aAllowUnsafeRules);
nsresult Parse(nsIUnicharInputStream* aInput,
nsIURI* aSheetURL,
nsIURI* aBaseURI,
nsIPrincipal* aSheetPrincipal,
PRUint32 aLineNumber,
PRBool aAllowUnsafeRules);
// 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_HIDDEN_(nsresult) ParseStyleAttribute(const nsAString& aAttributeValue,
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aNodePrincipal,
nsICSSStyleRule** aResult);
nsresult ParseStyleAttribute(const nsAString& aAttributeValue,
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aNodePrincipal,
nsICSSStyleRule** aResult);
NS_HIDDEN_(nsresult) ParseAndAppendDeclaration(const nsAString& aBuffer,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
nsIPrincipal* aSheetPrincipal,
nsCSSDeclaration* aDeclaration,
PRBool aParseOnlyOneDecl,
PRBool* aChanged,
PRBool aClearOldDecl);
nsresult ParseAndAppendDeclaration(const nsAString& aBuffer,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
nsIPrincipal* aSheetPrincipal,
nsCSSDeclaration* aDeclaration,
PRBool aParseOnlyOneDecl,
PRBool* aChanged,
PRBool aClearOldDecl);
NS_HIDDEN_(nsresult) ParseRule(const nsAString& aRule,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
nsIPrincipal* aSheetPrincipal,
nsCOMArray<nsICSSRule>& aResult);
nsresult ParseRule(const nsAString& aRule,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
nsIPrincipal* aSheetPrincipal,
nsCOMArray<nsICSSRule>& aResult);
NS_HIDDEN_(nsresult) ParseProperty(const nsCSSProperty aPropID,
const nsAString& aPropValue,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
nsIPrincipal* aSheetPrincipal,
nsCSSDeclaration* aDeclaration,
PRBool* aChanged,
PRBool aIsImportant);
nsresult ParseProperty(const nsCSSProperty aPropID,
const nsAString& aPropValue,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
nsIPrincipal* aSheetPrincipal,
nsCSSDeclaration* aDeclaration,
PRBool* aChanged,
PRBool aIsImportant);
/**
* Parse aBuffer into a media list |aMediaList|, which must be
@ -162,11 +162,11 @@ public:
* parentheses and strings more important than commas. |aURL| and
* |aLineNumber| are used for error reporting.
*/
NS_HIDDEN_(nsresult) ParseMediaList(const nsSubstring& aBuffer,
nsIURI* aURL,
PRUint32 aLineNumber,
nsMediaList* aMediaList,
PRBool aHTMLMode);
nsresult ParseMediaList(const nsSubstring& aBuffer,
nsIURI* aURL,
PRUint32 aLineNumber,
nsMediaList* aMediaList,
PRBool aHTMLMode);
/**
* Parse aBuffer into a nscolor |aColor|. The alpha component of the
@ -177,19 +177,19 @@ public:
* self-contained (i.e. doesn't reference any external style state,
* such as "initial" or "inherit").
*/
NS_HIDDEN_(nsresult) ParseColorString(const nsSubstring& aBuffer,
nsIURI* aURL,
PRUint32 aLineNumber,
nscolor* aColor);
nsresult ParseColorString(const nsSubstring& aBuffer,
nsIURI* aURL,
PRUint32 aLineNumber,
nscolor* aColor);
/**
* Parse aBuffer into a selector list. On success, caller must
* delete *aSelectorList when done with it.
*/
NS_HIDDEN_(nsresult) ParseSelectorString(const nsSubstring& aSelectorString,
nsIURI* aURL,
PRUint32 aLineNumber,
nsCSSSelectorList** aSelectorList);
nsresult ParseSelectorString(const nsSubstring& aSelectorString,
nsIURI* aURL,
PRUint32 aLineNumber,
nsCSSSelectorList** aSelectorList);
protected:
// This is a CSSParserImpl*, but if we expose that type name in this

View File

@ -161,28 +161,27 @@ class nsCSSScanner {
#endif
#ifdef CSS_REPORT_PARSE_ERRORS
NS_HIDDEN_(void) AddToError(const nsSubstring& aErrorText);
NS_HIDDEN_(void) OutputError();
NS_HIDDEN_(void) ClearError();
void AddToError(const nsSubstring& aErrorText);
void OutputError();
void ClearError();
// aMessage must take no parameters
NS_HIDDEN_(void) ReportUnexpected(const char* aMessage);
NS_HIDDEN_(void) ReportUnexpectedParams(const char* aMessage,
const PRUnichar **aParams,
PRUint32 aParamsLength);
void ReportUnexpected(const char* aMessage);
void ReportUnexpectedParams(const char* aMessage,
const PRUnichar **aParams,
PRUint32 aParamsLength);
// aLookingFor is a plain string, not a format string
NS_HIDDEN_(void) ReportUnexpectedEOF(const char* aLookingFor);
void ReportUnexpectedEOF(const char* aLookingFor);
// aLookingFor is a single character
NS_HIDDEN_(void) ReportUnexpectedEOF(PRUnichar aLookingFor);
void ReportUnexpectedEOF(PRUnichar aLookingFor);
// aMessage must take 1 parameter (for the string representation of the
// unexpected token)
NS_HIDDEN_(void) ReportUnexpectedToken(nsCSSToken& tok,
const char *aMessage);
void ReportUnexpectedToken(nsCSSToken& tok, const char *aMessage);
// aParams's first entry must be null, and we'll fill in the token
NS_HIDDEN_(void) ReportUnexpectedTokenParams(nsCSSToken& tok,
const char* aMessage,
const PRUnichar **aParams,
PRUint32 aParamsLength);
void ReportUnexpectedTokenParams(nsCSSToken& tok,
const char* aMessage,
const PRUnichar **aParams,
PRUint32 aParamsLength);
#endif
PRUint32 GetLineNumber() { return mLineNumber; }

View File

@ -151,14 +151,14 @@ public:
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const;
NS_IMETHOD SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
nsIURI* aBaseURI);
virtual NS_HIDDEN_(void) SetPrincipal(nsIPrincipal* aPrincipal);
virtual NS_HIDDEN_(nsIPrincipal*) Principal() const;
virtual void SetPrincipal(nsIPrincipal* aPrincipal);
virtual nsIPrincipal* Principal() const;
NS_IMETHOD SetTitle(const nsAString& aTitle);
NS_IMETHOD SetMedia(nsMediaList* aMedia);
NS_IMETHOD SetOwningNode(nsIDOMNode* aOwningNode);
NS_IMETHOD SetOwnerRule(nsICSSImportRule* aOwnerRule);
NS_IMETHOD GetOwnerRule(nsICSSImportRule** aOwnerRule);
virtual NS_HIDDEN_(nsXMLNameSpaceMap*) GetNameSpaceMap() const;
virtual nsXMLNameSpaceMap* GetNameSpaceMap() const;
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
nsICSSImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,

View File

@ -181,18 +181,18 @@ public:
NS_ASSERTION(aUnit <= eCSSUnit_RectIsAuto, "not a valueless unit");
}
nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit) NS_HIDDEN;
nsCSSValue(float aValue, nsCSSUnit aUnit) NS_HIDDEN;
nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) NS_HIDDEN;
nsCSSValue(Array* aArray, nsCSSUnit aUnit) NS_HIDDEN;
explicit nsCSSValue(URL* aValue) NS_HIDDEN;
explicit nsCSSValue(Image* aValue) NS_HIDDEN;
explicit nsCSSValue(nsCSSValueGradient* aValue) NS_HIDDEN;
nsCSSValue(const nsCSSValue& aCopy) NS_HIDDEN;
nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit);
nsCSSValue(float aValue, nsCSSUnit aUnit);
nsCSSValue(const nsString& aValue, nsCSSUnit aUnit);
nsCSSValue(Array* aArray, nsCSSUnit aUnit);
explicit nsCSSValue(URL* aValue);
explicit nsCSSValue(Image* aValue);
explicit nsCSSValue(nsCSSValueGradient* aValue);
nsCSSValue(const nsCSSValue& aCopy);
~nsCSSValue() { Reset(); }
NS_HIDDEN_(nsCSSValue&) operator=(const nsCSSValue& aCopy);
NS_HIDDEN_(PRBool) operator==(const nsCSSValue& aOther) const;
nsCSSValue& operator=(const nsCSSValue& aCopy);
PRBool operator==(const nsCSSValue& aOther) const;
PRBool operator!=(const nsCSSValue& aOther) const
{
@ -310,44 +310,43 @@ public:
// Not making this inline because that would force us to include
// imgIRequest.h, which leads to REQUIRES hell, since this header is included
// all over.
NS_HIDDEN_(imgIRequest*) GetImageValue() const;
imgIRequest* GetImageValue() const;
NS_HIDDEN_(nscoord) GetLengthTwips() const;
nscoord GetLengthTwips() const;
NS_HIDDEN_(void) Reset() // sets to null
void Reset() // sets to null
{
if (mUnit != eCSSUnit_Null)
DoReset();
}
private:
NS_HIDDEN_(void) DoReset();
void DoReset();
public:
NS_HIDDEN_(void) SetIntValue(PRInt32 aValue, nsCSSUnit aUnit);
NS_HIDDEN_(void) SetPercentValue(float aValue);
NS_HIDDEN_(void) SetFloatValue(float aValue, nsCSSUnit aUnit);
NS_HIDDEN_(void) SetStringValue(const nsString& aValue, nsCSSUnit aUnit);
NS_HIDDEN_(void) SetColorValue(nscolor aValue);
NS_HIDDEN_(void) SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
NS_HIDDEN_(void) SetURLValue(nsCSSValue::URL* aURI);
NS_HIDDEN_(void) SetImageValue(nsCSSValue::Image* aImage);
NS_HIDDEN_(void) SetGradientValue(nsCSSValueGradient* aGradient);
NS_HIDDEN_(void) SetAutoValue();
NS_HIDDEN_(void) SetInheritValue();
NS_HIDDEN_(void) SetInitialValue();
NS_HIDDEN_(void) SetNoneValue();
NS_HIDDEN_(void) SetAllValue();
NS_HIDDEN_(void) SetNormalValue();
NS_HIDDEN_(void) SetSystemFontValue();
NS_HIDDEN_(void) SetDummyValue();
NS_HIDDEN_(void) SetDummyInheritValue();
NS_HIDDEN_(void) StartImageLoad(nsIDocument* aDocument)
const; // Not really const, but pretending
void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit);
void SetPercentValue(float aValue);
void SetFloatValue(float aValue, nsCSSUnit aUnit);
void SetStringValue(const nsString& aValue, nsCSSUnit aUnit);
void SetColorValue(nscolor aValue);
void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
void SetURLValue(nsCSSValue::URL* aURI);
void SetImageValue(nsCSSValue::Image* aImage);
void SetGradientValue(nsCSSValueGradient* aGradient);
void SetAutoValue();
void SetInheritValue();
void SetInitialValue();
void SetNoneValue();
void SetAllValue();
void SetNormalValue();
void SetSystemFontValue();
void SetDummyValue();
void SetDummyInheritValue();
void StartImageLoad(nsIDocument* aDocument) const; // Only pretend const
// Initializes as a function value with the specified function id.
NS_HIDDEN_(Array*) InitFunction(nsCSSKeyword aFunctionId, PRUint32 aNumArgs);
Array* InitFunction(nsCSSKeyword aFunctionId, PRUint32 aNumArgs);
// Checks if this is a function value with the specified function id.
NS_HIDDEN_(PRBool) EqualsFunction(nsCSSKeyword aFunctionId) const;
PRBool EqualsFunction(nsCSSKeyword aFunctionId) const;
// Returns an already addrefed buffer. Can return null on allocation
// failure.
@ -361,17 +360,17 @@ public:
// aString must not be null.
// aOriginPrincipal must not be null.
URL(nsIURI* aURI, nsStringBuffer* aString, nsIURI* aReferrer,
nsIPrincipal* aOriginPrincipal) NS_HIDDEN;
nsIPrincipal* aOriginPrincipal);
~URL() NS_HIDDEN;
~URL();
NS_HIDDEN_(PRBool) operator==(const URL& aOther) const;
PRBool operator==(const URL& aOther) const;
// URIEquals only compares URIs and principals (unlike operator==, which
// also compares the original strings). URIEquals also assumes that the
// mURI member of both URL objects is non-null. Do NOT call this method
// unless you're sure this is the case.
NS_HIDDEN_(PRBool) URIEquals(const URL& aOther) const;
PRBool URIEquals(const URL& aOther) const;
nsCOMPtr<nsIURI> mURI; // null == invalid URL
nsStringBuffer* mString; // Could use nsRefPtr, but it'd add useless
@ -394,8 +393,8 @@ public:
// this header is included all over.
// aString must not be null.
Image(nsIURI* aURI, nsStringBuffer* aString, nsIURI* aReferrer,
nsIPrincipal* aOriginPrincipal, nsIDocument* aDocument) NS_HIDDEN;
~Image() NS_HIDDEN;
nsIPrincipal* aOriginPrincipal, nsIDocument* aDocument);
~Image();
// Inherit operator== from nsCSSValue::URL
@ -429,10 +428,10 @@ protected:
struct nsCSSValueGradientStop {
public:
nsCSSValueGradientStop() NS_HIDDEN;
nsCSSValueGradientStop();
// needed to keep bloat logs happy when we use the nsTArray in nsCSSValueGradient
nsCSSValueGradientStop(const nsCSSValueGradientStop& aOther) NS_HIDDEN;
~nsCSSValueGradientStop() NS_HIDDEN;
nsCSSValueGradientStop(const nsCSSValueGradientStop& aOther);
~nsCSSValueGradientStop();
nsCSSValue mLocation;
nsCSSValue mColor;
@ -450,8 +449,7 @@ public:
};
struct nsCSSValueGradient {
nsCSSValueGradient(PRBool aIsRadial,
PRBool aIsRepeating) NS_HIDDEN;
nsCSSValueGradient(PRBool aIsRadial, PRBool aIsRepeating);
// true if gradient is radial, false if it is linear
PRPackedBool mIsRadial;

View File

@ -93,10 +93,10 @@ public:
* This can only be called once with a non-null principal. Calling this with
* a null pointer is allowed and is treated as a no-op.
*/
virtual NS_HIDDEN_(void) SetPrincipal(nsIPrincipal* aPrincipal) = 0;
virtual void SetPrincipal(nsIPrincipal* aPrincipal) = 0;
// Principal() never returns a null pointer.
virtual NS_HIDDEN_(nsIPrincipal*) Principal() const = 0;
virtual nsIPrincipal* Principal() const = 0;
NS_IMETHOD SetTitle(const nsAString& aTitle) = 0;
NS_IMETHOD SetMedia(nsMediaList* aMedia) = 0;
@ -106,7 +106,7 @@ public:
NS_IMETHOD GetOwnerRule(nsICSSImportRule** aOwnerRule) = 0;
// get namespace map for sheet
virtual NS_HIDDEN_(nsXMLNameSpaceMap*) GetNameSpaceMap() const = 0;
virtual nsXMLNameSpaceMap* GetNameSpaceMap() const = 0;
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
nsICSSImportRule* aCloneOwnerRule,

View File

@ -172,7 +172,7 @@ struct nsCachedStyleData
return 1 << aSID;
}
NS_HIDDEN_(void*) NS_FASTCALL GetStyleData(const nsStyleStructID& aSID) {
void* NS_FASTCALL GetStyleData(const nsStyleStructID& aSID) {
// Each struct is stored at this.m##type##Data->m##name##Data where
// |type| is either Inherit or Reset, and |name| is the name of the
// style struct. The |gInfo| stores the offset of the appropriate
@ -205,18 +205,18 @@ struct nsCachedStyleData
// Typesafe and faster versions of the above
#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(nsStyle##name_ *) NS_FASTCALL GetStyle##name_ () { \
nsStyle##name_ * NS_FASTCALL GetStyle##name_ () { \
return mInheritedData ? mInheritedData->m##name_##Data : nsnull; \
}
#define STYLE_STRUCT_RESET(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(nsStyle##name_ *) NS_FASTCALL GetStyle##name_ () { \
nsStyle##name_ * NS_FASTCALL GetStyle##name_ () { \
return mResetData ? mResetData->m##name_##Data : nsnull; \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
NS_HIDDEN_(void) Destroy(PRUint32 aBits, nsPresContext* aContext) {
void Destroy(PRUint32 aBits, nsPresContext* aContext) {
if (mResetData)
mResetData->Destroy(aBits, aContext);
if (mInheritedData)
@ -431,149 +431,148 @@ private:
public:
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
// (which comes from the presShell) to perform the allocation.
NS_HIDDEN_(void*) operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
NS_HIDDEN_(void) Destroy() { DestroyInternal(nsnull); }
static NS_HIDDEN_(nsILanguageAtomService*) gLangService;
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
void Destroy() { DestroyInternal(nsnull); }
static nsILanguageAtomService* gLangService;
// Implemented in nsStyleSet.h, since it needs to know about nsStyleSet.
inline NS_HIDDEN_(void) AddRef();
inline void AddRef();
// Implemented in nsStyleSet.h, since it needs to know about nsStyleSet.
inline NS_HIDDEN_(void) Release();
inline void Release();
protected:
NS_HIDDEN_(void) DestroyInternal(nsRuleNode ***aDestroyQueueTail);
NS_HIDDEN_(void) PropagateDependentBit(PRUint32 aBit,
nsRuleNode* aHighestNode);
NS_HIDDEN_(void) PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
void DestroyInternal(nsRuleNode ***aDestroyQueueTail);
void PropagateDependentBit(PRUint32 aBit, nsRuleNode* aHighestNode);
void PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
NS_HIDDEN_(const void*) SetDefaultOnRoot(const nsStyleStructID aSID,
nsStyleContext* aContext);
const void* SetDefaultOnRoot(const nsStyleStructID aSID,
nsStyleContext* aContext);
NS_HIDDEN_(const void*)
const void*
WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext,
nsRuleData* aRuleData, nsRuleDataStruct* aSpecificData);
NS_HIDDEN_(const void*)
const void*
ComputeDisplayData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeVisibilityData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeFontData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeColorData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeBackgroundData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeMarginData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeBorderData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputePaddingData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeOutlineData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeListData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputePositionData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeTableData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeTableBorderData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeContentData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeQuotesData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeTextData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeTextResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeUserInterfaceData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
@ -581,35 +580,35 @@ protected:
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeUIResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeXULData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeColumnData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeSVGData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail,
const PRBool aCanStoreInRuleTree);
NS_HIDDEN_(const void*)
const void*
ComputeSVGResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
@ -617,95 +616,94 @@ protected:
const PRBool aCanStoreInRuleTree);
// helpers for |ComputeFontData| that need access to |mNoneBits|:
static NS_HIDDEN_(void) SetFontSize(nsPresContext* aPresContext,
const nsRuleDataFont& aFontData,
const nsStyleFont* aFont,
const nsStyleFont* aParentFont,
nscoord* aSize,
const nsFont& aSystemFont,
nscoord aParentSize,
nscoord aScriptLevelAdjustedParentSize,
PRBool aUsedStartStruct,
PRBool aAtRoot,
PRBool& aCanStoreInRuleTree);
static void SetFontSize(nsPresContext* aPresContext,
const nsRuleDataFont& aFontData,
const nsStyleFont* aFont,
const nsStyleFont* aParentFont,
nscoord* aSize,
const nsFont& aSystemFont,
nscoord aParentSize,
nscoord aScriptLevelAdjustedParentSize,
PRBool aUsedStartStruct,
PRBool aAtRoot,
PRBool& aCanStoreInRuleTree);
static NS_HIDDEN_(void) SetFont(nsPresContext* aPresContext,
nsStyleContext* aContext,
nscoord aMinFontSize,
PRUint8 aGenericFontID,
const nsRuleDataFont& aFontData,
const nsStyleFont* aParentFont,
nsStyleFont* aFont,
PRBool aStartStruct,
PRBool& aCanStoreInRuleTree);
static void SetFont(nsPresContext* aPresContext,
nsStyleContext* aContext,
nscoord aMinFontSize,
PRUint8 aGenericFontID,
const nsRuleDataFont& aFontData,
const nsStyleFont* aParentFont,
nsStyleFont* aFont,
PRBool aStartStruct,
PRBool& aCanStoreInRuleTree);
static NS_HIDDEN_(void) SetGenericFont(nsPresContext* aPresContext,
nsStyleContext* aContext,
PRUint8 aGenericFontID,
nscoord aMinFontSize,
nsStyleFont* aFont);
static void SetGenericFont(nsPresContext* aPresContext,
nsStyleContext* aContext,
PRUint8 aGenericFontID,
nscoord aMinFontSize,
nsStyleFont* aFont);
NS_HIDDEN_(void) AdjustLogicalBoxProp(nsStyleContext* aContext,
const nsCSSValue& aLTRSource,
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
PRUint8 aSide,
nsCSSRect& aValueRect,
PRBool& aCanStoreInRuleTree);
void AdjustLogicalBoxProp(nsStyleContext* aContext,
const nsCSSValue& aLTRSource,
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
PRUint8 aSide,
nsCSSRect& aValueRect,
PRBool& aCanStoreInRuleTree);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
NS_HIDDEN_(const void*) GetParentData(const nsStyleStructID aSID);
const void* GetParentData(const nsStyleStructID aSID);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_*) GetParent##name_();
const nsStyle##name_* GetParent##name_();
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
NS_HIDDEN_(const void*) GetDisplayData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetVisibilityData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetFontData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetColorData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetBackgroundData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetMarginData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetBorderData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetPaddingData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetOutlineData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetListData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetPositionData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetTableData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetTableBorderData(nsStyleContext* aContext);
const void* GetDisplayData(nsStyleContext* aContext);
const void* GetVisibilityData(nsStyleContext* aContext);
const void* GetFontData(nsStyleContext* aContext);
const void* GetColorData(nsStyleContext* aContext);
const void* GetBackgroundData(nsStyleContext* aContext);
const void* GetMarginData(nsStyleContext* aContext);
const void* GetBorderData(nsStyleContext* aContext);
const void* GetPaddingData(nsStyleContext* aContext);
const void* GetOutlineData(nsStyleContext* aContext);
const void* GetListData(nsStyleContext* aContext);
const void* GetPositionData(nsStyleContext* aContext);
const void* GetTableData(nsStyleContext* aContext);
const void* GetTableBorderData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetContentData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetQuotesData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetTextData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetTextResetData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetUserInterfaceData(nsStyleContext* aContext);
const void* GetContentData(nsStyleContext* aContext);
const void* GetQuotesData(nsStyleContext* aContext);
const void* GetTextData(nsStyleContext* aContext);
const void* GetTextResetData(nsStyleContext* aContext);
const void* GetUserInterfaceData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetUIResetData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetXULData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetColumnData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetSVGData(nsStyleContext* aContext);
NS_HIDDEN_(const void*) GetSVGResetData(nsStyleContext* aContext);
const void* GetUIResetData(nsStyleContext* aContext);
const void* GetXULData(nsStyleContext* aContext);
const void* GetColumnData(nsStyleContext* aContext);
const void* GetSVGData(nsStyleContext* aContext);
const void* GetSVGResetData(nsStyleContext* aContext);
NS_HIDDEN_(already_AddRefed<nsCSSShadowArray>)
GetShadowData(nsCSSValueList* aList,
nsStyleContext* aContext,
PRBool aIsBoxShadow,
PRBool& inherited);
already_AddRefed<nsCSSShadowArray>
GetShadowData(nsCSSValueList* aList,
nsStyleContext* aContext,
PRBool aIsBoxShadow,
PRBool& inherited);
private:
nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,
nsIStyleRule* aRule, PRUint8 aLevel, PRBool aIsImportant)
NS_HIDDEN;
~nsRuleNode() NS_HIDDEN;
nsIStyleRule* aRule, PRUint8 aLevel, PRBool aIsImportant);
~nsRuleNode();
public:
static NS_HIDDEN_(nsRuleNode*) CreateRootNode(nsPresContext* aPresContext);
static nsRuleNode* CreateRootNode(nsPresContext* aPresContext);
// Transition never returns null; on out of memory it'll just return |this|.
NS_HIDDEN_(nsRuleNode*) Transition(nsIStyleRule* aRule, PRUint8 aLevel,
PRPackedBool aIsImportantRule);
nsRuleNode* Transition(nsIStyleRule* aRule, PRUint8 aLevel,
PRPackedBool aIsImportantRule);
nsRuleNode* GetParent() const { return mParent; }
PRBool IsRoot() const { return mParent == nsnull; }
@ -725,14 +723,13 @@ public:
// NOTE: Does not |AddRef|.
nsPresContext* GetPresContext() const { return mPresContext; }
NS_HIDDEN_(const void*) GetStyleData(nsStyleStructID aSID,
nsStyleContext* aContext,
PRBool aComputeData);
const void* GetStyleData(nsStyleStructID aSID,
nsStyleContext* aContext,
PRBool aComputeData);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_*) \
GetStyle##name_(nsStyleContext* aContext, \
PRBool aComputeData);
const nsStyle##name_* GetStyle##name_(nsStyleContext* aContext, \
PRBool aComputeData);
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
@ -742,8 +739,8 @@ public:
* the children, destroys any that are unmarked, and clears marks,
* returning true if the node on which it was called was destroyed.
*/
NS_HIDDEN_(void) Mark();
NS_HIDDEN_(PRBool) Sweep();
void Mark();
PRBool Sweep();
static PRBool
HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,

View File

@ -753,6 +753,14 @@ nsStyleContext::GetVisitedDependentColor(nsCSSProperty aProperty)
/* static */ nscolor
nsStyleContext::CombineVisitedColors(nscolor *aColors, PRBool aLinkIsVisited)
{
if (NS_GET_A(aColors[1]) == 0) {
// If the style-if-visited is transparent, then just use the
// unvisited style rather than using the (meaningless) color
// components of the visited style along with a potentially
// non-transparent alpha value.
aLinkIsVisited = PR_FALSE;
}
// NOTE: We want this code to have as little timing dependence as
// possible on whether this->RelevantLinkVisited() is true.
const ColorIndexSet &set =

View File

@ -75,11 +75,11 @@ class nsStyleContext
public:
nsStyleContext(nsStyleContext* aParent, nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsRuleNode* aRuleNode, nsPresContext* aPresContext) NS_HIDDEN;
~nsStyleContext() NS_HIDDEN;
nsRuleNode* aRuleNode, nsPresContext* aPresContext);
~nsStyleContext();
NS_HIDDEN_(void*) operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW;
NS_HIDDEN_(void) Destroy();
void* operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW;
void Destroy();
nsrefcnt AddRef() {
if (mRefCnt == PR_UINT32_MAX) {
@ -122,7 +122,7 @@ public:
// * !GetStyleIfVisited() == !aRulesIfVisited, and, if they're
// non-null, GetStyleIfVisited()->GetRuleNode() == aRulesIfVisited
// * RelevantLinkVisited() == aRelevantLinkVisited
NS_HIDDEN_(already_AddRefed<nsStyleContext>)
already_AddRefed<nsStyleContext>
FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules,
nsRuleNode* aRulesIfVisited,
PRBool aRelevantLinkVisited);
@ -197,7 +197,7 @@ public:
}
// Tell this style context to cache aStruct as the struct for aSID
NS_HIDDEN_(void) SetStyle(nsStyleStructID aSID, void* aStruct);
void SetStyle(nsStyleStructID aSID, void* aStruct);
// Setters for inherit structs only, since rulenode only sets those eagerly.
#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_, ctor_args_) \
@ -220,7 +220,7 @@ public:
* Mark this style context's rule node (and its ancestors) to prevent
* it from being garbage collected.
*/
NS_HIDDEN_(void) Mark();
void Mark();
/*
* Get the style data for a style struct. This is the most important
@ -238,7 +238,7 @@ public:
* function, bothe because they're easier to read and because they're
* faster.
*/
NS_HIDDEN_(const void*) NS_FASTCALL GetStyleData(nsStyleStructID aSID);
const void* NS_FASTCALL GetStyleData(nsStyleStructID aSID);
/**
* Define typesafe getter functions for each style struct by
@ -268,9 +268,9 @@ public:
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
NS_HIDDEN_(void*) GetUniqueStyleData(const nsStyleStructID& aSID);
void* GetUniqueStyleData(const nsStyleStructID& aSID);
NS_HIDDEN_(nsChangeHint) CalcStyleDifference(nsStyleContext* aOther);
nsChangeHint CalcStyleDifference(nsStyleContext* aOther);
/**
* Get a color that depends on link-visitedness using this and
@ -283,7 +283,7 @@ public:
* Note that if aProperty is eCSSProperty_border_*_color, this
* function handles -moz-use-text-color.
*/
NS_HIDDEN_(nscolor) GetVisitedDependentColor(nsCSSProperty aProperty);
nscolor GetVisitedDependentColor(nsCSSProperty aProperty);
/**
* aColors should be a two element array of nscolor in which the first
@ -296,14 +296,14 @@ public:
PRBool aLinkIsVisited);
#ifdef DEBUG
NS_HIDDEN_(void) List(FILE* out, PRInt32 aIndent);
void List(FILE* out, PRInt32 aIndent);
#endif
protected:
NS_HIDDEN_(void) AddChild(nsStyleContext* aChild);
NS_HIDDEN_(void) RemoveChild(nsStyleContext* aChild);
void AddChild(nsStyleContext* aChild);
void RemoveChild(nsStyleContext* aChild);
NS_HIDDEN_(void) ApplyStyleFixups(nsPresContext* aPresContext);
void ApplyStyleFixups(nsPresContext* aPresContext);
// Helper function that GetStyleData and GetUniqueStyleData use. Only
// returns the structs we cache ourselves; never consults the ruletree.
@ -378,7 +378,7 @@ protected:
PRUint32 mRefCnt;
};
NS_HIDDEN_(already_AddRefed<nsStyleContext>)
already_AddRefed<nsStyleContext>
NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,

View File

@ -389,7 +389,7 @@ class nsStyleSet
};
inline
NS_HIDDEN_(void) nsRuleNode::AddRef()
void nsRuleNode::AddRef()
{
if (mRefCnt++ == 0 && !IsRoot()) {
mPresContext->StyleSet()->RuleNodeInUse();
@ -397,7 +397,7 @@ NS_HIDDEN_(void) nsRuleNode::AddRef()
}
inline
NS_HIDDEN_(void) nsRuleNode::Release()
void nsRuleNode::Release()
{
if (--mRefCnt == 0 && !IsRoot()) {
mPresContext->StyleSet()->RuleNodeUnused();

View File

@ -144,8 +144,7 @@ public:
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
NS_HIDDEN_(void) CoverValue(nsCSSProperty aProperty,
nsStyleAnimation::Value &aStartValue)
void CoverValue(nsCSSProperty aProperty, nsStyleAnimation::Value &aStartValue)
{
CoveredValue v = { aProperty, aStartValue };
mCoveredValues.AppendElement(v);

View File

@ -34,10 +34,10 @@ is(s.getPropertyValue("z-index"), "7",
is(s.getPropertyPriority("z-index"), "important",
"z-index priority stored");
s.setProperty("z-index", "3", "");
is(s.getPropertyValue("z-index"), "7",
"z-index not overridden by setting non-important");
is(s.getPropertyPriority("z-index"), "important",
"z-index priority not overridden by setting non-important");
is(s.getPropertyValue("z-index"), "3",
"z-index overridden by setting non-important");
is(s.getPropertyPriority("z-index"), "",
"z-index priority overridden by setting non-important");
is(s.getPropertyValue("text-decoration"), "underline",
"text-decoration still stored");
is(s.getPropertyPriority("text-decoration"), "",
@ -47,21 +47,74 @@ is(s.getPropertyValue("text-decoration"), "overline",
"text-decoration stored");
is(s.getPropertyPriority("text-decoration"), "",
"text-decoration priority stored");
is(s.getPropertyValue("z-index"), "7",
is(s.getPropertyValue("z-index"), "3",
"z-index still stored");
is(s.getPropertyPriority("z-index"), "important",
is(s.getPropertyPriority("z-index"), "",
"z-index priority still stored");
s.setProperty("text-decoration", "line-through", "important");
is(s.getPropertyValue("text-decoration"), "line-through",
"text-decoration stored at new priority");
is(s.getPropertyPriority("text-decoration"), "important",
"text-decoration priority overridden");
is(s.getPropertyValue("z-index"), "7",
is(s.getPropertyValue("z-index"), "3",
"z-index still stored");
is(s.getPropertyPriority("z-index"), "important",
is(s.getPropertyPriority("z-index"), "",
"z-index priority still stored");
// also test setting a shorthand
s.setProperty("font", "italic bold 12px/30px serif", "important");
is(s.getPropertyValue("font-style"), "italic", "font-style stored");
is(s.getPropertyPriority("font-style"), "important",
"font-style priority stored");
is(s.getPropertyValue("font-weight"), "bold", "font-weight stored");
is(s.getPropertyPriority("font-weight"), "important",
"font-weight priority stored");
is(s.getPropertyValue("font-size"), "12px", "font-size stored");
is(s.getPropertyPriority("font-size"), "important",
"font-size priority stored");
is(s.getPropertyValue("line-height"), "30px", "line-height stored");
is(s.getPropertyPriority("line-height"), "important",
"line-height priority stored");
is(s.getPropertyValue("font-family"), "serif", "font-family stored");
is(s.getPropertyPriority("font-family"), "important",
"font-family priority stored");
is(s.getPropertyValue("text-decoration"), "line-through",
"text-decoration still stored");
is(s.getPropertyPriority("text-decoration"), "important",
"text-decoration priority still stored");
is(s.getPropertyValue("z-index"), "3",
"z-index still stored");
is(s.getPropertyPriority("z-index"), "",
"z-index priority still stored");
// and overriding one element of that shorthand with some longhand
s.setProperty("font-style", "normal", "");
is(s.getPropertyValue("font-style"), "normal", "font-style overridden");
is(s.getPropertyPriority("font-style"), "", "font-style priority overridden");
is(s.getPropertyValue("font-weight"), "bold", "font-weight unchanged");
is(s.getPropertyPriority("font-weight"), "important",
"font-weight priority unchanged");
is(s.getPropertyValue("font-size"), "12px", "font-size unchanged");
is(s.getPropertyPriority("font-size"), "important",
"font-size priority unchanged");
is(s.getPropertyValue("line-height"), "30px", "line-height unchanged");
is(s.getPropertyPriority("line-height"), "important",
"line-height priority unchanged");
is(s.getPropertyValue("font-family"), "serif", "font-family unchanged");
is(s.getPropertyPriority("font-family"), "important",
"font-family priority unchanged");
is(s.getPropertyValue("text-decoration"), "line-through",
"text-decoration still stored");
is(s.getPropertyPriority("text-decoration"), "important",
"text-decoration priority still stored");
is(s.getPropertyValue("z-index"), "3",
"z-index still stored");
is(s.getPropertyPriority("z-index"), "",
"z-index priority still stored");
</script>
</pre>
</body>

View File

@ -77,6 +77,7 @@ var gTests = [
// FIXME: commented out because dynamic changes on the non-first-line
// part of the test don't work right when the link becomes visited.
//"== first-line-1.html first-line-1-ref.html",
"== white-to-transparent-1.html white-to-transparent-1-ref.html",
];
// Maintain a reference count of how many things we're waiting for until

View File

@ -100,26 +100,34 @@ nsOSHelperAppService::~nsOSHelperAppService()
nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists)
{
// CFStringCreateWithBytes() can fail even if we're not out of memory --
// for example if the 'bytes' parameter is something very wierd (like "ÿÿ~"
// aka "\xFF\xFF~"), or possibly if it can't be interpreted as using what's
// specified in the 'encoding' parameter. See bug 548719.
CFStringRef schemeString = ::CFStringCreateWithBytes(kCFAllocatorDefault,
(const UInt8*)aProtocolScheme,
strlen(aProtocolScheme),
kCFStringEncodingUTF8,
false);
// LSCopyDefaultHandlerForURLScheme() can fail to find the default handler
// for aProtocolScheme when it's never been explicitly set (using
// LSSetDefaultHandlerForURLScheme()). For example, Safari is the default
// handler for the "http" scheme on a newly installed copy of OS X. But
// this (presumably) wasn't done using LSSetDefaultHandlerForURLScheme(),
// so LSCopyDefaultHandlerForURLScheme() will fail to find Safari. To get
// around this we use LSCopyAllHandlersForURLScheme() instead -- which seems
// never to fail.
// http://lists.apple.com/archives/Carbon-dev/2007/May/msg00349.html
// http://www.realsoftware.com/listarchives/realbasic-nug/2008-02/msg00119.html
CFArrayRef handlerArray = ::LSCopyAllHandlersForURLScheme(schemeString);
*aHandlerExists = !!handlerArray;
if (handlerArray)
::CFRelease(handlerArray);
::CFRelease(schemeString);
if (schemeString) {
// LSCopyDefaultHandlerForURLScheme() can fail to find the default handler
// for aProtocolScheme when it's never been explicitly set (using
// LSSetDefaultHandlerForURLScheme()). For example, Safari is the default
// handler for the "http" scheme on a newly installed copy of OS X. But
// this (presumably) wasn't done using LSSetDefaultHandlerForURLScheme(),
// so LSCopyDefaultHandlerForURLScheme() will fail to find Safari. To get
// around this we use LSCopyAllHandlersForURLScheme() instead -- which seems
// never to fail.
// http://lists.apple.com/archives/Carbon-dev/2007/May/msg00349.html
// http://www.realsoftware.com/listarchives/realbasic-nug/2008-02/msg00119.html
CFArrayRef handlerArray = ::LSCopyAllHandlersForURLScheme(schemeString);
*aHandlerExists = !!handlerArray;
if (handlerArray)
::CFRelease(handlerArray);
::CFRelease(schemeString);
} else {
*aHandlerExists = PR_FALSE;
}
return NS_OK;
}
@ -270,23 +278,36 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
if (!aMIMEType.IsEmpty()) {
CFURLRef appURL = NULL;
// CFStringCreateWithCString() can fail even if we're not out of memory --
// for example if the 'cStr' parameter is something very wierd (like "ÿÿ~"
// aka "\xFF\xFF~"), or possibly if it can't be interpreted as using what's
// specified in the 'encoding' parameter. See bug 548719.
CFStringRef CFType = ::CFStringCreateWithCString(NULL, flatType.get(), kCFStringEncodingUTF8);
err = ::LSCopyApplicationForMIMEType(CFType, kLSRolesAll, &appURL);
if ((err == noErr) && appURL && ::CFURLGetFSRef(appURL, &typeAppFSRef)) {
haveAppForType = PR_TRUE;
PR_LOG(mLog, PR_LOG_DEBUG, ("LSCopyApplicationForMIMEType found a default application\n"));
if (CFType) {
err = ::LSCopyApplicationForMIMEType(CFType, kLSRolesAll, &appURL);
if ((err == noErr) && appURL && ::CFURLGetFSRef(appURL, &typeAppFSRef)) {
haveAppForType = PR_TRUE;
PR_LOG(mLog, PR_LOG_DEBUG, ("LSCopyApplicationForMIMEType found a default application\n"));
}
if (appURL)
::CFRelease(appURL);
::CFRelease(CFType);
}
if (appURL)
::CFRelease(appURL);
::CFRelease(CFType);
}
if (!aFileExt.IsEmpty()) {
// CFStringCreateWithCString() can fail even if we're not out of memory --
// for example if the 'cStr' parameter is something very wierd (like "ÿÿ~"
// aka "\xFF\xFF~"), or possibly if it can't be interpreted as using what's
// specified in the 'encoding' parameter. See bug 548719.
CFStringRef CFExt = ::CFStringCreateWithCString(NULL, flatExt.get(), kCFStringEncodingUTF8);
err = ::LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFExt,
kLSRolesAll, &extAppFSRef, nsnull);
if (err == noErr) {
haveAppForExt = PR_TRUE;
PR_LOG(mLog, PR_LOG_DEBUG, ("LSGetApplicationForInfo found a default application\n"));
if (CFExt) {
err = ::LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFExt,
kLSRolesAll, &extAppFSRef, nsnull);
if (err == noErr) {
haveAppForExt = PR_TRUE;
PR_LOG(mLog, PR_LOG_DEBUG, ("LSGetApplicationForInfo found a default application\n"));
}
::CFRelease(CFExt);
}
}