[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: http://svn.webkit.org/repository/webkit/trunk@125193 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests: Another build fix after r125178.

* resources/runner.js:

LayoutTests: Fix a test after r125178.

* fast/harness/perftests/runs-per-second-log-expected.txt:
* fast/harness/perftests/runs-per-second-log.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Content Security Policy directives that begin with an invalid character should log a console warning.
https://bugs.webkit.org/show_bug.cgi?id=93622

Patch by Mike West <mkwst@chromium.org> on 2012-08-09
Reviewed by Adam Barth.

CSP directives containing unrecognized characters somewhere in the
middle were caught and logged by the current algorithm. We additionally
caught the case in which the directive begins with an invalid character,
but we silently ignored it. Now we're slightly more vocal.

This change also exits 'parseDirective' early in the case where the
directive text is empty, or filled only with whitespace. There doesn't
seem to be any value in flagging that case, as it has no impact on the
way the policy would have been interpreted (that is, 'img-src *;;...'
doesn't change in meaning by ignoring the empty directive between the
semicolons).

Test: http/tests/security/contentSecurityPolicy/directive-parsing-05.html

* page/ContentSecurityPolicy.cpp:
(WebCore::CSPDirectiveList::parseDirective):
    Two changes: first, we now exit early if the entire directive text
    is empty (e.g. ';;;' or ';      ;'); second, if the directive begins
    with a character that doesn't match 'isDirectiveNameCharacter', then
    we advance either to the next space, or the end of the value, and
    report an unrecognized directive to the policy.

LayoutTests: Content Security Policy directives with an invalid character should log a console warning.
https://bugs.webkit.org/show_bug.cgi?id=93622

Patch by Mike West <mkwst@chromium.org> on 2012-08-09
Reviewed by Adam Barth.

* http/tests/security/contentSecurityPolicy/directive-parsing-05-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/directive-parsing-05.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Do partial-swap scissoring on quads during draw instead of on layers
https://bugs.webkit.org/show_bug.cgi?id=91800

Reviewed by Adrienne Walker.

Source/WebCore:

Computing the scissor rect for each render pass is now done in
LayerRendererChromium::drawRenderPass() instead of being done for each
layer and then copied into the quads. This allows us to always push a
full frame of quads (and include damage rects) from a child compositor,
and do partial-swap scissoring in the host compositor.

This also make partial-swap functionality completely contained within
LayerRendererChromium!

The scissorRect is removed from all layers, and the concept of
scissorRect is now misplaced in CCOcclusionTracker, so the variables
and methods in the tracker should be renamed to more appropriate
things.

Covered by existing tests, as well as: CCLayerTreeHostImplTest.textureCachingWithScissor

* platform/graphics/chromium/LayerChromium.h:
(LayerChromium):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::clearFramebuffer):
(WebCore::LayerRendererChromium::renderPassTextureSize):
(WebCore::LayerRendererChromium::drawFrame):
(WebCore::LayerRendererChromium::drawRenderPass):
(WebCore::LayerRendererChromium::drawQuad):
(WebCore::LayerRendererChromium::drawDebugBorderQuad):
(WebCore::LayerRendererChromium::drawBackgroundFilters):
(WebCore::LayerRendererChromium::drawTileQuad):
(WebCore::LayerRendererChromium::swapBuffers):
(WebCore::LayerRendererChromium::useRenderPass):
(WebCore::LayerRendererChromium::setScissorToRect):
* platform/graphics/chromium/LayerRendererChromium.h:
(LayerRendererChromium):
(DrawingFrame):
* platform/graphics/chromium/RenderSurfaceChromium.cpp:
* platform/graphics/chromium/RenderSurfaceChromium.h:
(RenderSurfaceChromium):
* platform/graphics/chromium/cc/CCDrawQuad.h:
(WebCore::CCDrawQuad::clippedRectInTarget):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::createSharedQuadState):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::updateLayers):
(WebCore::CCLayerTreeHost::paintLayerContents):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateVisibleRectsInternal):
(WebCore::CCLayerTreeHostCommon::calculateVisibleRects):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.h:
(CCLayerTreeHostCommon):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList):
(WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
(WebCore::CCLayerTreeHostImpl::drawLayers):
(WebCore::CCLayerTreeHostImpl::swapBuffers):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(CCLayerTreeHostImpl):
* platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
(WebCore::::layerScissorRectInTargetSurface):
* platform/graphics/chromium/cc/CCRenderPass.cpp:
(WebCore::CCRenderPass::CCRenderPass):
(WebCore::CCRenderPass::appendQuadsToFillScreen):
* platform/graphics/chromium/cc/CCRenderPass.h:
(CCRenderPass):
(WebCore::CCRenderPass::transformToRootTarget):
(WebCore::CCRenderPass::outputRect):
(WebCore::CCRenderPass::damageRect):
(WebCore::CCRenderPass::setDamageRect):
* platform/graphics/chromium/cc/CCRenderSurface.cpp:
(WebCore::computeClippedRectInTarget):
(WebCore):
(WebCore::CCRenderSurface::createSharedQuadState):
(WebCore::CCRenderSurface::createReplicaSharedQuadState):
* platform/graphics/chromium/cc/CCRenderSurface.h:
(CCRenderSurface):
* platform/graphics/chromium/cc/CCRenderer.h:
(CCRenderer):
* platform/graphics/chromium/cc/CCSharedQuadState.cpp:
(WebCore::CCSharedQuadState::create):
(WebCore::CCSharedQuadState::CCSharedQuadState):
* platform/graphics/chromium/cc/CCSharedQuadState.h:
(CCSharedQuadState):
* platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
(WebCore::CCTiledLayerImpl::appendQuads):

Source/WebKit/chromium:

* tests/CCDamageTrackerTest.cpp:
(WebKitTests::executeCalculateDrawTransformsAndVisibility):
* tests/CCLayerIteratorTest.cpp:
* tests/CCLayerTreeHostCommonTest.cpp:
Removed tests of the scissor rect here, as they are no longer
computed within CCLayerTreeHostCommon. Verify that the scissor
does not affect texture caching in CCLayerTreeHostImplTest now.
Previous scissor would affect the texture cache decisions, but
this was incorrect, as damaged areas are always inside the
scissor rect, and anything outside the scissor rect should
be considered as valid and complete (assuming no external
occlusion, which is computed outside the scissor rect now also).

* tests/CCLayerTreeHostImplTest.cpp:
Removed didDrawNotCalledOnScissoredLayer test, as this no longer
applies. didDraw will be called on layers that are outside the
partial swap rect, regardless.

Removed partialSwapNoUpdate test, and merged its functionality into
the partialSwap test while updating its expectations.

Added textureCachingWithScissor, which is loosely based on the
CCLayerTreeHostCommonTest.scissorRectWithClip test.

* tests/CCOcclusionTrackerTest.cpp:
(WebKitTests::CCOcclusionTrackerTest::calcDrawEtc):
(WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
(WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
* tests/CCQuadCullerTest.cpp:
* tests/CCRenderSurfaceTest.cpp:
* tests/CCSolidColorLayerImplTest.cpp:
(CCLayerTestCommon::TEST):
* tests/CCTiledLayerImplTest.cpp:
(CCLayerTestCommon::createLayer):
* tests/LayerRendererChromiumTest.cpp:
(LayerRendererChromiumTest::swapBuffers):
(TEST_F):
(TEST):
* tests/TiledLayerChromiumTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        [WK2] Add a process model constant for multiple processes
        https://bugs.webkit.org/show_bug.cgi?id=93642

        Reviewed by Anders Carlsson.

        * UIProcess/ProcessModel.h: Added ProcessModelMultipleSecondaryProcesses.
        Deleted ProcessModelSecondaryProcess in favor of more descriptive ProcessModelSharedSecondaryProcess - 
        these used to behave the same.

        * UIProcess/WebContext.cpp: (WebKit::WebContext::create): Changed to use ProcessModelSharedSecondaryProcess.

        * UIProcess/WebProcessProxy.h: Removed an unncessary include of ProcessModel.h.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125197 268f45cc-cd09-0410-ab3c-d52691b4dbfc