This commit is contained in:
Mike Hommey 2010-10-15 14:55:09 +02:00
Родитель 4e2463429e caadaeb619
Коммит 8fe45db57a
31 изменённых файлов: 135 добавлений и 235 удалений

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

@ -167,7 +167,7 @@ toolbarbutton.bookmark-item {
color: #222;
border: 0;
border-radius: 10000px;
padding: 0 8px;
padding: 1px 8px;
margin: 0 0 1px;
}
@ -214,6 +214,8 @@ toolbarbutton.bookmark-item > menupopup {
.bookmark-item > .toolbarbutton-icon {
width: 16px;
min-height: 16px;
max-height: 16px;
padding: 0;
}
.bookmark-item > .toolbarbutton-icon[label]:not([label=""]),

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

@ -5565,8 +5565,8 @@ nsSVGFEImageElement::Filter(nsSVGFilterInstance *instance,
gfxMatrix TM = viewBoxTM * xyTM;
gfxContext ctx(aTarget->mImage);
nsSVGUtils::CompositePatternMatrix(&ctx, thebesPattern, TM, nativeWidth, nativeHeight, 1.0);
nsRefPtr<gfxContext> ctx = new gfxContext(aTarget->mImage);
nsSVGUtils::CompositePatternMatrix(ctx, thebesPattern, TM, nativeWidth, nativeHeight, 1.0);
}
return NS_OK;

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

@ -1042,11 +1042,12 @@ nsSVGPathList::Playback(gfxContext *aCtx)
already_AddRefed<gfxFlattenedPath>
nsSVGPathList::GetFlattenedPath(const gfxMatrix& aMatrix)
{
gfxContext ctx(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
nsRefPtr<gfxContext> ctx =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
ctx.SetMatrix(aMatrix);
Playback(&ctx);
ctx.IdentityMatrix();
ctx->SetMatrix(aMatrix);
Playback(ctx);
ctx->IdentityMatrix();
return ctx.GetFlattenedPath();
return ctx->GetFlattenedPath();
}

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

@ -64,6 +64,8 @@ struct RedirEntry {
URI. Perhaps we should separate the two concepts out...
*/
static RedirEntry kRedirMap[] = {
{ "", "chrome://global/content/about.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
{ "about", "chrome://global/content/aboutAbout.xhtml", 0 },
{ "credits", "http://www.mozilla.org/credits/",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },

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

@ -183,6 +183,7 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ "@mozilla.org/docshell;1", &kNS_DOCSHELL_CID },
{ NS_URIFIXUP_CONTRACTID, &kNS_DEFAULTURIFIXUP_CID },
{ NS_WEBNAVIGATION_INFO_CONTRACTID, &kNS_WEBNAVIGATION_INFO_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "about", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifdef MOZ_CRASHREPORTER

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

@ -270,9 +270,9 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
if (!temp || temp->CairoStatus())
return nsnull;
gfxContext tmpCtx(temp);
tmpCtx.SetOperator(OptimalFillOperator());
aDrawable->Draw(&tmpCtx, needed - needed.pos, PR_TRUE,
nsRefPtr<gfxContext> tmpCtx = new gfxContext(temp);
tmpCtx->SetOperator(OptimalFillOperator());
aDrawable->Draw(tmpCtx, needed - needed.pos, PR_TRUE,
gfxPattern::FILTER_FAST, gfxMatrix().Translate(needed.pos));
nsRefPtr<gfxPattern> resultPattern = new gfxPattern(temp);

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

@ -379,8 +379,9 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
"Reference frame must be a display root for us to use the layer manager");
nsIWidget* window = referenceFrame->GetNearestWidget();
if (window) {
layerManager = window->GetLayerManager();
if (layerManager) {
bool allowRetaining = true;
layerManager = window->GetLayerManager(&allowRetaining);
if (layerManager && allowRetaining) {
aBuilder->LayerBuilder()->WillBeginRetainedLayerTransaction(layerManager);
}
}

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

@ -0,0 +1,4 @@
<!DOCTYPE html>
<title>Stack pointer free with -moz-element</title>
<div id="paintServer" style="width: 20px; height: 20px; background: red;"></div>
<div style="-moz-transform: scale(1.01); width: 100px; height: 100px; background: -moz-element(#paintServer) -5px -3px; background-size: 20px 32769px;"></div>

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

@ -338,3 +338,4 @@ load 586973-1.html
load 589002-1.html
load 590404.html
load 591141.html
asserts(0-1) load 592118.html

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

@ -170,23 +170,24 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
PRBool isHit = PR_FALSE;
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
nsRefPtr<gfxContext> context =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
GeneratePath(&context);
GeneratePath(context);
gfxPoint userSpacePoint =
context.DeviceToUser(gfxPoint(PresContext()->AppUnitsToGfxUnits(aPoint.x),
PresContext()->AppUnitsToGfxUnits(aPoint.y)));
context->DeviceToUser(gfxPoint(PresContext()->AppUnitsToGfxUnits(aPoint.x),
PresContext()->AppUnitsToGfxUnits(aPoint.y)));
if (fillRule == NS_STYLE_FILL_RULE_EVENODD)
context.SetFillRule(gfxContext::FILL_RULE_EVEN_ODD);
context->SetFillRule(gfxContext::FILL_RULE_EVEN_ODD);
else
context.SetFillRule(gfxContext::FILL_RULE_WINDING);
context->SetFillRule(gfxContext::FILL_RULE_WINDING);
if (mask & HITTEST_MASK_FILL)
isHit = context.PointInFill(userSpacePoint);
isHit = context->PointInFill(userSpacePoint);
if (!isHit && (mask & HITTEST_MASK_STROKE)) {
SetupCairoStrokeHitGeometry(&context);
isHit = context.PointInStroke(userSpacePoint);
SetupCairoStrokeHitGeometry(context);
isHit = context->PointInStroke(userSpacePoint);
}
if (isHit && nsSVGUtils::HitTestClip(this, aPoint))
@ -250,12 +251,13 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
{
mRect.Empty();
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
nsRefPtr<gfxContext> context =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
GeneratePath(&context);
context.IdentityMatrix();
GeneratePath(context);
context->IdentityMatrix();
gfxRect extent = context.GetUserPathExtent();
gfxRect extent = context->GetUserPathExtent();
// Be careful when replacing the following logic to get the fill and stroke
// extents independently (instead of computing the stroke extents from the
@ -270,12 +272,12 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
// stroke bounds that it will return will be empty.
if (HasStroke()) {
SetupCairoStrokeGeometry(&context);
SetupCairoStrokeGeometry(context);
if (extent.Width() <= 0 && extent.Height() <= 0) {
// If 'extent' is empty, its position will not be set. Although
// GetUserStrokeExtent gets the extents wrong we can still use it
// to get the device space position of zero length stroked paths.
extent = context.GetUserStrokeExtent();
extent = context->GetUserStrokeExtent();
extent.pos.x += extent.size.width / 2;
extent.pos.y += extent.size.height / 2;
extent.size.width = 0;
@ -362,10 +364,11 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace)
// XXX ReportToConsole
return gfxRect(0.0, 0.0, 0.0, 0.0);
}
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
GeneratePath(&context, &aToBBoxUserspace);
context.IdentityMatrix();
return context.GetUserPathExtent();
nsRefPtr<gfxContext> context =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
GeneratePath(context, &aToBBoxUserspace);
context->IdentityMatrix();
return context->GetUserPathExtent();
}
//----------------------------------------------------------------------

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

@ -98,15 +98,6 @@ LightweightThemeConsumer.prototype = {
}
#ifdef XP_MACOSX
if (active && aData.accentcolor) {
root.setAttribute("activetitlebarcolor", aData.accentcolor);
root.setAttribute("inactivetitlebarcolor", aData.accentcolor);
} else {
root.removeAttribute("activetitlebarcolor");
root.removeAttribute("inactivetitlebarcolor");
}
if (active)
root.setAttribute("drawintitlebar", "true");
else

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

@ -68,9 +68,7 @@
<ul id="aboutPageList">
<li>&about.credits.beforeLink;<a href="about:credits">&about.credits.linkTitle;</a>&about.credits.afterLink;</li>
<li>&about.license.beforeTheLink;<a href="about:license">&about.license.linkTitle;</a>&about.license.afterTheLink;</li>
<!-- Release notes link removed pending fix for bug 349985
<li>&about.relnotes.beforeTheLink;<a id="releaseNotesURL" href="">&about.relnotes.linkTitle;</a>&about.relnotes.afterTheLink;</li>
-->
<li>&about.buildconfig.beforeTheLink;<a href="about:buildconfig">&about.buildconfig.linkTitle;</a>&about.buildconfig.afterTheLink;</li>
<script type="application/javascript">
// get release notes URL from prefs

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

@ -56,7 +56,6 @@ html|*.numberbox-input {
.numberbox-input-box {
-moz-box-align: center;
-moz-appearance: spinner-textfield;
cursor: text;
margin-right: -1px;
border: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;

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

@ -52,7 +52,6 @@ html|*.numberbox-input {
.numberbox-input-box {
-moz-appearance: textfield;
cursor: text;
margin-right: 4px;
border: 3px solid;
-moz-border-top-colors: transparent #888888 #000000;
@ -62,5 +61,4 @@ html|*.numberbox-input {
border-top-right-radius: 2px;
border-bottom-left-radius: 2px;
background-color: -moz-Field;
color: -moz-FieldText;
}

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

@ -117,10 +117,10 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
#endif
// 8bd36c8c-8218-4859-bfbc-ca5d78b52f7d
// cc443f0b-af39-415d-9c4b-7e06eaa8b13b
#define NS_IWIDGET_IID \
{ 0x8bd36c8c, 0x8218, 0x4859, \
{ 0xbf, 0xbc, 0xca, 0x5d, 0x78, 0xb5, 0x2f, 0x7d } }
{ 0xcc443f0b, 0xaf39, 0x415d, \
{ 0x9c, 0x4b, 0x7e, 0x06, 0xea, 0xa8, 0xb1, 0x3b } }
/*
* Window shadow styles
@ -855,10 +855,11 @@ class nsIWidget : public nsISupports {
/**
* Return the widget's LayerManager. The layer tree for that
* LayerManager is what gets rendered to the widget.
* The layer manager is guaranteed to be the same for the lifetime
* of the widget.
*
* @param aAllowRetaining an outparam that states whether the returned
* layer manager should be used for retained layers
*/
virtual LayerManager* GetLayerManager() = 0;
virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull) = 0;
/**
* Internal methods

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

@ -592,8 +592,11 @@ nsWindow::SetWindowClass(const nsAString& xulWinType)
}
mozilla::layers::LayerManager*
nsWindow::GetLayerManager()
nsWindow::GetLayerManager(bool* aAllowRetaining)
{
if (aAllowRetaining) {
*aAllowRetaining = true;
}
if (mLayerManager) {
return mLayerManager;
}

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

@ -162,7 +162,7 @@ public:
NS_IMETHOD OnIMESelectionChange(void);
virtual nsIMEUpdatePreference GetIMEUpdatePreference();
LayerManager* GetLayerManager();
LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull);
gfxASurface* GetThebesSurface();
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);

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

@ -211,7 +211,7 @@ extern "C" long TSMProcessRawKeyEvent(EventRef carbonEvent);
- (void)handleMouseMoved:(NSEvent*)aEvent;
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
- (void)drawRect:(NSRect)aRect inTitlebarContext:(CGContextRef)aContext;
- (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
enter:(BOOL)aEnter
@ -228,8 +228,6 @@ extern "C" long TSMProcessRawKeyEvent(EventRef carbonEvent);
- (BOOL)isPluginView;
- (BOOL)isUsingOpenGL;
// Simple gestures support
//
// XXX - The swipeWithEvent, beginGestureWithEvent, magnifyWithEvent,

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

@ -117,6 +117,7 @@ extern "C" {
extern CGSConnection _CGSDefaultConnection();
extern CGError CGSGetScreenRectForWindow(const CGSConnection cid, CGSWindow wid, CGRect *outRect);
extern CGError CGSGetWindowLevel(const CGSConnection cid, CGSWindow wid, CGWindowLevel *level);
extern CGError CGSGetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float* alpha);
}
// defined in nsMenuBarX.mm
@ -191,6 +192,8 @@ PRUint32 nsChildView::sLastInputEventCount = 0;
- (float)beginMaybeResetUnifiedToolbar;
- (void)endMaybeResetUnifiedToolbar:(float)aOldHeight;
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
#if USE_CLICK_HOLD_CONTEXTMENU
// called on a timer two seconds after a mouse down to see if we should display
// a context menu (click-hold)
@ -2597,11 +2600,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
[self update];
}
- (BOOL) isUsingOpenGL
{
return mGeckoChild && mGeckoChild->GetLayerManager()->GetBackendType() == LayerManager::LAYERS_OPENGL;
}
// The display system has told us that a portion of our view is dirty. Tell
// gecko to paint it
- (void)drawRect:(NSRect)aRect
@ -2620,6 +2618,14 @@ NSEvent* gLastDragMouseDownEvent = nil;
[self endMaybeResetUnifiedToolbar:oldHeight];
}
- (void)drawRect:(NSRect)aRect inTitlebarContext:(CGContextRef)aContext
{
// Title bar drawing only works if we really draw into aContext, which only
// the basic layer manager will do.
nsBaseWidget::AutoUseBasicLayerManager setupLayerManager(mGeckoChild);
[self drawRect:aRect inContext:aContext];
}
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
{
PRBool isVisible;
@ -2654,6 +2660,8 @@ NSEvent* gLastDragMouseDownEvent = nil;
// Create the event so we can fill in its region
nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, mGeckoChild);
nsIntRect boundingRect =
nsIntRect(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
const NSRect *rects;
NSInteger count, i;
[[NSView focusView] getRectsBeingDrawn:&rects count:&count];
@ -2664,9 +2672,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
paintEvent.region.Or(paintEvent.region,
nsIntRect(r.origin.x, r.origin.y, r.size.width, r.size.height));
}
paintEvent.region.And(paintEvent.region, boundingRect);
} else {
paintEvent.region =
nsIntRect(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
paintEvent.region = boundingRect;
}
#ifndef NP_NO_QUICKDRAW
@ -6320,6 +6328,12 @@ static BOOL WindowNumberIsUnderPoint(NSInteger aWindowNumber, NSPoint aPoint) {
level > kPopupWindowLevel)) // Snapz Pro X while recording a screencast
return false;
// Ignore transparent windows.
float alpha;
if ((kCGErrorSuccess == CGSGetWindowAlpha(cid, aWindowNumber, &alpha)) &&
alpha < 0.1f)
return false;
CGRect rect;
if (kCGErrorSuccess != CGSGetScreenRectForWindow(cid, aWindowNumber, &rect))
return false;

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

@ -254,7 +254,7 @@ public:
NS_IMETHOD Invalidate(const nsIntRect &aRect, PRBool aIsSynchronous);
NS_IMETHOD Update();
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
virtual LayerManager* GetLayerManager();
virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull);
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) ;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, nsIMenuRollup * aMenuRollup,
PRBool aDoCapture, PRBool aConsumeRollupEvent);

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

@ -932,10 +932,10 @@ nsCocoaWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
}
LayerManager*
nsCocoaWindow::GetLayerManager()
nsCocoaWindow::GetLayerManager(bool* aAllowRetaining)
{
if (mPopupContentView) {
return mPopupContentView->GetLayerManager();
return mPopupContentView->GetLayerManager(aAllowRetaining);
}
return nsnull;
}
@ -2435,23 +2435,15 @@ ContentPatternDrawCallback(void* aInfo, CGContextRef aContext)
CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height);
NSRect titlebarRect = NSMakeRect(0, 0, [window frame].size.width, [window titlebarHeight]);
[(ChildView*)view drawRect:titlebarRect inContext:aContext];
[(ChildView*)view drawRect:titlebarRect inTitlebarContext:aContext];
}
- (void)setFill
{
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGPatternDrawPatternCallback cb;
float patternWidth;
NSView* view = [[[mWindow contentView] subviews] lastObject];
if (view && [view isKindOfClass:[ChildView class]] && [(ChildView*)view isUsingOpenGL]) {
cb = &RepeatedPatternDrawCallback;
patternWidth = sPatternWidth;
} else {
cb = [mWindow drawsContentsIntoWindowFrame] ?
CGPatternDrawPatternCallback cb = [mWindow drawsContentsIntoWindowFrame] ?
&ContentPatternDrawCallback : &RepeatedPatternDrawCallback;
patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth;
}
float patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth;
CGPatternCallbacks callbacks = {0, cb, NULL};
CGPatternRef pattern = CGPatternCreate(mWindow, CGRectMake(0.0f, 0.0f, patternWidth, [mWindow frame].size.height),
CGAffineTransformIdentity, patternWidth, [mWindow frame].size.height,
@ -2460,6 +2452,7 @@ ContentPatternDrawCallback(void* aInfo, CGContextRef aContext)
// Set the pattern as the fill, which is what we were asked to do. All our
// drawing will take place in the patternDraw callback.
CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSetFillColorSpace(context, patternSpace);
CGColorSpaceRelease(patternSpace);
CGFloat component = 1.0f;

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

@ -3180,8 +3180,12 @@ nsWindow::HasPendingInputEvent()
**************************************************************/
mozilla::layers::LayerManager*
nsWindow::GetLayerManager()
nsWindow::GetLayerManager(bool* aAllowRetaining)
{
if (aAllowRetaining) {
*aAllowRetaining = true;
}
#ifndef WINCE
if (!mLayerManager) {
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);

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

@ -166,7 +166,7 @@ public:
PRBool aDoCapture, PRBool aConsumeRollupEvent);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
virtual PRBool HasPendingInputEvent();
virtual LayerManager* GetLayerManager();
virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull);
gfxASurface *GetThebesSurface();
NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect);
NS_IMETHOD OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta, PRBool aIsHorizontal, PRInt32 &aOverriddenDelta);

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

@ -310,11 +310,14 @@ PuppetWidget::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
}
LayerManager*
PuppetWidget::GetLayerManager()
PuppetWidget::GetLayerManager(bool* aAllowRetaining)
{
if (!mLayerManager) {
mLayerManager = new BasicShadowLayerManager(this);
}
if (aAllowRetaining) {
*aAllowRetaining = true;
}
return mLayerManager;
}

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

@ -164,7 +164,7 @@ public:
//
//NS_IMETHOD CaptureMouse(PRBool aCapture);
virtual LayerManager* GetLayerManager();
virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull);
// virtual nsIDeviceContext* GetDeviceContext();
virtual gfxASurface* GetThebesSurface();

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

@ -106,6 +106,7 @@ nsBaseWidget::nsBaseWidget()
, mBorderStyle(eBorderStyle_none)
, mOnDestroyCalled(PR_FALSE)
, mUseAcceleratedRendering(PR_FALSE)
, mTemporarilyUseBasicLayerManager(PR_FALSE)
, mBounds(0,0,0,0)
, mOriginalBounds(nsnull)
, mClipRectCount(0)
@ -761,6 +762,17 @@ nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup()
}
}
nsBaseWidget::AutoUseBasicLayerManager::AutoUseBasicLayerManager(nsBaseWidget* aWidget)
: mWidget(aWidget)
{
mWidget->mTemporarilyUseBasicLayerManager = PR_TRUE;
}
nsBaseWidget::AutoUseBasicLayerManager::~AutoUseBasicLayerManager()
{
mWidget->mTemporarilyUseBasicLayerManager = PR_FALSE;
}
PRBool
nsBaseWidget::GetShouldAccelerate()
{
@ -794,7 +806,7 @@ nsBaseWidget::GetShouldAccelerate()
return mUseAcceleratedRendering;
}
LayerManager* nsBaseWidget::GetLayerManager()
LayerManager* nsBaseWidget::GetLayerManager(bool* aAllowRetaining)
{
if (!mLayerManager) {
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
@ -816,10 +828,18 @@ LayerManager* nsBaseWidget::GetLayerManager()
}
}
if (!mLayerManager) {
mLayerManager = CreateBasicLayerManager();
mBasicLayerManager = mLayerManager = CreateBasicLayerManager();
}
}
return mLayerManager;
if (mTemporarilyUseBasicLayerManager && !mBasicLayerManager) {
mBasicLayerManager = CreateBasicLayerManager();
}
LayerManager* usedLayerManager = mTemporarilyUseBasicLayerManager ?
mBasicLayerManager : mLayerManager;
if (aAllowRetaining) {
*aAllowRetaining = (usedLayerManager == mLayerManager);
}
return usedLayerManager;
}
BasicLayerManager* nsBaseWidget::CreateBasicLayerManager()

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

@ -115,7 +115,7 @@ public:
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
virtual nsIDeviceContext* GetDeviceContext();
virtual nsIToolkit* GetToolkit();
virtual LayerManager* GetLayerManager();
virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull);
virtual gfxASurface* GetThebesSurface();
NS_IMETHOD SetModal(PRBool aModal);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
@ -202,6 +202,15 @@ public:
};
friend class AutoLayerManagerSetup;
class AutoUseBasicLayerManager {
public:
AutoUseBasicLayerManager(nsBaseWidget* aWidget);
~AutoUseBasicLayerManager();
private:
nsBaseWidget* mWidget;
};
friend class AutoUseBasicLayerManager;
protected:
virtual void ResolveIconName(const nsAString &aIconName,
@ -255,6 +264,7 @@ protected:
nsIDeviceContext* mContext;
nsIToolkit* mToolkit;
nsRefPtr<LayerManager> mLayerManager;
nsRefPtr<LayerManager> mBasicLayerManager;
nscolor mBackground;
nscolor mForeground;
nsCursor mCursor;
@ -262,6 +272,7 @@ protected:
nsBorderStyle mBorderStyle;
PRPackedBool mOnDestroyCalled;
PRPackedBool mUseAcceleratedRendering;
PRPackedBool mTemporarilyUseBasicLayerManager;
nsIntRect mBounds;
nsIntRect* mOriginalBounds;
// When this pointer is null, the widget is not clipped

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

@ -60,7 +60,6 @@ CPPSRCS = \
nsAppShellWindowEnumerator.cpp \
nsWebShellWindow.cpp \
nsWindowMediator.cpp \
nsAbout.cpp \
nsAppShellFactory.cpp \
$(NULL)

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

@ -1,84 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAbout.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
#include "nsIChannel.h"
#include "nsCOMPtr.h"
#include "nsIURI.h"
#include "nsNetCID.h"
#include "nsIScriptSecurityManager.h"
#include "nsLiteralString.h"
NS_IMPL_ISUPPORTS1(nsAbout, nsIAboutModule)
static const char kURI[] = "chrome://global/content/about.xhtml";
NS_IMETHODIMP
nsAbout::NewChannel(nsIURI *aURI, nsIChannel **result)
{
nsresult rv;
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIChannel> tempChannel;
rv = ioService->NewChannel(NS_LITERAL_CSTRING(kURI), nsnull, nsnull,
getter_AddRefs(tempChannel));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptSecurityManager> securityManager =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal;
rv = securityManager->GetCodebasePrincipal(aURI, getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> owner = do_QueryInterface(principal);
rv = tempChannel->SetOwner(owner);
*result = tempChannel.get();
NS_ADDREF(*result);
return rv;
}
NS_IMETHODIMP
nsAbout::GetURIFlags(nsIURI *aURI, PRUint32 *result)
{
*result = nsIAboutModule::ALLOW_SCRIPT;
return NS_OK;
}

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

@ -1,58 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsAbout_h_
#define nsAbout_h_
#include "nsIAboutModule.h"
#define NS_ABOUT_CID \
{ /* {1f1ce501-663a-11d3-b7a0-be426e4e69bc} */ \
0x1f1ce501, 0x663a, 0x11d3, { 0xb7, 0xa0, 0xbe, 0x42, 0x6e, 0x4e, 0x69, 0xbc } \
}
class nsAbout : public nsIAboutModule
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIABOUTMODULE
nsAbout() {}
virtual ~nsAbout() {}
};
#endif // nsAbout_h_

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

@ -38,7 +38,6 @@
#include "mozilla/ModuleUtils.h"
#include "nscore.h"
#include "nsIWindowMediator.h"
#include "nsAbout.h"
#include "nsIAppShellService.h"
#include "nsAppShellService.h"
@ -47,24 +46,20 @@
#include "nsAppShellCID.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShellService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbout)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowMediator, Init)
NS_DEFINE_NAMED_CID(NS_APPSHELLSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWMEDIATOR_CID);
NS_DEFINE_NAMED_CID(NS_ABOUT_CID);
static const mozilla::Module::CIDEntry kAppShellCIDs[] = {
{ &kNS_APPSHELLSERVICE_CID, false, NULL, nsAppShellServiceConstructor },
{ &kNS_WINDOWMEDIATOR_CID, false, NULL, nsWindowMediatorConstructor },
{ &kNS_ABOUT_CID, false, NULL, nsAboutConstructor },
{ NULL }
};
static const mozilla::Module::ContractIDEntry kAppShellContracts[] = {
{ NS_APPSHELLSERVICE_CONTRACTID, &kNS_APPSHELLSERVICE_CID },
{ NS_WINDOWMEDIATOR_CONTRACTID, &kNS_WINDOWMEDIATOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX, &kNS_ABOUT_CID },
{ NULL }
};