mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1179451 - Part 1: Rewrite some ternary operators as if/else. r=froydnj
This commit is contained in:
parent
b77e18ed9a
commit
a0d8e26be1
@ -396,7 +396,10 @@ SingleAccIterator::Next()
|
||||
{
|
||||
nsRefPtr<Accessible> nextAcc;
|
||||
mAcc.swap(nextAcc);
|
||||
return (nextAcc && !nextAcc->IsDefunct()) ? nextAcc : nullptr;
|
||||
if (!nextAcc || nextAcc->IsDefunct()) {
|
||||
return nullptr;
|
||||
}
|
||||
return nextAcc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -486,7 +486,10 @@ HTMLTextFieldAccessible::IsWidget() const
|
||||
Accessible*
|
||||
HTMLTextFieldAccessible::ContainerWidget() const
|
||||
{
|
||||
return mParent && mParent->Role() == roles::AUTOCOMPLETE ? mParent : nullptr;
|
||||
if (!mParent || mParent->Role() != roles::AUTOCOMPLETE) {
|
||||
return nullptr;
|
||||
}
|
||||
return mParent;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4338,7 +4338,10 @@ nsDocShell::GetDocument()
|
||||
nsPIDOMWindow*
|
||||
nsDocShell::GetWindow()
|
||||
{
|
||||
return NS_SUCCEEDED(EnsureScriptEnvironment()) ? mScriptGlobal : nullptr;
|
||||
if (NS_FAILED(EnsureScriptEnvironment())) {
|
||||
return nullptr;
|
||||
}
|
||||
return mScriptGlobal;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -84,7 +84,10 @@ public:
|
||||
File* IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = aIndex < mFiles.Length();
|
||||
return aFound ? mFiles.ElementAt(aIndex) : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
return mFiles.ElementAt(aIndex);
|
||||
}
|
||||
|
||||
uint32_t Length()
|
||||
|
@ -696,7 +696,10 @@ ShadowRoot *
|
||||
nsGenericDOMDataNode::GetContainingShadow() const
|
||||
{
|
||||
nsDataSlots *slots = GetExistingDataSlots();
|
||||
return slots ? slots->mContainingShadow : nullptr;
|
||||
if (!slots) {
|
||||
return nullptr;
|
||||
}
|
||||
return slots->mContainingShadow;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -264,8 +264,10 @@ nsMimeType::GetDescription(nsString& aRetval) const
|
||||
nsPluginElement*
|
||||
nsMimeType::GetEnabledPlugin() const
|
||||
{
|
||||
return (mPluginElement && mPluginElement->PluginTag()->IsEnabled()) ?
|
||||
mPluginElement : nullptr;
|
||||
if (!mPluginElement || !mPluginElement->PluginTag()->IsEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
return mPluginElement;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -175,7 +175,11 @@ nsPluginArray::IndexedGetter(uint32_t aIndex, bool &aFound)
|
||||
|
||||
aFound = aIndex < mPlugins.Length();
|
||||
|
||||
return aFound ? mPlugins[aIndex] : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mPlugins[aIndex];
|
||||
}
|
||||
|
||||
void
|
||||
@ -391,7 +395,11 @@ nsPluginElement::IndexedGetter(uint32_t aIndex, bool &aFound)
|
||||
|
||||
aFound = aIndex < mMimeTypes.Length();
|
||||
|
||||
return aFound ? mMimeTypes[aIndex] : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mMimeTypes[aIndex];
|
||||
}
|
||||
|
||||
nsMimeType*
|
||||
|
@ -137,7 +137,10 @@ BluetoothManager::DisconnectFromOwner()
|
||||
BluetoothAdapter*
|
||||
BluetoothManager::GetDefaultAdapter()
|
||||
{
|
||||
return DefaultAdapterExists() ? mAdapters[mDefaultAdapterIndex] : nullptr;
|
||||
if (!DefaultAdapterExists()) {
|
||||
return nullptr;
|
||||
}
|
||||
return mAdapters[mDefaultAdapterIndex];
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -89,7 +89,10 @@ public:
|
||||
PaintRequest* IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = aIndex < mArray.Length();
|
||||
return aFound ? mArray.ElementAt(aIndex) : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
return mArray.ElementAt(aIndex);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -689,7 +689,10 @@ TextComposition*
|
||||
TextCompositionArray::GetCompositionFor(nsIWidget* aWidget)
|
||||
{
|
||||
index_type i = IndexOf(aWidget);
|
||||
return i != NoIndex ? ElementAt(i) : nullptr;
|
||||
if (i == NoIndex) {
|
||||
return nullptr;
|
||||
}
|
||||
return ElementAt(i);
|
||||
}
|
||||
|
||||
TextComposition*
|
||||
@ -697,7 +700,10 @@ TextCompositionArray::GetCompositionFor(nsPresContext* aPresContext,
|
||||
nsINode* aNode)
|
||||
{
|
||||
index_type i = IndexOf(aPresContext, aNode);
|
||||
return i != NoIndex ? ElementAt(i) : nullptr;
|
||||
if (i == NoIndex) {
|
||||
return nullptr;
|
||||
}
|
||||
return ElementAt(i);
|
||||
}
|
||||
|
||||
TextComposition*
|
||||
|
@ -74,7 +74,10 @@ MediaTrack*
|
||||
MediaTrackList::IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = aIndex < mTracks.Length();
|
||||
return aFound ? mTracks[aIndex] : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
return mTracks[aIndex];
|
||||
}
|
||||
|
||||
MediaTrack*
|
||||
|
@ -50,7 +50,10 @@ TextTrackCue*
|
||||
TextTrackCueList::IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = aIndex < mList.Length();
|
||||
return aFound ? mList[aIndex] : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
return mList[aIndex];
|
||||
}
|
||||
|
||||
TextTrackCue*
|
||||
|
@ -69,7 +69,10 @@ TextTrack*
|
||||
TextTrackList::IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = aIndex < mTextTracks.Length();
|
||||
return aFound ? mTextTracks[aIndex] : nullptr;
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
return mTextTracks[aIndex];
|
||||
}
|
||||
|
||||
TextTrack*
|
||||
|
@ -38,7 +38,11 @@ SourceBufferList::IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
aFound = aIndex < mSourceBuffers.Length();
|
||||
return aFound ? mSourceBuffers[aIndex] : nullptr;
|
||||
|
||||
if (!aFound) {
|
||||
return nullptr;
|
||||
}
|
||||
return mSourceBuffers[aIndex];
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -873,7 +873,10 @@ nsRangeFrame::GetAdditionalStyleContext(int32_t aIndex) const
|
||||
// We only implement this so that SetAdditionalStyleContext will be
|
||||
// called if style changes that would change the -moz-focus-outer
|
||||
// pseudo-element have occurred.
|
||||
return aIndex == 0 ? mOuterFocusStyle : nullptr;
|
||||
if (aIndex != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
return mOuterFocusStyle;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user