+ if ( mTitle )
+ {
+ Vector3 titleNaturalSize = mTitle.GetImplementation().GetNaturalSize();
+ // Buffer to avoid errors. The width of the popup could potentially be the width of the title text.
+ // It was observed in this case that text wrapping was then inconsistent when seen on device
+ const float titleBuffer = 0.5f;
+ titleNaturalSize.width += titleBuffer;
+
+ // As TextLabel GetNaturalSize does not take wrapping into account, limit the width
+ // to that of the stage
+ if( titleNaturalSize.width >= maxWidth)
+ {
+ naturalSize.width = maxWidth;
+ naturalSize.height = mTitle.GetImplementation().GetHeightForWidth( naturalSize.width );
+ }
+ else
+ {
+ naturalSize += titleNaturalSize;
+ }
+
+ naturalSize.height += mPopupStyle->margin;
+ }
+