PRBool nsStyleCoord::operator==(const nsStyleCoord& aOther) const { if (mUnit == aOther.mUnit) { if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { return PRBool(mValue.mFloat == aOther.mValue.mFloat); } else { return PRBool(mValue.mInt == aOther.mValue.mInt); } } return PR_FALSE; }
void ValidateBaselineFiles(const char* anIndexFilename) { fstream theIndexFile(anIndexFilename,ios::in | ios::nocreate); char theFilename[500]; char theBaselineFilename[500]; char theTempFilename[500]; PRBool done=PR_FALSE; ComputeTempFilename(anIndexFilename,theTempFilename); while(!done) { theIndexFile >> theFilename; theIndexFile >> theBaselineFilename; if(theFilename[0] && theBaselineFilename[0]) { if(NS_SUCCEEDED(GenerateBaselineFile(theFilename,theTempFilename))) { PRBool matches=CompareFiles(theTempFilename,theBaselineFilename); cout << theFilename << kResultMsg[matches] << endl; } } theFilename[0]=0; theBaselineFilename[0]=0; done=PRBool(theIndexFile.ipfx(1)==0); } // Now it's time to compare our output to the baseline... // if(!CompareFiles(aBaselineFilename,aBaselineFilename)){ // cout << "File: \"" << aSourceFilename << "\" does not match baseline." << endl; // } }
PRBool CompareFiles(const char* aFilename1, const char* aFilename2) { PRBool result=PR_TRUE; fstream theFirstStream(aFilename1,ios::in | ios::nocreate); fstream theSecondStream(aFilename2,ios::in | ios::nocreate); PRBool done=PR_FALSE; char ch1,ch2; while(!done) { theFirstStream >> ch1; theSecondStream >> ch2; if(ch1!=ch2) { result=PR_FALSE; break; } done=PRBool((theFirstStream.ipfx(1)==0) || (theSecondStream.ipfx(1)==0)); } return result; }
void nsCSSSelector::ToStringInternal(nsAString& aString, nsICSSStyleSheet* aSheet, PRBool aIsPseudoElem, PRIntn aNegatedIndex, const nsString& aIdPrefix) const { nsAutoString temp; PRBool aIsNegated = PRBool(0 < aNegatedIndex); PRBool isPseudoElement = IsPseudoElement(mTag); // selectors are linked from right-to-left, so the next selector in the linked list // actually precedes this one in the resulting string if (mNext) { mNext->ToStringInternal(aString, aSheet, IsPseudoElement(mTag), 0, aIdPrefix); if (!aIsNegated && !isPseudoElement) { // don't add a leading whitespace if we have a pseudo-element // or a negated simple selector aString.Append(PRUnichar(' ')); } } if (1 < aNegatedIndex) { // the first mNegations does not contain a negated type element selector // or a negated universal selector NS_IF_NEGATED_START(aIsNegated, aString) } // For non-pseudo-element selectors or for lone pseudo-elements, deal with // namespace prefixes. if (!isPseudoElement || !mNext) { // append the namespace prefix if needed if (mNameSpace == kNameSpaceID_None) { // The only way to do this in CSS is to have an explicit namespace // of "none" specified in the sheet by having a '|' with nothing // before it. aString.Append(PRUnichar('|')); } else { #ifndef FBML if (aSheet) { nsXMLNameSpaceMap *sheetNS = aSheet->GetNameSpaceMap(); // sheetNS is non-null if and only if we had an @namespace rule. If it's // null, that means that the only namespaces we could have are the // wildcard namespace (which can be implicit in this case) and the "none" // namespace, which we handled above. So no need to output anything when // sheetNS is null. if (sheetNS) { nsIAtom *prefixAtom = nsnull; // prefixAtom is non-null if and only if we have a prefix other than // '*' if (mNameSpace != kNameSpaceID_Unknown) { prefixAtom = sheetNS->FindPrefix(mNameSpace); } if (prefixAtom) { nsAutoString prefix; prefixAtom->ToString(prefix); aString.Append(prefix); aString.Append(PRUnichar('|')); } else if (mNameSpace == kNameSpaceID_Unknown) { // explicit *| or only non-default namespace rules and we're not // using any of those namespaces aString.AppendLiteral("*|"); } // else we are in the default namespace and don't need to output // anything } } #endif } } // smells like a universal selector if (!mTag && !mIDList && !mClassList) { if (1 != aNegatedIndex) { aString.Append(PRUnichar('*')); } if (1 < aNegatedIndex) { NS_IF_NEGATED_END(aIsNegated, aString) } } else { // Append the tag name, if there is one if (mTag) {