зеркало из https://github.com/mozilla/pjs.git
added the caching of the restore state until the list frame gets reset
removed the positioning of the dropdown at the bottom of reflow r kmcclusk b=21945,25059
This commit is contained in:
Родитель
02a596c71f
Коммит
76d491d5dc
|
@ -240,6 +240,17 @@ nsComboboxControlFrame::InitTextStr(nsIPresContext* aPresContext, PRBool aUpdate
|
|||
void
|
||||
nsComboboxControlFrame::Reset(nsIPresContext* aPresContext)
|
||||
{
|
||||
if (mPresState) {
|
||||
nsIStatefulFrame* sFrame = nsnull;
|
||||
nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame),
|
||||
(void**)&sFrame);
|
||||
if (NS_SUCCEEDED(res) && sFrame) {
|
||||
res = sFrame->RestoreState(mPresContext, mPresState);
|
||||
NS_RELEASE(sFrame);
|
||||
}
|
||||
mPresState = do_QueryInterface(nsnull);
|
||||
}
|
||||
|
||||
// Reset the dropdown list to its original state
|
||||
nsIFormControlFrame* fcFrame = nsnull;
|
||||
nsIFrame* dropdownFrame = GetDropdownFrame();
|
||||
|
@ -881,11 +892,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
||||
}
|
||||
|
||||
nsRect absoluteTwips;
|
||||
nsRect absolutePixels;
|
||||
GetAbsoluteFramePosition(aPresContext, this, absoluteTwips, absolutePixels);
|
||||
//PositionDropdown(aPresContext, aDesiredSize.height, absoluteTwips, absolutePixels);
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
#if 0
|
||||
COMPARE_QUIRK_SIZE("nsComboboxControlFrame", 127, 22)
|
||||
|
@ -1307,6 +1313,7 @@ nsComboboxControlFrame::SetDropDown(nsIFrame* aDropDownFrame)
|
|||
mDropdownFrame = aDropDownFrame;
|
||||
|
||||
if (NS_OK != mDropdownFrame->QueryInterface(kIListControlFrameIID, (void**)&mListControlFrame)) {
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1735,7 +1742,10 @@ nsComboboxControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** a
|
|||
NS_IMETHODIMP
|
||||
nsComboboxControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
|
||||
{
|
||||
if (!mListControlFrame) return NS_ERROR_UNEXPECTED;
|
||||
if (!mListControlFrame) {
|
||||
mPresState = aState;
|
||||
return NS_OK;
|
||||
}
|
||||
nsIStatefulFrame* sFrame = nsnull;
|
||||
nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame),
|
||||
(void**)&sFrame);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "nsISelectControlFrame.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
#include "nsIRollupListener.h"
|
||||
#include "nsIPresState.h"
|
||||
|
||||
class nsButtonControlFrame;
|
||||
class nsTextControlFrame;
|
||||
|
@ -41,7 +42,6 @@ class nsIView;
|
|||
class nsStyleContext;
|
||||
class nsIHTMLContent;
|
||||
class nsIListControlFrame;
|
||||
class nsIPresState;
|
||||
|
||||
/**
|
||||
* Child list name indices
|
||||
|
@ -215,6 +215,9 @@ protected:
|
|||
nsIListControlFrame * mListControlFrame; // ListControl Interface for the dropdown frame
|
||||
PRBool mIgnoreFocus; // Tells the combo to ignore all focus notifications
|
||||
|
||||
|
||||
nsCOMPtr<nsIPresState> mPresState; // Need cache state when list is null
|
||||
|
||||
// Resize Reflow Optimization
|
||||
nsSize mCacheSize;
|
||||
nsSize mCachedMaxElementSize;
|
||||
|
|
|
@ -240,6 +240,17 @@ nsComboboxControlFrame::InitTextStr(nsIPresContext* aPresContext, PRBool aUpdate
|
|||
void
|
||||
nsComboboxControlFrame::Reset(nsIPresContext* aPresContext)
|
||||
{
|
||||
if (mPresState) {
|
||||
nsIStatefulFrame* sFrame = nsnull;
|
||||
nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame),
|
||||
(void**)&sFrame);
|
||||
if (NS_SUCCEEDED(res) && sFrame) {
|
||||
res = sFrame->RestoreState(mPresContext, mPresState);
|
||||
NS_RELEASE(sFrame);
|
||||
}
|
||||
mPresState = do_QueryInterface(nsnull);
|
||||
}
|
||||
|
||||
// Reset the dropdown list to its original state
|
||||
nsIFormControlFrame* fcFrame = nsnull;
|
||||
nsIFrame* dropdownFrame = GetDropdownFrame();
|
||||
|
@ -881,11 +892,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
||||
}
|
||||
|
||||
nsRect absoluteTwips;
|
||||
nsRect absolutePixels;
|
||||
GetAbsoluteFramePosition(aPresContext, this, absoluteTwips, absolutePixels);
|
||||
//PositionDropdown(aPresContext, aDesiredSize.height, absoluteTwips, absolutePixels);
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
#if 0
|
||||
COMPARE_QUIRK_SIZE("nsComboboxControlFrame", 127, 22)
|
||||
|
@ -1307,6 +1313,7 @@ nsComboboxControlFrame::SetDropDown(nsIFrame* aDropDownFrame)
|
|||
mDropdownFrame = aDropDownFrame;
|
||||
|
||||
if (NS_OK != mDropdownFrame->QueryInterface(kIListControlFrameIID, (void**)&mListControlFrame)) {
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1735,7 +1742,10 @@ nsComboboxControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** a
|
|||
NS_IMETHODIMP
|
||||
nsComboboxControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
|
||||
{
|
||||
if (!mListControlFrame) return NS_ERROR_UNEXPECTED;
|
||||
if (!mListControlFrame) {
|
||||
mPresState = aState;
|
||||
return NS_OK;
|
||||
}
|
||||
nsIStatefulFrame* sFrame = nsnull;
|
||||
nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame),
|
||||
(void**)&sFrame);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "nsISelectControlFrame.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
#include "nsIRollupListener.h"
|
||||
#include "nsIPresState.h"
|
||||
|
||||
class nsButtonControlFrame;
|
||||
class nsTextControlFrame;
|
||||
|
@ -41,7 +42,6 @@ class nsIView;
|
|||
class nsStyleContext;
|
||||
class nsIHTMLContent;
|
||||
class nsIListControlFrame;
|
||||
class nsIPresState;
|
||||
|
||||
/**
|
||||
* Child list name indices
|
||||
|
@ -215,6 +215,9 @@ protected:
|
|||
nsIListControlFrame * mListControlFrame; // ListControl Interface for the dropdown frame
|
||||
PRBool mIgnoreFocus; // Tells the combo to ignore all focus notifications
|
||||
|
||||
|
||||
nsCOMPtr<nsIPresState> mPresState; // Need cache state when list is null
|
||||
|
||||
// Resize Reflow Optimization
|
||||
nsSize mCacheSize;
|
||||
nsSize mCachedMaxElementSize;
|
||||
|
|
Загрузка…
Ссылка в новой задаче