From e56febfa3e96d05d83158f789410f98f7a4e63fd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 2 Aug 2013 09:09:02 +0200 Subject: [PATCH] Bug 899931 - Part i: Inline nsListControlFrame::GetSizeAttribute; r=dzbarsky --- layout/forms/nsListControlFrame.cpp | 23 +++++++---------------- layout/forms/nsListControlFrame.h | 3 --- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 1d5e420d0399..73890fbbe133 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -931,20 +931,6 @@ nsListControlFrame::SetInitialChildList(ChildListID aListID, return rv; } -//--------------------------------------------------------- -nsresult -nsListControlFrame::GetSizeAttribute(uint32_t *aSize) { - nsresult rv = NS_OK; - nsIDOMHTMLSelectElement* selectElement; - rv = mContent->QueryInterface(NS_GET_IID(nsIDOMHTMLSelectElement),(void**) &selectElement); - if (mContent && NS_SUCCEEDED(rv)) { - rv = selectElement->GetSize(aSize); - NS_RELEASE(selectElement); - } - return rv; -} - - //--------------------------------------------------------- void nsListControlFrame::Init(nsIContent* aContent, @@ -1543,8 +1529,13 @@ nsListControlFrame::CalcIntrinsicHeight(nscoord aHeightOfARow, NS_PRECONDITION(!IsInDropDownMode(), "Shouldn't be in dropdown mode when we call this"); - mNumDisplayRows = 1; - GetSizeAttribute(&mNumDisplayRows); + dom::HTMLSelectElement* select = + dom::HTMLSelectElement::FromContentOrNull(mContent); + if (select) { + mNumDisplayRows = select->Size(); + } else { + mNumDisplayRows = 1; + } if (mNumDisplayRows < 1) { mNumDisplayRows = 4; diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index 2f86d6fd92ca..10536a1b2ff7 100644 --- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -305,9 +305,6 @@ protected: nsListControlFrame(nsIPresShell* aShell, nsIDocument* aDocument, nsStyleContext* aContext); virtual ~nsListControlFrame(); - // Utility methods - nsresult GetSizeAttribute(uint32_t *aSize); - /** * Sets the mSelectedIndex and mOldSelectedIndex from figuring out what * item was selected using content