move DOMElement.style.backgroundSize to CPDomDisplayServerSetStyleBackgroundSize equivalent method

This commit is contained in:
Christophe Serafin committed 2014-08-22 10:09:09 -07:00
1 parent 872fd126f4
commit 3dbce0e800
2 files changed
+18 -9

No files matched your search

+12 -9
View File
@@ -1806,7 +1806,7 @@ var CPViewFlags = { },
_DOMImageParts[0].style.background = [_backgroundColor cssString];
if (patternImage)
_DOMImageParts[0].style.backgroundSize = [patternImage size].width + "px " + [patternImage size].height + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[0], [patternImage size].width + "px", [patternImage size].height + "px");
if (CPFeatureIsCompatible(CPOpacityRequiresFilterFeature))
_DOMImageParts[0].style.filter = "alpha(opacity=" + [_backgroundColor alphaComponent] * 100 + ")";
@@ -1820,7 +1820,7 @@ var CPViewFlags = { },
_DOMElement.style.background = colorCSS;
if (patternImage)
_DOMElement.style.backgroundSize = [patternImage size].width + "px " + [patternImage size].height + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMElement, [patternImage size].width + "px", [patternImage size].height + "px");
}
else
{
@@ -1925,7 +1925,7 @@ var CPViewFlags = { },
// Make sure to repeat the top and bottom pieces horizontally if they're not the exact width needed.
if (top)
{
_DOMImageParts[partIndex].style.backgroundSize = frameSize.width + "px " + top + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", top + "px");
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, top);
partIndex++;
@@ -1933,14 +1933,16 @@ var CPViewFlags = { },
if (_DOMImageSizes[1])
{
var height = frameSize.height - top - bottom;
_DOMImageParts[partIndex].style.backgroundSize = frameSize.width + "px " + height + "px";
//_DOMImageParts[partIndex].style.backgroundSize = frameSize.width + "px " + height + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", height + "px");
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, top);
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, height);
partIndex++;
}
if (bottom)
{
_DOMImageParts[partIndex].style.backgroundSize = frameSize.width + "px " + bottom + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", bottom + "px");
CPDOMDisplayServerSetStyleLeftBottom(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, bottom);
}
@@ -1955,22 +1957,23 @@ var CPViewFlags = { },
// Make sure to repeat the left and right pieces vertically if they're not the exact height needed.
if (left)
{
_DOMImageParts[partIndex].style.backgroundSize = left + "px " + frameSize.height + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], left + "px", frameSize.height + "px");
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], left, frameSize.height);
partIndex++;
}
if (_DOMImageSizes[1])
{
var width = (frameSize.width - left - right)
_DOMImageParts[partIndex].style.backgroundSize = width + "px " + frameSize.height + "px";
var width = (frameSize.width - left - right);
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], width + "px", frameSize.height + "px");
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, left, 0.0);
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], width, frameSize.height);
partIndex++;
}
if (right)
{
_DOMImageParts[partIndex].style.backgroundSize = right + "px " + frameSize.height + "px";
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], right + "px", frameSize.height + "px");
CPDOMDisplayServerSetStyleRightTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], right, frameSize.height);
}
+6
View File
@@ -80,6 +80,9 @@ aDOMElement.style.bottom = ROUND(____p.y) + "px";
aDOMElement.width = MAX(0.0, ROUND(aWidth));\
aDOMElement.height = MAX(0.0, ROUND(aHeight));
#define CPDomDisplayServerSetStyleBackgroundSize(aDOMElement, aWidth, aHeight)\
aDOMElement.style.backgroundSize = aWidth + ' ' + aHeight;
#define CPDOMDisplayServerAppendChild(aParentElement, aChildElement) aParentElement.appendChild(aChildElement)
#define CPDOMDisplayServerInsertBefore(aParentElement, aChildElement, aBeforeElement) aParentElement.insertBefore(aChildElement, aBeforeElement)
@@ -126,6 +129,9 @@ aDOMElement.style.bottom = ROUND(____p.y) + "px";
CPDOMDisplayServerInstructions[__index + 2] = aWidth;\
CPDOMDisplayServerInstructions[__index + 3] = aHeight;
#define CPDomDisplayServerSetStyleBackgroundSize(aDOMElement, aWidth, aHeight)\
aDOMElement.style.backgroundSize = aWidth + ' ' + aHeight;
#define CPDOMDisplayServerAppendChild(aParentElement, aChildElement)\
if (aChildElement.CPDOMDisplayContext) aChildElement.CPDOMDisplayContext[SetStyleOrigin] = -1;\
CPDOMDisplayServerInstructions[CPDOMDisplayServerInstructionCount++] = AppendChild;\