Commit cba888fc authored by mjudge%netscape.com's avatar mjudge%netscape.com
Browse files

updates and fixes for CTRL left arrow and right arrow. also fixes for...

updates and fixes for CTRL left arrow and right arrow. also fixes for releasing the presshell correctly.  the selection code was leaking it.  updates for PREV and NEXT in nsFrameTraversal
parent 1d7617de
Loading
Loading
Loading
Loading
+37 −5
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@ nsFrameIterator::CurrentItem(nsISupports **aItem)
  if (!aItem)
    return NS_ERROR_NULL_POINTER;
  *aItem = mCurrent;
  if (mOffEdge)
    return NS_COMFALSE;
  return NS_OK;
}

@@ -254,7 +256,7 @@ nsLeafIterator::Next()
  setCurrent(result);
  if (!result)
    setOffEdge(1);
  return nsnull;
  return NS_OK;
}


@@ -267,10 +269,39 @@ nsLeafIterator::Prev()
  nsIFrame *result;
  nsIFrame *parent = getCurrent();
  if (!parent)
    return NS_ERROR_FAILURE;

    parent = getLast();
  while(parent){
    nsIFrame *grandParent;
    if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent &&
      NS_SUCCEEDED(grandParent->FirstChild(nsnull,&result))){
      nsFrameList list(result);
      if (result = list.GetPrevSiblingFor(parent)){
        parent = result;
        while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result){
          parent = result;
          while(NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){
            parent = result;
          }
        }
        result = parent;
        break;
      }
      else if (NS_FAILED(parent->GetParent(&result)) || !result){
          result = nsnull;
          break;
      }
      else 
        parent = result;
    }
    else{
      setLast(parent);
      result = nsnull;
      break;
    }
  }


/*  while(parent){
    nsIFrame *grandParent;
    if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent){
      nsIFrame * grandFchild;
@@ -297,8 +328,9 @@ nsLeafIterator::Prev()
      }
    }
  }
  */
  setCurrent(result);
  if (!result)
    setOffEdge(-1);
  return nsnull;
  return NS_OK;
}
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ class nsISelectionMgr;
 */
class nsIPresShell : public nsISupports {
public:
  static const nsIID& IID() { static nsIID iid = NS_IPRESSHELL_IID; return iid; }

  NS_IMETHOD Init(nsIDocument* aDocument,
                  nsIPresContext* aPresContext,
                  nsIViewManager* aViewManager,
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@
class nsIFocusTracker : public nsISupports
{
public:
  static const nsIID& IID() { static nsIID iid = NS_IFOCUSTRACKER_IID; return iid; }

  /** SetFocus will keep track of the new frame as the focus frame. 
   *  as well as keeping track of the anchor frame; <BR>
   *  @param aFrame will be the focus frame
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ class nsISelectionMgr;
 */
class nsIPresShell : public nsISupports {
public:
  static const nsIID& IID() { static nsIID iid = NS_IPRESSHELL_IID; return iid; }

  NS_IMETHOD Init(nsIDocument* aDocument,
                  nsIPresContext* aPresContext,
                  nsIViewManager* aViewManager,
+37 −5
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@ nsFrameIterator::CurrentItem(nsISupports **aItem)
  if (!aItem)
    return NS_ERROR_NULL_POINTER;
  *aItem = mCurrent;
  if (mOffEdge)
    return NS_COMFALSE;
  return NS_OK;
}

@@ -254,7 +256,7 @@ nsLeafIterator::Next()
  setCurrent(result);
  if (!result)
    setOffEdge(1);
  return nsnull;
  return NS_OK;
}


@@ -267,10 +269,39 @@ nsLeafIterator::Prev()
  nsIFrame *result;
  nsIFrame *parent = getCurrent();
  if (!parent)
    return NS_ERROR_FAILURE;

    parent = getLast();
  while(parent){
    nsIFrame *grandParent;
    if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent &&
      NS_SUCCEEDED(grandParent->FirstChild(nsnull,&result))){
      nsFrameList list(result);
      if (result = list.GetPrevSiblingFor(parent)){
        parent = result;
        while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result){
          parent = result;
          while(NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){
            parent = result;
          }
        }
        result = parent;
        break;
      }
      else if (NS_FAILED(parent->GetParent(&result)) || !result){
          result = nsnull;
          break;
      }
      else 
        parent = result;
    }
    else{
      setLast(parent);
      result = nsnull;
      break;
    }
  }


/*  while(parent){
    nsIFrame *grandParent;
    if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent){
      nsIFrame * grandFchild;
@@ -297,8 +328,9 @@ nsLeafIterator::Prev()
      }
    }
  }
  */
  setCurrent(result);
  if (!result)
    setOffEdge(-1);
  return nsnull;
  return NS_OK;
}
Loading