зеркало из https://github.com/mozilla/gecko-dev.git
adding parameters to setselectedcontent. This will keep down overhead of the nsIFrame implementation and still not allow outsiders to talk to their presshell. so please forgive this grown method. this extra parameter will maintain the anchor and focus point after reflow
This commit is contained in:
Родитель
8fb4029fc4
Коммит
5ac012630e
|
@ -38,6 +38,7 @@ class nsIWidget;
|
|||
class nsIReflowCommand;
|
||||
class nsAutoString;
|
||||
class nsString;
|
||||
class nsIFocusTracker;
|
||||
|
||||
struct nsPoint;
|
||||
struct nsRect;
|
||||
|
@ -535,7 +536,22 @@ public:
|
|||
|
||||
NS_IMETHOD SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset, PRBool aForceRedraw) = 0;
|
||||
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset, PRBool aForceRedraw, nsIFrame **aActualSelected) = 0;
|
||||
/**
|
||||
* Called to start a selection with this frame content.
|
||||
* @param aSelected Selected or not?
|
||||
* @param aBeginContentOffset where to begin the selection in content offsets
|
||||
* @param aEndContentOffset where to end the selection in content offsets
|
||||
* @param aAnchorOffset if this is set(not -1) it will tell the implementation of nsIFrame where
|
||||
* to put the anchor in content offsets.
|
||||
* @param aFocusOffset if this is set(not -1) it will tell the implementation of nsIFrame where
|
||||
* to put the focus in content offsets.
|
||||
* @param aFocusTracker will allow the frame to set the focus to what it needs.
|
||||
* @param return value of which frame (maybe not this one, maybe one of its siblings)
|
||||
*/
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
|
||||
PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
|
||||
nsIFocusTracker *aTracker,
|
||||
nsIFrame **aActualSelected)=0;
|
||||
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected, PRInt32 *aBeginOffset, PRInt32 *aEndOffset, PRInt32 *aBeginContentOffset) = 0;
|
||||
|
||||
|
|
|
@ -1775,7 +1775,10 @@ nsFrame::SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset, PRBool aForceRedraw, nsIFrame **aActualSelected)
|
||||
nsFrame::SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
|
||||
PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
|
||||
nsIFocusTracker *aTracker,
|
||||
nsIFrame **aActualSelected)
|
||||
{
|
||||
if (!aActualSelected)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1783,13 +1786,19 @@ nsFrame::SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset
|
|||
nsresult result = FirstChild(nsnull, child);
|
||||
if (NS_FAILED(result)){
|
||||
*aActualSelected = this;
|
||||
if (aAnchorOffset > 0)
|
||||
aTracker->SetFocus(nsnull,this);
|
||||
if (aFocusOffset > 0)
|
||||
aTracker->SetFocus(this,nsnull);
|
||||
return SetSelected(aSelected, aBeginContentOffset, aEndContentOffset, aForceRedraw);
|
||||
}
|
||||
*aActualSelected = nsnull;
|
||||
if (aBeginContentOffset)
|
||||
SetSelected(PR_FALSE, 0, 0, aForceRedraw); //if all children are not selected, then neither is this
|
||||
while (child && NS_SUCCEEDED(result)){
|
||||
result |= child->SetSelectedContentOffsets(aSelected, aBeginContentOffset, aEndContentOffset, aForceRedraw , aActualSelected);
|
||||
result |= child->SetSelectedContentOffsets(aSelected, aBeginContentOffset, aEndContentOffset,
|
||||
aAnchorOffset, aFocusOffset,
|
||||
aForceRedraw , aTracker, aActualSelected);
|
||||
if (NS_SUCCEEDED(result) && aActualSelected)
|
||||
return result; //done.
|
||||
result |= child->GetNextSibling(child);
|
||||
|
|
|
@ -207,7 +207,10 @@ public:
|
|||
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent);
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
NS_IMETHOD SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset, PRBool aForceRedraw);
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset, PRBool aForceRedraw, nsIFrame **aActualSelected);
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
|
||||
PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
|
||||
nsIFocusTracker *aTracker,
|
||||
nsIFrame **aActualSelected);
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected, PRInt32 *aBeginOffset, PRInt32 *aEndOffset, PRInt32 *aBeginContentOffset);
|
||||
NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
|
||||
// nsIHTMLReflow
|
||||
|
|
|
@ -38,6 +38,7 @@ class nsIWidget;
|
|||
class nsIReflowCommand;
|
||||
class nsAutoString;
|
||||
class nsString;
|
||||
class nsIFocusTracker;
|
||||
|
||||
struct nsPoint;
|
||||
struct nsRect;
|
||||
|
@ -535,7 +536,22 @@ public:
|
|||
|
||||
NS_IMETHOD SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset, PRBool aForceRedraw) = 0;
|
||||
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset, PRBool aForceRedraw, nsIFrame **aActualSelected) = 0;
|
||||
/**
|
||||
* Called to start a selection with this frame content.
|
||||
* @param aSelected Selected or not?
|
||||
* @param aBeginContentOffset where to begin the selection in content offsets
|
||||
* @param aEndContentOffset where to end the selection in content offsets
|
||||
* @param aAnchorOffset if this is set(not -1) it will tell the implementation of nsIFrame where
|
||||
* to put the anchor in content offsets.
|
||||
* @param aFocusOffset if this is set(not -1) it will tell the implementation of nsIFrame where
|
||||
* to put the focus in content offsets.
|
||||
* @param aFocusTracker will allow the frame to set the focus to what it needs.
|
||||
* @param return value of which frame (maybe not this one, maybe one of its siblings)
|
||||
*/
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
|
||||
PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
|
||||
nsIFocusTracker *aTracker,
|
||||
nsIFrame **aActualSelected)=0;
|
||||
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected, PRInt32 *aBeginOffset, PRInt32 *aEndOffset, PRInt32 *aBeginContentOffset) = 0;
|
||||
|
||||
|
|
|
@ -1775,7 +1775,10 @@ nsFrame::SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset, PRBool aForceRedraw, nsIFrame **aActualSelected)
|
||||
nsFrame::SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
|
||||
PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
|
||||
nsIFocusTracker *aTracker,
|
||||
nsIFrame **aActualSelected)
|
||||
{
|
||||
if (!aActualSelected)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1783,13 +1786,19 @@ nsFrame::SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset
|
|||
nsresult result = FirstChild(nsnull, child);
|
||||
if (NS_FAILED(result)){
|
||||
*aActualSelected = this;
|
||||
if (aAnchorOffset > 0)
|
||||
aTracker->SetFocus(nsnull,this);
|
||||
if (aFocusOffset > 0)
|
||||
aTracker->SetFocus(this,nsnull);
|
||||
return SetSelected(aSelected, aBeginContentOffset, aEndContentOffset, aForceRedraw);
|
||||
}
|
||||
*aActualSelected = nsnull;
|
||||
if (aBeginContentOffset)
|
||||
SetSelected(PR_FALSE, 0, 0, aForceRedraw); //if all children are not selected, then neither is this
|
||||
while (child && NS_SUCCEEDED(result)){
|
||||
result |= child->SetSelectedContentOffsets(aSelected, aBeginContentOffset, aEndContentOffset, aForceRedraw , aActualSelected);
|
||||
result |= child->SetSelectedContentOffsets(aSelected, aBeginContentOffset, aEndContentOffset,
|
||||
aAnchorOffset, aFocusOffset,
|
||||
aForceRedraw , aTracker, aActualSelected);
|
||||
if (NS_SUCCEEDED(result) && aActualSelected)
|
||||
return result; //done.
|
||||
result |= child->GetNextSibling(child);
|
||||
|
|
|
@ -207,7 +207,10 @@ public:
|
|||
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent);
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
NS_IMETHOD SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset, PRBool aForceRedraw);
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset, PRBool aForceRedraw, nsIFrame **aActualSelected);
|
||||
NS_IMETHOD SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
|
||||
PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
|
||||
nsIFocusTracker *aTracker,
|
||||
nsIFrame **aActualSelected);
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected, PRInt32 *aBeginOffset, PRInt32 *aEndOffset, PRInt32 *aBeginContentOffset);
|
||||
NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
|
||||
// nsIHTMLReflow
|
||||
|
|
Загрузка…
Ссылка в новой задаче