зеркало из https://github.com/mozilla/pjs.git
bug 4143; bug 2467; removed frame caching in nsFormFrame.
This commit is contained in:
Родитель
d75b978d4d
Коммит
00e49d0539
|
@ -98,6 +98,7 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
|
|||
NS_IF_RELEASE(mVisibleStyleContext);
|
||||
NS_IF_RELEASE(mHiddenStyleContext);
|
||||
NS_IF_RELEASE(mBlockTextStyle);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
@ -276,8 +277,6 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -293,6 +292,7 @@ NS_IMETHODIMP nsComboboxControlFrame::Reflow(nsIPresContext& aPresConte
|
|||
if (mFirstTime) {
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull); // XXX This temporary
|
||||
mListFrame->ReResolveStyleContext(&aPresContext, mCurrentStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
mFirstTime = PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ nsFormControlFrame::nsFormControlFrame()
|
|||
mLastMouseState = eMouseNone;
|
||||
mDidInit = PR_FALSE;
|
||||
mWidget = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
nsFormControlFrame::~nsFormControlFrame()
|
||||
|
@ -210,8 +211,6 @@ nsFormControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -223,6 +222,11 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
|
|||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// add ourself as an nsIFormControlFrame
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
aPresContext.GetDeviceContext(getter_AddRefs(dx));
|
||||
PRBool requiresWidget = PR_TRUE;
|
||||
|
|
|
@ -69,6 +69,11 @@ public:
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus& aEventStatus);
|
||||
|
@ -133,7 +138,8 @@ nsImageControlFrame::nsImageControlFrame()
|
|||
mLastClickPoint = nsPoint(0,0);
|
||||
mPreviousCursor = eCursor_standard;
|
||||
mTranslatedRect = nsRect(0,0,0,0);
|
||||
mGotFocus = PR_FALSE;
|
||||
mGotFocus = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -177,39 +183,47 @@ nsImageControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
if (nsnull == mFormFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// create our view, we need a view to grab the mouse
|
||||
nsIView* view;
|
||||
GetView(&view);
|
||||
if (!view) {
|
||||
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext.GetShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
presShell->GetViewManager(getter_AddRefs(viewMan));
|
||||
|
||||
nsIFrame* parWithView;
|
||||
nsIView *parView;
|
||||
GetParentWithView(&parWithView);
|
||||
parWithView->GetView(&parView);
|
||||
// the view's size is not know yet, but its size will be kept in synch with our frame.
|
||||
nsRect boundBox(0, 0, 500, 500);
|
||||
result = view->Init(viewMan, boundBox, parView, nsnull);
|
||||
viewMan->InsertChild(parView, view, 0);
|
||||
SetView(view);
|
||||
|
||||
const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
// set the opacity
|
||||
viewMan->SetViewOpacity(view, color->mOpacity);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsImageControlFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
|
||||
// create our view, we need a view to grab the mouse
|
||||
nsIView* view;
|
||||
GetView(&view);
|
||||
if (!view) {
|
||||
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext.GetShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
presShell->GetViewManager(getter_AddRefs(viewMan));
|
||||
|
||||
nsIFrame* parWithView;
|
||||
nsIView *parView;
|
||||
GetParentWithView(&parWithView);
|
||||
parWithView->GetView(&parView);
|
||||
// the view's size is not know yet, but its size will be kept in synch with our frame.
|
||||
nsRect boundBox(0, 0, 500, 500);
|
||||
result = view->Init(viewMan, boundBox, parView, nsnull);
|
||||
viewMan->InsertChild(parView, view, 0);
|
||||
SetView(view);
|
||||
|
||||
const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
// set the opacity
|
||||
viewMan->SetViewOpacity(view, color->mOpacity);
|
||||
}
|
||||
}
|
||||
return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsImageControlFrame::HandleEvent(nsIPresContext& aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
|
|
|
@ -106,12 +106,14 @@ nsListControlFrame::nsListControlFrame()
|
|||
mNumSelections = 0;
|
||||
mInDropDownMode = PR_FALSE;
|
||||
mComboboxFrame = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
nsListControlFrame::~nsListControlFrame()
|
||||
{
|
||||
NS_IF_RELEASE(mComboboxFrame);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -826,8 +828,8 @@ NS_IMETHODIMP nsListControlFrame::HandleEvent(nsIPresContext& aPresContext,
|
|||
//----------------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsListControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
mContentFrame = aChildList;
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
|
|||
NS_IF_RELEASE(mVisibleStyleContext);
|
||||
NS_IF_RELEASE(mHiddenStyleContext);
|
||||
NS_IF_RELEASE(mBlockTextStyle);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
@ -276,8 +277,6 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -293,6 +292,7 @@ NS_IMETHODIMP nsComboboxControlFrame::Reflow(nsIPresContext& aPresConte
|
|||
if (mFirstTime) {
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull); // XXX This temporary
|
||||
mListFrame->ReResolveStyleContext(&aPresContext, mCurrentStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
mFirstTime = PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ nsFormControlFrame::nsFormControlFrame()
|
|||
mLastMouseState = eMouseNone;
|
||||
mDidInit = PR_FALSE;
|
||||
mWidget = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
nsFormControlFrame::~nsFormControlFrame()
|
||||
|
@ -210,8 +211,6 @@ nsFormControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -223,6 +222,11 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
|
|||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// add ourself as an nsIFormControlFrame
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
aPresContext.GetDeviceContext(getter_AddRefs(dx));
|
||||
PRBool requiresWidget = PR_TRUE;
|
||||
|
|
|
@ -101,107 +101,6 @@ static NS_DEFINE_IID(kIDOMNSHTMLFormElementIID, NS_IDOMNSHTMLFORMELEMENT_IID);
|
|||
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
|
||||
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
||||
|
||||
// XXX This crud needs to go! The FindFrameWithContent *will* be using
|
||||
// a hashtable so this code will be redundant. In addition,
|
||||
// FindFrameWithContent will be connected to the frame construction
|
||||
// and guaranteed to be kept properly up to date.
|
||||
static nsFormFrameTable* gFormFrameTable;
|
||||
|
||||
nsFormFrame*
|
||||
nsFormFrame::GetFormFrame(nsIPresContext& aPresContext,
|
||||
nsIDOMHTMLFormElement& aFormElem)
|
||||
{
|
||||
if (nsnull == gFormFrameTable) {
|
||||
gFormFrameTable = new nsFormFrameTable();
|
||||
}
|
||||
return gFormFrameTable->Get(aPresContext, aFormElem);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFrame::PutFormFrame(nsIPresContext& aPresContext,
|
||||
nsIDOMHTMLFormElement& aFormElem,
|
||||
nsFormFrame& aFrame)
|
||||
{
|
||||
if (nsnull == gFormFrameTable) {
|
||||
gFormFrameTable = new nsFormFrameTable();
|
||||
}
|
||||
gFormFrameTable->Put(aPresContext, aFormElem, aFrame);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFrame::RemoveFormFrame(nsFormFrame& aFrame)
|
||||
{
|
||||
if (nsnull == gFormFrameTable) {
|
||||
gFormFrameTable = new nsFormFrameTable();
|
||||
}
|
||||
gFormFrameTable->Remove(aFrame);
|
||||
}
|
||||
|
||||
nsFormFrameTableEntry::
|
||||
nsFormFrameTableEntry(nsIPresContext& aPresContext,
|
||||
nsIDOMHTMLFormElement& aFormElement,
|
||||
nsFormFrame& aFormFrame) : mPresContext(&aPresContext),
|
||||
mFormElement(&aFormElement),
|
||||
mFormFrame(&aFormFrame)
|
||||
{
|
||||
}
|
||||
|
||||
nsFormFrameTableEntry::~nsFormFrameTableEntry()
|
||||
{
|
||||
}
|
||||
|
||||
nsFormFrameTable::~nsFormFrameTable()
|
||||
{
|
||||
PRInt32 count = mEntries.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
delete mEntries.ElementAt(i);
|
||||
}
|
||||
mEntries.Clear();
|
||||
}
|
||||
|
||||
nsFormFrame*
|
||||
nsFormFrameTable::Get(nsIPresContext& aPresContext, nsIDOMHTMLFormElement& aFormElem)
|
||||
{
|
||||
PRInt32 count = mEntries.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsFormFrameTableEntry* entry = (nsFormFrameTableEntry *)mEntries.ElementAt(i);
|
||||
if ((entry->mPresContext == &aPresContext) && (entry->mFormElement == &aFormElem)) {
|
||||
return entry->mFormFrame;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFrameTable::Put(nsIPresContext& aPresContext, nsIDOMHTMLFormElement& aFormElem,
|
||||
nsFormFrame& aFormFrame)
|
||||
{
|
||||
NS_ADDREF(&aFormElem);
|
||||
mEntries.AppendElement(new nsFormFrameTableEntry(aPresContext, aFormElem, aFormFrame));
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFrameTable::Remove(nsFormFrame& aFormFrame)
|
||||
{
|
||||
PRInt32 hits[10];
|
||||
PRInt32 hitIndex = 0;
|
||||
PRInt32 count = mEntries.Count();
|
||||
PRInt32 i;
|
||||
for (i = 0; i < count; i++) {
|
||||
nsFormFrameTableEntry* entry = (nsFormFrameTableEntry *)mEntries.ElementAt(i);
|
||||
if (entry->mFormFrame == &aFormFrame) {
|
||||
hits[hitIndex] = i;
|
||||
hitIndex++;
|
||||
NS_IF_RELEASE(entry->mFormElement);
|
||||
}
|
||||
}
|
||||
for (i = hitIndex-1; i >= 0; i--) {
|
||||
delete mEntries.ElementAt(i);
|
||||
mEntries.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
|
@ -232,9 +131,6 @@ nsFormFrame::nsFormFrame()
|
|||
|
||||
nsFormFrame::~nsFormFrame()
|
||||
{
|
||||
mFormControls.Clear();
|
||||
RemoveFormFrame(*this);
|
||||
RemoveRadioGroups();
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -342,23 +238,6 @@ nsFormFrame::GetEnctype(PRInt32* aEnctype)
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMHTMLFormElement* content = nsnull;
|
||||
if (mContent) {
|
||||
nsresult result = mContent->QueryInterface(kIDOMHTMLFormElementIID, (void**)&content);
|
||||
if ((NS_OK == result) && (nsnull != content)) {
|
||||
nsFormFrame::PutFormFrame(aPresContext, *content, *this);
|
||||
NS_RELEASE(content);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -399,25 +278,32 @@ void nsFormFrame::AddFormControlFrame(nsIPresContext& aPresContext, nsIFrame& aF
|
|||
return;
|
||||
}
|
||||
|
||||
nsIContent* iContent = nsnull;
|
||||
aFrame.GetContent(&iContent);
|
||||
if (nsnull != iContent) {
|
||||
nsIFormControl* formControl = nsnull;
|
||||
result = iContent->QueryInterface(kIFormControlIID, (void**)&formControl);
|
||||
if ((NS_OK == result) && (nsnull != formControl)) {
|
||||
nsIDOMHTMLFormElement* formElem = nsnull;
|
||||
result = formControl->GetForm(&formElem);
|
||||
if (nsnull != formElem) {
|
||||
nsFormFrame* formFrame = nsFormFrame::GetFormFrame(aPresContext, *formElem);
|
||||
if (nsnull != formFrame) {
|
||||
formFrame->AddFormControlFrame(*fcFrame);
|
||||
fcFrame->SetFormFrame(formFrame);
|
||||
nsCOMPtr<nsIContent> iContent;
|
||||
result = aFrame.GetContent(getter_AddRefs(iContent));
|
||||
if (NS_SUCCEEDED(result) && iContent) {
|
||||
nsCOMPtr<nsIFormControl> formControl;
|
||||
result = iContent->QueryInterface(kIFormControlIID, getter_AddRefs(formControl));
|
||||
if (NS_SUCCEEDED(result) && formControl) {
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElem;
|
||||
result = formControl->GetForm(getter_AddRefs(formElem));
|
||||
if (NS_SUCCEEDED(result) && formElem) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
result = aPresContext.GetShell(getter_AddRefs(presShell));
|
||||
if (NS_SUCCEEDED(result) && presShell) {
|
||||
nsIContent* formContent;
|
||||
result = formElem->QueryInterface(kIContentIID, (void**)&formContent);
|
||||
if (NS_SUCCEEDED(result) && formContent) {
|
||||
nsFormFrame* formFrame = nsnull;
|
||||
result = presShell->GetPrimaryFrameFor(formContent, (nsIFrame**)&formFrame);
|
||||
if (NS_SUCCEEDED(result) && formFrame) {
|
||||
formFrame->AddFormControlFrame(*fcFrame);
|
||||
fcFrame->SetFormFrame(formFrame);
|
||||
}
|
||||
NS_RELEASE(formContent);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(formElem);
|
||||
}
|
||||
NS_RELEASE(formControl);
|
||||
}
|
||||
NS_RELEASE(iContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,39 +35,12 @@ class nsIDocument;
|
|||
class nsIPresContext;
|
||||
class nsFormFrame;
|
||||
|
||||
// XXX these structs and gFormFrameTable below provide a faster way to get from a form content to
|
||||
// the appropriate frame. Before replacing this mechanism with FindFrameWithContent, please test
|
||||
// a page with thousands of frames and hundreds of form controls.
|
||||
struct nsFormFrameTableEntry
|
||||
{
|
||||
nsIPresContext* mPresContext;
|
||||
nsIDOMHTMLFormElement* mFormElement;
|
||||
nsFormFrame* mFormFrame;
|
||||
nsFormFrameTableEntry(nsIPresContext& aPresContext,
|
||||
nsIDOMHTMLFormElement& aFormElement,
|
||||
nsFormFrame& aFormFrame);
|
||||
~nsFormFrameTableEntry();
|
||||
};
|
||||
struct nsFormFrameTable
|
||||
{
|
||||
nsVoidArray mEntries;
|
||||
nsFormFrameTable() {}
|
||||
~nsFormFrameTable();
|
||||
void Put(nsIPresContext& aPresContext, nsIDOMHTMLFormElement& aFormElem, nsFormFrame& aFormFrame);
|
||||
nsFormFrame* Get(nsIPresContext& aPresContext, nsIDOMHTMLFormElement& aFormElem);
|
||||
void Remove(nsFormFrame& aFormFrame);
|
||||
};
|
||||
|
||||
class nsFormFrame : public nsLeafFrame,
|
||||
public nsIFormManager
|
||||
{
|
||||
public:
|
||||
nsFormFrame();
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
@ -96,15 +69,6 @@ public:
|
|||
NS_IMETHOD GetTarget(nsString* aTarget);
|
||||
NS_IMETHOD GetAction(nsString* aAction);
|
||||
|
||||
static nsFormFrame* GetFormFrame(nsIPresContext& aPresContext,
|
||||
nsIDOMHTMLFormElement& aFormElem);
|
||||
|
||||
static void PutFormFrame(nsIPresContext& aPresContext,
|
||||
nsIDOMHTMLFormElement& aFormElem,
|
||||
nsFormFrame& aFrame);
|
||||
|
||||
static void RemoveFormFrame(nsFormFrame& aFrame);
|
||||
|
||||
// static helper functions for nsIFormControls
|
||||
|
||||
static PRBool GetDisabled(nsIFrame* aChildFrame, nsIContent* aContent = 0);
|
||||
|
|
|
@ -69,6 +69,11 @@ public:
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus& aEventStatus);
|
||||
|
@ -133,7 +138,8 @@ nsImageControlFrame::nsImageControlFrame()
|
|||
mLastClickPoint = nsPoint(0,0);
|
||||
mPreviousCursor = eCursor_standard;
|
||||
mTranslatedRect = nsRect(0,0,0,0);
|
||||
mGotFocus = PR_FALSE;
|
||||
mGotFocus = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -177,39 +183,47 @@ nsImageControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
if (nsnull == mFormFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// create our view, we need a view to grab the mouse
|
||||
nsIView* view;
|
||||
GetView(&view);
|
||||
if (!view) {
|
||||
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext.GetShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
presShell->GetViewManager(getter_AddRefs(viewMan));
|
||||
|
||||
nsIFrame* parWithView;
|
||||
nsIView *parView;
|
||||
GetParentWithView(&parWithView);
|
||||
parWithView->GetView(&parView);
|
||||
// the view's size is not know yet, but its size will be kept in synch with our frame.
|
||||
nsRect boundBox(0, 0, 500, 500);
|
||||
result = view->Init(viewMan, boundBox, parView, nsnull);
|
||||
viewMan->InsertChild(parView, view, 0);
|
||||
SetView(view);
|
||||
|
||||
const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
// set the opacity
|
||||
viewMan->SetViewOpacity(view, color->mOpacity);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsImageControlFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
||||
|
||||
// create our view, we need a view to grab the mouse
|
||||
nsIView* view;
|
||||
GetView(&view);
|
||||
if (!view) {
|
||||
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext.GetShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
presShell->GetViewManager(getter_AddRefs(viewMan));
|
||||
|
||||
nsIFrame* parWithView;
|
||||
nsIView *parView;
|
||||
GetParentWithView(&parWithView);
|
||||
parWithView->GetView(&parView);
|
||||
// the view's size is not know yet, but its size will be kept in synch with our frame.
|
||||
nsRect boundBox(0, 0, 500, 500);
|
||||
result = view->Init(viewMan, boundBox, parView, nsnull);
|
||||
viewMan->InsertChild(parView, view, 0);
|
||||
SetView(view);
|
||||
|
||||
const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
// set the opacity
|
||||
viewMan->SetViewOpacity(view, color->mOpacity);
|
||||
}
|
||||
}
|
||||
return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsImageControlFrame::HandleEvent(nsIPresContext& aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
|
|
|
@ -106,12 +106,14 @@ nsListControlFrame::nsListControlFrame()
|
|||
mNumSelections = 0;
|
||||
mInDropDownMode = PR_FALSE;
|
||||
mComboboxFrame = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
nsListControlFrame::~nsListControlFrame()
|
||||
{
|
||||
NS_IF_RELEASE(mComboboxFrame);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -826,8 +828,8 @@ NS_IMETHODIMP nsListControlFrame::HandleEvent(nsIPresContext& aPresContext,
|
|||
//----------------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsListControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
mContentFrame = aChildList;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче