mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 915558 - save attributes of binding element to startup cache r=smaug
This commit is contained in:
parent
41ecc9a0dc
commit
9aac72e8ce
@ -998,8 +998,38 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
previousHandler = handler;
|
||||
} while (1);
|
||||
|
||||
if (mBinding) {
|
||||
while (true) {
|
||||
XBLBindingSerializeDetails type;
|
||||
rv = aStream->Read8(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (type != XBLBinding_Serialize_Attribute) {
|
||||
break;
|
||||
}
|
||||
|
||||
int32_t attrNamespace;
|
||||
rv = ReadNamespace(aStream, attrNamespace);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString attrPrefix, attrName, attrValue;
|
||||
rv = aStream->ReadString(attrPrefix);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->ReadString(attrName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->ReadString(attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAtom> atomPrefix = do_GetAtom(attrPrefix);
|
||||
nsCOMPtr<nsIAtom> atomName = do_GetAtom(attrName);
|
||||
mBinding->SetAttr(attrNamespace, atomName, atomPrefix, attrValue, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, read in the resources.
|
||||
do {
|
||||
while (true) {
|
||||
XBLBindingSerializeDetails type;
|
||||
rv = aStream->Read8(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1016,7 +1046,7 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
|
||||
AddResource(type == XBLBinding_Serialize_Stylesheet ? nsGkAtoms::stylesheet :
|
||||
nsGkAtoms::image, src);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
if (isFirstBinding) {
|
||||
aDocInfo->SetFirstPrototypeBinding(this);
|
||||
@ -1126,6 +1156,39 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
|
||||
aStream->Write8(XBLBinding_Serialize_NoMoreItems);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mBinding) {
|
||||
uint32_t attributes = mBinding->GetAttrCount();
|
||||
nsAutoString attrValue;
|
||||
for (uint32_t i = 0; i < attributes; ++i) {
|
||||
const nsAttrName* attr = mBinding->GetAttrNameAt(i);
|
||||
nsDependentAtomString attrName = attr->LocalName();
|
||||
mBinding->GetAttr(attr->NamespaceID(), attr->LocalName(), attrValue);
|
||||
rv = aStream->Write8(XBLBinding_Serialize_Attribute);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = WriteNamespace(aStream, attr->NamespaceID());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIAtom* prefix = attr->GetPrefix();
|
||||
nsAutoString prefixString;
|
||||
if (prefix) {
|
||||
prefix->ToString(prefixString);
|
||||
}
|
||||
|
||||
rv = aStream->WriteWStringZ(prefixString.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->WriteWStringZ(attrName.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->WriteWStringZ(attrValue.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
aStream->Write8(XBLBinding_Serialize_NoMoreItems);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Write out the resources
|
||||
if (mResources) {
|
||||
rv = mResources->Write(aStream);
|
||||
|
@ -15,7 +15,7 @@ typedef uint8_t XBLBindingSerializeDetails;
|
||||
|
||||
// A version number to ensure we don't load cached data in a different
|
||||
// file format.
|
||||
#define XBLBinding_Serialize_Version 0x00000002
|
||||
#define XBLBinding_Serialize_Version 0x00000003
|
||||
|
||||
// Set for the first binding in a document
|
||||
#define XBLBinding_Serialize_IsFirstBinding 1
|
||||
@ -45,6 +45,7 @@ typedef uint8_t XBLBindingSerializeDetails;
|
||||
#define XBLBinding_Serialize_Handler 8
|
||||
#define XBLBinding_Serialize_Image 9
|
||||
#define XBLBinding_Serialize_Stylesheet 10
|
||||
#define XBLBinding_Serialize_Attribute 0xA
|
||||
#define XBLBinding_Serialize_Mask 0x0F
|
||||
#define XBLBinding_Serialize_ReadOnly 0x80
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user