зеркало из https://github.com/mozilla/gecko-dev.git
Bugs 27947, 27271. Re-order content-model-to-layout notification to avoid an incremental reflow. This ensures that 1) all menus will be completely created before they are displayed, and 2) the 'oncreate' handler runs after RDF content has been generated. r=hyatt
This commit is contained in:
Родитель
861c915827
Коммит
21c4ae46b3
|
@ -1416,19 +1416,9 @@ nsXULDocument::AttributeChanged(nsIContent* aElement,
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now notify external observers
|
// Handle "open" and "close" cases. We do this handling before
|
||||||
for (PRInt32 i = 0; i < mObservers.Count(); i++) {
|
// we've notified the observer, so that content is already created
|
||||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
// for the frame system to walk.
|
||||||
observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, aHint);
|
|
||||||
if (observer != (nsIDocumentObserver*)mObservers.ElementAt(i)) {
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle "special" cases. We do this handling _after_ we've
|
|
||||||
// notified the observer to ensure that any frames that are
|
|
||||||
// caching information (e.g., the tree widget and the 'open'
|
|
||||||
// attribute) will notice things properly.
|
|
||||||
if ((nameSpaceID == kNameSpaceID_XUL) && (aAttribute == kOpenAtom)) {
|
if ((nameSpaceID == kNameSpaceID_XUL) && (aAttribute == kOpenAtom)) {
|
||||||
nsAutoString open;
|
nsAutoString open;
|
||||||
rv = aElement->GetAttribute(kNameSpaceID_None, kOpenAtom, open);
|
rv = aElement->GetAttribute(kNameSpaceID_None, kOpenAtom, open);
|
||||||
|
@ -1441,7 +1431,20 @@ nsXULDocument::AttributeChanged(nsIContent* aElement,
|
||||||
CloseWidgetItem(aElement);
|
CloseWidgetItem(aElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aAttribute == kRefAtom) {
|
|
||||||
|
// Now notify external observers
|
||||||
|
for (PRInt32 i = 0; i < mObservers.Count(); i++) {
|
||||||
|
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||||
|
observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, aHint);
|
||||||
|
if (observer != (nsIDocumentObserver*)mObservers.ElementAt(i)) {
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a change to the 'ref' attribute on an atom, in which
|
||||||
|
// case we may need to nuke and rebuild the entire content model
|
||||||
|
// beneath the element.
|
||||||
|
if (aAttribute == kRefAtom) {
|
||||||
RebuildWidgetItem(aElement);
|
RebuildWidgetItem(aElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -771,7 +771,9 @@ RDFGenericBuilderImpl::OpenContainer(nsIContent* aElement)
|
||||||
rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
|
rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (container) {
|
if (container && IsTreeWidgetItem(aElement)) {
|
||||||
|
// The tree widget is special, and has to be spanked every
|
||||||
|
// time we add content to a container.
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||||
if (! doc)
|
if (! doc)
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
@ -2462,22 +2464,11 @@ RDFGenericBuilderImpl::CreateContainerContents(nsIContent* aElement,
|
||||||
*aNewIndexInContainer = -1;
|
*aNewIndexInContainer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's XUL, then see if the item is even "open" (HTML content
|
// The tree widget is special. If the item isn't open, then just
|
||||||
// must be generated eagerly). If not, then just pretend it
|
// "pretend" that there aren't any contents here. We'll create
|
||||||
// doesn't have _any_ contents. We check this _before_ checking
|
// them when OpenContainer() gets called.
|
||||||
// the contents-generated attribute so that we don't eagerly set
|
if (IsTreeWidgetItem(aElement) && !IsOpen(aElement))
|
||||||
// contents-generated on a closed node.
|
|
||||||
{
|
|
||||||
PRInt32 nameSpaceID;
|
|
||||||
rv = aElement->GetNameSpaceID(nameSpaceID);
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get namespace ID");
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
if (nameSpaceID == kNameSpaceID_XUL) {
|
|
||||||
if (! IsOpen(aElement))
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See if the element's templates contents have been generated:
|
// See if the element's templates contents have been generated:
|
||||||
// this prevents a re-entrant call from triggering another
|
// this prevents a re-entrant call from triggering another
|
||||||
|
|
|
@ -771,7 +771,9 @@ RDFGenericBuilderImpl::OpenContainer(nsIContent* aElement)
|
||||||
rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
|
rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (container) {
|
if (container && IsTreeWidgetItem(aElement)) {
|
||||||
|
// The tree widget is special, and has to be spanked every
|
||||||
|
// time we add content to a container.
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||||
if (! doc)
|
if (! doc)
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
@ -2462,22 +2464,11 @@ RDFGenericBuilderImpl::CreateContainerContents(nsIContent* aElement,
|
||||||
*aNewIndexInContainer = -1;
|
*aNewIndexInContainer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's XUL, then see if the item is even "open" (HTML content
|
// The tree widget is special. If the item isn't open, then just
|
||||||
// must be generated eagerly). If not, then just pretend it
|
// "pretend" that there aren't any contents here. We'll create
|
||||||
// doesn't have _any_ contents. We check this _before_ checking
|
// them when OpenContainer() gets called.
|
||||||
// the contents-generated attribute so that we don't eagerly set
|
if (IsTreeWidgetItem(aElement) && !IsOpen(aElement))
|
||||||
// contents-generated on a closed node.
|
|
||||||
{
|
|
||||||
PRInt32 nameSpaceID;
|
|
||||||
rv = aElement->GetNameSpaceID(nameSpaceID);
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get namespace ID");
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
if (nameSpaceID == kNameSpaceID_XUL) {
|
|
||||||
if (! IsOpen(aElement))
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See if the element's templates contents have been generated:
|
// See if the element's templates contents have been generated:
|
||||||
// this prevents a re-entrant call from triggering another
|
// this prevents a re-entrant call from triggering another
|
||||||
|
|
|
@ -1416,19 +1416,9 @@ nsXULDocument::AttributeChanged(nsIContent* aElement,
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now notify external observers
|
// Handle "open" and "close" cases. We do this handling before
|
||||||
for (PRInt32 i = 0; i < mObservers.Count(); i++) {
|
// we've notified the observer, so that content is already created
|
||||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
// for the frame system to walk.
|
||||||
observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, aHint);
|
|
||||||
if (observer != (nsIDocumentObserver*)mObservers.ElementAt(i)) {
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle "special" cases. We do this handling _after_ we've
|
|
||||||
// notified the observer to ensure that any frames that are
|
|
||||||
// caching information (e.g., the tree widget and the 'open'
|
|
||||||
// attribute) will notice things properly.
|
|
||||||
if ((nameSpaceID == kNameSpaceID_XUL) && (aAttribute == kOpenAtom)) {
|
if ((nameSpaceID == kNameSpaceID_XUL) && (aAttribute == kOpenAtom)) {
|
||||||
nsAutoString open;
|
nsAutoString open;
|
||||||
rv = aElement->GetAttribute(kNameSpaceID_None, kOpenAtom, open);
|
rv = aElement->GetAttribute(kNameSpaceID_None, kOpenAtom, open);
|
||||||
|
@ -1441,7 +1431,20 @@ nsXULDocument::AttributeChanged(nsIContent* aElement,
|
||||||
CloseWidgetItem(aElement);
|
CloseWidgetItem(aElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aAttribute == kRefAtom) {
|
|
||||||
|
// Now notify external observers
|
||||||
|
for (PRInt32 i = 0; i < mObservers.Count(); i++) {
|
||||||
|
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||||
|
observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, aHint);
|
||||||
|
if (observer != (nsIDocumentObserver*)mObservers.ElementAt(i)) {
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a change to the 'ref' attribute on an atom, in which
|
||||||
|
// case we may need to nuke and rebuild the entire content model
|
||||||
|
// beneath the element.
|
||||||
|
if (aAttribute == kRefAtom) {
|
||||||
RebuildWidgetItem(aElement);
|
RebuildWidgetItem(aElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -771,7 +771,9 @@ RDFGenericBuilderImpl::OpenContainer(nsIContent* aElement)
|
||||||
rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
|
rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (container) {
|
if (container && IsTreeWidgetItem(aElement)) {
|
||||||
|
// The tree widget is special, and has to be spanked every
|
||||||
|
// time we add content to a container.
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||||
if (! doc)
|
if (! doc)
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
@ -2462,22 +2464,11 @@ RDFGenericBuilderImpl::CreateContainerContents(nsIContent* aElement,
|
||||||
*aNewIndexInContainer = -1;
|
*aNewIndexInContainer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's XUL, then see if the item is even "open" (HTML content
|
// The tree widget is special. If the item isn't open, then just
|
||||||
// must be generated eagerly). If not, then just pretend it
|
// "pretend" that there aren't any contents here. We'll create
|
||||||
// doesn't have _any_ contents. We check this _before_ checking
|
// them when OpenContainer() gets called.
|
||||||
// the contents-generated attribute so that we don't eagerly set
|
if (IsTreeWidgetItem(aElement) && !IsOpen(aElement))
|
||||||
// contents-generated on a closed node.
|
|
||||||
{
|
|
||||||
PRInt32 nameSpaceID;
|
|
||||||
rv = aElement->GetNameSpaceID(nameSpaceID);
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get namespace ID");
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
if (nameSpaceID == kNameSpaceID_XUL) {
|
|
||||||
if (! IsOpen(aElement))
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See if the element's templates contents have been generated:
|
// See if the element's templates contents have been generated:
|
||||||
// this prevents a re-entrant call from triggering another
|
// this prevents a re-entrant call from triggering another
|
||||||
|
|
Загрузка…
Ссылка в новой задаче