diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 852d9a33b98..c7492c311bd 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -8784,7 +8784,7 @@ PRBool NotifyListBoxBody(nsPresContext* aPresContext, xulElement->GetBoxObject(getter_AddRefs(boxObject)); nsCOMPtr listBoxObject = do_QueryInterface(boxObject); if (listBoxObject) { - nsIListBoxObject* listboxBody = listBoxObject->GetListBoxBody(); + nsIListBoxObject* listboxBody = listBoxObject->GetListBoxBody(PR_FALSE); if (listboxBody) { nsListBoxBodyFrame *listBoxBodyFrame = static_cast(listboxBody); if (aOperation == CONTENT_REMOVED) { diff --git a/layout/xul/base/src/nsListBoxObject.cpp b/layout/xul/base/src/nsListBoxObject.cpp index eacf8914e4a..4ed04d75cff 100644 --- a/layout/xul/base/src/nsListBoxObject.cpp +++ b/layout/xul/base/src/nsListBoxObject.cpp @@ -55,7 +55,7 @@ public: NS_DECL_NSILISTBOXOBJECT // nsPIListBoxObject - virtual nsIListBoxObject* GetListBoxBody(); + virtual nsIListBoxObject* GetListBoxBody(PRBool aFlush); nsListBoxObject(); @@ -88,7 +88,7 @@ nsListBoxObject::GetListboxBody(nsIListBoxObject * *aListboxBody) NS_IMETHODIMP nsListBoxObject::GetRowCount(PRInt32 *aResult) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->GetRowCount(aResult); return NS_OK; @@ -97,7 +97,7 @@ nsListBoxObject::GetRowCount(PRInt32 *aResult) NS_IMETHODIMP nsListBoxObject::GetNumberOfVisibleRows(PRInt32 *aResult) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->GetNumberOfVisibleRows(aResult); return NS_OK; @@ -106,7 +106,7 @@ nsListBoxObject::GetNumberOfVisibleRows(PRInt32 *aResult) NS_IMETHODIMP nsListBoxObject::GetIndexOfFirstVisibleRow(PRInt32 *aResult) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->GetIndexOfFirstVisibleRow(aResult); return NS_OK; @@ -114,7 +114,7 @@ nsListBoxObject::GetIndexOfFirstVisibleRow(PRInt32 *aResult) NS_IMETHODIMP nsListBoxObject::EnsureIndexIsVisible(PRInt32 aRowIndex) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->EnsureIndexIsVisible(aRowIndex); return NS_OK; @@ -123,7 +123,7 @@ NS_IMETHODIMP nsListBoxObject::EnsureIndexIsVisible(PRInt32 aRowIndex) NS_IMETHODIMP nsListBoxObject::ScrollToIndex(PRInt32 aRowIndex) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->ScrollToIndex(aRowIndex); return NS_OK; @@ -132,7 +132,7 @@ nsListBoxObject::ScrollToIndex(PRInt32 aRowIndex) NS_IMETHODIMP nsListBoxObject::ScrollByLines(PRInt32 aNumLines) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->ScrollByLines(aNumLines); return NS_OK; @@ -141,7 +141,7 @@ nsListBoxObject::ScrollByLines(PRInt32 aNumLines) NS_IMETHODIMP nsListBoxObject::GetItemAtIndex(PRInt32 index, nsIDOMElement **_retval) { - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->GetItemAtIndex(index, _retval); return NS_OK; @@ -152,7 +152,7 @@ nsListBoxObject::GetIndexOfItem(nsIDOMElement* aElement, PRInt32 *aResult) { *aResult = 0; - nsIListBoxObject* body = GetListBoxBody(); + nsIListBoxObject* body = GetListBoxBody(PR_TRUE); if (body) return body->GetIndexOfItem(aElement, aResult); return NS_OK; @@ -187,21 +187,23 @@ FindBodyContent(nsIContent* aParent, nsIContent** aResult) } nsIListBoxObject* -nsListBoxObject::GetListBoxBody() +nsListBoxObject::GetListBoxBody(PRBool aFlush) { if (mListBoxBody) { return mListBoxBody; } - nsIFrame* frame = GetFrame(PR_FALSE); - if (!frame) - return nsnull; - nsIPresShell* shell = GetPresShell(PR_FALSE); if (!shell) { return nsnull; } + nsIFrame* frame = aFlush ? + GetFrame(PR_FALSE) /* does Flush_Frames */ : + shell->GetPrimaryFrameFor(mContent); + if (!frame) + return nsnull; + // Iterate over our content model children looking for the body. nsCOMPtr content; FindBodyContent(frame->GetContent(), getter_AddRefs(content)); diff --git a/layout/xul/base/src/nsPIListBoxObject.h b/layout/xul/base/src/nsPIListBoxObject.h index b1b8a4ad238..a194aadec48 100644 --- a/layout/xul/base/src/nsPIListBoxObject.h +++ b/layout/xul/base/src/nsPIListBoxObject.h @@ -38,9 +38,10 @@ #ifndef nsPIListBoxObject_h__ #define nsPIListBoxObject_h__ +// fa9549f7-ee09-48fc-89f7-30cceee21c15 #define NS_PILISTBOXOBJECT_IID \ -{ 0x965f3d0b, 0x2960, 0x40f5, \ - { 0xaa, 0xab, 0x32, 0xd2, 0xae, 0x09, 0x90, 0x94 } } +{ 0xfa9549f7, 0xee09, 0x48fc, \ + { 0x89, 0xf7, 0x30, 0xcc, 0xee, 0xe2, 0x1c, 0x15 } } #include "nsIListBoxObject.h" @@ -49,8 +50,9 @@ class nsPIListBoxObject : public nsIListBoxObject { NS_DECLARE_STATIC_IID_ACCESSOR(NS_PILISTBOXOBJECT_IID) /** * Get the list box body. This will search for it as needed. + * If aFlush is PR_FALSE we don't Flush_Frames though. */ - virtual nsIListBoxObject* GetListBoxBody() = 0; + virtual nsIListBoxObject* GetListBoxBody(PRBool aFlush) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsPIListBoxObject, NS_PILISTBOXOBJECT_IID)