From a366580fadcfc6a35e4a4c443acd0f4509f690d5 Mon Sep 17 00:00:00 2001 From: "allan%beaufour.dk" Date: Wed, 8 Mar 2006 10:14:50 +0000 Subject: [PATCH] [XForms] Fix excess refresh during widget loading. Bug 326766, r=smaug+me, patch by surkov@dc.baikal.ru --- extensions/xforms/nsXFormsDelegateStub.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/extensions/xforms/nsXFormsDelegateStub.cpp b/extensions/xforms/nsXFormsDelegateStub.cpp index bee04c1eb5f6..d248a7294b18 100644 --- a/extensions/xforms/nsXFormsDelegateStub.cpp +++ b/extensions/xforms/nsXFormsDelegateStub.cpp @@ -190,9 +190,20 @@ nsXFormsDelegateStub::ReportError(const nsAString& aErrorMsg) NS_IMETHODIMP nsXFormsDelegateStub::WidgetAttached() { - if (UpdateRepeatState() != eType_Template) - nsXFormsModelElement::NeedsPostRefresh(this); + if (UpdateRepeatState() == eType_Template) + return NS_OK; + if (mBindAttrsCount) { + // If control is bounded to instance data then we should ask for refresh + // only when model is loaded entirely. The reason is control is refreshed + // by model when it get loaded. + nsCOMPtr domDoc; + mElement->GetOwnerDocument(getter_AddRefs(domDoc)); + if (!nsXFormsUtils::IsDocumentReadyForBind(domDoc)) + return NS_OK; + } + + nsXFormsModelElement::NeedsPostRefresh(this); return NS_OK; }