author | Ehsan Akhgari <ehsan@mozilla.com> |
Tue, 06 Apr 2010 21:10:47 -0400 | |
changeset 40523 | b931ea32034b6ab61214cb3aaec814da8aff159d |
parent 40522 | 309acf8ab20fae89fa0378de4a9752ecf4cce5b4 (current diff) |
parent 40521 | a016ac686be0d126b9aa13c6d887306095539e7f (diff) |
child 40524 | 7ab21bd712e31decb1ffbfd4f209f2cdc042a4c1 |
push id | 12646 |
push user | eakhgari@mozilla.com |
push date | Wed, 07 Apr 2010 01:11:51 +0000 |
treeherder | mozilla-central@b931ea32034b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 221820 |
milestone | 1.9.3a4pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
|
--- a/content/base/src/nsAttrAndChildArray.cpp +++ b/content/base/src/nsAttrAndChildArray.cpp @@ -595,17 +595,17 @@ nsAttrAndChildArray::SetMappedAttrStyleS mapped->SetStyleSheet(aSheet); return MakeMappedUnique(mapped); } void nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker) { - if (mImpl && mImpl->mMappedAttrs && aRuleWalker) { + if (mImpl && mImpl->mMappedAttrs) { aRuleWalker->Forward(mImpl->mMappedAttrs); } } void nsAttrAndChildArray::Compact() { if (!mImpl) {
new file mode 100644 --- /dev/null +++ b/content/smil/crashtests/555026-1.svg @@ -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>
--- a/content/smil/crashtests/crashtests.list +++ b/content/smil/crashtests/crashtests.list @@ -4,9 +4,10 @@ load 523188-1.svg load 525099-1.svg load 526536-1.svg load 526875-1.svg load 526875-2.svg load 529387-1.xhtml load 537157-1.svg load 547333-1.svg load 548899-1.svg +load 555026-1.svg load 556841-1.svg
--- a/content/smil/nsSMILAnimationFunction.cpp +++ b/content/smil/nsSMILAnimationFunction.cpp @@ -407,56 +407,60 @@ nsSMILAnimationFunction::InterpolateResu double fTime = double(mSampleTime); double fDur = double(dur); // Get the normalised progress through the simple duration double simpleProgress = (fDur > 0.0) ? fTime / fDur : 0.0; // 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()) aResult = aValues[0]; return rv; } double last = mKeyTimes[mKeyTimes.Length() - 1]; if (last < 1.0 && simpleProgress >= last) { if (IsToAnimation()) aResult = aValues[0]; else aResult = aValues[aValues.Length() - 1]; return rv; } } - 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, intervalProgress, from, to); // Note: If the above call fails, we'll skip the "from->Interpolate" // call below, and we'll drop into the CALC_DISCRETE section // 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]; to = &aValues[index + 1]; intervalProgress = simpleProgress * (aValues.Length() - 1) - index; ScaleIntervalProgress(intervalProgress, index, aValues.Length() - 1); } }
--- a/content/smil/test/Makefile.in +++ b/content/smil/test/Makefile.in @@ -65,16 +65,17 @@ include $(topsrcdir)/config/rules.mk test_smilMappedAttrFromBy.xhtml \ test_smilMappedAttrPaced.xhtml \ test_smilReset.xhtml \ test_smilRestart.xhtml \ test_smilFillMode.xhtml \ test_smilGetStartTime.xhtml \ test_smilGetSimpleDuration.xhtml \ test_smilKeySplines.xhtml \ + test_smilKeyTimesPacedMode.xhtml \ test_smilSetCurrentTime.xhtml \ test_smilSync.xhtml \ test_smilSyncbaseTarget.xhtml \ test_smilSyncTransform.xhtml \ test_smilTextZoom.xhtml \ test_smilTiming.xhtml \ test_smilTimingZeroIntervals.xhtml \ test_smilUpdatedInterval.xhtml \
new file mode 100644 --- /dev/null +++ b/content/smil/test/test_smilKeyTimesPacedMode.xhtml @@ -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>
new file mode 100644 --- /dev/null +++ b/layout/reftests/bugs/556661-1-ref.html @@ -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>
new file mode 100644 --- /dev/null +++ b/layout/reftests/bugs/556661-1.html @@ -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>
--- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1414,10 +1414,11 @@ fails-if(http.oscpu.match(/Mac\x20OS\x20 random-if(!haveTestPlugin) == 541406-1.html 541406-1-ref.html == 542620-1.html 542620-1-ref.html == 545049-1.html 545049-1-ref.html == 546033-1.html 546033-1-ref.html 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 +== 551699-1.html 551699-1-ref.html == 552334-1.html 552334-1-ref.html -== 551699-1.html 551699-1-ref.html +== 556661-1.html 556661-1-ref.html
new file mode 100644 --- /dev/null +++ b/layout/reftests/css-visited/white-to-transparent-1-ref.html @@ -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>
new file mode 100644 --- /dev/null +++ b/layout/reftests/css-visited/white-to-transparent-1.html @@ -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>
--- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -398,23 +398,29 @@ protected: PRBool* aChanged); // After a parse error parsing |aPropID|, clear the data in // |mTempData|. void ClearTempData(nsCSSProperty aPropID); // After a successful parse of |aPropID|, transfer data from // |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 // destination location. It's the caller's responsibility to make sure that // the source and destination locations point to the right kind of objects // for the property id. This can only be used for non-shorthand properties. void CopyValue(void *aSource, void *aDest, nsCSSProperty aPropID, PRBool* aChanged); @@ -1139,17 +1145,18 @@ CSSParserImpl::ParseProperty(const nsCSS } nsresult result = NS_OK; PRBool parsedOK = ParseProperty(aPropID); if (parsedOK && !GetToken(PR_TRUE)) { if (valueSlot) { 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) { // Junk at end of property value. REPORT_UNEXPECTED_TOKEN(PEExpectEndValue); } NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(aPropID)); const PRUnichar *params[] = { @@ -3978,17 +3985,17 @@ CSSParserImpl::ParseDeclaration(nsCSSDec return PR_FALSE; } CLEAR_ERROR(); // See if the declaration is followed by a "!important" declaration 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; } if (eCSSToken_Symbol == tk->mType && '!' == tk->mSymbol) { // Look for important ident if (!GetToken(PR_TRUE)) { // Premature eof is not ok @@ -4011,31 +4018,31 @@ CSSParserImpl::ParseDeclaration(nsCSSDec UngetToken(); } // Make sure valid property declaration is terminated with either a // semicolon, EOF or a right-curly-brace (this last only when // 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; } if (aCheckForBraces && '}' == tk->mSymbol) { // 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; } } if (aCheckForBraces) REPORT_UNEXPECTED_TOKEN(PEBadDeclOrRuleEnd2); else REPORT_UNEXPECTED_TOKEN(PEBadDeclEnd); @@ -4055,50 +4062,63 @@ CSSParserImpl::ClearTempData(nsCSSProper } else { mTempData.ClearProperty(aPropID); } mTempData.AssertInitialState(); } 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(); } // Perhaps the transferring code should be in nsCSSExpandedDataBlock, in // case some other caller wants to use it in the future (although I // can't think of why). void CSSParserImpl::DoTransferTempData(nsCSSDeclaration* aDeclaration, - nsCSSProperty aPropID, PRBool aIsImportant, + nsCSSProperty aPropID, + PRBool aIsImportant, + PRBool aOverrideImportant, PRBool aMustCallValueAppended, PRBool* aChanged) { NS_ASSERTION(mTempData.HasPropertyBit(aPropID), "oops"); if (aIsImportant) { if (!mData.HasImportantBit(aPropID)) *aChanged = PR_TRUE; 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); } } if (aMustCallValueAppended || !mData.HasPropertyBit(aPropID)) { aDeclaration->ValueAppended(aPropID); } mData.SetPropertyBit(aPropID);
--- a/layout/style/nsCSSParser.h +++ b/layout/style/nsCSSParser.h @@ -60,48 +60,48 @@ namespace css { class Loader; } } // Interface to the css parser. 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(); private: // not to be implemented nsCSSParser(nsCSSParser const&); nsCSSParser& operator=(nsCSSParser const&); 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 * SetStyleSheet. Calling this method without calling SetStyleSheet first is * an error. * * @param aInput the data to parse * @param aSheetURL the URI to use as the sheet URI (for error reporting). @@ -109,92 +109,92 @@ public: * SetStyleSheet. * @param aBaseURI the URI to use for relative URI resolution * @param aSheetPrincipal the principal of the stylesheet. This must match * the principal of the sheet passed to SetStyleSheet. * @param aLineNumber the line number of the first line of the sheet. * @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 * non-null, replacing its current contents. If aHTMLMode is true, * parse according to HTML rules, with commas as the most important * delimiter. Otherwise, parse according to CSS rules, with * 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 * resulting aColor may vary due to rgba()/hsla(). Will return * NS_ERROR_FAILURE if aBuffer is not a valid CSS color specification. * * Will also currently return NS_ERROR_FAILURE if it is not * 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 // header, we can't put the type definition (in nsCSSParser.cpp) in // the anonymous namespace. void* mImpl; };
--- a/layout/style/nsCSSScanner.h +++ b/layout/style/nsCSSScanner.h @@ -156,38 +156,37 @@ class nsCSSScanner { mSVGMode = aSVGMode; } PRBool IsSVGMode() const { return mSVGMode; } #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; } // Get the next token. Return PR_FALSE on EOF. aTokenResult // is filled in with the data for the token. PRBool Next(nsCSSToken& aTokenResult);
--- a/layout/style/nsCSSStyleSheet.h +++ b/layout/style/nsCSSStyleSheet.h @@ -146,24 +146,24 @@ public: NS_IMETHOD GetStyleRuleAt(PRInt32 aIndex, nsICSSRule*& aRule) const; NS_IMETHOD DeleteRuleFromGroup(nsICSSGroupRule* aGroup, PRUint32 aIndex); NS_IMETHOD InsertRuleIntoGroup(const nsAString& aRule, nsICSSGroupRule* aGroup, PRUint32 aIndex, PRUint32* _retval); NS_IMETHOD ReplaceRuleInGroup(nsICSSGroupRule* aGroup, nsICSSRule* aOld, nsICSSRule* aNew); NS_IMETHOD StyleSheetCount(PRInt32& aCount) const; 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, nsIDOMNode* aCloneOwningNode, nsICSSStyleSheet** aClone) const; NS_IMETHOD IsModified(PRBool* aSheetModified) const; NS_IMETHOD SetModified(PRBool aModified); NS_IMETHOD AddRuleProcessor(nsCSSRuleProcessor* aProcessor);
--- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -176,28 +176,28 @@ public: // for valueless units only (null, auto, inherit, none, all, normal) explicit nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null) : mUnit(aUnit) { 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 { return !(*this == aOther); } nsCSSUnit GetUnit() const { return mUnit; } PRBool IsLengthUnit() const @@ -305,78 +305,77 @@ public: return GetBufferValue(mUnit == eCSSUnit_URL ? mValue.mURL->mString : mValue.mImage->mString); } // 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. static nsStringBuffer* BufferFromString(const nsString& aValue); struct URL { // Methods are not inline because using an nsIPrincipal means requiring // caps, which leads to REQUIRES hell, since this header is included all // over. // 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 // null-checks; this is never null. nsCOMPtr<nsIURI> mReferrer; nsCOMPtr<nsIPrincipal> mOriginPrincipal; NS_INLINE_DECL_REFCOUNTING(nsCSSValue::URL) @@ -389,18 +388,18 @@ public: }; struct Image : public URL { // Not making the constructor and destructor inline because that would // force us to include imgIRequest.h, which leads to REQUIRES hell, since // 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 nsCOMPtr<imgIRequest> mRequest; // null == image load blocked or somehow failed // Override AddRef and Release to not only log ourselves correctly, but // also so that we delete correctly without a virtual destructor NS_INLINE_DECL_REFCOUNTING(nsCSSValue::Image) @@ -424,20 +423,20 @@ protected: URL* mURL; Image* mImage; nsCSSValueGradient* mGradient; } mValue; }; 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; PRBool operator==(const nsCSSValueGradientStop& aOther) const { return (mLocation == aOther.mLocation && mColor == aOther.mColor); @@ -445,18 +444,17 @@ public: PRBool operator!=(const nsCSSValueGradientStop& aOther) const { return !(*this == aOther); } }; 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; PRPackedBool mIsRepeating; // line position and angle nsCSSValue mBgPosX; nsCSSValue mBgPosY; nsCSSValue mAngle;
--- a/layout/style/nsICSSStyleSheet.h +++ b/layout/style/nsICSSStyleSheet.h @@ -88,30 +88,30 @@ public: NS_IMETHOD SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI, nsIURI* aBaseURI) = 0; /** * SetPrincipal should be called on all sheets before parsing into them. * 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; NS_IMETHOD SetOwningNode(nsIDOMNode* aOwningNode) = 0; NS_IMETHOD SetOwnerRule(nsICSSImportRule* aOwnerRule) = 0; 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, nsIDocument* aCloneDocument, nsIDOMNode* aCloneOwningNode, nsICSSStyleSheet** aClone) const = 0; NS_IMETHOD IsModified(PRBool* aModified) const = 0; // returns the mDirty status of the sheet
--- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -167,17 +167,17 @@ struct nsCachedStyleData static PRBool IsReset(const nsStyleStructID& aSID) { return gInfo[aSID].mIsReset; } static PRUint32 GetBitForSID(const nsStyleStructID& aSID) { 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 // m##type##Data for the struct within nsCachedStyleData (|this|) // and the offset of the appropriate m##name##Data within the // m##type##Data. Note that if we don't have any reset structs, // then mResetData is null, and likewise for mInheritedData. This // saves us from having to go through the long if-else cascade into @@ -200,28 +200,28 @@ struct nsCachedStyleData char* dataSlot = resetOrInherit + info.mInheritResetOffset; data = *reinterpret_cast<void**>(dataSlot); } return data; } // 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) mInheritedData->Destroy(aBits, aContext); mResetData = nsnull; mInheritedData = nsnull; } @@ -426,291 +426,289 @@ private: // Reference count. This just counts the style contexts that // reference this rulenode. When this goes to 0 or stops being 0, // we notify the style set. PRUint32 mRefCnt; 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, nsRuleNode* aHighestNode, 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, RuleDetail aRuleDetail, 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; } // These PRUint8s are really nsStyleSet::sheetType values. PRUint8 GetLevel() const { NS_ASSERTION(!IsRoot(), "can't call on root"); return (mDependentBits & NS_RULE_NODE_LEVEL_MASK) >> NS_RULE_NODE_LEVEL_SHIFT; @@ -720,35 +718,34 @@ public: return (mDependentBits & NS_RULE_NODE_IS_IMPORTANT) != 0; } // NOTE: Does not |AddRef|. nsIStyleRule* GetRule() const { return mRule; } // 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 /* * Garbage collection. Mark walks up the tree, marking any unmarked * ancestors until it reaches a marked one. Sweep recursively sweeps * 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, PRUint32 ruleTypeMask, PRBool aAuthorColorsAllowed); // Expose this so media queries can use it static nscoord CalcLengthWithInitialFont(nsPresContext* aPresContext,
--- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -748,16 +748,24 @@ nsStyleContext::GetVisitedDependentColor return nsStyleContext::CombineVisitedColors(colors, this->RelevantLinkVisited()); } /* 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 = gVisitedIndices[aLinkIsVisited ? 1 : 0]; nscolor colorColor = aColors[set.colorIndex]; nscolor alphaColor = aColors[set.alphaIndex]; return NS_RGBA(NS_GET_R(colorColor), NS_GET_G(colorColor),
--- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -70,21 +70,21 @@ class nsPresContext; * collection. */ 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) { NS_WARNING("refcount overflow, leaking object"); return mRefCnt; } ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "nsStyleContext", sizeof(nsStyleContext)); @@ -117,17 +117,17 @@ public: // Find, if it already exists *and is easily findable* (i.e., near the // start of the child list), a style context whose: // * GetPseudo() matches aPseudoTag // * GetRuleNode() matches aRules // * !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); // Does this style context or any of its ancestors have text // decorations? PRBool HasTextDecorations() const { return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); } @@ -192,17 +192,17 @@ public: "parent mismatch"); } else { NS_ASSERTION(GetStyleIfVisited()->GetParent() == GetParent(), "parent mismatch"); } } // 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_) \ void SetStyle##name_ (nsStyle##name_ * aStruct) { \ NS_ASSERTION(!mCachedInheritedData.m##name_##Data || \ (mBits & \ nsCachedStyleData::GetBitForSID(eStyleStruct_##name_)), \ "Going to leak styledata"); \ @@ -215,17 +215,17 @@ public: nsRuleNode* GetRuleNode() { return mRuleNode; } void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; } /* * 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 * member function of nsIStyleContext. It fills in a const pointer * to a style data struct that is appropriate for the style context's * frame. This struct may be shared with other contexts (either in * the rule tree or the style context tree), so it should not be * modified. @@ -233,17 +233,17 @@ public: * This function will NOT return null (even when out of memory) when * given a valid style struct ID, so the result does not need to be * null-checked. * * The typesafe functions below are preferred to the use of this * 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 * preprocessing the list of style structs. These functions are the * preferred way to get style data. The macro creates functions like: * const nsStyleBorder* GetStyleBorder(); * const nsStyleColor* GetStyleColor(); */ @@ -263,52 +263,52 @@ public: */ #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \ const nsStyle##name_ * PeekStyle##name_() { \ return DoGetStyle##name_(PR_FALSE); \ } #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 * this->GetStyleIfVisited(). * * aProperty must be a color-valued property that nsStyleAnimation * knows how to extract. It must also be a property that we know to * do change handling for in nsStyleContext::CalcDifference. * * 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 * color is the unvisited color and the second is the visited color. * * Combine the R, G, and B components of whichever of aColors should * be used based on aLinkIsVisited with the A component of aColors[0]. */ static nscolor CombineVisitedColors(nscolor *aColors, 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. inline const void* GetCachedStyleData(nsStyleStructID aSID); // Helper functions for GetStyle* and PeekStyle* #define STYLE_STRUCT_INHERITED(name_, checkdata_cb_, ctor_args_) \ const nsStyle##name_ * DoGetStyle##name_(PRBool aComputeData) { \ @@ -373,15 +373,15 @@ protected: // sometimes allocate the mCachedResetData. nsResetStyleData* mCachedResetData; // Cached reset style data. nsInheritedStyleData mCachedInheritedData; // Cached inherited style data PRUint32 mBits; // Which structs are inherited from the // parent context or owned by mRuleNode. PRUint32 mRefCnt; }; -NS_HIDDEN_(already_AddRefed<nsStyleContext>) +already_AddRefed<nsStyleContext> NS_NewStyleContext(nsStyleContext* aParentContext, nsIAtom* aPseudoTag, nsCSSPseudoElements::Type aPseudoType, nsRuleNode* aRuleNode, nsPresContext* aPresContext); #endif
--- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -384,23 +384,23 @@ class nsStyleSet unsigned mInShutdown : 1; unsigned mAuthorStyleDisabled: 1; unsigned mInReconstruct : 1; unsigned mDirty : 8; // one dirty bit is used per sheet type }; inline -NS_HIDDEN_(void) nsRuleNode::AddRef() +void nsRuleNode::AddRef() { if (mRefCnt++ == 0 && !IsRoot()) { mPresContext->StyleSet()->RuleNodeInUse(); } } inline -NS_HIDDEN_(void) nsRuleNode::Release() +void nsRuleNode::Release() { if (--mRefCnt == 0 && !IsRoot()) { mPresContext->StyleSet()->RuleNodeUnused(); } } #endif
--- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -139,18 +139,17 @@ public: NS_DECL_ISUPPORTS // nsIStyleRule implementation NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG 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); } struct CoveredValue { nsCSSProperty mProperty; nsStyleAnimation::Value mCoveredValue;
--- a/layout/style/test/test_priority_preservation.html +++ b/layout/style/test/test_priority_preservation.html @@ -29,40 +29,93 @@ is(s.getPropertyValue("text-decoration") is(s.getPropertyPriority("text-decoration"), "", "text-decoration priority stored"); s.setProperty("z-index", "7", "important"); is(s.getPropertyValue("z-index"), "7", "z-index stored"); 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"), "", "text-decoration priority still stored"); s.setProperty("text-decoration", "overline", ""); 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> </html>
--- a/layout/style/test/test_visited_reftests.html +++ b/layout/style/test/test_visited_reftests.html @@ -72,16 +72,17 @@ var gTests = [ "== subject-of-selector-descendant-2.xhtml subject-of-selector-descendant-2-ref.xhtml", "== subject-of-selector-child-1.html subject-of-selector-1-ref.html", "== subject-of-selector-adj-sibling-1.html subject-of-selector-1-ref.html", "== subject-of-selector-any-sibling-1.html subject-of-selector-1-ref.html", "== inherit-keyword-1.xhtml inherit-keyword-1-ref.html", // 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 // we can say the tests are done. var gDelayCount = 0; function AddFinishDependency() { ++gDelayCount; } function RemoveFinishDependency()
--- a/uriloader/exthandler/mac/nsOSHelperAppService.mm +++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm @@ -95,36 +95,44 @@ nsOSHelperAppService::nsOSHelperAppServi { } 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; } NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; nsresult rv = NS_ERROR_NOT_AVAILABLE; @@ -265,33 +273,46 @@ nsOSHelperAppService::GetMIMEInfoFromOS( PRBool haveAppForExt = PR_FALSE; PRBool typeAppIsDefault = PR_FALSE; PRBool extAppIsDefault = PR_FALSE; FSRef typeAppFSRef; FSRef extAppFSRef; 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); } } if (haveAppForType && haveAppForExt) { // Do aMIMEType and aFileExt match? if (::FSCompareFSRefs((const FSRef *) &typeAppFSRef, (const FSRef *) &extAppFSRef) == noErr) { typeAppIsDefault = PR_TRUE; *aFound = PR_TRUE;