зеркало из https://github.com/mozilla/pjs.git
fixing 34356. hack to get clickng before table working beta3+
This commit is contained in:
Родитель
6eabb6acbd
Коммит
41f6039492
|
@ -6478,6 +6478,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
@ -6492,8 +6493,9 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
result = mainframe->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsPeekOffsetStruct pos;
|
||||
|
||||
while(NS_SUCCEEDED(result))
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
|
||||
|
||||
|
@ -6537,7 +6539,6 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
nsPeekOffsetStruct pos;
|
||||
pos.mTracker = tracker;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
|
@ -6550,7 +6551,8 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
);
|
||||
|
||||
if (NS_SUCCEEDED(result) && pos.mResultFrame){
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
if (result == NS_OK)
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
resultFrame = pos.mResultFrame;
|
||||
mainframe = resultFrame;
|
||||
}
|
||||
|
@ -6563,7 +6565,26 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (NS_COMFALSE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
result = GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
//get the selection controller
|
||||
if (NS_SUCCEEDED(result) && selCon)
|
||||
{
|
||||
PRInt16 displayresult;
|
||||
selCon->GetDisplaySelection(&displayresult);
|
||||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (frameselection)
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
|
|
|
@ -6478,6 +6478,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
@ -6492,8 +6493,9 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
result = mainframe->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsPeekOffsetStruct pos;
|
||||
|
||||
while(NS_SUCCEEDED(result))
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
|
||||
|
||||
|
@ -6537,7 +6539,6 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
nsPeekOffsetStruct pos;
|
||||
pos.mTracker = tracker;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
|
@ -6550,7 +6551,8 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
);
|
||||
|
||||
if (NS_SUCCEEDED(result) && pos.mResultFrame){
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
if (result == NS_OK)
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
resultFrame = pos.mResultFrame;
|
||||
mainframe = resultFrame;
|
||||
}
|
||||
|
@ -6563,7 +6565,26 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (NS_COMFALSE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
result = GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
//get the selection controller
|
||||
if (NS_SUCCEEDED(result) && selCon)
|
||||
{
|
||||
PRInt16 displayresult;
|
||||
selCon->GetDisplaySelection(&displayresult);
|
||||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (frameselection)
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
|
|
|
@ -6478,6 +6478,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
@ -6492,8 +6493,9 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
result = mainframe->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsPeekOffsetStruct pos;
|
||||
|
||||
while(NS_SUCCEEDED(result))
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
|
||||
|
||||
|
@ -6537,7 +6539,6 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
nsPeekOffsetStruct pos;
|
||||
pos.mTracker = tracker;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
|
@ -6550,7 +6551,8 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
);
|
||||
|
||||
if (NS_SUCCEEDED(result) && pos.mResultFrame){
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
if (result == NS_OK)
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
resultFrame = pos.mResultFrame;
|
||||
mainframe = resultFrame;
|
||||
}
|
||||
|
@ -6563,7 +6565,26 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (NS_COMFALSE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
result = GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
//get the selection controller
|
||||
if (NS_SUCCEEDED(result) && selCon)
|
||||
{
|
||||
PRInt16 displayresult;
|
||||
selCon->GetDisplaySelection(&displayresult);
|
||||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (frameselection)
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
|
|
|
@ -2707,6 +2707,50 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
|
|||
return result;
|
||||
point.y = tempRect.height + offset.y;
|
||||
|
||||
//special check. if we allow non-text selection then we can allow a hit location to fall before a table.
|
||||
//otherwise there is no way to get and click signal to fall before a table (it being a line iterator itself)
|
||||
PRBool isEditor = PR_FALSE;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
shell->GetDisplayNonTextSelection ( &isEditor );
|
||||
if ( isEditor )
|
||||
{
|
||||
nsIAtom *resultFrameType;
|
||||
if(NS_SUCCEEDED(resultFrame->GetFrameType(&resultFrameType)) && resultFrameType)
|
||||
{
|
||||
if (resultFrameType == nsLayoutAtoms::tableOuterFrame)
|
||||
{
|
||||
if (((point.x - offset.x + tempRect.x)<0) || ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
resultFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
if (content)
|
||||
{
|
||||
content->GetParent(*getter_AddRefs(parent));
|
||||
if (parent)
|
||||
{
|
||||
aPos->mResultContent = parent;
|
||||
parent->IndexOf(content, aPos->mContentOffset);
|
||||
aPos->mPreferLeft = PR_FALSE;
|
||||
if ((point.x - offset.x+ tempRect.x)>tempRect.width)
|
||||
{
|
||||
aPos->mContentOffset++;//go to end of this frame
|
||||
aPos->mPreferLeft = PR_TRUE;
|
||||
}
|
||||
aPos->mContentOffsetEnd = aPos->mContentOffset;
|
||||
//result frame is the result frames parent.
|
||||
resultFrame->GetParent(&aPos->mResultFrame);
|
||||
return NS_COMFALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(resultFrame->GetView(aPresContext, &view)) || !view)
|
||||
{
|
||||
result = resultFrame->GetContentAndOffsetsFromPoint(context,point,
|
||||
|
@ -3107,7 +3151,9 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
|
|||
}
|
||||
//this block is now one child down from blockframe
|
||||
if (NS_FAILED(result) || !it || !blockFrame || !thisBlock)
|
||||
{
|
||||
return ((result) ? result : NS_ERROR_FAILURE);
|
||||
}
|
||||
result = it->FindLineContaining(thisBlock, &thisLine);
|
||||
if (NS_FAILED(result) || thisLine <0)
|
||||
return result;
|
||||
|
|
|
@ -6478,6 +6478,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
@ -6492,8 +6493,9 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
result = mainframe->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsPeekOffsetStruct pos;
|
||||
|
||||
while(NS_SUCCEEDED(result))
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
|
||||
|
||||
|
@ -6537,7 +6539,6 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
nsPeekOffsetStruct pos;
|
||||
pos.mTracker = tracker;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
|
@ -6550,7 +6551,8 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
);
|
||||
|
||||
if (NS_SUCCEEDED(result) && pos.mResultFrame){
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
if (result == NS_OK)
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
resultFrame = pos.mResultFrame;
|
||||
mainframe = resultFrame;
|
||||
}
|
||||
|
@ -6563,7 +6565,26 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (NS_COMFALSE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
result = GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
//get the selection controller
|
||||
if (NS_SUCCEEDED(result) && selCon)
|
||||
{
|
||||
PRInt16 displayresult;
|
||||
selCon->GetDisplaySelection(&displayresult);
|
||||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (frameselection)
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
|
|
|
@ -6478,6 +6478,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
@ -6492,8 +6493,9 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
result = mainframe->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsPeekOffsetStruct pos;
|
||||
|
||||
while(NS_SUCCEEDED(result))
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
|
||||
|
||||
|
@ -6537,7 +6539,6 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
nsPeekOffsetStruct pos;
|
||||
pos.mTracker = tracker;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
|
@ -6550,7 +6551,8 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
);
|
||||
|
||||
if (NS_SUCCEEDED(result) && pos.mResultFrame){
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
if (result == NS_OK)
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
resultFrame = pos.mResultFrame;
|
||||
mainframe = resultFrame;
|
||||
}
|
||||
|
@ -6563,7 +6565,26 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (NS_COMFALSE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
result = GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
//get the selection controller
|
||||
if (NS_SUCCEEDED(result) && selCon)
|
||||
{
|
||||
PRInt16 displayresult;
|
||||
selCon->GetDisplaySelection(&displayresult);
|
||||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (frameselection)
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
|
|
|
@ -6478,6 +6478,7 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
@ -6492,8 +6493,9 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
result = mainframe->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsPeekOffsetStruct pos;
|
||||
|
||||
while(NS_SUCCEEDED(result))
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
|
||||
|
||||
|
@ -6537,7 +6539,6 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
nsPeekOffsetStruct pos;
|
||||
pos.mTracker = tracker;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
|
@ -6550,7 +6551,8 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
);
|
||||
|
||||
if (NS_SUCCEEDED(result) && pos.mResultFrame){
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
if (result == NS_OK)
|
||||
result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator),getter_AddRefs(it));//if this fails thats ok
|
||||
resultFrame = pos.mResultFrame;
|
||||
mainframe = resultFrame;
|
||||
}
|
||||
|
@ -6563,7 +6565,26 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (NS_COMFALSE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
result = GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
//get the selection controller
|
||||
if (NS_SUCCEEDED(result) && selCon)
|
||||
{
|
||||
PRInt16 displayresult;
|
||||
selCon->GetDisplaySelection(&displayresult);
|
||||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (frameselection)
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
|
|
|
@ -2707,6 +2707,50 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
|
|||
return result;
|
||||
point.y = tempRect.height + offset.y;
|
||||
|
||||
//special check. if we allow non-text selection then we can allow a hit location to fall before a table.
|
||||
//otherwise there is no way to get and click signal to fall before a table (it being a line iterator itself)
|
||||
PRBool isEditor = PR_FALSE;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
shell->GetDisplayNonTextSelection ( &isEditor );
|
||||
if ( isEditor )
|
||||
{
|
||||
nsIAtom *resultFrameType;
|
||||
if(NS_SUCCEEDED(resultFrame->GetFrameType(&resultFrameType)) && resultFrameType)
|
||||
{
|
||||
if (resultFrameType == nsLayoutAtoms::tableOuterFrame)
|
||||
{
|
||||
if (((point.x - offset.x + tempRect.x)<0) || ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
resultFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
if (content)
|
||||
{
|
||||
content->GetParent(*getter_AddRefs(parent));
|
||||
if (parent)
|
||||
{
|
||||
aPos->mResultContent = parent;
|
||||
parent->IndexOf(content, aPos->mContentOffset);
|
||||
aPos->mPreferLeft = PR_FALSE;
|
||||
if ((point.x - offset.x+ tempRect.x)>tempRect.width)
|
||||
{
|
||||
aPos->mContentOffset++;//go to end of this frame
|
||||
aPos->mPreferLeft = PR_TRUE;
|
||||
}
|
||||
aPos->mContentOffsetEnd = aPos->mContentOffset;
|
||||
//result frame is the result frames parent.
|
||||
resultFrame->GetParent(&aPos->mResultFrame);
|
||||
return NS_COMFALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(resultFrame->GetView(aPresContext, &view)) || !view)
|
||||
{
|
||||
result = resultFrame->GetContentAndOffsetsFromPoint(context,point,
|
||||
|
@ -3107,7 +3151,9 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
|
|||
}
|
||||
//this block is now one child down from blockframe
|
||||
if (NS_FAILED(result) || !it || !blockFrame || !thisBlock)
|
||||
{
|
||||
return ((result) ? result : NS_ERROR_FAILURE);
|
||||
}
|
||||
result = it->FindLineContaining(thisBlock, &thisLine);
|
||||
if (NS_FAILED(result) || thisLine <0)
|
||||
return result;
|
||||
|
|
Загрузка…
Ссылка в новой задаче