Bug 970647 patch 1: Remove some null-checks and simplify control flow in nsIFrame::HasPerspective and nsIFrame::ChildrenHavePerspective. r=mattwoodrow

This commit is contained in:
L. David Baron 2014-02-10 17:03:25 -08:00
parent 28f1ae0664
commit 5a1494a9c2

View File

@ -1051,30 +1051,21 @@ nsIFrame::HasPerspective() const
if (!IsTransformed()) {
return false;
}
const nsStyleDisplay* parentDisp = nullptr;
nsStyleContext* parentStyleContext = StyleContext()->GetParent();
if (parentStyleContext) {
parentDisp = parentStyleContext->StyleDisplay();
if (!parentStyleContext) {
return false;
}
if (parentDisp &&
parentDisp->mChildPerspective.GetUnit() == eStyleUnit_Coord &&
parentDisp->mChildPerspective.GetCoordValue() > 0.0) {
return true;
}
return false;
const nsStyleDisplay* parentDisp = parentStyleContext->StyleDisplay();
return parentDisp->mChildPerspective.GetUnit() == eStyleUnit_Coord &&
parentDisp->mChildPerspective.GetCoordValue() > 0.0;
}
bool
nsIFrame::ChildrenHavePerspective() const
{
const nsStyleDisplay *disp = StyleDisplay();
if (disp &&
disp->mChildPerspective.GetUnit() == eStyleUnit_Coord &&
disp->mChildPerspective.GetCoordValue() > 0.0) {
return true;
}
return false;
return disp->mChildPerspective.GetUnit() == eStyleUnit_Coord &&
disp->mChildPerspective.GetCoordValue() > 0.0;
}
nsRect