Commit 85fa8e43 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Source/WebCore: If you set a tiled cross-faded-image or a tiled gradient as

a background layer, -webkit-background-blend-mode doesn't work.
The problem consists in the blendMode parameter not being set
for these specific drawing paths.

https://bugs.webkit.org/show_bug.cgi?id=126888
Patch by Mihai Tica <mitica@adobe.com> on 2014-01-21
Reviewed by Dirk Schulze.

Test: css3/compositing/background-blend-mode-tiled-layers.html

* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern): Add the blendMode parameter and pass it to ImageBuffer::drawPattern.
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern): Add the blendMode parameter and pass it to ImageBuffer::drawPattern.
* platform/graphics/ImageBuffer.h: Add a BlendMode parameter to the drawPattern method.
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::drawPattern): Add the default BlendMode parameter to the method declaration.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::drawPattern): Add and use the blendMode parameter for all the code paths.
* platform/graphics/wince/ImageBufferWinCE.cpp:
(WebCore::BufferedImage::drawPattern): Add the default BlendMode parameter to the method declaration.

LayoutTests: If you set a tiled cross-faded-image or a tiled gradient as
a background layer, -webkit-background-blend-mode doesn't work.
https://bugs.webkit.org/show_bug.cgi?id=126888

Patch by Mihai Tica <mitica@adobe.com> on 2014-01-21
Reviewed by Dirk Schulze.

* css3/compositing/background-blend-mode-tiled-layers-expected.html: Added.
* css3/compositing/background-blend-mode-tiled-layers.html: Added.
* platform/efl/TestExpectations: Skip test for efl, blendModes are not implemented.
* platform/mac/TestExpectations: Mark added test as ImageOnlyFailure due to slight differences between the actual result and the blending formula.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4c113670
2014-01-21 Mihai Tica <mitica@adobe.com>
If you set a tiled cross-faded-image or a tiled gradient as
a background layer, -webkit-background-blend-mode doesn't work.
https://bugs.webkit.org/show_bug.cgi?id=126888
Reviewed by Dirk Schulze.
* css3/compositing/background-blend-mode-tiled-layers-expected.html: Added.
* css3/compositing/background-blend-mode-tiled-layers.html: Added.
* platform/efl/TestExpectations: Skip test for efl, blendModes are not implemented.
* platform/mac/TestExpectations: Mark added test as ImageOnlyFailure due to slight differences between the actual result and the blending formula.
2014-01-21 Peter Molnar <pmolnar.u-szeged@partner.samsung.com>
 
Fix SVG animations which set rx or ry attributes
<!DOCTYPE HTML>
<!-- Test background blend mode with several tiled layers. Test passes if you can see 6 lime squares. -->
<style>
div {
margin: 5px;
width: 100px;
height: 100px;
background: lime;
float: left;
}
</style>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<!DOCTYPE HTML>
<!-- Test background blend mode with several tiled layers. Test passes if you can see 6 lime squares. -->
<style>
div {
margin: 5px;
width: 100px;
height: 100px;
-webkit-background-blend-mode: difference, normal;
float: left;
}
.tiledSVG {
background: url('data:image/svg+xml;utf8, \
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> \
<rect width="100" height="100" fill="#F00"/> \
</svg>'
) 0 0 /50% 50%, #FF0;
}
.tiledGradient {
background: linear-gradient(to right, #F00 0%, #F00 100%) 0 0 /50% 50%, #FF0;
}
.tiledCrossfadeImage {
background: -webkit-cross-fade(url('data:image/svg+xml;utf8, \
<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="100px"> \
<rect width="100" height="100" fill="#F00"/> \
</svg>'
), url('data:image/svg+xml;utf8, \
<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="100px"> \
<rect width="100" height="100" fill="#F00"/> \
</svg>'
), 100%) 0 0 /50% 50%, #FF0;
}
.accelerated {
-webkit-transform: translateZ(0);
}
</style>
<script type="text/javascript">
if (window.testRunner)
window.testRunner.overridePreference("WebKitAcceleratedCompositingEnabled", "1");
</script>
<div class="tiledSVG"></div>
<div class="tiledSVG accelerated"></div>
<div class="tiledGradient"></div>
<div class="tiledGradient accelerated"></div>
<div class="tiledCrossfadeImage"></div>
<div class="tiledCrossfadeImage accelerated"></div>
......@@ -499,6 +499,7 @@ webkit.org/b/99200 css3/compositing/blend-mode-reflection.html [ Skip ]
webkit.org/b/99200 css3/compositing/blend-mode-simple.html [ Skip ]
webkit.org/b/99200 css3/compositing/blend-mode-should-not-have-compositing-layer.html [ Skip ]
webkit.org/b/118894 css3/compositing/background-blend-mode-data-uri-svg-image.html [ Skip ]
webkit.org/b/126888 css3/compositing/background-blend-mode-tiled-layers.html [ Skip ]
# No concept of secure text input
editing/secure-input [ Failure ]
......
......@@ -617,6 +617,8 @@ compositing/overflow/scrolling-without-painting.html
# Blend mode result is slightly different than the applied formula.
css3/compositing/background-blend-mode-data-uri-svg-image.html [ ImageOnlyFailure Pass ]
css3/compositing/background-blend-mode-tiled-layers.html [ ImageOnlyFailure Pass ]
css3/compositing/background-blend-mode-crossfade-image.html [ ImageOnlyFailure Pass ]
# https://bugs.webkit.org/show_bug.cgi?id=110871
compositing/overlap-blending/reflection-opacity-huge.html
......@@ -661,9 +663,6 @@ fast/canvas/canvas-quadratic-same-endpoint.html
css3/filters/composited-during-transition-layertree.html
webkit.org/b/95622 css3/filters/composited-during-animation-layertree.html [ Pass Failure ]
# Blending result is slightly different than the formula.
webkit.org/b/126887 css3/compositing/background-blend-mode-crossfade-image.html [ ImageOnlyFailure Pass ]
# --- Custom Filters ---
# The following 5 tests are currently skipped on Mac for slight color differences,
# please see the relevant bug: http://webkit.org/b/107487
......
2014-01-21 Mihai Tica <mitica@adobe.com>
If you set a tiled cross-faded-image or a tiled gradient as
a background layer, -webkit-background-blend-mode doesn't work.
The problem consists in the blendMode parameter not being set
for these specific drawing paths.
https://bugs.webkit.org/show_bug.cgi?id=126888
Reviewed by Dirk Schulze.
Test: css3/compositing/background-blend-mode-tiled-layers.html
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern): Add the blendMode parameter and pass it to ImageBuffer::drawPattern.
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern): Add the blendMode parameter and pass it to ImageBuffer::drawPattern.
* platform/graphics/ImageBuffer.h: Add a BlendMode parameter to the drawPattern method.
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::drawPattern): Add the default BlendMode parameter to the method declaration.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::drawPattern): Add and use the blendMode parameter for all the code paths.
* platform/graphics/wince/ImageBufferWinCE.cpp:
(WebCore::BufferedImage::drawPattern): Add the default BlendMode parameter to the method declaration.
2014-01-21 Gurpreet Kaur <k.gurpreet@samsung.com>
 
The WebCore.vcxproj.filters doesnot apply
......@@ -96,7 +96,7 @@ void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
drawCrossfade(context);
}
void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode)
void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
{
std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(size(), 1, ColorSpaceDeviceRGB, context->isAcceleratedContext() ? Accelerated : Unaccelerated);
if (!imageBuffer)
......@@ -107,7 +107,7 @@ void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatR
drawCrossfade(graphicsContext);
// Tile the image buffer into the context.
imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, dstRect);
imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, dstRect, blendMode);
}
}
......@@ -45,7 +45,7 @@ void GradientImage::draw(GraphicsContext* destContext, const FloatRect& destRect
}
void GradientImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode)
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
{
// Allow the generator to provide visually-equivalent tiling parameters for better performance.
IntSize adjustedSize = size();
......@@ -81,7 +81,7 @@ void GradientImage::drawPattern(GraphicsContext* destContext, const FloatRect& s
destContext->setDrawLuminanceMask(false);
// Tile the image buffer into the context.
m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect);
m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect, blendMode);
}
}
......@@ -143,7 +143,7 @@ namespace WebCore {
void clip(GraphicsContext*, const FloatRect&) const;
void draw(GraphicsContext*, ColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
inline void genericConvertToLuminanceMask();
......
......@@ -153,7 +153,7 @@ void ImageBuffer::draw(GraphicsContext* destinationContext, ColorSpace styleColo
}
void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode)
{
RefPtr<Image> image = copyImage(DontCopyBackingStore);
image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
......
......@@ -307,7 +307,7 @@ void ImageBuffer::draw(GraphicsContext* destContext, ColorSpace styleColorSpace,
destContext->drawNativeImage(image.get(), m_data.m_backingStoreSize, colorSpace, destRect, adjustedSrcRect, 1, op, blendMode);
}
void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
{
FloatRect adjustedSrcRect = srcRect;
adjustedSrcRect.scale(m_resolutionScale, m_resolutionScale);
......@@ -315,14 +315,14 @@ void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& src
if (!m_context->isAcceleratedContext()) {
if (destContext == m_context || destContext->isAcceleratedContext()) {
RefPtr<Image> copy = copyImage(CopyBackingStore); // Drawing into our own buffer, need to deep copy.
copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect);
copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
} else {
RefPtr<Image> imageForRendering = copyImage(DontCopyBackingStore);
imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect);
imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
}
} else {
RefPtr<Image> copy = copyImage(CopyBackingStore);
copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect);
copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
}
}
......
......@@ -56,7 +56,7 @@ void BufferedImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const
}
void BufferedImage::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRectIn, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode)
{
m_data->m_bitmap->drawPattern(ctxt, tileRectIn, patternTransform, phase, styleColorSpace, op, destRect, size());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment