From cbca07291c7a364eb40b1f4cb2ad6aa0b5403bcb Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Tue, 16 Apr 2002 02:42:09 +0000 Subject: [PATCH] 82151 r=jfrancis sr = kin --- layout/base/nsCaret.cpp | 2 +- layout/base/nsFrameTraversal.cpp | 92 +++++++++++++++++++------- layout/base/nsFrameTraversal.h | 3 +- layout/base/nsIFrameSelection.h | 17 +++-- layout/base/nsPresShell.cpp | 1 + layout/base/public/nsFrameTraversal.h | 3 +- layout/base/public/nsIFrameSelection.h | 17 +++-- layout/base/src/nsCaret.cpp | 2 +- layout/base/src/nsFrameTraversal.cpp | 92 +++++++++++++++++++------- layout/generic/nsBlockFrame.cpp | 2 +- layout/generic/nsFrame.cpp | 42 ++++++------ layout/html/base/src/nsBlockFrame.cpp | 2 +- layout/html/base/src/nsFrame.cpp | 42 ++++++------ layout/html/base/src/nsPresShell.cpp | 1 + 14 files changed, 216 insertions(+), 102 deletions(-) diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 99d45565bb24..6e306e40637b 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -992,7 +992,7 @@ void nsCaret::DrawCaret() presContext->GetDeviceContext(getter_AddRefs(dx)); if (dx) dx->GetDevUnitsToTwips(tDevUnitsToTwips); - mCaretTwipsWidth = tDevUnitsToTwips * mCaretPixelsWidth; + mCaretTwipsWidth = (nscoord)(tDevUnitsToTwips * (float)mCaretPixelsWidth); } caretRect.width = mCaretTwipsWidth; diff --git a/layout/base/nsFrameTraversal.cpp b/layout/base/nsFrameTraversal.cpp index 034025c3a8dc..a1aae3ec4be3 100644 --- a/layout/base/nsFrameTraversal.cpp +++ b/layout/base/nsFrameTraversal.cpp @@ -97,7 +97,7 @@ public: nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start); void SetExtensive(PRBool aExtensive) {mExtensive = aExtensive;} PRBool GetExtensive(){return mExtensive;} - + void SetLockInScrollView(PRBool aLockScroll){mLockScroll = aLockScroll;} private : NS_IMETHOD Next(); @@ -106,6 +106,7 @@ private : nsIPresContext* mPresContext; PRPackedBool mExtensive; + PRBool mLockScroll; }; class nsFocusIterator : public nsFrameIterator @@ -184,7 +185,8 @@ nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIPresContext* aPresContext, - nsIFrame *aStart) + nsIFrame *aStart, + PRBool aLockInScrollView) { if (!aEnumerator || !aStart) return NS_ERROR_NULL_POINTER; @@ -194,6 +196,7 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsLeafIterator *trav = new nsLeafIterator(aPresContext, aStart); if (!trav) return NS_ERROR_OUT_OF_MEMORY; + trav->SetLockInScrollView(aLockInScrollView); *aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav); NS_ADDREF(trav); trav->SetExtensive(PR_FALSE); @@ -262,7 +265,7 @@ nsFrameTraversal::NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, { return NS_NewFrameTraversal(aEnumerator, NS_STATIC_CAST(nsTraversalType, aType), - aPresContext, aStart); + aPresContext, aStart,PR_FALSE); } /*********nsFrameIterator************/ @@ -328,6 +331,7 @@ nsLeafIterator::nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *aStart) setStart(aStart); setCurrent(aStart); setLast(aStart); + SetLockInScrollView(PR_FALSE); } static PRBool @@ -380,9 +384,18 @@ nsLeafIterator::Next() else { parent = result; + // check if FrameType of result is TextInputFrame + if (mLockScroll) //lock the traversal when we hit a scroll frame + { + nsCOMPtr atom; + nsresult res = result->GetFrameType(getter_AddRefs(atom)); + if ( NS_SUCCEEDED(res) && atom ) { + if ( atom.get() == nsLayoutAtoms::scrollFrame ) return NS_ERROR_FAILURE; + } + } if (mExtensive) break; - } + } } } } @@ -403,35 +416,66 @@ nsLeafIterator::Prev() nsIFrame *parent = getCurrent(); if (!parent) parent = getLast(); + while(parent){ nsIFrame *grandParent; - if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent && - NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){ - nsFrameList list(result); - result = list.GetPrevSiblingFor(parent); - if (result){ - parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result){ - parent = result; - while(NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){ - parent = result; + if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent ) + { + // check if FrameType of grandParent is TextInputFrame + if (mLockScroll) //lock the traversal when we hit a scroll frame + { + nsCOMPtr atom; + nsresult res = grandParent->GetFrameType(getter_AddRefs(atom)); + if ( NS_SUCCEEDED(res) && atom ) + { + #ifdef DEBUG_skamio + nsAutoString aString; + res = atom->ToString(aString); + if ( NS_SUCCEEDED(res) ) { + printf("%s:%d\n", __FILE__, __LINE__); + printf("FrameType: %s\n", NS_ConvertUCS2toUTF8(aString).get()); } + #endif + if ( atom.get() == nsLayoutAtoms::scrollFrame ) + return NS_ERROR_FAILURE; + } - result = parent; - break; } - else if (NS_FAILED(parent->GetParent(&result)) || !result){ + if (NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))) + { + + nsFrameList list(result); + result = list.GetPrevSiblingFor(parent); + if (result) + { + parent = result; + while(NS_SUCCEEDED(parent->FirstChild(mPresContext, 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; - if (mExtensive) - break; + + } + else + { + parent = result; + if (mExtensive) + break; + } } } - else{ + else + { setLast(parent); result = nsnull; break; diff --git a/layout/base/nsFrameTraversal.h b/layout/base/nsFrameTraversal.h index 993551a85639..c95b9fd60cc4 100644 --- a/layout/base/nsFrameTraversal.h +++ b/layout/base/nsFrameTraversal.h @@ -44,7 +44,8 @@ nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIPresContext* aPresContext, - nsIFrame *aStart); + nsIFrame *aStart, + PRBool aLockInScrollView); nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult); diff --git a/layout/base/nsIFrameSelection.h b/layout/base/nsIFrameSelection.h index 3b1a3a162787..f3518d9a2728 100644 --- a/layout/base/nsIFrameSelection.h +++ b/layout/base/nsIFrameSelection.h @@ -85,6 +85,7 @@ struct SelectionDetails * @param mEatingWS boolean to tell us the state of our search for Next/Prev * @param mPreferLeft true = prev line end, false = next line begin * @param mJumpLines if this is true then its ok to cross lines while peeking + * @param mScrollViewStop if this is true then stop peeking across scroll view boundary */ struct nsPeekOffsetStruct { @@ -95,11 +96,18 @@ struct nsPeekOffsetStruct PRInt32 aStartOffset, PRBool aEatingWS, PRBool aPreferLeft, - PRBool aJumpLines) + PRBool aJumpLines, + PRBool aScrollViewStop) { - mTracker=aTracker;mDesiredX=aDesiredX;mAmount=aAmount; - mDirection=aDirection;mStartOffset=aStartOffset;mEatingWS=aEatingWS; - mPreferLeft=aPreferLeft;mJumpLines = aJumpLines; + mTracker=aTracker; + mDesiredX=aDesiredX; + mAmount=aAmount; + mDirection=aDirection; + mStartOffset=aStartOffset; + mEatingWS=aEatingWS; + mPreferLeft=aPreferLeft; + mJumpLines = aJumpLines; + mScrollViewStop = aScrollViewStop; } nsIFocusTracker *mTracker; nscoord mDesiredX; @@ -113,6 +121,7 @@ struct nsPeekOffsetStruct PRBool mEatingWS; PRBool mPreferLeft; PRBool mJumpLines; + PRBool mScrollViewStop; }; class nsIScrollableView; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 2430f5f2f2bf..a2bdf21bedbd 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3244,6 +3244,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend) pos.mTracker = this; pos.mContentOffset = 0; pos.mContentOffsetEnd = 0; + pos.mScrollViewStop = PR_FALSE;//dont stop on scrolled views. if (aForward) { outsideLimit = 1;//search from end diff --git a/layout/base/public/nsFrameTraversal.h b/layout/base/public/nsFrameTraversal.h index 993551a85639..c95b9fd60cc4 100644 --- a/layout/base/public/nsFrameTraversal.h +++ b/layout/base/public/nsFrameTraversal.h @@ -44,7 +44,8 @@ nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIPresContext* aPresContext, - nsIFrame *aStart); + nsIFrame *aStart, + PRBool aLockInScrollView); nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult); diff --git a/layout/base/public/nsIFrameSelection.h b/layout/base/public/nsIFrameSelection.h index 3b1a3a162787..f3518d9a2728 100644 --- a/layout/base/public/nsIFrameSelection.h +++ b/layout/base/public/nsIFrameSelection.h @@ -85,6 +85,7 @@ struct SelectionDetails * @param mEatingWS boolean to tell us the state of our search for Next/Prev * @param mPreferLeft true = prev line end, false = next line begin * @param mJumpLines if this is true then its ok to cross lines while peeking + * @param mScrollViewStop if this is true then stop peeking across scroll view boundary */ struct nsPeekOffsetStruct { @@ -95,11 +96,18 @@ struct nsPeekOffsetStruct PRInt32 aStartOffset, PRBool aEatingWS, PRBool aPreferLeft, - PRBool aJumpLines) + PRBool aJumpLines, + PRBool aScrollViewStop) { - mTracker=aTracker;mDesiredX=aDesiredX;mAmount=aAmount; - mDirection=aDirection;mStartOffset=aStartOffset;mEatingWS=aEatingWS; - mPreferLeft=aPreferLeft;mJumpLines = aJumpLines; + mTracker=aTracker; + mDesiredX=aDesiredX; + mAmount=aAmount; + mDirection=aDirection; + mStartOffset=aStartOffset; + mEatingWS=aEatingWS; + mPreferLeft=aPreferLeft; + mJumpLines = aJumpLines; + mScrollViewStop = aScrollViewStop; } nsIFocusTracker *mTracker; nscoord mDesiredX; @@ -113,6 +121,7 @@ struct nsPeekOffsetStruct PRBool mEatingWS; PRBool mPreferLeft; PRBool mJumpLines; + PRBool mScrollViewStop; }; class nsIScrollableView; diff --git a/layout/base/src/nsCaret.cpp b/layout/base/src/nsCaret.cpp index 99d45565bb24..6e306e40637b 100644 --- a/layout/base/src/nsCaret.cpp +++ b/layout/base/src/nsCaret.cpp @@ -992,7 +992,7 @@ void nsCaret::DrawCaret() presContext->GetDeviceContext(getter_AddRefs(dx)); if (dx) dx->GetDevUnitsToTwips(tDevUnitsToTwips); - mCaretTwipsWidth = tDevUnitsToTwips * mCaretPixelsWidth; + mCaretTwipsWidth = (nscoord)(tDevUnitsToTwips * (float)mCaretPixelsWidth); } caretRect.width = mCaretTwipsWidth; diff --git a/layout/base/src/nsFrameTraversal.cpp b/layout/base/src/nsFrameTraversal.cpp index 034025c3a8dc..a1aae3ec4be3 100644 --- a/layout/base/src/nsFrameTraversal.cpp +++ b/layout/base/src/nsFrameTraversal.cpp @@ -97,7 +97,7 @@ public: nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start); void SetExtensive(PRBool aExtensive) {mExtensive = aExtensive;} PRBool GetExtensive(){return mExtensive;} - + void SetLockInScrollView(PRBool aLockScroll){mLockScroll = aLockScroll;} private : NS_IMETHOD Next(); @@ -106,6 +106,7 @@ private : nsIPresContext* mPresContext; PRPackedBool mExtensive; + PRBool mLockScroll; }; class nsFocusIterator : public nsFrameIterator @@ -184,7 +185,8 @@ nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIPresContext* aPresContext, - nsIFrame *aStart) + nsIFrame *aStart, + PRBool aLockInScrollView) { if (!aEnumerator || !aStart) return NS_ERROR_NULL_POINTER; @@ -194,6 +196,7 @@ NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsLeafIterator *trav = new nsLeafIterator(aPresContext, aStart); if (!trav) return NS_ERROR_OUT_OF_MEMORY; + trav->SetLockInScrollView(aLockInScrollView); *aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav); NS_ADDREF(trav); trav->SetExtensive(PR_FALSE); @@ -262,7 +265,7 @@ nsFrameTraversal::NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, { return NS_NewFrameTraversal(aEnumerator, NS_STATIC_CAST(nsTraversalType, aType), - aPresContext, aStart); + aPresContext, aStart,PR_FALSE); } /*********nsFrameIterator************/ @@ -328,6 +331,7 @@ nsLeafIterator::nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *aStart) setStart(aStart); setCurrent(aStart); setLast(aStart); + SetLockInScrollView(PR_FALSE); } static PRBool @@ -380,9 +384,18 @@ nsLeafIterator::Next() else { parent = result; + // check if FrameType of result is TextInputFrame + if (mLockScroll) //lock the traversal when we hit a scroll frame + { + nsCOMPtr atom; + nsresult res = result->GetFrameType(getter_AddRefs(atom)); + if ( NS_SUCCEEDED(res) && atom ) { + if ( atom.get() == nsLayoutAtoms::scrollFrame ) return NS_ERROR_FAILURE; + } + } if (mExtensive) break; - } + } } } } @@ -403,35 +416,66 @@ nsLeafIterator::Prev() nsIFrame *parent = getCurrent(); if (!parent) parent = getLast(); + while(parent){ nsIFrame *grandParent; - if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent && - NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){ - nsFrameList list(result); - result = list.GetPrevSiblingFor(parent); - if (result){ - parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result){ - parent = result; - while(NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){ - parent = result; + if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent ) + { + // check if FrameType of grandParent is TextInputFrame + if (mLockScroll) //lock the traversal when we hit a scroll frame + { + nsCOMPtr atom; + nsresult res = grandParent->GetFrameType(getter_AddRefs(atom)); + if ( NS_SUCCEEDED(res) && atom ) + { + #ifdef DEBUG_skamio + nsAutoString aString; + res = atom->ToString(aString); + if ( NS_SUCCEEDED(res) ) { + printf("%s:%d\n", __FILE__, __LINE__); + printf("FrameType: %s\n", NS_ConvertUCS2toUTF8(aString).get()); } + #endif + if ( atom.get() == nsLayoutAtoms::scrollFrame ) + return NS_ERROR_FAILURE; + } - result = parent; - break; } - else if (NS_FAILED(parent->GetParent(&result)) || !result){ + if (NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))) + { + + nsFrameList list(result); + result = list.GetPrevSiblingFor(parent); + if (result) + { + parent = result; + while(NS_SUCCEEDED(parent->FirstChild(mPresContext, 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; - if (mExtensive) - break; + + } + else + { + parent = result; + if (mExtensive) + break; + } } } - else{ + else + { setLast(parent); result = nsnull; break; diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 68b814a69128..8778a96e7570 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -5690,7 +5690,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext, pos.mTracker = tracker; pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - + pos.mScrollViewStop = PR_FALSE; result = nsFrame::GetNextPrevLineFromeBlockFrame(aPresContext, &pos, mainframe, diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index afcb51840ceb..c1c09e0e264d 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1130,7 +1130,7 @@ nsFrame::HandlePress(nsIPresContext* aPresContext, if (me->clickCount >1 ) { rv = frameselection->SetMouseDownState( PR_TRUE ); - return HandleMultiplePress(aPresContext,aEvent,aEventStatus); + return HandleMultiplePress(aPresContext, aEvent, aEventStatus); } nsCOMPtr content; @@ -1331,7 +1331,8 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack, aStartPos, PR_FALSE, PR_TRUE, - aJumpLines); + aJumpLines, + PR_TRUE);//limit on scrolled views rv = PeekOffset(aPresContext, &startpos); if (NS_FAILED(rv)) return rv; @@ -1343,7 +1344,8 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack, aStartPos, PR_FALSE, PR_FALSE, - aJumpLines); + aJumpLines, + PR_TRUE);//limit on scrolled views rv = PeekOffset(aPresContext, &endpos); if (NS_FAILED(rv)) return rv; @@ -3017,7 +3019,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, nsCOMPtr frameTraversal; result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF, - aPresContext, resultFrame); + aPresContext, resultFrame, aPos->mScrollViewStop); if (NS_FAILED(result)) return result; nsISupports *isupports = nsnull; @@ -3117,7 +3119,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, if (!found){ resultFrame = storeOldResultFrame; result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF, - aPresContext, resultFrame); + aPresContext, resultFrame, aPos->mScrollViewStop); } while ( !found ){ nsCOMPtr context; @@ -3836,11 +3838,11 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct aPresContext, (lineJump && lineIsRTL) ? (aPos->mDirection == eDirNext) ? lastFrame : firstFrame - : traversedFrame); + : traversedFrame, aPos->mScrollViewStop); #else //if we are a container frame we MUST init with last leaf for eDirNext // - result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF, aPresContext, traversedFrame); + result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF, aPresContext, traversedFrame, pos->mScrollViewStop); #endif if (NS_FAILED(result)) return result; @@ -3891,7 +3893,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct thisBlock = blockFrame; result = blockFrame->GetParent(&blockFrame); if (NS_SUCCEEDED(result) && blockFrame){ - result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); + result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator), getter_AddRefs(it)); } else blockFrame = nsnull; @@ -3914,7 +3916,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct } else { - result = it->GetLine(thisLine, &firstFrame, &lineFrameCount,nonUsedRect, + result = it->GetLine(thisLine, &firstFrame, &lineFrameCount, nonUsedRect, &lineFlags); if (NS_FAILED(result)) return result; @@ -3958,9 +3960,9 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct aPos->mStartOffset = -1; #ifdef IBMBIDI PRUint8 oldLevel, newLevel, baseLevel; - GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&oldLevel,sizeof(oldLevel)); - newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&newLevel,sizeof(newLevel)); - newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::baseLevel, (void**)&baseLevel,sizeof(baseLevel)); + GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&oldLevel, sizeof(oldLevel)); + newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&newLevel, sizeof(newLevel)); + newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::baseLevel, (void**)&baseLevel, sizeof(baseLevel)); if (newLevel & 1) // The new frame is RTL, go to the other end aPos->mStartOffset = -1 - aPos->mStartOffset; @@ -4246,7 +4248,7 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) return rv; if (!parent) return NS_ERROR_FAILURE; - parent->GetView(aPresContext,&view); + parent->GetView(aPresContext, &view); } nsCOMPtr viewMan; @@ -4256,9 +4258,9 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) view->GetViewManager(*getter_AddRefs(viewMan)); if (viewMan) { if (aGrabMouseEvents) { - viewMan->GrabMouseEvents(view,result); + viewMan->GrabMouseEvents(view, result); } else { - viewMan->GrabMouseEvents(nsnull,result); + viewMan->GrabMouseEvents(nsnull, result); } } } @@ -4271,7 +4273,7 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext) { // get its view nsIView* view = nsnull; - GetView(aPresContext, & view); + GetView(aPresContext, &view); if (!view) { nsIFrame *parent;//might be THIS frame thats ok @@ -4281,7 +4283,7 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext) if (!parent) return NS_ERROR_FAILURE; - parent->GetView(aPresContext,&view); + parent->GetView(aPresContext, &view); } nsCOMPtr viewMan; @@ -4771,7 +4773,7 @@ void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType, DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType) { PRInt32 numEntries = mFrameTypeTable.Count(); - NS_ASSERTION(numEntries != 0,"empty FrameTypeTable"); + NS_ASSERTION(numEntries != 0, "empty FrameTypeTable"); for (PRInt32 i = 0; i < numEntries; i++) { DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i); if (info && (info->mType == aFrameType)) { @@ -4784,7 +4786,7 @@ DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType) DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName) { PRInt32 numEntries = mFrameTypeTable.Count(); - NS_ASSERTION(numEntries != 0,"empty FrameTypeTable"); + NS_ASSERTION(numEntries != 0, "empty FrameTypeTable"); for (PRInt32 i = 0; i < numEntries; i++) { DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i); if (info && ((strcmp(aFrameName, info->mName) == 0) || (strcmp(aFrameName, info->mNameAbbrev) == 0))) { @@ -4843,7 +4845,7 @@ void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame, for (PRInt32 i = 0; i < aIndent; i++) { printf(" "); } - if(!strcmp(frameTypeInfo->mNameAbbrev,"unknown")) { + if(!strcmp(frameTypeInfo->mNameAbbrev, "unknown")) { nsAutoString name; nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 68b814a69128..8778a96e7570 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -5690,7 +5690,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext, pos.mTracker = tracker; pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - + pos.mScrollViewStop = PR_FALSE; result = nsFrame::GetNextPrevLineFromeBlockFrame(aPresContext, &pos, mainframe, diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index afcb51840ceb..c1c09e0e264d 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -1130,7 +1130,7 @@ nsFrame::HandlePress(nsIPresContext* aPresContext, if (me->clickCount >1 ) { rv = frameselection->SetMouseDownState( PR_TRUE ); - return HandleMultiplePress(aPresContext,aEvent,aEventStatus); + return HandleMultiplePress(aPresContext, aEvent, aEventStatus); } nsCOMPtr content; @@ -1331,7 +1331,8 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack, aStartPos, PR_FALSE, PR_TRUE, - aJumpLines); + aJumpLines, + PR_TRUE);//limit on scrolled views rv = PeekOffset(aPresContext, &startpos); if (NS_FAILED(rv)) return rv; @@ -1343,7 +1344,8 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack, aStartPos, PR_FALSE, PR_FALSE, - aJumpLines); + aJumpLines, + PR_TRUE);//limit on scrolled views rv = PeekOffset(aPresContext, &endpos); if (NS_FAILED(rv)) return rv; @@ -3017,7 +3019,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, nsCOMPtr frameTraversal; result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF, - aPresContext, resultFrame); + aPresContext, resultFrame, aPos->mScrollViewStop); if (NS_FAILED(result)) return result; nsISupports *isupports = nsnull; @@ -3117,7 +3119,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, if (!found){ resultFrame = storeOldResultFrame; result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF, - aPresContext, resultFrame); + aPresContext, resultFrame, aPos->mScrollViewStop); } while ( !found ){ nsCOMPtr context; @@ -3836,11 +3838,11 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct aPresContext, (lineJump && lineIsRTL) ? (aPos->mDirection == eDirNext) ? lastFrame : firstFrame - : traversedFrame); + : traversedFrame, aPos->mScrollViewStop); #else //if we are a container frame we MUST init with last leaf for eDirNext // - result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF, aPresContext, traversedFrame); + result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF, aPresContext, traversedFrame, pos->mScrollViewStop); #endif if (NS_FAILED(result)) return result; @@ -3891,7 +3893,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct thisBlock = blockFrame; result = blockFrame->GetParent(&blockFrame); if (NS_SUCCEEDED(result) && blockFrame){ - result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); + result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator), getter_AddRefs(it)); } else blockFrame = nsnull; @@ -3914,7 +3916,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct } else { - result = it->GetLine(thisLine, &firstFrame, &lineFrameCount,nonUsedRect, + result = it->GetLine(thisLine, &firstFrame, &lineFrameCount, nonUsedRect, &lineFlags); if (NS_FAILED(result)) return result; @@ -3958,9 +3960,9 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct aPos->mStartOffset = -1; #ifdef IBMBIDI PRUint8 oldLevel, newLevel, baseLevel; - GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&oldLevel,sizeof(oldLevel)); - newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&newLevel,sizeof(newLevel)); - newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::baseLevel, (void**)&baseLevel,sizeof(baseLevel)); + GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&oldLevel, sizeof(oldLevel)); + newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**)&newLevel, sizeof(newLevel)); + newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::baseLevel, (void**)&baseLevel, sizeof(baseLevel)); if (newLevel & 1) // The new frame is RTL, go to the other end aPos->mStartOffset = -1 - aPos->mStartOffset; @@ -4246,7 +4248,7 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) return rv; if (!parent) return NS_ERROR_FAILURE; - parent->GetView(aPresContext,&view); + parent->GetView(aPresContext, &view); } nsCOMPtr viewMan; @@ -4256,9 +4258,9 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) view->GetViewManager(*getter_AddRefs(viewMan)); if (viewMan) { if (aGrabMouseEvents) { - viewMan->GrabMouseEvents(view,result); + viewMan->GrabMouseEvents(view, result); } else { - viewMan->GrabMouseEvents(nsnull,result); + viewMan->GrabMouseEvents(nsnull, result); } } } @@ -4271,7 +4273,7 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext) { // get its view nsIView* view = nsnull; - GetView(aPresContext, & view); + GetView(aPresContext, &view); if (!view) { nsIFrame *parent;//might be THIS frame thats ok @@ -4281,7 +4283,7 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext) if (!parent) return NS_ERROR_FAILURE; - parent->GetView(aPresContext,&view); + parent->GetView(aPresContext, &view); } nsCOMPtr viewMan; @@ -4771,7 +4773,7 @@ void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType, DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType) { PRInt32 numEntries = mFrameTypeTable.Count(); - NS_ASSERTION(numEntries != 0,"empty FrameTypeTable"); + NS_ASSERTION(numEntries != 0, "empty FrameTypeTable"); for (PRInt32 i = 0; i < numEntries; i++) { DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i); if (info && (info->mType == aFrameType)) { @@ -4784,7 +4786,7 @@ DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType) DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName) { PRInt32 numEntries = mFrameTypeTable.Count(); - NS_ASSERTION(numEntries != 0,"empty FrameTypeTable"); + NS_ASSERTION(numEntries != 0, "empty FrameTypeTable"); for (PRInt32 i = 0; i < numEntries; i++) { DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i); if (info && ((strcmp(aFrameName, info->mName) == 0) || (strcmp(aFrameName, info->mNameAbbrev) == 0))) { @@ -4843,7 +4845,7 @@ void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame, for (PRInt32 i = 0; i < aIndent; i++) { printf(" "); } - if(!strcmp(frameTypeInfo->mNameAbbrev,"unknown")) { + if(!strcmp(frameTypeInfo->mNameAbbrev, "unknown")) { nsAutoString name; nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 2430f5f2f2bf..a2bdf21bedbd 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -3244,6 +3244,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend) pos.mTracker = this; pos.mContentOffset = 0; pos.mContentOffsetEnd = 0; + pos.mScrollViewStop = PR_FALSE;//dont stop on scrolled views. if (aForward) { outsideLimit = 1;//search from end