             minHeight = Math.max(minHeight, extY + elementMinHeight);
         }
 
-        layoutTarget.measuredWidth = Math.max(width, minWidth);
-        layoutTarget.measuredHeight = Math.max(height, minHeight);
-
-        layoutTarget.measuredMinWidth = minWidth;
-        layoutTarget.measuredMinHeight = minHeight;
+        // Use Math.ceil() to make sure that if the content partially occupies
+        // the last pixel, we'll count it as if the whole pixel is occupied.
+        layoutTarget.measuredWidth = Math.ceil(Math.max(width, minWidth));
+        layoutTarget.measuredHeight = Math.ceil(Math.max(height, minHeight));
+        layoutTarget.measuredMinWidth = Math.ceil(minWidth);
+        layoutTarget.measuredMinHeight = Math.ceil(minHeight);
     }
 
     /**

            if (!isNaN(vCenter))
                childY = Math.round((unscaledHeight - elementHeight) / 2 + vCenter);
            else if (!isNaN(baseline))
                childY = baseline - IVisualElement(layoutElement).baselinePosition;
            else if (!isNaN(top))
                childY = top;
            else if (!isNaN(bottom))

            }
            else if (!isNaN(baseline))
            {
                extY = Math.round(baseline - layoutElement.baselinePosition);
            }
            else if (!isNaN(top) || !isNaN(bottom))
            {
