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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h
index dc8c643..9f57192 100644
--- a/Source/WebCore/platform/graphics/ImageBuffer.h
+++ b/Source/WebCore/platform/graphics/ImageBuffer.h
@@ -128,6 +128,12 @@
// with textures that are RGB or RGBA format, and UNSIGNED_BYTE type.
bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool);
+ FloatSize spaceSize() const { return m_space; }
+ void setSpaceSize(const FloatSize& space)
+ {
+ m_space = space;
+ }
+
private:
#if USE(CG)
PassNativeImagePtr copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
@@ -152,6 +158,7 @@
IntSize m_logicalSize;
float m_resolutionScale;
OwnPtr<GraphicsContext> m_context;
+ FloatSize m_space;
// This constructor will place its success into the given out-variable
// so that create() knows when it should return failure.