[chromium] Pass mask scale and offset to shaders for correct masking
authorshawnsingh@chromium.org <shawnsingh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Aug 2012 19:39:24 +0000 (19:39 +0000)
committershawnsingh@chromium.org <shawnsingh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Aug 2012 19:39:24 +0000 (19:39 +0000)
commit1c2eb398f725bb9ceb2b3c3cc1b9dac9fdbafd58
treeda03cb0e1c121af54b635af251dca817b79c6077
parent526149c92765cd114a512471e676df6405199af6
[chromium] Pass mask scale and offset to shaders for correct masking
https://bugs.webkit.org/show_bug.cgi?id=93558

Reviewed by Adrienne Walker.

Source/WebCore:

In chromium compositor code, the mask was accidentally mapped 1:1
to the layer's renderSurface, rather than the layer itself. This
patch adds a layout test that reproduces the error and fixes the
problem. The solution we opted for in this patch is to pass a
scale and offset to the fragment shader, so that the correct
texture coordinate lookup is computed by the fragment shader.

Test: compositing/masks/mask-of-clipped-layer.html

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawRenderPassQuad):
* platform/graphics/chromium/ShaderChromium.cpp:
(WebCore::FragmentShaderRGBATexAlphaMask::FragmentShaderRGBATexAlphaMask):
(WebCore::FragmentShaderRGBATexAlphaMask::init):
(WebCore::FragmentShaderRGBATexAlphaMask::getShaderString):
(WebCore::FragmentShaderRGBATexAlphaMaskAA::FragmentShaderRGBATexAlphaMaskAA):
(WebCore::FragmentShaderRGBATexAlphaMaskAA::init):
(WebCore::FragmentShaderRGBATexAlphaMaskAA::getShaderString):
* platform/graphics/chromium/ShaderChromium.h:
(WebCore::FragmentShaderRGBATexAlphaMask::maskTexCoordScaleLocation):
(WebCore::FragmentShaderRGBATexAlphaMask::maskTexCoordOffsetLocation):
(FragmentShaderRGBATexAlphaMask):
(WebCore::FragmentShaderRGBATexAlphaMaskAA::maskTexCoordScaleLocation):
(WebCore::FragmentShaderRGBATexAlphaMaskAA::maskTexCoordOffsetLocation):
(FragmentShaderRGBATexAlphaMaskAA):
* platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp:
(WebCore::CCRenderPassDrawQuad::create):
(WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad):
* platform/graphics/chromium/cc/CCRenderPassDrawQuad.h:
(CCRenderPassDrawQuad):
(WebCore::CCRenderPassDrawQuad::maskTexCoordScaleX):
(WebCore::CCRenderPassDrawQuad::maskTexCoordScaleY):
(WebCore::CCRenderPassDrawQuad::maskTexCoordOffsetX):
(WebCore::CCRenderPassDrawQuad::maskTexCoordOffsetY):
* platform/graphics/chromium/cc/CCRenderSurface.cpp:
(WebCore::CCRenderSurface::appendQuads):

Source/WebKit/chromium:

Updated one unit test that needed additional args in a
constructor, but no change in behavior of the test.

* tests/CCLayerTreeHostImplTest.cpp:

LayoutTests:

Added a layout test that checks the mask does not accidentally get
resized when it is inside of an overflow div.

* compositing/masks/mask-of-clipped-layer-expected.png: Added.
* compositing/masks/mask-of-clipped-layer-expected.txt: Added.
* compositing/masks/mask-of-clipped-layer.html: Added.
* compositing/resources/alpha-blocks.png: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125193 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/masks/mask-of-clipped-layer-expected.png [new file with mode: 0644]
LayoutTests/compositing/masks/mask-of-clipped-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/masks/mask-of-clipped-layer.html [new file with mode: 0644]
LayoutTests/compositing/resources/alpha-blocks.png [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp
Source/WebCore/platform/graphics/chromium/ShaderChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h
Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp