+ if ( mImpl->mHeightPolicy == Toolkit::Control::Fixed )
+ {
+ // Height is fixed so if the application / control has set it, then use that.
+ if ( !EqualsZero( mImpl->mNaturalSize.height ) )
+ {
+ size.height = mImpl->mNaturalSize.height;
+ }
+ else
+ {
+ // Otherwise, set the height to what has been allocated.
+ size.height = allocatedSize.height;
+ }
+
+ // Width is flexible so ask control what the width should be for our height.
+ size.width = GetWidthForHeight( size.height );
+
+ // Ensure width is within our policy rules
+ size.width = Calculate( mImpl->mWidthPolicy, mImpl->GetMinimumSize().width, mImpl->GetMaximumSize().width, size.width );
+ }
+ else
+ {
+ // Width and height are BOTH flexible.
+ // Calculate the width and height using the policy rules.
+ size.width = Calculate( mImpl->mWidthPolicy, mImpl->GetMinimumSize().width, mImpl->GetMaximumSize().width, allocatedSize.width );
+ size.height = Calculate( mImpl->mHeightPolicy, mImpl->GetMinimumSize().height, mImpl->GetMaximumSize().height, allocatedSize.height );
+ }