Bug 966591 - Add #ifdef guards to fix compile issue with non-a11y builds r=dholbert

This commit is contained in:
Rik Cabanier 2014-02-25 13:47:29 -08:00
Родитель dfb0b68df3
Коммит c4b25124db
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -615,13 +615,14 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
return true;
}
#ifdef ACCESSIBILITY
PLDHashOperator
CanvasRenderingContext2D::RemoveHitRegionProperty(RegionInfo* aEntry, void*)
{
aEntry->mElement->DeleteProperty(nsGkAtoms::hitregion);
return PL_DHASH_NEXT;
}
#endif
nsresult
CanvasRenderingContext2D::Reset()
@ -639,7 +640,9 @@ CanvasRenderingContext2D::Reset()
mTarget = nullptr;
// reset hit regions
#ifdef ACCESSIBILITY
mHitRegionsOptions.EnumerateEntries(RemoveHitRegionProperty, nullptr);
#endif
mHitRegionsOptions.Clear();
// Since the target changes the backing texture will change, and this will
@ -2367,6 +2370,7 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
return new TextMetrics(width);
}
#ifdef ACCESSIBILITY
// Callback function, for freeing hit regions bounds values stored in property table
static void
ReleaseBBoxPropertyValue(void* aObject, /* unused */
@ -2378,6 +2382,7 @@ ReleaseBBoxPropertyValue(void* aObject, /* unused */
static_cast<nsRect*>(aPropertyValue);
delete valPtr;
}
#endif
void
CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorResult& error)
@ -2413,6 +2418,7 @@ CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorRes
return;
}
#ifdef ACCESSIBILITY
if (isDescendant) {
nsRect* nsBounds = new nsRect();
gfxRect rect(bounds.x, bounds.y, bounds.width, bounds.height);
@ -2421,6 +2427,7 @@ CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorRes
options.mControl->SetProperty(nsGkAtoms::hitregion, nsBounds,
ReleaseBBoxPropertyValue);
}
#endif
// finally, add the region to the list if it has an ID
if (options.mId.Length() != 0) {
@ -2436,7 +2443,9 @@ CanvasRenderingContext2D::RemoveHitRegion(const nsAString& id)
return;
}
#ifdef ACCESSIBILITY
info->mElement->DeleteProperty(nsGkAtoms::hitregion);
#endif
mHitRegionsOptions.RemoveEntry(id);
}

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

@ -702,7 +702,9 @@ protected:
nsRefPtr<Element> mElement;
};
#ifdef ACCESSIBILITY
static PLDHashOperator RemoveHitRegionProperty(RegionInfo* aEntry, void* aData);
#endif
nsTHashtable<RegionInfo> mHitRegionsOptions;
/**