From f0e5161b7b73f48e040f77876b2fadc58d7539a9 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Tue, 13 Mar 2012 13:36:52 +0000 Subject: [PATCH] Tile narrow vertical three part images horizontally, and short horizontal three part images vertically. This allows you to use a 1px wide vertical three part image to stretch to any width. --- AppKit/CPView.j | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index be1d20556..28c947d59 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -849,11 +849,17 @@ var CPViewFlags = { }, if (_backgroundType === BackgroundVerticalThreePartImage) { + // Make sure to repeat the top and bottom pieces horizontally if they're not the exact width needed. + CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], size.width, _DOMImageSizes[0].height); CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], size.width, size.height - _DOMImageSizes[0].height - _DOMImageSizes[2].height); + CPDOMDisplayServerSetStyleSize(_DOMImageParts[2], size.width, _DOMImageSizes[2].height); } else if (_backgroundType === BackgroundHorizontalThreePartImage) { + // Make sure to repeat the left and right pieces vertically if they're not the exact height needed. + CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], _DOMImageSizes[0].width, size.height); CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], size.width - _DOMImageSizes[0].width - _DOMImageSizes[2].width, size.height); + CPDOMDisplayServerSetStyleSize(_DOMImageParts[2], _DOMImageSizes[2].width, size.height); } else if (_backgroundType === BackgroundNinePartImage) { @@ -1540,7 +1546,10 @@ var CPViewFlags = { }, } else if (_backgroundType == BackgroundVerticalThreePartImage) { + // Make sure to repeat the top and bottom pieces horizontally if they're not the exact width needed. + CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], frameSize.width, _DOMImageSizes[0].height); CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], frameSize.width, frameSize.height - _DOMImageSizes[0].height - _DOMImageSizes[2].height); + CPDOMDisplayServerSetStyleSize(_DOMImageParts[2], frameSize.width, _DOMImageSizes[2].height); CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[0], NULL, 0.0, 0.0); CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[1], NULL, 0.0, _DOMImageSizes[0].height); @@ -1548,7 +1557,10 @@ var CPViewFlags = { }, } else if (_backgroundType == BackgroundHorizontalThreePartImage) { + // Make sure to repeat the left and right pieces vertically if they're not the exact height needed. + CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], _DOMImageSizes[0].width, frameSize.height); CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], frameSize.width - _DOMImageSizes[0].width - _DOMImageSizes[2].width, frameSize.height); + CPDOMDisplayServerSetStyleSize(_DOMImageParts[2], _DOMImageSizes[2].width, frameSize.height); CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[0], NULL, 0.0, 0.0); CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[1], NULL, _DOMImageSizes[0].width, 0.0);