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 the startup cache r=smaug
This commit is contained in:
parent
6aa687de11
commit
4c180e5f42
@ -998,8 +998,34 @@ 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 attrName, attrValue;
|
||||
rv = aStream->ReadString(attrName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->ReadString(attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAtom> atomName = do_GetAtom(attrName);
|
||||
mBinding->SetAttr(attrNamespace, atomName, attrValue, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, read in the resources.
|
||||
do {
|
||||
while (true) {
|
||||
XBLBindingSerializeDetails type;
|
||||
rv = aStream->Read8(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1016,7 +1042,7 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
|
||||
AddResource(type == XBLBinding_Serialize_Stylesheet ? nsGkAtoms::stylesheet :
|
||||
nsGkAtoms::image, src);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
if (isFirstBinding) {
|
||||
aDocInfo->SetFirstPrototypeBinding(this);
|
||||
@ -1126,6 +1152,30 @@ 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->Atom();
|
||||
mBinding->GetAttr(attr->NamespaceID(), attr->Atom(), attrValue);
|
||||
rv = aStream->Write8(XBLBinding_Serialize_Attribute);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = WriteNamespace(aStream, attr->NamespaceID());
|
||||
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