haikuwebkit/LayoutTests/css3/masking/mask-repeat-space-border-ex...

51 lines
1.7 KiB
HTML
Raw Permalink Normal View History

Source/WebCore: [CSS Masking] -webkit-mask-repeat: space does not work Added the space option to background-repeat and -webkit-mask-repeat. With the property value 'space', the background or mask image gets repeated as often as it fits within the background positioning area. The repeated images are spaced equally to fill the unused area. https://bugs.webkit.org/show_bug.cgi?id=119324 Patch by Andrei Parvu <parvu@adobe.com> on 2013-08-30 Reviewed by Dirk Schulze. Tests: css3/background/background-repeat-space-border.html css3/background/background-repeat-space-content.html css3/background/background-repeat-space-padding.html css3/masking/mask-repeat-space-border.html css3/masking/mask-repeat-space-content.html css3/masking/mask-repeat-space-padding.html * platform/graphics/GeneratorGeneratedImage.cpp: (WebCore::GeneratorGeneratedImage::drawPattern): Passed the space values to the image buffer. * platform/graphics/Image.cpp: (WebCore::Image::drawTiled): Added the space values when computing the location of the tile. * platform/graphics/Image.h: Added the space property. (WebCore::Image::spaceSize): (WebCore::Image::setSpaceSize): * platform/graphics/ImageBuffer.h: Added the space property. (WebCore::ImageBuffer::spaceSize): (WebCore::ImageBuffer::setSpaceSize): * platform/graphics/cg/ImageBufferCG.cpp: Passed the space values when copying an image. (WebCore::ImageBuffer::copyImage): * platform/graphics/cg/ImageCG.cpp: Added the space values when creating a platform pattern. (WebCore::Image::drawPattern): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): Computed the space values on x and y axis. (WebCore::getSpace): (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Pass the space values to the Image class. * rendering/RenderBoxModelObject.h: Added the space property. (WebCore::RenderBoxModelObject::BackgroundImageGeometry::spaceSize): (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setSpaceSize): * svg/graphics/SVGImage.cpp: Passed the space property to the created image. (WebCore::SVGImage::drawPatternForContainer): * svg/graphics/SVGImageForContainer.cpp: Passed the space property to the image property. (WebCore::SVGImageForContainer::drawPattern): LayoutTests: [CSS Masking] -webkit-mask-repeat: space does not work Added tests to verify correct usage of background-repeat: space and mask-repeat: space. Added one test for each possible mask/background clip: border, padding and content https://bugs.webkit.org/show_bug.cgi?id=119324 Patch by Andrei Parvu <parvu@adobe.com> on 2013-08-30 Reviewed by Dirk Schulze. * css3/background/background-repeat-space-border-expected.html: Added. * css3/background/background-repeat-space-border.html: Added. * css3/background/background-repeat-space-content-expected.html: Added. * css3/background/background-repeat-space-content.html: Added. * css3/background/background-repeat-space-padding-expected.html: Added. * css3/background/background-repeat-space-padding.html: Added. * css3/masking/mask-repeat-space-border-expected.html: Added. * css3/masking/mask-repeat-space-border.html: Added. * css3/masking/mask-repeat-space-content-expected.html: Added. * css3/masking/mask-repeat-space-content.html: Added. * css3/masking/mask-repeat-space-padding-expected.html: Added. * css3/masking/mask-repeat-space-padding.html: Added. Canonical link: https://commits.webkit.org/138503@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 12:58:10 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#back {
width: 700px;
height: 500px;
background-color: green;
}
#front {
width: 500px;
height: 300px;
background-color: red;
border: 50px solid blue;
padding: 50px;
}
</style>
<script>
var sizeX = 151, sizeY = 128, spaceX = 32, spaceY = 58, width = 700, height = 500;
var urls = Array(), size = Array(), position = Array();
function addMasks() {
for (var x = 0; x < width; x += sizeX + spaceX) {
for (var y = 0; y < height; y += sizeY + spaceY) {
urls.push("linear-gradient(45deg, black, transparent 100%)");
size.push(sizeX + "px " + sizeY + "px");
position.push(x + "px " + y + "px");
}
}
div = document.getElementById("front");
div.style.cssText += "-webkit-mask-image: " + urls.join(", ") + ";" +
"-webkit-mask-size: " + size.join(", ") + ";" +
"-webkit-mask-position: " + position.join(", ") + ";" +
"-webkit-mask-repeat: no-repeat;" +
"-webkit-mask-origin: border-box;" +
"-webkit-mask-clip: border-box;";
}
</script>
</head>
<body onload="addMasks()">
<div id="back">
<div id="front" />
</div>
</body>
</html>