mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 03:49:42 +00:00
Bug 13058: Make global enum a public member.
This commit is contained in:
parent
dabdaaa2e9
commit
73c3c9952a
@ -644,7 +644,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
|
||||
PRUint32 ID;
|
||||
rv = content->GetContentID(&ID);
|
||||
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
|
||||
StateType type = eNoType;
|
||||
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
|
||||
rv = statefulFrame->GetStateType(&type);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsISupports* frameState;
|
||||
@ -696,7 +696,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
|
||||
PRUint32 ID;
|
||||
rv = content->GetContentID(&ID);
|
||||
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
|
||||
StateType type = eNoType;
|
||||
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
|
||||
rv = statefulFrame->GetStateType(&type);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsISupports* frameState = nsnull;
|
||||
|
@ -14,8 +14,8 @@ class nsILayoutHistoryState : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
|
||||
|
||||
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, StateType aStateType) = 0;
|
||||
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, StateType aStateType) = 0;
|
||||
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
|
@ -25,8 +25,8 @@ class HistoryKey: public nsHashKey {
|
||||
PRUint32 itsHash;
|
||||
|
||||
public:
|
||||
HistoryKey(PRUint32 aContentID, StateType aStateType) {
|
||||
itsHash = aContentID*eNumStateTypes + aStateType;
|
||||
HistoryKey(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) {
|
||||
itsHash = aContentID * nsIStatefulFrame::eNumStateTypes + aStateType;
|
||||
}
|
||||
|
||||
HistoryKey(PRUint32 aKey) {
|
||||
@ -57,10 +57,10 @@ public:
|
||||
// nsILayoutHistoryState
|
||||
NS_IMETHOD AddState(PRUint32 aContentID,
|
||||
nsISupports* aState,
|
||||
StateType aStateType = eNoType);
|
||||
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
|
||||
NS_IMETHOD GetState(PRUint32 aContentID,
|
||||
nsISupports** aState,
|
||||
StateType aStateType = eNoType);
|
||||
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
|
||||
|
||||
private:
|
||||
nsSupportsHashtable mStates;
|
||||
@ -99,8 +99,9 @@ NS_IMPL_ISUPPORTS(nsLayoutHistoryState,
|
||||
NS_IMETHODIMP
|
||||
nsLayoutHistoryState::AddState(PRUint32 aContentID,
|
||||
nsISupports* aState,
|
||||
StateType aStateType)
|
||||
nsIStatefulFrame::StateType aStateType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
HistoryKey key(aContentID, aStateType);
|
||||
void * res = mStates.Put(&key, (void *) aState);
|
||||
/* nsHashTable seems to return null when it actually added
|
||||
@ -109,25 +110,24 @@ nsLayoutHistoryState::AddState(PRUint32 aContentID,
|
||||
* element that was already present. Not sure if that was
|
||||
* the intended behavior
|
||||
*/
|
||||
if (!res)
|
||||
printf("nsLayoutHistoryState::AddState State successfully added to the hash table\n");
|
||||
else
|
||||
if (res) {
|
||||
printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n");
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLayoutHistoryState::GetState(PRUint32 aContentID,
|
||||
nsISupports** aState,
|
||||
StateType aStateType)
|
||||
nsIStatefulFrame::StateType aStateType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
HistoryKey key(aContentID, aStateType);
|
||||
void * state = nsnull;
|
||||
state = mStates.Get(&key);
|
||||
if (state) {
|
||||
printf("nsLayoutHistoryState::GetState, Got the History state for the key\n");
|
||||
*aState = (nsISupports *)state;
|
||||
}
|
||||
else {
|
||||
|
@ -14,8 +14,8 @@ class nsILayoutHistoryState : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
|
||||
|
||||
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, StateType aStateType) = 0;
|
||||
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, StateType aStateType) = 0;
|
||||
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
|
@ -9,16 +9,16 @@
|
||||
{0x306c8ca0, 0x5f0c, 0x11d3, \
|
||||
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsIStatefulFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
|
||||
|
||||
// If you implement nsIStatefulFrame, add an entry to this enum and use it
|
||||
// in your GetStateType method to prevent collisions.
|
||||
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
|
||||
eTextType, eNumStateTypes};
|
||||
|
||||
class nsIStatefulFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
|
||||
|
||||
NS_IMETHOD GetStateType(StateType* aStateType) = 0;
|
||||
NS_IMETHOD GetStateType(nsIStatefulFrame::StateType* aStateType) = 0;
|
||||
NS_IMETHOD SaveState(nsISupports** aState) = 0;
|
||||
NS_IMETHOD RestoreState(nsISupports* aState) = 0;
|
||||
|
||||
|
@ -25,8 +25,8 @@ class HistoryKey: public nsHashKey {
|
||||
PRUint32 itsHash;
|
||||
|
||||
public:
|
||||
HistoryKey(PRUint32 aContentID, StateType aStateType) {
|
||||
itsHash = aContentID*eNumStateTypes + aStateType;
|
||||
HistoryKey(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) {
|
||||
itsHash = aContentID * nsIStatefulFrame::eNumStateTypes + aStateType;
|
||||
}
|
||||
|
||||
HistoryKey(PRUint32 aKey) {
|
||||
@ -57,10 +57,10 @@ public:
|
||||
// nsILayoutHistoryState
|
||||
NS_IMETHOD AddState(PRUint32 aContentID,
|
||||
nsISupports* aState,
|
||||
StateType aStateType = eNoType);
|
||||
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
|
||||
NS_IMETHOD GetState(PRUint32 aContentID,
|
||||
nsISupports** aState,
|
||||
StateType aStateType = eNoType);
|
||||
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
|
||||
|
||||
private:
|
||||
nsSupportsHashtable mStates;
|
||||
@ -99,8 +99,9 @@ NS_IMPL_ISUPPORTS(nsLayoutHistoryState,
|
||||
NS_IMETHODIMP
|
||||
nsLayoutHistoryState::AddState(PRUint32 aContentID,
|
||||
nsISupports* aState,
|
||||
StateType aStateType)
|
||||
nsIStatefulFrame::StateType aStateType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
HistoryKey key(aContentID, aStateType);
|
||||
void * res = mStates.Put(&key, (void *) aState);
|
||||
/* nsHashTable seems to return null when it actually added
|
||||
@ -109,25 +110,24 @@ nsLayoutHistoryState::AddState(PRUint32 aContentID,
|
||||
* element that was already present. Not sure if that was
|
||||
* the intended behavior
|
||||
*/
|
||||
if (!res)
|
||||
printf("nsLayoutHistoryState::AddState State successfully added to the hash table\n");
|
||||
else
|
||||
if (res) {
|
||||
printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n");
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLayoutHistoryState::GetState(PRUint32 aContentID,
|
||||
nsISupports** aState,
|
||||
StateType aStateType)
|
||||
nsIStatefulFrame::StateType aStateType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
HistoryKey key(aContentID, aStateType);
|
||||
void * state = nsnull;
|
||||
state = mStates.Get(&key);
|
||||
if (state) {
|
||||
printf("nsLayoutHistoryState::GetState, Got the History state for the key\n");
|
||||
*aState = (nsISupports *)state;
|
||||
}
|
||||
else {
|
||||
|
@ -9,16 +9,16 @@
|
||||
{0x306c8ca0, 0x5f0c, 0x11d3, \
|
||||
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsIStatefulFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
|
||||
|
||||
// If you implement nsIStatefulFrame, add an entry to this enum and use it
|
||||
// in your GetStateType method to prevent collisions.
|
||||
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
|
||||
eTextType, eNumStateTypes};
|
||||
|
||||
class nsIStatefulFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
|
||||
|
||||
NS_IMETHOD GetStateType(StateType* aStateType) = 0;
|
||||
NS_IMETHOD GetStateType(nsIStatefulFrame::StateType* aStateType) = 0;
|
||||
NS_IMETHOD SaveState(nsISupports** aState) = 0;
|
||||
NS_IMETHOD RestoreState(nsISupports* aState) = 0;
|
||||
|
||||
|
@ -644,7 +644,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
|
||||
PRUint32 ID;
|
||||
rv = content->GetContentID(&ID);
|
||||
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
|
||||
StateType type = eNoType;
|
||||
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
|
||||
rv = statefulFrame->GetStateType(&type);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsISupports* frameState;
|
||||
@ -696,7 +696,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
|
||||
PRUint32 ID;
|
||||
rv = content->GetContentID(&ID);
|
||||
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
|
||||
StateType type = eNoType;
|
||||
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
|
||||
rv = statefulFrame->GetStateType(&type);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsISupports* frameState = nsnull;
|
||||
|
Loading…
x
Reference in New Issue
Block a user