Bug 866659 - Avoid bad cast in nsNativeTheme::IsRangeHorizontal. r=bz

This commit is contained in:
Jonathan Watt 2013-11-06 10:05:18 +00:00
parent 6c5218e413
commit a01c162997

View File

@ -664,11 +664,15 @@ nsNativeTheme::IsRangeHorizontal(nsIFrame* aFrame)
{
nsIFrame* rangeFrame = aFrame;
if (rangeFrame->GetType() != nsGkAtoms::rangeFrame) {
// If the thumb's frame is passed in, get its range parent:
rangeFrame = aFrame->GetParent();
}
MOZ_ASSERT(rangeFrame->GetType() == nsGkAtoms::rangeFrame);
return static_cast<nsRangeFrame*>(rangeFrame)->IsHorizontal();
if (rangeFrame->GetType() == nsGkAtoms::rangeFrame) {
return static_cast<nsRangeFrame*>(rangeFrame)->IsHorizontal();
}
// Not actually a range frame - just use the ratio of the frame's size to
// decide:
return aFrame->GetSize().width >= aFrame->GetSize().height;
}
static nsIFrame*