Remove non-cairo gfx support from cocoa widgets. This isn't going to work soon anyway, camino can't build without cairo already, and it is a lot of clutter. Carbon widgets will still build with non-cairo gfx. b=364379 r=smorgan r=mento sr=pinkerton

This commit is contained in:
joshmoz%gmail.com 2006-12-19 20:47:53 +00:00
Родитель 01611874f2
Коммит 432d318547
9 изменённых файлов: 21 добавлений и 1459 удалений

Просмотреть файл

@ -72,15 +72,13 @@ REQUIRES = xpcom \
unicharutil \ unicharutil \
exthandler \ exthandler \
appshell \ appshell \
thebes \
cairo \
$(NULL) $(NULL)
ifdef MOZ_ENABLE_CAIRO_GFX
REQUIRES += thebes cairo
ifdef MOZ_ENABLE_GLITZ ifdef MOZ_ENABLE_GLITZ
REQUIRES += glitz glitzagl REQUIRES += glitz glitzagl
endif endif
endif
ifdef ACCESSIBILITY ifdef ACCESSIBILITY
REQUIRES += accessibility REQUIRES += accessibility
@ -97,20 +95,11 @@ MAC_LCPPSRCS = \
nsPrintSessionX.cpp \ nsPrintSessionX.cpp \
$(NULL) $(NULL)
ifndef MOZ_ENABLE_CAIRO_GFX
MAC_LCPPSRCS += nsNativeThemeMac.cpp \
$(NULL)
endif
CPPSRCS = \ CPPSRCS = \
$(MAC_LCPPSRCS) \ $(MAC_LCPPSRCS) \
nsNativeThemeCocoa.cpp \
$(NULL) $(NULL)
ifdef MOZ_ENABLE_CAIRO_GFX
CPPSRCS += nsNativeThemeCocoa.cpp
endif
CMMSRCS = \ CMMSRCS = \
nsBidiKeyboard.mm \ nsBidiKeyboard.mm \
nsClipboard.mm \ nsClipboard.mm \
@ -150,12 +139,9 @@ EXTRA_DSO_LDOPTS += \
$(TK_LIBS) \ $(TK_LIBS) \
$(call EXPAND_LIBNAME_PATH,gkgfx,$(DEPTH)/gfx/src) \ $(call EXPAND_LIBNAME_PATH,gkgfx,$(DEPTH)/gfx/src) \
$(MOZ_COMPONENT_LIBS) \ $(MOZ_COMPONENT_LIBS) \
-lthebes \
$(NULL) $(NULL)
ifdef MOZ_ENABLE_CAIRO_GFX
EXTRA_DSO_LDOPTS += -lthebes
endif
GARBAGE += $(GFX_LCPPSRCS) $(MAC_LCPPSRCS) GARBAGE += $(GFX_LCPPSRCS) $(MAC_LCPPSRCS)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -65,10 +65,7 @@
#include "nsplugindefs.h" #include "nsplugindefs.h"
#include <Quickdraw.h> #include <Quickdraw.h>
#ifdef MOZ_CAIRO_GFX
class gfxASurface; class gfxASurface;
#endif
#define NSRGB_2_COLOREF(color) \ #define NSRGB_2_COLOREF(color) \
RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color)) RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
@ -80,18 +77,11 @@ struct nsPluginPort;
class nsChildView; class nsChildView;
// Depending on whether we're on cairo, and if accessibility is on, we support different @protocols @interface ChildView : NSView<
// and have a different superclass.
@interface ChildView :
#ifdef MOZ_CAIRO_GFX
NSView<
#else
NSQuickDrawView<
#endif
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
mozAccessible, mozAccessible,
#endif #endif
mozView, NSTextInput> mozView, NSTextInput>
{ {
@private @private
NSWindow* mWindow; // shortcut to the top window, [WEAK] NSWindow* mWindow; // shortcut to the top window, [WEAK]
@ -243,11 +233,6 @@ public:
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus); NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent); virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent);
#ifndef MOZ_CAIRO_GFX
virtual void StartDraw(nsIRenderingContext* aRenderingContext = nsnull);
virtual void EndDraw();
void UpdateWidget(nsRect& aRect, nsIRenderingContext* aContext, nsIRegion *aRegion);
#endif
NS_IMETHOD Update(); NS_IMETHOD Update();
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY); virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
@ -292,9 +277,8 @@ public:
void GetDocumentAccessible(nsIAccessible** aAccessible); void GetDocumentAccessible(nsIAccessible** aAccessible);
#endif #endif
#ifdef MOZ_CAIRO_GFX
virtual gfxASurface* GetThebesSurface(); virtual gfxASurface* GetThebesSurface();
#endif
protected: protected:
PRBool ReportDestroyEvent(); PRBool ReportDestroyEvent();
@ -324,22 +308,14 @@ protected:
NSView<mozView>* mParentView; NSView<mozView>* mParentView;
nsIWidget* mParentWidget; nsIWidget* mParentWidget;
#ifndef MOZ_CAIRO_GFX
nsCOMPtr<nsIFontMetrics> mFontMetrics;
nsCOMPtr<nsIRenderingContext> mTempRenderingContext;
PRPackedBool mTempRenderingContextMadeHere;
#endif
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
// weak ref to this childview's associated mozAccessible for speed reasons // weak ref to this childview's associated mozAccessible for speed reasons
// (we get queried for it *a lot* but don't want to own it) // (we get queried for it *a lot* but don't want to own it)
nsWeakPtr mAccessible; nsWeakPtr mAccessible;
#endif #endif
#ifdef MOZ_CAIRO_GFX
nsRefPtr<gfxASurface> mTempThebesSurface; nsRefPtr<gfxASurface> mTempThebesSurface;
#endif
PRPackedBool mDestructorCalled; PRPackedBool mDestructorCalled;
PRPackedBool mVisible; PRPackedBool mVisible;

Просмотреть файл

@ -68,7 +68,6 @@
static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
#ifdef MOZ_CAIRO_GFX
#include "gfxContext.h" #include "gfxContext.h"
#include "gfxQuartzSurface.h" #include "gfxQuartzSurface.h"
@ -80,10 +79,6 @@ CG_EXTERN void CGContextResetClip (CGContextRef);
#undef DEBUG_UPDATE #undef DEBUG_UPDATE
#else
#include "nsGfxUtils.h" // for StPortSetter
#endif
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
#include "nsIAccessible.h" #include "nsIAccessible.h"
@ -337,9 +332,6 @@ nsChildView::nsChildView() : nsBaseWidget()
, mView(nsnull) , mView(nsnull)
, mParentView(nsnull) , mParentView(nsnull)
, mParentWidget(nsnull) , mParentWidget(nsnull)
#ifndef MOZ_CAIRO_GFX
, mTempRenderingContextMadeHere(PR_FALSE)
#endif
, mDestructorCalled(PR_FALSE) , mDestructorCalled(PR_FALSE)
, mVisible(PR_FALSE) , mVisible(PR_FALSE)
, mDrawing(PR_FALSE) , mDrawing(PR_FALSE)
@ -757,11 +749,7 @@ NS_IMETHODIMP nsChildView::SetFocus(PRBool aRaise)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
nsIFontMetrics* nsChildView::GetFont(void) nsIFontMetrics* nsChildView::GetFont(void)
{ {
#ifdef MOZ_CAIRO_GFX
return nsnull; return nsnull;
#else
return mFontMetrics;
#endif
} }
@ -772,14 +760,7 @@ nsIFontMetrics* nsChildView::GetFont(void)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsChildView::SetFont(const nsFont &aFont) NS_IMETHODIMP nsChildView::SetFont(const nsFont &aFont)
{ {
#ifdef MOZ_CAIRO_GFX
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
#else
mFontMetrics = nsnull;
if (mContext)
mContext->GetMetricsFor(aFont, *getter_AddRefs(mFontMetrics));
return NS_OK;
#endif
} }
@ -1274,77 +1255,6 @@ inline PRUint16 COLOR8TOCOLOR16(PRUint8 color8)
} }
#ifndef MOZ_CAIRO_GFX
//-------------------------------------------------------------------------
// StartDraw
//
//-------------------------------------------------------------------------
void nsChildView::StartDraw(nsIRenderingContext* aRenderingContext)
{
if (mDrawing)
return;
mDrawing = PR_TRUE;
if (aRenderingContext == nsnull) {
// make sure we have a rendering context
mTempRenderingContext = getter_AddRefs(GetRenderingContext());
mTempRenderingContextMadeHere = PR_TRUE;
}
else {
// if we already have a rendering context, save its state
mTempRenderingContext = aRenderingContext;
mTempRenderingContextMadeHere = PR_FALSE;
mTempRenderingContext->PushState();
// set the environment to the current widget
mTempRenderingContext->Init(mContext, this);
}
// set the widget font. nsMacControl implements SetFont, which is where
// the font should get set.
if (mFontMetrics) {
mTempRenderingContext->SetFont(mFontMetrics);
}
// set the widget background and foreground colors
nscolor color = GetBackgroundColor();
RGBColor macColor;
macColor.red = COLOR8TOCOLOR16(NS_GET_R(color));
macColor.green = COLOR8TOCOLOR16(NS_GET_G(color));
macColor.blue = COLOR8TOCOLOR16(NS_GET_B(color));
::RGBBackColor(&macColor);
color = GetForegroundColor();
macColor.red = COLOR8TOCOLOR16(NS_GET_R(color));
macColor.green = COLOR8TOCOLOR16(NS_GET_G(color));
macColor.blue = COLOR8TOCOLOR16(NS_GET_B(color));
::RGBForeColor(&macColor);
mTempRenderingContext->SetColor(color); // just in case, set the rendering context color too
}
//-------------------------------------------------------------------------
// EndDraw
//
//-------------------------------------------------------------------------
void nsChildView::EndDraw()
{
if (!mDrawing)
return;
mDrawing = PR_FALSE;
if (mTempRenderingContextMadeHere)
mTempRenderingContext->PopState();
mTempRenderingContext = nsnull;
}
#endif /* MOZ_CAIRO_GFX */
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
void void
nsChildView::Flash(nsPaintEvent &aEvent) nsChildView::Flash(nsPaintEvent &aEvent)
{ {
@ -1392,54 +1302,6 @@ NS_IMETHODIMP nsChildView::Update()
#pragma mark - #pragma mark -
#ifndef MOZ_CAIRO_GFX
//
// UpdateWidget
//
// Dispatches the Paint event into Gecko. Usually called from our
// NSView in response to the display system noticing that something
// needs repainting. We don't have to worry about painting our child views
// because the display system will take care of that for us.
//
void
nsChildView::UpdateWidget(nsRect& aRect, nsIRenderingContext* aContext, nsIRegion *aRegion)
{
if (! mVisible)
return;
// For updating widgets, we _always_ want to use the NSQuickDrawView's port,
// since that's the correct port for gecko to use to make rendering contexts.
// The plugin is the only thing that uses the plugin port.
GrafPtr curPort = GetChildViewQuickDrawPort();
if (!curPort) return;
StPortSetter port(curPort);
// initialize the paint event
nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, this);
paintEvent.renderingContext = aContext; // nsPaintEvent
paintEvent.rect = &aRect;
paintEvent.region = aRegion;
// offscreen drawing is pointless.
if (paintEvent.rect->x < 0)
paintEvent.rect->x = 0;
if (paintEvent.rect->y < 0)
paintEvent.rect->y = 0;
// draw the widget
StartDraw(aContext);
if ( OnPaint(paintEvent) ) {
nsEventStatus eventStatus;
DispatchWindowEvent(paintEvent,eventStatus);
if(eventStatus != nsEventStatus_eIgnore)
Flash(paintEvent);
}
EndDraw();
}
#endif
// //
// Scroll // Scroll
// //
@ -1611,7 +1473,7 @@ NS_IMETHODIMP nsChildView::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStat
return NS_OK; return NS_OK;
} }
//-------------------------------------------------------------------------
PRBool nsChildView::DispatchWindowEvent(nsGUIEvent &event) PRBool nsChildView::DispatchWindowEvent(nsGUIEvent &event)
{ {
nsEventStatus status; nsEventStatus status;
@ -1619,18 +1481,15 @@ PRBool nsChildView::DispatchWindowEvent(nsGUIEvent &event)
return ConvertStatus(status); return ConvertStatus(status);
} }
//-------------------------------------------------------------------------
PRBool nsChildView::DispatchWindowEvent(nsGUIEvent &event,nsEventStatus &aStatus) PRBool nsChildView::DispatchWindowEvent(nsGUIEvent &event,nsEventStatus &aStatus)
{ {
DispatchEvent(&event, aStatus); DispatchEvent(&event, aStatus);
return ConvertStatus(aStatus); return ConvertStatus(aStatus);
} }
//-------------------------------------------------------------------------
//
// Deal with all sort of mouse event // Deal with all sort of mouse event
//
//-------------------------------------------------------------------------
PRBool nsChildView::DispatchMouseEvent(nsMouseEvent &aEvent) PRBool nsChildView::DispatchMouseEvent(nsMouseEvent &aEvent)
{ {
PRBool result = PR_FALSE; PRBool result = PR_FALSE;
@ -1659,12 +1518,10 @@ PRBool nsChildView::DispatchMouseEvent(nsMouseEvent &aEvent)
return result; return result;
} }
#pragma mark - #pragma mark -
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool nsChildView::ReportDestroyEvent() PRBool nsChildView::ReportDestroyEvent()
{ {
// nsEvent // nsEvent
@ -1675,10 +1532,7 @@ PRBool nsChildView::ReportDestroyEvent()
return (DispatchWindowEvent(event)); return (DispatchWindowEvent(event));
} }
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool nsChildView::ReportMoveEvent() PRBool nsChildView::ReportMoveEvent()
{ {
// nsEvent // nsEvent
@ -1691,10 +1545,7 @@ PRBool nsChildView::ReportMoveEvent()
return (DispatchWindowEvent(moveEvent)); return (DispatchWindowEvent(moveEvent));
} }
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool nsChildView::ReportSizeEvent() PRBool nsChildView::ReportSizeEvent()
{ {
// nsEvent // nsEvent
@ -1711,29 +1562,21 @@ PRBool nsChildView::ReportSizeEvent()
} }
#pragma mark - #pragma mark -
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
void nsChildView::CalcWindowRegions() void nsChildView::CalcWindowRegions()
{ {
// i don't think this is necessary anymore... // i don't think this is necessary anymore...
} }
//-------------------------------------------------------------------------
/* Calculate the x and y offsets for this particular widget /* Calculate the x and y offsets for this particular widget
* @update ps 09/22/98 * @update ps 09/22/98
* @param aX -- x offset amount * @param aX -- x offset amount
* @param aY -- y offset amount * @param aY -- y offset amount
* @return NOTHING * @return NOTHING
*/ */
NS_IMETHODIMP nsChildView::CalcOffset(PRInt32 &aX,PRInt32 &aY) NS_IMETHODIMP nsChildView::CalcOffset(PRInt32 &aX,PRInt32 &aY)
{ {
aX = aY = 0; aX = aY = 0;
@ -1746,10 +1589,7 @@ NS_IMETHODIMP nsChildView::CalcOffset(PRInt32 &aX,PRInt32 &aY)
} }
//------------------------------------------------------------------------- // Find if a point in local coordinates is inside this object
// PointInWidget
// Find if a point in local coordinates is inside this object
//-------------------------------------------------------------------------
PRBool nsChildView::PointInWidget(Point aThePoint) PRBool nsChildView::PointInWidget(Point aThePoint)
{ {
// get the origin in local coordinates // get the origin in local coordinates
@ -2043,7 +1883,7 @@ nsChildView::Idle()
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
#ifdef MOZ_CAIRO_GFX
gfxASurface* gfxASurface*
nsChildView::GetThebesSurface() nsChildView::GetThebesSurface()
{ {
@ -2056,7 +1896,7 @@ nsChildView::GetThebesSurface()
NS_ADDREF(surf); NS_ADDREF(surf);
return surf; return surf;
} }
#endif
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
void void
@ -2363,12 +2203,8 @@ NSEvent* globalDragEvent = nil;
// //
- (BOOL)isOpaque - (BOOL)isOpaque
{ {
#ifdef MOZ_CAIRO_GFX
// this will be NO when we can do transparent windows/views // this will be NO when we can do transparent windows/views
return YES; return YES;
#else
return mIsPluginView;
#endif
} }
-(void)setIsPluginView:(BOOL)aIsPlugin -(void)setIsPluginView:(BOOL)aIsPlugin
@ -2484,7 +2320,6 @@ NSEvent* globalDragEvent = nil;
if ([self isRectObscuredBySubview:aRect]) if ([self isRectObscuredBySubview:aRect])
return; return;
#ifdef MOZ_CAIRO_GFX
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
nsRect geckoBounds; nsRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds); mGeckoChild->GetBounds(geckoBounds);
@ -2563,28 +2398,6 @@ NSEvent* globalDragEvent = nil;
CGContextStrokeRect (cgContext, CGContextStrokeRect (cgContext,
CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height)); CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height));
#endif #endif
#else
/* non-MOZ_CAIRO_GFX */
nsCOMPtr<nsIRegion> rgn(do_CreateInstance(kRegionCID));
if (rgn) {
rgn->Init();
nsRect r;
const NSRect *rects;
int count, i;
[self getRectsBeingDrawn:&rects count:&count];
for (i = 0; i < count; ++i) {
NSRectToGeckoRect(rects[i], r);
rgn->Union(r.x, r.y, r.width, r.height);
}
}
nsRect fullRect;
NSRectToGeckoRect(aRect, fullRect);
nsCOMPtr<nsIRenderingContext> rendContext = getter_AddRefs(mGeckoChild->GetRenderingContext());
mGeckoChild->UpdateWidget(fullRect, rendContext, rgn);
#endif
} }
- (BOOL)isRectObscuredBySubview:(NSRect)inRect - (BOOL)isRectObscuredBySubview:(NSRect)inRect

Просмотреть файл

@ -47,10 +47,6 @@
#include "nsMemory.h" #include "nsMemory.h"
#include "nsIImage.h" #include "nsIImage.h"
#ifndef MOZ_CAIRO_GFX
#include "nsIImageMac.h"
#endif
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
nsClipboard::nsClipboard() : nsBaseClipboard() nsClipboard::nsClipboard() : nsBaseClipboard()
@ -103,7 +99,7 @@ nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
nsCOMPtr<nsISupports> primitiveData; nsCOMPtr<nsISupports> primitiveData;
ptrPrimitive->GetData(getter_AddRefs(primitiveData)); ptrPrimitive->GetData(getter_AddRefs(primitiveData));
#ifdef MOZ_CAIRO_GFX
nsCOMPtr<nsIImage> image(do_QueryInterface(primitiveData)); nsCOMPtr<nsIImage> image(do_QueryInterface(primitiveData));
if (!image) { if (!image) {
NS_WARNING("Image isn't an nsIImage in transferable"); NS_WARNING("Image isn't an nsIImage in transferable");
@ -154,25 +150,6 @@ nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
continue; continue;
[pasteboardOutputDict setObject:tiffData forKey:NSTIFFPboardType]; [pasteboardOutputDict setObject:tiffData forKey:NSTIFFPboardType];
#else
// We have an image, which is in the transferable as an nsIImageMac. Convert it
// to PICT and put those bits on the clipboard. The actual size
// of the picture is the size of the handle, not sizeof(Picture).
nsCOMPtr<nsIImageMac> image = do_QueryInterface(primitiveData);
if (!image) {
NS_WARNING("Image isn't an nsIImageMac in transferable");
continue;
}
PicHandle picture = nsnull;
image->ConvertToPICT(&picture);
if (picture) {
NSData* pictData = [NSData dataWithBytes:*picture length:(::GetHandleSize((Handle)picture))];
[pasteboardOutputDict setObject:pictData forKey:NSPICTPboardType];
::KillPicture(picture);
}
#endif
} }
else { else {
/* If it isn't an image, we just throw the data on the clipboard with the mime string /* If it isn't an image, we just throw the data on the clipboard with the mime string

Просмотреть файл

@ -61,11 +61,6 @@
#include "nsIView.h" #include "nsIView.h"
#include "nsIRegion.h" #include "nsIRegion.h"
#ifndef MOZ_CAIRO_GFX
#include "nsIImageMac.h"
#include "nsGfxUtils.h"
#endif
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
extern NSPasteboard* globalDragPboard; extern NSPasteboard* globalDragPboard;
@ -218,7 +213,7 @@ static nsresult SetUpDragClipboard(nsISupportsArray* aTransferableArray)
nsCOMPtr<nsISupports> primitiveData; nsCOMPtr<nsISupports> primitiveData;
ptrPrimitive->GetData(getter_AddRefs(primitiveData)); ptrPrimitive->GetData(getter_AddRefs(primitiveData));
#ifdef MOZ_CAIRO_GFX
nsCOMPtr<nsIImage> image(do_QueryInterface(primitiveData)); nsCOMPtr<nsIImage> image(do_QueryInterface(primitiveData));
if (!image) { if (!image) {
NS_WARNING("Image isn't an nsIImage in transferable"); NS_WARNING("Image isn't an nsIImage in transferable");
@ -269,25 +264,6 @@ static nsresult SetUpDragClipboard(nsISupportsArray* aTransferableArray)
continue; continue;
[pasteboardOutputDict setObject:tiffData forKey:NSTIFFPboardType]; [pasteboardOutputDict setObject:tiffData forKey:NSTIFFPboardType];
#else
// We have an image, which is in the transferable as an nsIImageMac. Convert it
// to PICT and put those bits on the clipboard. The actual size
// of the picture is the size of the handle, not sizeof(Picture).
nsCOMPtr<nsIImageMac> image = do_QueryInterface(primitiveData);
if (!image) {
NS_WARNING("Image isn't an nsIImageMac in transferable");
continue;
}
PicHandle picture = nsnull;
image->ConvertToPICT(&picture);
if (picture) {
NSData* pictData = [NSData dataWithBytes:*picture length:(::GetHandleSize((Handle)picture))];
[pasteboardOutputDict setObject:pictData forKey:NSPICTPboardType];
::KillPicture(picture);
}
#endif
} }
else { else {
/* If it isn't an image, we just throw the data on the clipboard with the mime string /* If it isn't an image, we just throw the data on the clipboard with the mime string
@ -343,15 +319,6 @@ NS_IMETHODIMP
nsDragService::InvokeDragSession(nsIDOMNode* aDOMNode, nsISupportsArray* aTransferableArray, nsDragService::InvokeDragSession(nsIDOMNode* aDOMNode, nsISupportsArray* aTransferableArray,
nsIScriptableRegion* aDragRgn, PRUint32 aActionType) nsIScriptableRegion* aDragRgn, PRUint32 aActionType)
{ {
#ifndef MOZ_CAIRO_GFX
nsGraphicsUtils::SetPortToKnownGoodPort();
GrafPtr port;
GDHandle handle;
::GetGWorld(&port, &handle);
if (!IsValidPort(port))
return NS_ERROR_FAILURE;
#endif
nsBaseDragService::InvokeDragSession(aDOMNode, aTransferableArray, aDragRgn, aActionType); nsBaseDragService::InvokeDragSession(aDOMNode, aTransferableArray, aDragRgn, aActionType);
// put data on the clipboard // put data on the clipboard

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -36,17 +36,8 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
// see bug 180535
#ifndef MOZ_CAIRO_GFX
#define USE_QUARTZ_FONT_PREFS 1
#endif
#include "nsIToolkit.h" #include "nsIToolkit.h"
#ifdef USE_QUARTZ_FONT_PREFS
#include "nsIObserver.h"
#endif
#include <IOKit/IOKitLib.h> #include <IOKit/IOKitLib.h>
/** /**
@ -77,9 +68,6 @@
#define MAC_OS_X_VERSION_10_4_HEX 0x00001040 #define MAC_OS_X_VERSION_10_4_HEX 0x00001040
class nsToolkit : public nsIToolkit class nsToolkit : public nsIToolkit
#ifdef USE_QUARTZ_FONT_PREFS
, public nsIObserver
#endif
{ {
public: public:
nsToolkit(); nsToolkit();
@ -87,9 +75,6 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSITOOLKIT NS_DECL_NSITOOLKIT
#ifdef USE_QUARTZ_FONT_PREFS
NS_DECL_NSIOBSERVER
#endif
// Returns the OS X version as returned from Gestalt(gestaltSystemVersion, ...) // Returns the OS X version as returned from Gestalt(gestaltSystemVersion, ...)
static long OSXVersion(); static long OSXVersion();
@ -101,12 +86,6 @@ protected:
nsresult RegisterForSleepWakeNotifcations(); nsresult RegisterForSleepWakeNotifcations();
void RemoveSleepWakeNotifcations(); void RemoveSleepWakeNotifcations();
#ifdef USE_QUARTZ_FONT_PREFS
protected:
static void SetupQuartzRendering();
#endif
protected: protected:
bool mInited; bool mInited;

Просмотреть файл

@ -59,15 +59,6 @@
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#ifdef USE_QUARTZ_FONT_PREFS
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
static const char kQuartzRenderingPref[] = "browser.quartz.enable";
static const char kAllFontSizesPref[] = "browser.quartz.enable.all_font_sizes";
#endif
static io_connect_t gRootPort = MACH_PORT_NULL; static io_connect_t gRootPort = MACH_PORT_NULL;
// Static thread local storage index of the Toolkit // Static thread local storage index of the Toolkit
@ -90,11 +81,7 @@ nsToolkit::~nsToolkit()
} }
#ifdef USE_QUARTZ_FONT_PREFS
NS_IMPL_THREADSAFE_ISUPPORTS2(nsToolkit, nsIToolkit, nsIObserver);
#else
NS_IMPL_THREADSAFE_ISUPPORTS1(nsToolkit, nsIToolkit); NS_IMPL_THREADSAFE_ISUPPORTS1(nsToolkit, nsIToolkit);
#endif
NS_IMETHODIMP NS_IMETHODIMP
@ -106,33 +93,10 @@ nsToolkit::Init(PRThread * aThread)
RegisterForSleepWakeNotifcations(); RegisterForSleepWakeNotifcations();
#ifdef USE_QUARTZ_FONT_PREFS
SetupQuartzRendering();
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
prefs->AddObserver(kQuartzRenderingPref, this, PR_FALSE);
prefs->AddObserver(kAllFontSizesPref, this, PR_FALSE);
}
#endif
return NS_OK; return NS_OK;
} }
#ifdef USE_QUARTZ_FONT_PREFS
// The pref changed, reset the app to use quartz rendering as dictated by the pref
NS_IMETHODIMP
nsToolkit::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
SetupQuartzRendering();
return NS_OK;
}
#endif
nsToolkit* NS_CreateToolkitInstance() nsToolkit* NS_CreateToolkitInstance()
{ {
return new nsToolkit(); return new nsToolkit();
@ -212,53 +176,6 @@ nsToolkit::RemoveSleepWakeNotifcations()
} }
#ifdef USE_QUARTZ_FONT_PREFS
// SetupQuartzRendering
//
// Use apple's technote for 10.1.5 to turn on quartz rendering with CG metrics. This
// slows us down about 12% when turned on.
void
nsToolkit::SetupQuartzRendering()
{
// from Apple's technote at http://developer.apple.com/qa/qa2001/qa1193.html
enum {
kQDDontChangeFlags = 0xFFFFFFFF, // don't change anything
kQDUseDefaultTextRendering = 0, // bit 0
kQDUseTrueTypeScalerGlyphs = (1 << 0), // bit 1
kQDUseCGTextRendering = (1 << 1), // bit 2
kQDUseCGTextMetrics = (1 << 2)
};
const int kFlagsWeUse = kQDUseCGTextRendering | kQDUseCGTextMetrics;
// Just turn on the bits that we need, don't turn off what someone else might have wanted.
// If the pref isn't found, assume we want it on. That way, we have to explicitly put
// in a pref to disable it, rather than force everyone who wants it to carry around
// an extra pref.
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return;
PRBool enableQuartz = PR_TRUE;
nsresult rv = prefs->GetBoolPref(kQuartzRenderingPref, &enableQuartz);
UInt32 oldFlags = QDSwapTextFlags(kQDDontChangeFlags);
if (NS_FAILED(rv) || enableQuartz) {
QDSwapTextFlags(oldFlags | kFlagsWeUse);
// the system defaults to not anti-aliasing small fonts, but some people
// think it looks better that way. If the pref is set, turn them on
PRBool antiAliasAllFontSizes = PR_FALSE;
rv = prefs->GetBoolPref(kAllFontSizesPref, &antiAliasAllFontSizes);
if (NS_SUCCEEDED(rv) && antiAliasAllFontSizes)
SetOutlinePreferred(true);
}
else {
QDSwapTextFlags(oldFlags & ~kFlagsWeUse);
}
}
#endif
// Return the nsIToolkit for the current thread. If a toolkit does not // Return the nsIToolkit for the current thread. If a toolkit does not
// yet exist, then one will be created... // yet exist, then one will be created...
NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult) NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult)

Просмотреть файл

@ -92,13 +92,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSessionX, Init)
#include "nsBidiKeyboard.h" #include "nsBidiKeyboard.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
#ifdef MOZ_CAIRO_GFX
#include "nsNativeThemeCocoa.h" #include "nsNativeThemeCocoa.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeCocoa) NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeCocoa)
#else
#include "nsNativeThemeMac.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeMac)
#endif
static const nsModuleComponentInfo gComponents[] = static const nsModuleComponentInfo gComponents[] =
{ {
@ -174,17 +169,10 @@ static const nsModuleComponentInfo gComponents[] =
NS_NATIVESCROLLBAR_CID, NS_NATIVESCROLLBAR_CID,
"@mozilla.org/widget/nativescrollbar;1", "@mozilla.org/widget/nativescrollbar;1",
nsNativeScrollbarConstructor }, nsNativeScrollbarConstructor },
#ifdef MOZ_CAIRO_GFX
{ "Native Theme Renderer", { "Native Theme Renderer",
NS_THEMERENDERER_CID, NS_THEMERENDERER_CID,
"@mozilla.org/chrome/chrome-native-theme;1", "@mozilla.org/chrome/chrome-native-theme;1",
nsNativeThemeCocoaConstructor }, nsNativeThemeCocoaConstructor },
#else
{ "Native Theme Renderer",
NS_THEMERENDERER_CID,
"@mozilla.org/chrome/chrome-native-theme;1",
nsNativeThemeMacConstructor },
#endif
{ "nsScreenManager", { "nsScreenManager",
NS_SCREENMANAGER_CID, NS_SCREENMANAGER_CID,
"@mozilla.org/gfx/screenmanager;1", "@mozilla.org/gfx/screenmanager;1",