зеркало из https://github.com/mozilla/pjs.git
Bug 654369 - Part 11: Remove OOM checks from layout/base r=bz
--HG-- extra : rebase_source : a725d78f3e128d6d4ca1eb48eec1cfc78f7762bf
This commit is contained in:
Родитель
b380a043ca
Коммит
4d70324117
|
@ -1600,8 +1600,6 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
|
|||
nsCounterUseNode* node =
|
||||
new nsCounterUseNode(counters, aContentIndex,
|
||||
type == eStyleContentType_Counters);
|
||||
if (!node)
|
||||
return nsnull;
|
||||
|
||||
nsGenConInitializer* initializer =
|
||||
new nsGenConInitializer(node, counterList,
|
||||
|
@ -1621,8 +1619,6 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
|
|||
{
|
||||
nsQuoteNode* node =
|
||||
new nsQuoteNode(type, aContentIndex);
|
||||
if (!node)
|
||||
return nsnull;
|
||||
|
||||
nsGenConInitializer* initializer =
|
||||
new nsGenConInitializer(node, &mQuoteList,
|
||||
|
@ -5072,9 +5068,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
PRBool resolveStyle;
|
||||
|
||||
nsAutoPtr<PendingBinding> newPendingBinding(new PendingBinding());
|
||||
if (!newPendingBinding) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = xblService->LoadBindings(aContent, display->mBinding->GetURI(),
|
||||
display->mBinding->mOriginPrincipal,
|
||||
PR_FALSE,
|
||||
|
@ -9405,10 +9399,6 @@ nsCSSFrameConstructor::CreateNeededTablePseudos(nsFrameConstructorState& aState,
|
|||
wrapperStyle.forget(),
|
||||
PR_TRUE);
|
||||
|
||||
if (!newItem) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Here we're cheating a tad... technically, table-internal items should be
|
||||
// inline if aParentFrame is inline, but they'll get wrapped in an
|
||||
// inline-table in the end, so it'll all work out. In any case, arguably
|
||||
|
|
|
@ -856,14 +856,9 @@ private:
|
|||
new FrameConstructionItem(aFCData, aContent, aTag, aNameSpaceID,
|
||||
aPendingBinding, aStyleContext,
|
||||
aSuppressWhiteSpaceOptimizations);
|
||||
if (item) {
|
||||
PR_APPEND_LINK(item, &mItems);
|
||||
++mItemCount;
|
||||
++mDesiredParentCounts[item->DesiredParentType()];
|
||||
} else {
|
||||
// Clean up the style context
|
||||
nsRefPtr<nsStyleContext> sc(aStyleContext);
|
||||
}
|
||||
PR_APPEND_LINK(item, &mItems);
|
||||
++mItemCount;
|
||||
++mDesiredParentCounts[item->DesiredParentType()];
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
|
@ -2121,7 +2121,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
|
|||
}
|
||||
gradientPattern = new gfxPattern(lineStart.x, lineStart.y, innerRadius,
|
||||
lineStart.x, lineStart.y, outerRadius);
|
||||
if (gradientPattern && radiusX != radiusY) {
|
||||
if (radiusX != radiusY) {
|
||||
// Stretch the circles into ellipses vertically by setting a transform
|
||||
// in the pattern.
|
||||
// Recall that this is the transform from user space to pattern space.
|
||||
|
@ -2134,7 +2134,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
|
|||
gradientPattern->SetMatrix(matrix);
|
||||
}
|
||||
}
|
||||
if (!gradientPattern || gradientPattern->CairoStatus())
|
||||
if (gradientPattern->CairoStatus())
|
||||
return;
|
||||
|
||||
// Now set normalized color stops in pattern.
|
||||
|
|
|
@ -244,8 +244,6 @@ nsCounterManager::AddResetOrIncrement(nsIFrame *aFrame, PRInt32 aIndex,
|
|||
{
|
||||
nsCounterChangeNode *node =
|
||||
new nsCounterChangeNode(aFrame, aType, aCounterData->mValue, aIndex);
|
||||
if (!node)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCounterList *counterList = CounterListFor(aCounterData->mCounter);
|
||||
if (!counterList) {
|
||||
|
@ -277,8 +275,6 @@ nsCounterManager::CounterListFor(const nsSubstring& aCounterName)
|
|||
nsCounterList *counterList;
|
||||
if (!mNames.Get(aCounterName, &counterList)) {
|
||||
counterList = new nsCounterList();
|
||||
if (!counterList)
|
||||
return nsnull;
|
||||
if (!mNames.Put(aCounterName, counterList)) {
|
||||
delete counterList;
|
||||
return nsnull;
|
||||
|
|
|
@ -574,8 +574,6 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
|
|||
return;
|
||||
}
|
||||
layerManager = new BasicLayerManager();
|
||||
if (!layerManager)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aFlags & PAINT_FLUSH_LAYERS) {
|
||||
|
|
|
@ -545,9 +545,6 @@ nsresult
|
|||
NS_NewDocumentViewer(nsIDocumentViewer** aResult)
|
||||
{
|
||||
*aResult = new DocumentViewerImpl();
|
||||
if (!*aResult) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
|
@ -800,7 +797,6 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
|
|||
if (!mSelectionListener) {
|
||||
nsDocViewerSelectionListener *selectionListener =
|
||||
new nsDocViewerSelectionListener();
|
||||
NS_ENSURE_TRUE(selectionListener, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
selectionListener->Init(this);
|
||||
|
||||
|
@ -825,7 +821,6 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
|
|||
// now register ourselves as a focus listener, so that we get called
|
||||
// when the focus changes in the window
|
||||
nsDocViewerFocusListener *focusListener = new nsDocViewerFocusListener();
|
||||
NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
focusListener->Init(this);
|
||||
|
||||
|
@ -2180,9 +2175,6 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
|
|||
// this should eventually get expanded to allow for creating
|
||||
// different sets for different media
|
||||
nsStyleSet *styleSet = new nsStyleSet();
|
||||
if (!styleSet) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
styleSet->BeginUpdate();
|
||||
|
||||
|
@ -3684,7 +3676,6 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
|
|||
|
||||
if (!mPrintEngine) {
|
||||
mPrintEngine = new nsPrintEngine();
|
||||
NS_ENSURE_TRUE(mPrintEngine, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = mPrintEngine->Initialize(this, mContainer, mDocument,
|
||||
float(mDeviceContext->AppUnitsPerCSSInch()) /
|
||||
|
@ -3751,7 +3742,6 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
nsPrintEventDispatcher beforeAndAfterPrint(doc);
|
||||
if (!mPrintEngine) {
|
||||
mPrintEngine = new nsPrintEngine();
|
||||
NS_ENSURE_TRUE(mPrintEngine, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = mPrintEngine->Initialize(this, mContainer, doc,
|
||||
float(mDeviceContext->AppUnitsPerCSSInch()) /
|
||||
|
|
|
@ -380,14 +380,12 @@ nsFrameManager::SetUndisplayedContent(nsIContent* aContent,
|
|||
if (! mUndisplayedMap) {
|
||||
mUndisplayedMap = new UndisplayedMap;
|
||||
}
|
||||
if (mUndisplayedMap) {
|
||||
nsIContent* parent = aContent->GetParent();
|
||||
NS_ASSERTION(parent || (mPresShell && mPresShell->GetDocument() &&
|
||||
mPresShell->GetDocument()->GetRootElement() == aContent),
|
||||
"undisplayed content must have a parent, unless it's the root "
|
||||
"element");
|
||||
mUndisplayedMap->AddNodeFor(parent, aContent, aStyleContext);
|
||||
}
|
||||
nsIContent* parent = aContent->GetParent();
|
||||
NS_ASSERTION(parent || (mPresShell && mPresShell->GetDocument() &&
|
||||
mPresShell->GetDocument()->GetRootElement() == aContent),
|
||||
"undisplayed content must have a parent, unless it's the root "
|
||||
"element");
|
||||
mUndisplayedMap->AddNodeFor(parent, aContent, aStyleContext);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1900,9 +1898,6 @@ nsFrameManagerBase::UndisplayedMap::AddNodeFor(nsIContent* aParentContent,
|
|||
nsStyleContext* aStyle)
|
||||
{
|
||||
UndisplayedNode* node = new UndisplayedNode(aChild, aStyle);
|
||||
if (! node) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
AppendNodeFor(node, aParentContent);
|
||||
return NS_OK;
|
||||
|
|
|
@ -151,8 +151,6 @@ nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult)
|
|||
*aResult = nsnull;
|
||||
|
||||
nsCOMPtr<nsIFrameTraversal> t(new nsFrameTraversal());
|
||||
if (!t)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aResult = t;
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -179,10 +177,7 @@ NS_NewFrameTraversal(nsIFrameEnumerator **aEnumerator,
|
|||
trav = new nsFrameIterator(aPresContext, aStart, aType,
|
||||
aLockInScrollView, aFollowOOFs);
|
||||
}
|
||||
if (!trav)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aEnumerator = trav;
|
||||
NS_ADDREF(trav);
|
||||
trav.forget(aEnumerator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,9 +84,6 @@ NS_NewLayoutDebugger(nsILayoutDebugger** aResult)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsLayoutDebugger* it = new nsLayoutDebugger();
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(NS_GET_IID(nsILayoutDebugger), (void**)aResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,6 @@ NS_NewLayoutHistoryState(nsILayoutHistoryState** aState)
|
|||
|
||||
*aState = nsnull;
|
||||
state = new nsLayoutHistoryState();
|
||||
if (!state)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(state);
|
||||
nsresult rv = state->Init();
|
||||
|
|
|
@ -1811,10 +1811,6 @@ nsLayoutUtils::RectListBuilder::RectListBuilder(nsClientRectList* aList)
|
|||
|
||||
void nsLayoutUtils::RectListBuilder::AddRect(const nsRect& aRect) {
|
||||
nsRefPtr<nsClientRect> rect = new nsClientRect();
|
||||
if (!rect) {
|
||||
mRV = NS_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
rect->SetLayoutRect(aRect);
|
||||
mRectList->Append(rect);
|
||||
|
@ -3876,12 +3872,8 @@ nsLayoutUtils::SurfaceFromElement(nsIDOMElement *aElement,
|
|||
if (wantImageSurface && surf->GetType() != gfxASurface::SurfaceTypeImage) {
|
||||
nsRefPtr<gfxImageSurface> imgSurf =
|
||||
new gfxImageSurface(size, gfxASurface::ImageFormatARGB32);
|
||||
if (!imgSurf)
|
||||
return result;
|
||||
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(imgSurf);
|
||||
if (!ctx)
|
||||
return result;
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
ctx->DrawSurface(surf, size);
|
||||
surf = imgSurf;
|
||||
|
|
|
@ -912,18 +912,11 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
|||
}
|
||||
|
||||
mEventManager = new nsEventStateManager();
|
||||
if (!mEventManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(mEventManager);
|
||||
|
||||
mTransitionManager = new nsTransitionManager(this);
|
||||
if (!mTransitionManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mAnimationManager = new nsAnimationManager(this);
|
||||
if (!mAnimationManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (mDocument->GetDisplayDocument()) {
|
||||
NS_ASSERTION(mDocument->GetDisplayDocument()->GetShell() &&
|
||||
|
@ -959,8 +952,6 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
|||
|
||||
if (!mRefreshDriver) {
|
||||
mRefreshDriver = new nsRefreshDriver(this);
|
||||
if (!mRefreshDriver)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1244,10 +1244,8 @@ protected:
|
|||
aEvent->widget,
|
||||
aEvent->reason,
|
||||
aEvent->context);
|
||||
if (mEvent) {
|
||||
Init(aEvent);
|
||||
static_cast<nsMouseEvent*>(mEvent)->clickCount = aEvent->clickCount;
|
||||
}
|
||||
Init(aEvent);
|
||||
static_cast<nsMouseEvent*>(mEvent)->clickCount = aEvent->clickCount;
|
||||
}
|
||||
|
||||
virtual ~nsDelayedMouseEvent()
|
||||
|
@ -1264,14 +1262,12 @@ protected:
|
|||
mEvent = new nsKeyEvent(NS_IS_TRUSTED_EVENT(aEvent),
|
||||
aEvent->message,
|
||||
aEvent->widget);
|
||||
if (mEvent) {
|
||||
Init(aEvent);
|
||||
static_cast<nsKeyEvent*>(mEvent)->keyCode = aEvent->keyCode;
|
||||
static_cast<nsKeyEvent*>(mEvent)->charCode = aEvent->charCode;
|
||||
static_cast<nsKeyEvent*>(mEvent)->alternativeCharCodes =
|
||||
aEvent->alternativeCharCodes;
|
||||
static_cast<nsKeyEvent*>(mEvent)->isChar = aEvent->isChar;
|
||||
}
|
||||
Init(aEvent);
|
||||
static_cast<nsKeyEvent*>(mEvent)->keyCode = aEvent->keyCode;
|
||||
static_cast<nsKeyEvent*>(mEvent)->charCode = aEvent->charCode;
|
||||
static_cast<nsKeyEvent*>(mEvent)->alternativeCharCodes =
|
||||
aEvent->alternativeCharCodes;
|
||||
static_cast<nsKeyEvent*>(mEvent)->isChar = aEvent->isChar;
|
||||
}
|
||||
|
||||
virtual ~nsDelayedKeyEvent()
|
||||
|
@ -1664,8 +1660,6 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aInstancePtrResult = new PresShell();
|
||||
if (!*aInstancePtrResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aInstancePtrResult);
|
||||
return NS_OK;
|
||||
|
@ -1801,7 +1795,6 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
|
||||
// Create our frame constructor.
|
||||
mFrameConstructor = new nsCSSFrameConstructor(mDocument, this);
|
||||
NS_ENSURE_TRUE(mFrameConstructor, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// The document viewer owns both view manager and pres shell.
|
||||
mViewManager->SetViewObserver(this);
|
||||
|
@ -5486,8 +5479,6 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
|||
return nsnull;
|
||||
|
||||
info = new RangePaintInfo(range, ancestorFrame);
|
||||
if (!info)
|
||||
return nsnull;
|
||||
|
||||
nsRect ancestorRect = ancestorFrame->GetVisualOverflowRect();
|
||||
|
||||
|
@ -5589,7 +5580,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
|||
gfxImageSurface* surface =
|
||||
new gfxImageSurface(gfxIntSize(pixelArea.width, pixelArea.height),
|
||||
gfxImageSurface::ImageFormatARGB32);
|
||||
if (!surface || surface->CairoStatus()) {
|
||||
if (surface->CairoStatus()) {
|
||||
delete surface;
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -6565,7 +6556,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
} else if (!mNoDelayedKeyEvents) {
|
||||
nsDelayedEvent* event =
|
||||
new nsDelayedKeyEvent(static_cast<nsKeyEvent*>(aEvent));
|
||||
if (event && !mDelayedEvents.AppendElement(event)) {
|
||||
if (!mDelayedEvents.AppendElement(event)) {
|
||||
delete event;
|
||||
}
|
||||
}
|
||||
|
@ -8595,7 +8586,6 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) {
|
|||
nsRefPtr<gfxImageSurface> imgSurface =
|
||||
new gfxImageSurface(gfxIntSize(width, height),
|
||||
gfxImageSurface::ImageFormatARGB32);
|
||||
NS_ENSURE_TRUE(imgSurface, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<gfxContext> imgContext = new gfxContext(imgSurface);
|
||||
|
||||
|
@ -8606,7 +8596,6 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) {
|
|||
NS_ENSURE_TRUE(surface, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<gfxContext> context = new gfxContext(surface);
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
shell->RenderDocument(r, 0, NS_RGB(255, 255, 0), context);
|
||||
|
||||
|
@ -8979,7 +8968,6 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame)
|
|||
ReflowCounter * counter = (ReflowCounter *)PL_HashTableLookup(mCounts, aName);
|
||||
if (counter == nsnull) {
|
||||
counter = new ReflowCounter(this);
|
||||
NS_ASSERTION(counter != nsnull, "null ptr");
|
||||
char * name = NS_strdup(aName);
|
||||
NS_ASSERTION(name != nsnull, "null ptr");
|
||||
PL_HashTableAdd(mCounts, name, counter);
|
||||
|
@ -8995,7 +8983,6 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame)
|
|||
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
|
||||
if (counter == nsnull) {
|
||||
counter = new IndiReflowCounter(this);
|
||||
NS_ASSERTION(counter != nsnull, "null ptr");
|
||||
counter->mFrame = aFrame;
|
||||
counter->mName.AssignASCII(aName);
|
||||
PL_HashTableAdd(mIndiFrameCounts, key, counter);
|
||||
|
|
|
@ -169,7 +169,6 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
|
|||
NS_ENSURE_ARG_POINTER(aSheetURI);
|
||||
|
||||
nsRefPtr<mozilla::css::Loader> loader = new mozilla::css::Loader();
|
||||
NS_ENSURE_TRUE(loader, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsRefPtr<nsCSSStyleSheet> sheet;
|
||||
// Allow UA sheets, but not user sheets, to use unsafe rules
|
||||
|
|
Загрузка…
Ссылка в новой задаче