Bug 64176 - tabbing in proxies pref panel messed up. r=saari, sr=hyatt.

This commit is contained in:
bryner%netscape.com 2001-08-14 00:46:32 +00:00
Родитель e75294835e
Коммит 721790a6b4
5 изменённых файлов: 119 добавлений и 27 удалений

Просмотреть файл

@ -2861,7 +2861,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent, nsIFrame*
if (NS_FAILED(result)) if (NS_FAILED(result))
return result; return result;
result = trav->NewFrameTraversal(getter_AddRefs(frameTraversal), EXTENSIVE, result = trav->NewFrameTraversal(getter_AddRefs(frameTraversal), EXTENSIVE_PREORDER,
mPresContext, aFrame); mPresContext, aFrame);
if (NS_FAILED(result)) if (NS_FAILED(result))
return NS_OK; return NS_OK;

Просмотреть файл

@ -84,6 +84,9 @@ public:
nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start); nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start);
void SetExtensive(PRBool aExtensive) {mExtensive = aExtensive;} void SetExtensive(PRBool aExtensive) {mExtensive = aExtensive;}
PRBool GetExtensive(){return mExtensive;} PRBool GetExtensive(){return mExtensive;}
void SetPreOrder(PRBool aPreOrder) { mPreOrder = aPreOrder; }
PRBool GetPreOrder() { return mPreOrder; }
private : private :
NS_IMETHOD Next(); NS_IMETHOD Next();
@ -91,7 +94,8 @@ private :
NS_IMETHOD Prev(); NS_IMETHOD Prev();
nsIPresContext* mPresContext; nsIPresContext* mPresContext;
PRBool mExtensive; PRPackedBool mExtensive;
PRPackedBool mPreOrder;
}; };
#ifdef IBMBIDI // Simon #ifdef IBMBIDI // Simon
@ -144,6 +148,7 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav); *aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
NS_ADDREF(trav); NS_ADDREF(trav);
trav->SetExtensive(PR_FALSE); trav->SetExtensive(PR_FALSE);
trav->SetPreOrder(PR_FALSE);
} }
break; break;
case EXTENSIVE:{ case EXTENSIVE:{
@ -153,6 +158,17 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav); *aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
NS_ADDREF(trav); NS_ADDREF(trav);
trav->SetExtensive(PR_TRUE); trav->SetExtensive(PR_TRUE);
trav->SetPreOrder(PR_FALSE);
}
break;
case EXTENSIVE_PREORDER: {
nsLeafIterator *trav = new nsLeafIterator(aPresContext, aStart);
if (!trav)
return NS_ERROR_OUT_OF_MEMORY;
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
NS_ADDREF(trav);
trav->SetExtensive(PR_TRUE);
trav->SetPreOrder(PR_TRUE);
} }
break; break;
#ifdef IBMBIDI #ifdef IBMBIDI
@ -287,12 +303,15 @@ nsLeafIterator::Next()
nsIFrame *parent = getCurrent(); nsIFrame *parent = getCurrent();
if (!parent) if (!parent)
parent = getLast(); parent = getLast();
if (!mExtensive) if (!mExtensive && !mPreOrder)
{ {
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{ {
parent = result; parent = result;
} }
} else if (mPreOrder) {
if (NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull, &result)) && result)
parent = result;
} }
if (parent != getCurrent()) if (parent != getCurrent())
{ {
@ -300,13 +319,15 @@ nsLeafIterator::Next()
} }
else { else {
while(parent && !IsRootFrame(parent)) { while(parent && !IsRootFrame(parent)) {
if (NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){ if (NS_SUCCEEDED(parent->GetNextSibling(&result)) && result) {
if (!mPreOrder) {
parent = result; parent = result;
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{ {
parent = result; parent = result;
} }
result = parent; result = parent;
}
break; break;
} }
else else
@ -319,7 +340,7 @@ nsLeafIterator::Next()
else else
{ {
parent = result; parent = result;
if (mExtensive) if (mExtensive && !mPreOrder)
break; break;
} }
} }

Просмотреть файл

@ -26,7 +26,32 @@
#include "nsIEnumerator.h" #include "nsIEnumerator.h"
#include "nsIFrame.h" #include "nsIFrame.h"
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST /* Brief explanation of frame traversal types:
*
* LEAF:
* Iterate over only the leaf frames in the tree, in depth-first order.
*
* EXTENSIVE:
* Iterate over all frames in the tree, including non-leaf frames.
* Child frames are traversed before their parents going both forward
* and backward.
*
* EXTENSIVE_PREORDER:
* Like EXTENSIVE, but traverse parent frames before their children
* when going forward.
*
* FASTEST:
* XXX not implemented
*
* VISUAL:
* Traverse frames in "visual" order (left-to-right, top-to-bottom).
*/
enum nsTraversalType{
LEAF,
EXTENSIVE,
EXTENSIVE_PREORDER,
FASTEST
#ifdef IBMBIDI // Simon #ifdef IBMBIDI // Simon
, VISUAL , VISUAL
#endif #endif

Просмотреть файл

@ -26,7 +26,32 @@
#include "nsIEnumerator.h" #include "nsIEnumerator.h"
#include "nsIFrame.h" #include "nsIFrame.h"
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST /* Brief explanation of frame traversal types:
*
* LEAF:
* Iterate over only the leaf frames in the tree, in depth-first order.
*
* EXTENSIVE:
* Iterate over all frames in the tree, including non-leaf frames.
* Child frames are traversed before their parents going both forward
* and backward.
*
* EXTENSIVE_PREORDER:
* Like EXTENSIVE, but traverse parent frames before their children
* when going forward.
*
* FASTEST:
* XXX not implemented
*
* VISUAL:
* Traverse frames in "visual" order (left-to-right, top-to-bottom).
*/
enum nsTraversalType{
LEAF,
EXTENSIVE,
EXTENSIVE_PREORDER,
FASTEST
#ifdef IBMBIDI // Simon #ifdef IBMBIDI // Simon
, VISUAL , VISUAL
#endif #endif

Просмотреть файл

@ -84,6 +84,9 @@ public:
nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start); nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start);
void SetExtensive(PRBool aExtensive) {mExtensive = aExtensive;} void SetExtensive(PRBool aExtensive) {mExtensive = aExtensive;}
PRBool GetExtensive(){return mExtensive;} PRBool GetExtensive(){return mExtensive;}
void SetPreOrder(PRBool aPreOrder) { mPreOrder = aPreOrder; }
PRBool GetPreOrder() { return mPreOrder; }
private : private :
NS_IMETHOD Next(); NS_IMETHOD Next();
@ -91,7 +94,8 @@ private :
NS_IMETHOD Prev(); NS_IMETHOD Prev();
nsIPresContext* mPresContext; nsIPresContext* mPresContext;
PRBool mExtensive; PRPackedBool mExtensive;
PRPackedBool mPreOrder;
}; };
#ifdef IBMBIDI // Simon #ifdef IBMBIDI // Simon
@ -144,6 +148,7 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav); *aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
NS_ADDREF(trav); NS_ADDREF(trav);
trav->SetExtensive(PR_FALSE); trav->SetExtensive(PR_FALSE);
trav->SetPreOrder(PR_FALSE);
} }
break; break;
case EXTENSIVE:{ case EXTENSIVE:{
@ -153,6 +158,17 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav); *aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
NS_ADDREF(trav); NS_ADDREF(trav);
trav->SetExtensive(PR_TRUE); trav->SetExtensive(PR_TRUE);
trav->SetPreOrder(PR_FALSE);
}
break;
case EXTENSIVE_PREORDER: {
nsLeafIterator *trav = new nsLeafIterator(aPresContext, aStart);
if (!trav)
return NS_ERROR_OUT_OF_MEMORY;
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
NS_ADDREF(trav);
trav->SetExtensive(PR_TRUE);
trav->SetPreOrder(PR_TRUE);
} }
break; break;
#ifdef IBMBIDI #ifdef IBMBIDI
@ -287,12 +303,15 @@ nsLeafIterator::Next()
nsIFrame *parent = getCurrent(); nsIFrame *parent = getCurrent();
if (!parent) if (!parent)
parent = getLast(); parent = getLast();
if (!mExtensive) if (!mExtensive && !mPreOrder)
{ {
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{ {
parent = result; parent = result;
} }
} else if (mPreOrder) {
if (NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull, &result)) && result)
parent = result;
} }
if (parent != getCurrent()) if (parent != getCurrent())
{ {
@ -300,13 +319,15 @@ nsLeafIterator::Next()
} }
else { else {
while(parent && !IsRootFrame(parent)) { while(parent && !IsRootFrame(parent)) {
if (NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){ if (NS_SUCCEEDED(parent->GetNextSibling(&result)) && result) {
if (!mPreOrder) {
parent = result; parent = result;
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{ {
parent = result; parent = result;
} }
result = parent; result = parent;
}
break; break;
} }
else else
@ -319,7 +340,7 @@ nsLeafIterator::Next()
else else
{ {
parent = result; parent = result;
if (mExtensive) if (mExtensive && !mPreOrder)
break; break;
} }
} }