mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Landing changes from CHIMERA_M1_0_1_BRANCH. Code that depends on other mozilla changes is #ifdef'd BRANCH_CHANGES_NEED_MERGED.
This commit is contained in:
parent
513721f882
commit
c2ebb735d9
@ -1627,19 +1627,76 @@ NS_IMETHODIMP nsChildView::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
|
|||||||
NSRect horizInvalid = frame;
|
NSRect horizInvalid = frame;
|
||||||
NSRect vertInvalid = frame;
|
NSRect vertInvalid = frame;
|
||||||
|
|
||||||
horizInvalid.size.width = abs(aDx);
|
if (aDx != 0) {
|
||||||
vertInvalid.size.height = abs(aDy);
|
horizInvalid.size.width = abs(aDx);
|
||||||
if (aDy < 0)
|
if (aDx < 0)
|
||||||
vertInvalid.origin.y = frame.origin.y + frame.size.height + aDy;
|
horizInvalid.origin.x = frame.origin.x + frame.size.width + aDx;
|
||||||
if (aDx < 0)
|
|
||||||
horizInvalid.origin.x = frame.origin.x + frame.size.width + aDx;
|
|
||||||
|
|
||||||
if (aDx != 0)
|
|
||||||
[mView setNeedsDisplayInRect: horizInvalid];
|
[mView setNeedsDisplayInRect: horizInvalid];
|
||||||
|
}
|
||||||
if (aDy != 0)
|
|
||||||
[mView setNeedsDisplayInRect: vertInvalid];
|
|
||||||
|
|
||||||
|
if (aDy != 0) {
|
||||||
|
vertInvalid.size.height = abs(aDy);
|
||||||
|
if (aDy < 0)
|
||||||
|
vertInvalid.origin.y = frame.origin.y + frame.size.height + aDy;
|
||||||
|
[mView setNeedsDisplayInRect: vertInvalid];
|
||||||
|
}
|
||||||
|
|
||||||
|
// We also need to check for any ChildViews which overlap this widget
|
||||||
|
// but are not descendent widgets. If there are any, we need to
|
||||||
|
// invalidate the area of this view that these ChildViews will have been
|
||||||
|
// blitted into, since these widgets aren't supposed to scroll with
|
||||||
|
// this widget.
|
||||||
|
|
||||||
|
// To do this, start at the root Gecko NSView, and walk down along
|
||||||
|
// our ancestor view chain, looking at all the subviews in each level
|
||||||
|
// of the hierarchy. If we find a non-ancestor view that overlaps
|
||||||
|
// this view, invalidate the area around it.
|
||||||
|
|
||||||
|
// We need to convert all rects to a common ancestor view to intersect
|
||||||
|
// them, since a view's frame is in the coordinate space of its parent.
|
||||||
|
// Use mParentView as the frame of reference.
|
||||||
|
NSRect selfFrame = [mParentView convertRect:[mView frame] fromView:[mView superview]];
|
||||||
|
NSView* view = mParentView;
|
||||||
|
BOOL selfLevel = NO;
|
||||||
|
|
||||||
|
while (!selfLevel) {
|
||||||
|
NSView* nextAncestorView;
|
||||||
|
NSArray* subviews = [view subviews];
|
||||||
|
for (int i = 0; i < [subviews count]; ++i) {
|
||||||
|
NSView* subView = [subviews objectAtIndex: i];
|
||||||
|
if (subView == mView)
|
||||||
|
selfLevel = YES;
|
||||||
|
else if ([mView isDescendantOf:subView])
|
||||||
|
nextAncestorView = subView;
|
||||||
|
else {
|
||||||
|
NSRect intersectArea = NSIntersectionRect([mParentView convertRect:[subView frame] fromView:[subView superview]], selfFrame);
|
||||||
|
if (!NSIsEmptyRect(intersectArea)) {
|
||||||
|
NSPoint origin = [mView convertPoint:intersectArea.origin fromView:mParentView];
|
||||||
|
|
||||||
|
if (aDy != 0) {
|
||||||
|
vertInvalid.origin.x = origin.x;
|
||||||
|
if (aDy < 0) // scrolled down, invalidate above
|
||||||
|
vertInvalid.origin.y = origin.y + aDy;
|
||||||
|
else // invalidate below
|
||||||
|
vertInvalid.origin.y = origin.y + intersectArea.size.height;
|
||||||
|
vertInvalid.size.width = intersectArea.size.width;
|
||||||
|
[mView setNeedsDisplayInRect: vertInvalid];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aDx != 0) {
|
||||||
|
horizInvalid.origin.y = origin.y;
|
||||||
|
if (aDx < 0) // scrolled right, invalidate to the left
|
||||||
|
horizInvalid.origin.x = origin.x + aDx;
|
||||||
|
else // invalidate to the right
|
||||||
|
horizInvalid.origin.x = origin.x + intersectArea.size.width;
|
||||||
|
horizInvalid.size.height = intersectArea.size.height;
|
||||||
|
[mView setNeedsDisplayInRect: horizInvalid];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
view = nextAncestorView;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
#include "nsMimeMapper.h"
|
#include "nsMimeMapper.h"
|
||||||
|
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsXPCOM.h"
|
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsPrimitiveHelpers.h"
|
#include "nsPrimitiveHelpers.h"
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#include "nsClipboard.h"
|
#include "nsClipboard.h"
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsXPCOM.h"
|
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
@ -553,7 +552,7 @@ printf("looking for data in type %s, mac flavor %ld\n", NS_STATIC_CAST(const cha
|
|||||||
// check if it is present in the current drag item.
|
// check if it is present in the current drag item.
|
||||||
FlavorFlags unused;
|
FlavorFlags unused;
|
||||||
PRBool dataFound = PR_FALSE;
|
PRBool dataFound = PR_FALSE;
|
||||||
void* dataBuff;
|
void* dataBuff = nsnull;
|
||||||
PRInt32 dataSize = 0;
|
PRInt32 dataSize = 0;
|
||||||
if ( macOSFlavor && ::GetFlavorFlags(mDragRef, itemRef, macOSFlavor, &unused) == noErr ) {
|
if ( macOSFlavor && ::GetFlavorFlags(mDragRef, itemRef, macOSFlavor, &unused) == noErr ) {
|
||||||
nsresult loadResult = ExtractDataFromOS(mDragRef, itemRef, macOSFlavor, &dataBuff, &dataSize);
|
nsresult loadResult = ExtractDataFromOS(mDragRef, itemRef, macOSFlavor, &dataBuff, &dataSize);
|
||||||
@ -584,17 +583,38 @@ printf("looking for data in type %s, mac flavor %ld\n", NS_STATIC_CAST(const cha
|
|||||||
} // if looking for text/unicode
|
} // if looking for text/unicode
|
||||||
} // else we try one last ditch effort to find our data
|
} // else we try one last ditch effort to find our data
|
||||||
|
|
||||||
if ( dataFound ) {
|
if ( dataFound )
|
||||||
|
{
|
||||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
nsCOMPtr<nsISupports> genericDataWrapper;
|
||||||
if ( strcmp(flavorStr, kFileMime) == 0 ) {
|
if (strcmp(flavorStr, kFileMime) == 0)
|
||||||
// we have a HFSFlavor struct in |dataBuff|. Create an nsLocalFileMac object.
|
{
|
||||||
HFSFlavor* fileData = NS_REINTERPRET_CAST(HFSFlavor*, dataBuff);
|
// we have a HFSFlavor struct in |dataBuff|. Create an nsLocalFileMac object.
|
||||||
NS_ASSERTION ( sizeof(HFSFlavor) == dataSize, "Ooops, we realy don't have a HFSFlavor" );
|
HFSFlavor* fileData = NS_REINTERPRET_CAST(HFSFlavor*, dataBuff);
|
||||||
nsCOMPtr<nsILocalFileMac> file;
|
NS_ASSERTION ( sizeof(HFSFlavor) == dataSize, "Ooops, we realy don't have a HFSFlavor" );
|
||||||
if ( NS_SUCCEEDED(NS_NewLocalFileWithFSSpec(&fileData->fileSpec, PR_TRUE, getter_AddRefs(file))) )
|
nsCOMPtr<nsILocalFileMac> file;
|
||||||
genericDataWrapper = do_QueryInterface(file);
|
if ( NS_SUCCEEDED(NS_NewLocalFileWithFSSpec(&fileData->fileSpec, PR_TRUE, getter_AddRefs(file))) )
|
||||||
}
|
genericDataWrapper = do_QueryInterface(file);
|
||||||
else {
|
}
|
||||||
|
#ifdef BRANCH_CHANGES_NEED_MERGED
|
||||||
|
else if ((strcmp(flavorStr, kURLDataMime) == 0) || (strcmp(flavorStr, kURLDescriptionMime) == 0))
|
||||||
|
{
|
||||||
|
// need to convert platform data to unicode
|
||||||
|
const char* castedText = NS_REINTERPRET_CAST(char*, dataBuff);
|
||||||
|
PRUnichar* convertedText = nsnull;
|
||||||
|
PRInt32 convertedTextLen = 0;
|
||||||
|
nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode(castedText, dataSize,
|
||||||
|
&convertedText, &convertedTextLen);
|
||||||
|
if (convertedText)
|
||||||
|
{
|
||||||
|
nsMemory::Free(dataBuff);
|
||||||
|
dataBuff = convertedText;
|
||||||
|
dataSize = convertedTextLen * 2;
|
||||||
|
nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, (void *)dataBuff, dataSize, getter_AddRefs(genericDataWrapper));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
{
|
||||||
// we probably have some form of text. The DOM only wants LF, so convert k
|
// we probably have some form of text. The DOM only wants LF, so convert k
|
||||||
// from MacOS line endings to DOM line endings.
|
// from MacOS line endings to DOM line endings.
|
||||||
nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks ( flavorStr, &dataBuff, NS_REINTERPRET_CAST(int*, &dataSize) );
|
nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks ( flavorStr, &dataBuff, NS_REINTERPRET_CAST(int*, &dataSize) );
|
||||||
@ -808,11 +828,22 @@ nsDragService :: GetDataForFlavor ( nsISupportsArray* inDragItems, DragReference
|
|||||||
// if someone was asking for text/plain, lookup unicode instead so we can convert it.
|
// if someone was asking for text/plain, lookup unicode instead so we can convert it.
|
||||||
PRBool needToDoConversionToPlainText = PR_FALSE;
|
PRBool needToDoConversionToPlainText = PR_FALSE;
|
||||||
const char* actualFlavor = mimeFlavor.get();
|
const char* actualFlavor = mimeFlavor.get();
|
||||||
if ( strcmp(actualFlavor,kTextMime) == 0 ) {
|
if (strcmp(actualFlavor, kTextMime) == 0)
|
||||||
|
{
|
||||||
actualFlavor = kUnicodeMime;
|
actualFlavor = kUnicodeMime;
|
||||||
needToDoConversionToPlainText = PR_TRUE;
|
needToDoConversionToPlainText = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if ( strcmp(actualFlavor, kFilePromiseMime) == 0 ) {
|
#ifdef BRANCH_CHANGES_NEED_MERGED
|
||||||
|
else if (strcmp(actualFlavor, kURLDataMime) == 0)
|
||||||
|
{
|
||||||
|
needToDoConversionToPlainText = PR_TRUE;
|
||||||
|
}
|
||||||
|
else if (strcmp(actualFlavor, kURLDescriptionMime) == 0)
|
||||||
|
{
|
||||||
|
needToDoConversionToPlainText = PR_TRUE;
|
||||||
|
}
|
||||||
|
else if (strcmp(actualFlavor, kFilePromiseMime) == 0)
|
||||||
|
{
|
||||||
nsCOMPtr<nsISupports> imageURLPrimitive;
|
nsCOMPtr<nsISupports> imageURLPrimitive;
|
||||||
PRUint32 dataSize = 0;
|
PRUint32 dataSize = 0;
|
||||||
rv = item->GetTransferData(kFilePromiseURLMime, getter_AddRefs(imageURLPrimitive), &dataSize);
|
rv = item->GetTransferData(kFilePromiseURLMime, getter_AddRefs(imageURLPrimitive), &dataSize);
|
||||||
@ -834,7 +865,9 @@ nsDragService :: GetDataForFlavor ( nsISupportsArray* inDragItems, DragReference
|
|||||||
|
|
||||||
return HandleHFSPromiseDrop(inDragRef, inItemIndex, inFlavor, imageURLString, outData, outDataSize);
|
return HandleHFSPromiseDrop(inDragRef, inItemIndex, inFlavor, imageURLString, outData, outDataSize);
|
||||||
}
|
}
|
||||||
else if ( strcmp(actualFlavor, kNativeImageMime) == 0 ) {
|
#endif
|
||||||
|
else if (strcmp(actualFlavor, kNativeImageMime) == 0)
|
||||||
|
{
|
||||||
PRUint32 dataSize = 0;
|
PRUint32 dataSize = 0;
|
||||||
nsCOMPtr<nsISupports> transferSupports;
|
nsCOMPtr<nsISupports> transferSupports;
|
||||||
rv = item->GetTransferData(actualFlavor, getter_AddRefs(transferSupports), &dataSize);
|
rv = item->GetTransferData(actualFlavor, getter_AddRefs(transferSupports), &dataSize);
|
||||||
@ -853,7 +886,9 @@ nsDragService :: GetDataForFlavor ( nsISupportsArray* inDragItems, DragReference
|
|||||||
if (!picture) return cantGetFlavorErr;
|
if (!picture) return cantGetFlavorErr;
|
||||||
|
|
||||||
PRInt32 pictSize = ::GetHandleSize((Handle)picture);
|
PRInt32 pictSize = ::GetHandleSize((Handle)picture);
|
||||||
char* pictData = (char*)nsMemory::Alloc(pictSize);
|
char* pictData = nsnull;
|
||||||
|
if (pictSize > 0)
|
||||||
|
pictData = (char*)nsMemory::Alloc(pictSize);
|
||||||
if (pictData) {
|
if (pictData) {
|
||||||
::BlockMoveData(*picture, pictData, pictSize); // doesn't move memory
|
::BlockMoveData(*picture, pictData, pictSize); // doesn't move memory
|
||||||
*outData = (void*)pictData;
|
*outData = (void*)pictData;
|
||||||
@ -862,13 +897,14 @@ nsDragService :: GetDataForFlavor ( nsISupportsArray* inDragItems, DragReference
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
retVal = cantGetFlavorErr;
|
retVal = cantGetFlavorErr;
|
||||||
|
|
||||||
::KillPicture(picture);
|
::KillPicture(picture);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> data;
|
nsCOMPtr<nsISupports> data;
|
||||||
if ( NS_SUCCEEDED(item->GetTransferData(actualFlavor, getter_AddRefs(data), outDataSize)) ) {
|
if (NS_SUCCEEDED(item->GetTransferData(actualFlavor, getter_AddRefs(data), outDataSize)))
|
||||||
|
{
|
||||||
nsPrimitiveHelpers::CreateDataFromPrimitive ( actualFlavor, data, outData, *outDataSize );
|
nsPrimitiveHelpers::CreateDataFromPrimitive ( actualFlavor, data, outData, *outDataSize );
|
||||||
|
|
||||||
// Convert unix to mac linebreaks, since mac linebreaks are required for clipboard compatibility.
|
// Convert unix to mac linebreaks, since mac linebreaks are required for clipboard compatibility.
|
||||||
@ -886,7 +922,7 @@ nsDragService :: GetDataForFlavor ( nsISupportsArray* inDragItems, DragReference
|
|||||||
if ( needToDoConversionToPlainText ) {
|
if ( needToDoConversionToPlainText ) {
|
||||||
char* plainTextData = nsnull;
|
char* plainTextData = nsnull;
|
||||||
PRInt32 plainTextLen = 0;
|
PRInt32 plainTextLen = 0;
|
||||||
nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText ( castedUnicode, *outDataSize / 2, &plainTextData, &plainTextLen );
|
nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText(castedUnicode, *outDataSize / 2, &plainTextData, &plainTextLen);
|
||||||
if ( *outData ) {
|
if ( *outData ) {
|
||||||
nsMemory::Free(*outData);
|
nsMemory::Free(*outData);
|
||||||
*outData = plainTextData;
|
*outData = plainTextData;
|
||||||
@ -1113,7 +1149,7 @@ static OSErr GetFolderFileSpec(const FSSpec *inFolderSpec, ConstStr255Param inFi
|
|||||||
return ::FSMakeFSSpec(inFolderSpec->vRefNum, cipbp.dirInfo.ioDrDirID, inFileName, outFSSpec);
|
return ::FSMakeFSSpec(inFolderSpec->vRefNum, cipbp.dirInfo.ioDrDirID, inFileName, outFSSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BRANCH_CHANGES_NEED_MERGED
|
||||||
OSErr
|
OSErr
|
||||||
nsDragService::HandleHFSPromiseDrop(DragReference inDragRef, unsigned int inItemIndex,
|
nsDragService::HandleHFSPromiseDrop(DragReference inDragRef, unsigned int inItemIndex,
|
||||||
FlavorType inFlavor, const nsAString& inSourceURL, void** outData, unsigned int* outDataSize)
|
FlavorType inFlavor, const nsAString& inSourceURL, void** outData, unsigned int* outDataSize)
|
||||||
@ -1166,5 +1202,5 @@ nsDragService::HandleHFSPromiseDrop(DragReference inDragRef, unsigned int inItem
|
|||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -95,8 +95,10 @@ private:
|
|||||||
// compute a screen rect from the frame associated with the given dom node
|
// compute a screen rect from the frame associated with the given dom node
|
||||||
PRBool ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScreenRect ) ;
|
PRBool ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScreenRect ) ;
|
||||||
|
|
||||||
|
#ifdef BRANCH_CHANGES_NEED_MERGED
|
||||||
OSErr HandleHFSPromiseDrop(DragReference inDragRef, unsigned int inItemIndex,
|
OSErr HandleHFSPromiseDrop(DragReference inDragRef, unsigned int inItemIndex,
|
||||||
FlavorType inFlavor, const nsAString& inSourceURL, void** outData, unsigned int* outDataSize);
|
FlavorType inFlavor, const nsAString& inSourceURL, void** outData, unsigned int* outDataSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
// callback for the MacOS DragManager when a drop site asks for data
|
// callback for the MacOS DragManager when a drop site asks for data
|
||||||
static pascal OSErr DragSendDataProc ( FlavorType inFlavor, void* inRefCon,
|
static pascal OSErr DragSendDataProc ( FlavorType inFlavor, void* inRefCon,
|
||||||
|
@ -96,10 +96,6 @@ static NS_DEFINE_CID(kMenuItemCID, NS_MENUITEM_CID);
|
|||||||
class nsDummyMenuItemX : public nsISupports {
|
class nsDummyMenuItemX : public nsISupports {
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
nsDummyMenuItemX()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsrefcnt) nsDummyMenuItemX::AddRef() { return ++mRefCnt; }
|
NS_IMETHODIMP_(nsrefcnt) nsDummyMenuItemX::AddRef() { return ++mRefCnt; }
|
||||||
|
@ -170,7 +170,7 @@ static nsModuleComponentInfo components[] =
|
|||||||
NS_DRAGHELPERSERVICE_CID,
|
NS_DRAGHELPERSERVICE_CID,
|
||||||
"@mozilla.org/widget/draghelperservice;1",
|
"@mozilla.org/widget/draghelperservice;1",
|
||||||
nsDragHelperServiceConstructor },
|
nsDragHelperServiceConstructor },
|
||||||
{ "Gtk Bidi Keyboard",
|
{ "Cocoa Bidi Keyboard",
|
||||||
NS_BIDIKEYBOARD_CID,
|
NS_BIDIKEYBOARD_CID,
|
||||||
"@mozilla.org/widget/bidikeyboard;1",
|
"@mozilla.org/widget/bidikeyboard;1",
|
||||||
nsBidiKeyboardConstructor },
|
nsBidiKeyboardConstructor },
|
||||||
|
Loading…
Reference in New Issue
Block a user