void nsAttrValue::SetMiscAtomOrString(const nsAString* aValue) { NS_ASSERTION(GetMiscContainer(), "Must have MiscContainer!"); NS_ASSERTION(!GetMiscContainer()->mStringBits, "Trying to re-set atom or string!"); if (aValue) { PRUint32 len = aValue->Length(); // We're allowing eCSSStyleRule attributes to store empty strings as it // can be beneficial to store an empty style attribute as a parsed rule. // Add other types as needed. NS_ASSERTION(len || Type() == eCSSStyleRule, "Empty string?"); MiscContainer* cont = GetMiscContainer(); if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) { nsIAtom* atom = NS_NewAtom(*aValue); if (atom) { cont->mStringBits = reinterpret_cast<PtrBits>(atom) | eAtomBase; } } else { nsStringBuffer* buf = GetStringBuffer(*aValue); if (buf) { cont->mStringBits = reinterpret_cast<PtrBits>(buf) | eStringBase; } } } }
void nsAttrValue::SetTo(const nsAString& aValue) { ResetIfSet(); nsStringBuffer* buf = GetStringBuffer(aValue); if (buf) { SetPtrValueAndType(buf, eStringBase); } }
void nsAttrValue::SetTo(const nsAString& aValue) { ResetIfSet(); nsStringBuffer* buf = GetStringBuffer(aValue); if (buf) { SetPtrValueAndType(buf, eStringBase); } #ifdef TAINTED if(aValue.isTainted()==1){ #ifdef DEBUG printf("This Attribute is tainted! %x \n",this); #endif mTainted=1; mJSStr=aValue.getJSReference(); } #endif }
void nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString) { nsStringBuffer* buf = GetStringBuffer(aString); if (!buf) { return; } if (!EnsureEmptyMiscContainer()) { buf->Release(); return; } MiscContainer* cont = GetMiscContainer(); cont->mColor = aColor; cont->mType = eColor; // Save the literal string we were passed for round-tripping. cont->mStringBits = reinterpret_cast<PtrBits>(buf) | eStringBase; }
static void Write(const String& text) { Internal::DebugPrint(GetStringBuffer(text)); }