зеркало из https://github.com/mozilla/gecko-dev.git
Bug 788242: Implement and make use of void versions of NS_ENSURE_* macros; r=ehsan,bsmedberg
This commit is contained in:
Родитель
245dcc3f73
Коммит
dcf81f4fb0
|
@ -18,7 +18,7 @@ nsEventShell::FireEvent(AccEvent* aEvent)
|
|||
return;
|
||||
|
||||
Accessible* accessible = aEvent->GetAccessible();
|
||||
NS_ENSURE_TRUE(accessible,);
|
||||
NS_ENSURE_TRUE_VOID(accessible);
|
||||
|
||||
nsINode* node = aEvent->GetNode();
|
||||
if (node) {
|
||||
|
@ -35,7 +35,7 @@ void
|
|||
nsEventShell::FireEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
NS_ENSURE_TRUE(aAccessible,);
|
||||
NS_ENSURE_TRUE_VOID(aAccessible);
|
||||
|
||||
nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
|
||||
aIsFromUserInput);
|
||||
|
|
|
@ -2944,7 +2944,7 @@ void
|
|||
Accessible::CacheChildren()
|
||||
{
|
||||
DocAccessible* doc = Document();
|
||||
NS_ENSURE_TRUE(doc,);
|
||||
NS_ENSURE_TRUE_VOID(doc);
|
||||
|
||||
nsAccTreeWalker walker(doc, mContent, CanHaveAnonChildren());
|
||||
|
||||
|
|
|
@ -1705,7 +1705,7 @@ HyperTextAccessible::GetSelectionDOMRanges(int16_t aType,
|
|||
uint32_t childCount = startNode->GetChildCount();
|
||||
nsresult rv = domSel->
|
||||
GetRangesForIntervalArray(startNode, 0, startNode, childCount, true, aRanges);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
// Remove collapsed ranges
|
||||
uint32_t numRanges = aRanges->Length();
|
||||
|
|
|
@ -159,7 +159,7 @@ HTMLRadioButtonAccessible::GetPositionAndSizeInternal(int32_t* aPosInSet,
|
|||
inputElms = NS_GetContentList(formElm, namespaceId, tagName);
|
||||
else
|
||||
inputElms = NS_GetContentList(mContent->OwnerDoc(), namespaceId, tagName);
|
||||
NS_ENSURE_TRUE(inputElms, );
|
||||
NS_ENSURE_TRUE_VOID(inputElms);
|
||||
|
||||
uint32_t inputCount = inputElms->Length(false);
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ XULColorPickerAccessible::AreItemsOperable() const
|
|||
void
|
||||
XULColorPickerAccessible::CacheChildren()
|
||||
{
|
||||
NS_ENSURE_TRUE(mDoc,);
|
||||
NS_ENSURE_TRUE_VOID(mDoc);
|
||||
|
||||
nsAccTreeWalker walker(mDoc, mContent, true);
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ XULButtonAccessible::CacheChildren()
|
|||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::menuButton, eCaseMatters);
|
||||
|
||||
NS_ENSURE_TRUE(mDoc,);
|
||||
NS_ENSURE_TRUE_VOID(mDoc);
|
||||
if (!isMenu && !isMenuButton)
|
||||
return;
|
||||
|
||||
|
@ -823,7 +823,7 @@ XULTextFieldAccessible::GetEditor() const
|
|||
void
|
||||
XULTextFieldAccessible::CacheChildren()
|
||||
{
|
||||
NS_ENSURE_TRUE(mDoc,);
|
||||
NS_ENSURE_TRUE_VOID(mDoc);
|
||||
// Create child accessibles for native anonymous content of underlying HTML
|
||||
// input element.
|
||||
nsCOMPtr<nsIContent> inputContent(GetInputField());
|
||||
|
|
|
@ -449,11 +449,11 @@ nsChromeRegistryChrome::SendRegisteredChrome(
|
|||
PL_DHashTableEnumerate(&mPackagesHash, CollectPackages, &args);
|
||||
|
||||
nsCOMPtr<nsIIOService> io (do_GetIOService());
|
||||
NS_ENSURE_TRUE(io, );
|
||||
NS_ENSURE_TRUE_VOID(io);
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> ph;
|
||||
nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
//FIXME: Some substitutions are set up lazily and might not exist yet
|
||||
nsCOMPtr<nsIResProtocolHandler> irph (do_QueryInterface(ph));
|
||||
|
@ -464,7 +464,7 @@ nsChromeRegistryChrome::SendRegisteredChrome(
|
|||
|
||||
bool success = aParent->SendRegisterChrome(packages, resources, overrides,
|
||||
mSelectedLocale);
|
||||
NS_ENSURE_TRUE(success, );
|
||||
NS_ENSURE_TRUE_VOID(success);
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
|
|
|
@ -1367,13 +1367,13 @@ nsEventSource::DispatchAllMessageEvents()
|
|||
|
||||
// Let's play get the JSContext
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetOwner());
|
||||
NS_ENSURE_TRUE(sgo,);
|
||||
NS_ENSURE_TRUE_VOID(sgo);
|
||||
|
||||
nsIScriptContext* scriptContext = sgo->GetContext();
|
||||
NS_ENSURE_TRUE(scriptContext,);
|
||||
NS_ENSURE_TRUE_VOID(scriptContext);
|
||||
|
||||
JSContext* cx = scriptContext->GetNativeContext();
|
||||
NS_ENSURE_TRUE(cx,);
|
||||
NS_ENSURE_TRUE_VOID(cx);
|
||||
|
||||
while (mMessagesToDispatch.GetSize() > 0) {
|
||||
nsAutoPtr<Message>
|
||||
|
@ -1387,7 +1387,7 @@ nsEventSource::DispatchAllMessageEvents()
|
|||
jsString = JS_NewUCStringCopyN(cx,
|
||||
message->mData.get(),
|
||||
message->mData.Length());
|
||||
NS_ENSURE_TRUE(jsString,);
|
||||
NS_ENSURE_TRUE_VOID(jsString);
|
||||
|
||||
jsData = STRING_TO_JSVAL(jsString);
|
||||
}
|
||||
|
|
|
@ -198,25 +198,25 @@ nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget(aPresContext);
|
||||
NS_ENSURE_TRUE(widget, );
|
||||
NS_ENSURE_TRUE_VOID(widget);
|
||||
|
||||
bool isTrusted;
|
||||
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!isTrusted) {
|
||||
return; // ignore untrusted event.
|
||||
}
|
||||
|
||||
uint16_t button;
|
||||
rv = aMouseEvent->GetButton(&button);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (button != 0) {
|
||||
return; // not a left click event.
|
||||
}
|
||||
|
||||
int32_t clickCount;
|
||||
rv = aMouseEvent->GetDetail(&clickCount);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (clickCount != 1) {
|
||||
return; // should notify only first click event.
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ nsIMEStateManager::SetIMEState(const IMEState &aState,
|
|||
nsIWidget* aWidget,
|
||||
InputContextAction aAction)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWidget, );
|
||||
NS_ENSURE_TRUE_VOID(aWidget);
|
||||
|
||||
InputContext oldContext = aWidget->GetInputContext();
|
||||
|
||||
|
|
|
@ -1385,7 +1385,7 @@ nsTextEditorState::DestroyEditor()
|
|||
void
|
||||
nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
|
||||
{
|
||||
NS_ENSURE_TRUE(mBoundFrame, );
|
||||
NS_ENSURE_TRUE_VOID(mBoundFrame);
|
||||
|
||||
// If it was, however, it should be unbounded from the same frame.
|
||||
NS_ASSERTION(!aFrame || aFrame == mBoundFrame, "Unbinding from the wrong frame");
|
||||
|
@ -1984,7 +1984,7 @@ nsTextEditorState::SetPlaceholderClass(bool aVisible,
|
|||
classValue.AppendLiteral(" hidden");
|
||||
|
||||
nsIContent* placeholderDiv = GetPlaceholderNode();
|
||||
NS_ENSURE_TRUE(placeholderDiv, );
|
||||
NS_ENSURE_TRUE_VOID(placeholderDiv);
|
||||
|
||||
placeholderDiv->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
classValue, aNotify);
|
||||
|
|
|
@ -2405,7 +2405,7 @@ nsHTMLDocument::DeferredContentEditableCountChange(nsIContent *aElement)
|
|||
EditingState oldState = mEditingState;
|
||||
|
||||
nsresult rv = EditingStateChanged();
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (oldState == mEditingState && mEditingState == eContentEditable) {
|
||||
// We just changed the contentEditable state of a node, we need to reset
|
||||
|
@ -2422,7 +2422,7 @@ nsHTMLDocument::DeferredContentEditableCountChange(nsIContent *aElement)
|
|||
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell =
|
||||
do_QueryInterface(docshell, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
|
@ -2439,7 +2439,7 @@ nsHTMLDocument::DeferredContentEditableCountChange(nsIContent *aElement)
|
|||
nsCOMPtr<nsIInlineSpellChecker> spellChecker;
|
||||
rv = editor->GetInlineSpellChecker(false,
|
||||
getter_AddRefs(spellChecker));
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (spellChecker) {
|
||||
rv = spellChecker->SpellCheckRange(range);
|
||||
|
|
|
@ -329,12 +329,12 @@ IDBTransaction::RollbackSavepoint()
|
|||
nsCOMPtr<mozIStorageStatement> stmt = GetCachedStatement(NS_LITERAL_CSTRING(
|
||||
"ROLLBACK TO SAVEPOINT " SAVEPOINT_NAME
|
||||
));
|
||||
NS_ENSURE_TRUE(stmt,);
|
||||
NS_ENSURE_TRUE_VOID(stmt);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1065,14 +1065,14 @@ UpdateRefcountFunction::DidCommit()
|
|||
mFileInfoEntries.EnumerateRead(FileInfoUpdateCallback, nullptr);
|
||||
|
||||
nsresult rv = RemoveJournals(mJournalsToRemoveAfterCommit);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
void
|
||||
UpdateRefcountFunction::DidAbort()
|
||||
{
|
||||
nsresult rv = RemoveJournals(mJournalsToRemoveAfterAbort);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -165,23 +165,23 @@ ProcessPriorityManager::OnContentDocumentGlobalCreated(
|
|||
// Get the inner window (the topic of content-document-global-created is
|
||||
// the /outer/ window!).
|
||||
nsCOMPtr<nsPIDOMWindow> outerWindow = do_QueryInterface(aOuterWindow);
|
||||
NS_ENSURE_TRUE(outerWindow, );
|
||||
NS_ENSURE_TRUE_VOID(outerWindow);
|
||||
nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();
|
||||
NS_ENSURE_TRUE(innerWindow, );
|
||||
NS_ENSURE_TRUE_VOID(innerWindow);
|
||||
|
||||
// We're only interested in top-level windows.
|
||||
nsCOMPtr<nsIDOMWindow> parentOuterWindow;
|
||||
innerWindow->GetScriptableParent(getter_AddRefs(parentOuterWindow));
|
||||
NS_ENSURE_TRUE(parentOuterWindow, );
|
||||
NS_ENSURE_TRUE_VOID(parentOuterWindow);
|
||||
if (parentOuterWindow != outerWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(innerWindow);
|
||||
NS_ENSURE_TRUE(target, );
|
||||
NS_ENSURE_TRUE_VOID(target);
|
||||
|
||||
nsWeakPtr weakWin = do_GetWeakReference(innerWindow);
|
||||
NS_ENSURE_TRUE(weakWin, );
|
||||
NS_ENSURE_TRUE_VOID(weakWin);
|
||||
|
||||
if (mWindows.Contains(weakWin)) {
|
||||
return;
|
||||
|
|
|
@ -67,7 +67,7 @@ void MaemoLocationProvider::LocationChanged(LocationGPSDevice* device, void* sel
|
|||
return;
|
||||
|
||||
MaemoLocationProvider* provider = static_cast<MaemoLocationProvider*>(self);
|
||||
NS_ENSURE_TRUE(provider, );
|
||||
NS_ENSURE_TRUE_VOID(provider);
|
||||
provider->LocationUpdate(device);
|
||||
}
|
||||
|
||||
|
|
|
@ -1836,7 +1836,7 @@ nsEditor::NotifyEditorObservers(void)
|
|||
// overwork. We don't need to do it for the very rare case.
|
||||
|
||||
nsCOMPtr<nsIContent> target = GetInputEventTargetContent();
|
||||
NS_ENSURE_TRUE(target, );
|
||||
NS_ENSURE_TRUE_VOID(target);
|
||||
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new EditorInputEventDispatcher(this, mHandlingTrustedAction, target));
|
||||
|
@ -1997,7 +1997,7 @@ nsEditor::BeginIMEComposition()
|
|||
void
|
||||
nsEditor::EndIMEComposition()
|
||||
{
|
||||
NS_ENSURE_TRUE(mInIMEMode, ); // nothing to do
|
||||
NS_ENSURE_TRUE_VOID(mInIMEMode); // nothing to do
|
||||
|
||||
// commit the IME transaction..we can get at it via the transaction mgr.
|
||||
// Note that this means IME won't work without an undo stack!
|
||||
|
@ -5185,7 +5185,7 @@ nsEditor::SwitchTextDirectionTo(uint32_t aDirection)
|
|||
// Get the current root direction from its frame
|
||||
dom::Element *rootElement = GetRoot();
|
||||
nsresult rv = DetermineCurrentDirection();
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
// Apply the requested direction
|
||||
if (aDirection == nsIPlaintextEditor::eEditorLeftToRight &&
|
||||
|
|
|
@ -240,7 +240,7 @@ void gfxFT2FontGroup::GetCJKPrefFonts(nsTArray<nsRefPtr<gfxFontEntry> >& aFontEn
|
|||
key.AppendInt(mStyle.weight);
|
||||
|
||||
if (!platform->GetPrefFontEntries(key, &aFontEntryList)) {
|
||||
NS_ENSURE_TRUE(Preferences::GetRootBranch(), );
|
||||
NS_ENSURE_TRUE_VOID(Preferences::GetRootBranch());
|
||||
// Add the CJK pref fonts from accept languages, the order should be same order
|
||||
nsAdoptingCString list = Preferences::GetLocalizedCString("intl.accept_languages");
|
||||
if (!list.IsEmpty()) {
|
||||
|
|
|
@ -855,7 +855,7 @@ gfxPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
|||
static void
|
||||
AppendGenericFontFromPref(nsString& aFonts, nsIAtom *aLangGroup, const char *aGenericName)
|
||||
{
|
||||
NS_ENSURE_TRUE(Preferences::GetRootBranch(), );
|
||||
NS_ENSURE_TRUE_VOID(Preferences::GetRootBranch());
|
||||
|
||||
nsAutoCString prefName, langGroupString;
|
||||
|
||||
|
|
|
@ -109,23 +109,23 @@ nsLocaleService::nsLocaleService(void)
|
|||
// get the system LCID
|
||||
//
|
||||
LCID win_lcid = GetSystemDefaultLCID();
|
||||
NS_ENSURE_TRUE(win_lcid, );
|
||||
NS_ENSURE_TRUE_VOID(win_lcid);
|
||||
nsWin32Locale::GetXPLocale(win_lcid, xpLocale);
|
||||
nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale));
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
//
|
||||
// get the application LCID
|
||||
//
|
||||
win_lcid = GetUserDefaultLCID();
|
||||
NS_ENSURE_TRUE(win_lcid, );
|
||||
NS_ENSURE_TRUE_VOID(win_lcid);
|
||||
nsWin32Locale::GetXPLocale(win_lcid, xpLocale);
|
||||
rv = NewLocale(xpLocale, getter_AddRefs(mApplicationLocale));
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
#endif
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
nsRefPtr<nsLocale> resultLocale(new nsLocale());
|
||||
NS_ENSURE_TRUE(resultLocale, );
|
||||
NS_ENSURE_TRUE_VOID(resultLocale);
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
const char* lang = QLocale::system().name().toAscii();
|
||||
|
|
|
@ -51,7 +51,7 @@ ScopedXREEmbed::Start()
|
|||
return;
|
||||
|
||||
localFile = do_QueryInterface(parent);
|
||||
NS_ENSURE_TRUE(localFile,);
|
||||
NS_ENSURE_TRUE_VOID(localFile);
|
||||
|
||||
#ifdef OS_MACOSX
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
|
@ -62,21 +62,21 @@ ScopedXREEmbed::Start()
|
|||
return;
|
||||
|
||||
localFile = do_QueryInterface(parent);
|
||||
NS_ENSURE_TRUE(localFile,);
|
||||
NS_ENSURE_TRUE_VOID(localFile);
|
||||
|
||||
rv = localFile->GetParent(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
localFile = do_QueryInterface(parent);
|
||||
NS_ENSURE_TRUE(localFile,);
|
||||
NS_ENSURE_TRUE_VOID(localFile);
|
||||
|
||||
rv = localFile->GetParent(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
localFile = do_QueryInterface(parent);
|
||||
NS_ENSURE_TRUE(localFile,);
|
||||
NS_ENSURE_TRUE_VOID(localFile);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4705,7 +4705,7 @@ Selection::SetAnchorFocusToRange(nsRange* aRange)
|
|||
void
|
||||
Selection::ReplaceAnchorFocusRange(nsRange* aRange)
|
||||
{
|
||||
NS_ENSURE_TRUE(mAnchorFocusRange, );
|
||||
NS_ENSURE_TRUE_VOID(mAnchorFocusRange);
|
||||
nsRefPtr<nsPresContext> presContext;
|
||||
GetPresContext(getter_AddRefs(presContext));
|
||||
if (presContext) {
|
||||
|
|
|
@ -1000,18 +1000,18 @@ nsUpdateProcessor::StartBackgroundUpdate()
|
|||
mInfo.mAppVersion.get(),
|
||||
false,
|
||||
&mUpdaterPID);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (mUpdaterPID) {
|
||||
// Track the state of the background updater process
|
||||
rv = NS_DispatchToCurrentThread(NS_NewRunnableMethod(this, &nsUpdateProcessor::WaitForProcess));
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
} else {
|
||||
// Failed to launch the background updater process for some reason.
|
||||
// We need to shutdown the current thread as there isn't anything more for
|
||||
// us to do...
|
||||
rv = NS_DispatchToMainThread(NS_NewRunnableMethod(this, &nsUpdateProcessor::ShutdownWatcherThread));
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ nsWindow::SetSizeMode(int32_t aMode)
|
|||
// set to visible if one of their ancestors is invisible)
|
||||
static void find_first_visible_parent(QGraphicsItem* aItem, QGraphicsItem*& aVisibleItem)
|
||||
{
|
||||
NS_ENSURE_TRUE(aItem, );
|
||||
NS_ENSURE_TRUE_VOID(aItem);
|
||||
|
||||
aVisibleItem = nullptr;
|
||||
QGraphicsItem* parItem = nullptr;
|
||||
|
@ -2330,7 +2330,7 @@ nsWindow::NativeResize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
|||
|
||||
if (mIsTopLevel) {
|
||||
QGraphicsView *widget = qobject_cast<QGraphicsView*>(GetViewWidget());
|
||||
NS_ENSURE_TRUE(widget,);
|
||||
NS_ENSURE_TRUE_VOID(widget);
|
||||
// map from in-scene widget to scene, from scene to view.
|
||||
QRect r = widget->mapFromScene(mWidget->mapToScene(QRect(0, 0, aWidth, aHeight))).boundingRect();
|
||||
// going from QPolygon to QRect includes the points, adding one to width and height
|
||||
|
@ -2358,7 +2358,7 @@ nsWindow::NativeResize(int32_t aX, int32_t aY,
|
|||
|
||||
if (mIsTopLevel) {
|
||||
QGraphicsView *widget = qobject_cast<QGraphicsView*>(GetViewWidget());
|
||||
NS_ENSURE_TRUE(widget,);
|
||||
NS_ENSURE_TRUE_VOID(widget);
|
||||
// map from in-scene widget to scene, from scene to view.
|
||||
QRect r = widget->mapFromScene(mWidget->mapToScene(QRect(aX, aY, aWidth, aHeight))).boundingRect();
|
||||
// going from QPolygon to QRect includes the points, adding one to width and height
|
||||
|
@ -3166,7 +3166,7 @@ NS_IMETHODIMP_(void)
|
|||
nsWindow::SetInputContext(const InputContext& aContext,
|
||||
const InputContextAction& aAction)
|
||||
{
|
||||
NS_ENSURE_TRUE(mWidget, );
|
||||
NS_ENSURE_TRUE_VOID(mWidget);
|
||||
|
||||
// SetSoftwareKeyboardState uses mInputContext,
|
||||
// so, before calling that, record aContext in mInputContext.
|
||||
|
|
|
@ -310,7 +310,7 @@ MouseScrollHandler::InitEvent(nsWindow* aWindow,
|
|||
nsGUIEvent& aEvent,
|
||||
nsIntPoint* aPoint)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWindow, );
|
||||
NS_ENSURE_TRUE_VOID(aWindow);
|
||||
nsIntPoint point;
|
||||
if (aPoint) {
|
||||
point = *aPoint;
|
||||
|
|
|
@ -258,6 +258,17 @@
|
|||
#define NS_ENSURE_FALSE(x, ret) \
|
||||
NS_ENSURE_TRUE(!(x), ret)
|
||||
|
||||
#define NS_ENSURE_TRUE_VOID(x) \
|
||||
do { \
|
||||
if (NS_UNLIKELY(!(x))) { \
|
||||
NS_WARNING("NS_ENSURE_TRUE(" #x ") failed"); \
|
||||
return; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define NS_ENSURE_FALSE_VOID(x) \
|
||||
NS_ENSURE_TRUE_VOID(!(x))
|
||||
|
||||
/******************************************************************************
|
||||
** Macros for checking results
|
||||
******************************************************************************/
|
||||
|
@ -270,11 +281,20 @@
|
|||
NS_WARNING(msg); \
|
||||
PR_smprintf_free(msg);
|
||||
|
||||
#define NS_ENSURE_SUCCESS_BODY_VOID(res) \
|
||||
char *msg = PR_smprintf("NS_ENSURE_SUCCESS_VOID(%s) failed with " \
|
||||
"result 0x%X", #res, __rv); \
|
||||
NS_WARNING(msg); \
|
||||
PR_smprintf_free(msg);
|
||||
|
||||
#else
|
||||
|
||||
#define NS_ENSURE_SUCCESS_BODY(res, ret) \
|
||||
NS_WARNING("NS_ENSURE_SUCCESS(" #res ", " #ret ") failed");
|
||||
|
||||
#define NS_ENSURE_SUCCESS_BODY_VOID(res) \
|
||||
NS_WARNING("NS_ENSURE_SUCCESS_VOID(" #res ") failed");
|
||||
|
||||
#endif
|
||||
|
||||
#define NS_ENSURE_SUCCESS(res, ret) \
|
||||
|
@ -286,6 +306,15 @@
|
|||
} \
|
||||
} while(0)
|
||||
|
||||
#define NS_ENSURE_SUCCESS_VOID(res) \
|
||||
do { \
|
||||
nsresult __rv = res; \
|
||||
if (NS_FAILED(__rv)) { \
|
||||
NS_ENSURE_SUCCESS_BODY_VOID(res) \
|
||||
return; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/******************************************************************************
|
||||
** Macros for checking state and arguments upon entering interface boundaries
|
||||
******************************************************************************/
|
||||
|
|
Загрузка…
Ссылка в новой задаче