Changeset 127615 in webkit


Ignore:
Timestamp:
Sep 5, 2012 11:26:57 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Shaders] Update custom filter tests to use the new security model
https://bugs.webkit.org/show_bug.cgi?id=95760

Patch by Max Vujovic <mvujovic@adobe.com> on 2012-09-05
Reviewed by Dirk Schulze.

This patch updates the custom filter tests to not sample u_texture and not write
to gl_FragColor. Now, the tests use the new security model by writing to
css_MixColor and indirectly blending with the DOM element texture.

This patch prepares us to remove direct DOM texture access via "u_texture":
https://bugs.webkit.org/show_bug.cgi?id=93871

  • css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png:
  • css3/filters/custom/custom-filter-shader-cache-expected.png:
  • css3/filters/custom/custom-filter-shader-cache.html:

Use the CSS mix function with the updated color-offset.fs.

  • css3/filters/custom/effect-color-check-expected.png:
  • css3/filters/custom/effect-color-check.html:

Use the CSS mix function with the updated color-fill.fs.

  • css3/filters/custom/effect-custom-combined-missing-expected.png:
  • css3/filters/custom/effect-custom-combined-missing.html:

Use the CSS mix function with the updated color-offset.fs.

  • css3/filters/custom/effect-custom-expected.png:
  • css3/filters/custom/effect-custom-parameters-expected.png:
  • css3/filters/custom/effect-custom-parameters.html:

Use the mix-color.fs shader instead of color-offset-parameters.fs.

  • css3/filters/custom/effect-custom.html:

Use the CSS mix function with the updated color-offset.fs.

  • css3/filters/custom/filter-repaint-custom-clipped-expected.png:
  • css3/filters/custom/filter-repaint-custom-clipped.html:

Use the mix-color.fs shader instead of color-add.fs.

  • css3/filters/custom/filter-repaint-custom-expected.png:
  • css3/filters/custom/filter-repaint-custom-rotated-expected.png:
  • css3/filters/custom/filter-repaint-custom-rotated.html:

Use the mix-color.fs shader instead of color-add.fs. Fix a small typo in a comment.

  • css3/filters/custom/filter-repaint-custom.html:

Use the mix-color.fs shader instead of color-add.fs.

  • css3/filters/custom/invalid-custom-filter-shader.html:

Use the CSS mix function with the updated color-offset.fs.

  • css3/filters/custom/missing-custom-filter-shader-expected.png:
  • css3/filters/custom/missing-custom-filter-shader.html:

Use the CSS mix function with the updated color-offset.fs.

  • css3/filters/resources/color-add.fs:

Removed. The mix-color.fs shader can perform this shader's function.

  • css3/filters/resources/color-fill.fs:

Rewrote this shader to write to css_MixColor instead of sampling u_texture and writing
to gl_FragColor.

  • css3/filters/resources/color-offset-parameters.fs:

Removed. The mix-color.fs shader can perform this shader's function.

  • css3/filters/resources/color-offset.fs:

Rewrote this shader to write to css_MixColor instead of sampling u_texture and writing
to gl_FragColor.

  • platform/chromium-mac/css3/filters/custom/custom-filter-shader-cache-expected.png:
  • platform/chromium-mac/css3/filters/custom/effect-color-check-expected.png:
  • platform/chromium-mac/css3/filters/custom/effect-custom-combined-missing-expected.png:
  • platform/chromium-mac/css3/filters/custom/effect-custom-expected.png:
  • platform/chromium-mac/css3/filters/custom/effect-custom-parameters-expected.png:
  • platform/chromium-mac/css3/filters/custom/filter-repaint-custom-clipped-expected.png:
  • platform/chromium-mac/css3/filters/custom/filter-repaint-custom-expected.png:
  • platform/chromium-mac/css3/filters/custom/filter-repaint-custom-rotated-expected.png:
  • platform/chromium/TestExpectations:
Location:
trunk/LayoutTests
Files:
2 deleted
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r127612 r127615  
     12012-09-05  Max Vujovic  <mvujovic@adobe.com>
     2
     3        [CSS Shaders] Update custom filter tests to use the new security model
     4        https://bugs.webkit.org/show_bug.cgi?id=95760
     5
     6        Reviewed by Dirk Schulze.
     7
     8        This patch updates the custom filter tests to not sample u_texture and not write
     9        to gl_FragColor. Now, the tests use the new security model by writing to
     10        css_MixColor and indirectly blending with the DOM element texture.
     11
     12        This patch prepares us to remove direct DOM texture access via "u_texture":
     13        https://bugs.webkit.org/show_bug.cgi?id=93871
     14
     15        * css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png:
     16        * css3/filters/custom/custom-filter-shader-cache-expected.png:
     17        * css3/filters/custom/custom-filter-shader-cache.html:
     18            Use the CSS mix function with the updated color-offset.fs.
     19        * css3/filters/custom/effect-color-check-expected.png:
     20        * css3/filters/custom/effect-color-check.html:
     21            Use the CSS mix function with the updated color-fill.fs.
     22        * css3/filters/custom/effect-custom-combined-missing-expected.png:
     23        * css3/filters/custom/effect-custom-combined-missing.html:
     24            Use the CSS mix function with the updated color-offset.fs.           
     25        * css3/filters/custom/effect-custom-expected.png:
     26        * css3/filters/custom/effect-custom-parameters-expected.png:
     27        * css3/filters/custom/effect-custom-parameters.html:
     28            Use the mix-color.fs shader instead of color-offset-parameters.fs.
     29        * css3/filters/custom/effect-custom.html:
     30            Use the CSS mix function with the updated color-offset.fs.
     31        * css3/filters/custom/filter-repaint-custom-clipped-expected.png:
     32        * css3/filters/custom/filter-repaint-custom-clipped.html:
     33            Use the mix-color.fs shader instead of color-add.fs.
     34        * css3/filters/custom/filter-repaint-custom-expected.png:
     35        * css3/filters/custom/filter-repaint-custom-rotated-expected.png:
     36        * css3/filters/custom/filter-repaint-custom-rotated.html:
     37            Use the mix-color.fs shader instead of color-add.fs. Fix a small typo in a comment.
     38        * css3/filters/custom/filter-repaint-custom.html:
     39            Use the mix-color.fs shader instead of color-add.fs.
     40        * css3/filters/custom/invalid-custom-filter-shader.html:
     41            Use the CSS mix function with the updated color-offset.fs.
     42        * css3/filters/custom/missing-custom-filter-shader-expected.png:
     43        * css3/filters/custom/missing-custom-filter-shader.html:
     44            Use the CSS mix function with the updated color-offset.fs.
     45        * css3/filters/resources/color-add.fs:
     46            Removed. The mix-color.fs shader can perform this shader's function.
     47        * css3/filters/resources/color-fill.fs:
     48            Rewrote this shader to write to css_MixColor instead of sampling u_texture and writing
     49            to gl_FragColor.
     50        * css3/filters/resources/color-offset-parameters.fs:
     51            Removed. The mix-color.fs shader can perform this shader's function.
     52        * css3/filters/resources/color-offset.fs:
     53            Rewrote this shader to write to css_MixColor instead of sampling u_texture and writing
     54            to gl_FragColor.
     55        * platform/chromium-mac/css3/filters/custom/custom-filter-shader-cache-expected.png:
     56        * platform/chromium-mac/css3/filters/custom/effect-color-check-expected.png:
     57        * platform/chromium-mac/css3/filters/custom/effect-custom-combined-missing-expected.png:
     58        * platform/chromium-mac/css3/filters/custom/effect-custom-expected.png:
     59        * platform/chromium-mac/css3/filters/custom/effect-custom-parameters-expected.png:
     60        * platform/chromium-mac/css3/filters/custom/filter-repaint-custom-clipped-expected.png:
     61        * platform/chromium-mac/css3/filters/custom/filter-repaint-custom-expected.png:
     62        * platform/chromium-mac/css3/filters/custom/filter-repaint-custom-rotated-expected.png:
     63        * platform/chromium/TestExpectations:
     64
    1652012-09-05  Tommy Widenflycht  <tommyw@google.com>
    266
  • trunk/LayoutTests/css3/filters/custom/custom-filter-shader-cache.html

    r127217 r127615  
    2626            .fragment_shader
    2727            {
    28                 -webkit-filter: custom(url('../resources/pass-tex-coord.vs') url('../resources/color-offset.fs'));
     28                -webkit-filter: custom(url('../resources/pass-tex-coord.vs') mix(url('../resources/color-offset.fs') normal source-atop));
    2929            }
    3030            .both_shaders
    3131            {
    32                 -webkit-filter: custom(url('../resources/vertex-offset.vs') url('../resources/color-offset.fs'));
     32                -webkit-filter: custom(url('../resources/vertex-offset.vs') mix(url('../resources/color-offset.fs') normal source-atop));
    3333            }
    3434        </style>
  • trunk/LayoutTests/css3/filters/custom/effect-color-check.html

    r127217 r127615  
    2020    </head>
    2121    <body onload="runTest()">
    22         <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') url('../resources/color-fill.fs'), color 1 0 0 1)" src="../../../compositing/resources/thiswayup.png">
    23         <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') url('../resources/color-fill.fs'), color 0 1 0 1)" src="../../../compositing/resources/thiswayup.png">
    24         <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') url('../resources/color-fill.fs'), color 0 0 1 1)" src="../../../compositing/resources/thiswayup.png">
     22        <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') mix(url('../resources/color-fill.fs') normal source-atop), color 1 0 0 1)" src="../../../compositing/resources/thiswayup.png">
     23        <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') mix(url('../resources/color-fill.fs') normal source-atop), color 0 1 0 1)" src="../../../compositing/resources/thiswayup.png">
     24        <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') mix(url('../resources/color-fill.fs') normal source-atop), color 0 0 1 1)" src="../../../compositing/resources/thiswayup.png">
    2525        <!--
    2626            Testing that the color channels are specified correctly. You should see 3 boxes filled with red, green and blue. The arrow should
    27             point upside and the text should be written from left to right (no mirror). Also the gradient starts from up - transparent to down - full color.
     27            point upward and the text should be written from left to right (no mirror). Also the gradient starts from up - no color to down - full color.
    2828            Note: WebGL needs to be enabled for this test to succeed.
    2929        -->
  • trunk/LayoutTests/css3/filters/custom/effect-custom-combined-missing.html

    r119990 r127615  
    2525        }
    2626        .filterA {
    27             -webkit-filter: custom(url('../resources/vertex-offset.vs') url('../resources/color-offset.fs'))
    28                             custom(url('../resources/missing-vertex-offset.vs') url('../resources/missing-color-offset.fs'))
    29                             custom(url('../resources/vertex-offset.vs') url('../resources/color-offset.fs'));
     27            -webkit-filter: custom(url('../resources/vertex-offset.vs') mix(url('../resources/color-offset.fs') normal source-atop))
     28                            custom(url('../resources/missing-vertex-offset.vs') mix(url('../resources/missing-color-offset.fs') normal source-atop))
     29                            custom(url('../resources/vertex-offset.vs') mix(url('../resources/color-offset.fs') normal source-atop));
    3030        }
    3131        </style>
     
    3636        </div>
    3737        <!--
    38             Testing that multiple filters can be applied even if some filters cannot be loaded. You should see a washed out block of colored bars on top of green background.
    39             There should be two columns at the left of the block with different shades of green.
     38            Testing that multiple filters can be applied even if some filters cannot be loaded.
     39            You should see a rectangle with a washed out block of colored bars on top of green background.
     40            There should be a green column left of the block spanning 20% of the rectangle's width.
    4041        -->
    4142    </body>
  • trunk/LayoutTests/css3/filters/custom/effect-custom-parameters.html

    r119990 r127615  
    2121        /* Testing parameters of type float, vec2 and vec3 in vertex-offset-parameters.vs and vec4 in color-offset-parameters.fs. */
    2222        .filterA {
    23             -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') url('../resources/color-offset-parameters.fs'),
     23            -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') mix(url('../resources/mix-color.fs') normal source-atop),
    2424                                   perspective 2,
    2525                                   vertex_offset -0.05 0.1,
    2626                                   rotate 45 -25 -10,
    27                                    color_offset 0.4 0.2 0.5 0.1);
     27                                   mix_color 0.4 0.2 0.5 0.5);
    2828        }
    2929        .filterB {
    30             -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') url('../resources/color-offset-parameters.fs'),
     30            -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') mix(url('../resources/mix-color.fs') normal source-atop),
    3131                                   rotate 45 25 -10,
    3232                                   perspective 10,
    3333                                   vertex_offset -0.05 0.1,
    34                                    color_offset 0.1 0.9 0.5 -0.5);
     34                                   mix_color 0.1 0.9 0.5 0.5);
    3535        }
    3636        .filterC {
    37             -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') url('../resources/color-offset-parameters.fs'),
    38                                    color_offset 0 0 0 0,
     37            -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') mix(url('../resources/mix-color.fs') normal source-atop),
     38                                   mix_color 0 0 0 0.5,
    3939                                   perspective 2,
    4040                                   vertex_offset -0.05 0.1,
     
    4242        }
    4343        .filterD {
    44             -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') url('../resources/color-offset-parameters.fs'),
     44            -webkit-filter: custom(url('../resources/vertex-offset-parameters.vs') mix(url('../resources/mix-color.fs') normal source-atop),
    4545                                   vertex_offset -0.15 0.1,
    4646                                   rotate 15 -45 10,
    4747                                   perspective 1.5,
    48                                    color_offset 0.4 0.2 0.5 0.1);
     48                                   mix_color 0.4 0.2 0.5 0.5);
    4949        }
    5050        </style>
  • trunk/LayoutTests/css3/filters/custom/effect-custom.html

    r127217 r127615  
    2020    </head>
    2121    <body onload="runTest()">
    22         <img style="-webkit-filter: custom(url('../resources/vertex-offset.vs') url('../resources/color-offset.fs'))" src="../resources/reference.png">
     22        <img style="-webkit-filter: custom(url('../resources/vertex-offset.vs') mix(url('../resources/color-offset.fs') normal source-atop))" src="../resources/reference.png">
    2323        <img style="-webkit-filter: custom(url('../resources/vertex-offset.vs') mix(url('../resources/empty-shader.fs') normal source-atop), 6 11)" src="../resources/reference.png">
    2424        <img style="-webkit-filter: custom(url('../resources/vertex-explode-detached.vs') mix(url('../resources/empty-shader.fs') normal source-atop), 3 3 detached)" src="../resources/reference.png">
    25         <img style="-webkit-filter: custom(url('../resources/vertex-explode-detached.vs') url('../resources/color-offset.fs'), 3 3 detached)" src="../resources/reference.png">
    26         <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') url('../resources/color-offset.fs'))" src="../resources/reference.png">
     25        <img style="-webkit-filter: custom(url('../resources/vertex-explode-detached.vs') mix(url('../resources/color-offset.fs') normal source-atop), 3 3 detached)" src="../resources/reference.png">
     26        <img style="-webkit-filter: custom(url('../resources/pass-tex-coord.vs') mix(url('../resources/color-offset.fs') normal source-atop))" src="../resources/reference.png">
    2727        <!--
    2828            Testing that simple custom filters work in software mode. You should see 5 blocks of colored bars with different effects applied, from left to right:
  • trunk/LayoutTests/css3/filters/custom/filter-repaint-custom-clipped.html

    r119990 r127615  
    4242
    4343        .shader {
    44             -webkit-filter: custom(url(../resources/vertex-horizontal-offset.vs) url(../resources/color-add.fs), offset -0.5, add 0.1);
     44            -webkit-filter: custom(url(../resources/vertex-horizontal-offset.vs) mix(url(../resources/mix-color.fs) normal source-atop), offset -0.5, mix_color 1.0 1.0 1.0 0.1);
    4545        }
    4646    </style>
  • trunk/LayoutTests/css3/filters/custom/filter-repaint-custom-rotated.html

    r119990 r127615  
    33    This tests verifies that filter shader is repainted using the full source image of the element instead of just the dirty area.
    44    Also it tests that the clipping or the transform rectangle of the box is not affecting the filter.
    5     There should be one light green boxes on the screen. No red should be visible.
     5    There should be one light green box on the screen. No red should be visible.
    66-->
    77<html>
     
    4242
    4343        .shader {
    44             -webkit-filter: custom(url(../resources/vertex-horizontal-offset.vs) url(../resources/color-add.fs), offset -0.5, add 0.1);
     44            -webkit-filter: custom(url(../resources/vertex-horizontal-offset.vs) mix(url(../resources/mix-color.fs) normal source-atop), offset -0.5, mix_color 1.0 1.0 1.0 0.1);
    4545            -webkit-transform-origin: 50px 50px;
    4646            -webkit-transform: rotate(90deg);
  • trunk/LayoutTests/css3/filters/custom/filter-repaint-custom.html

    r119990 r127615  
    3333            border-top: 50px solid blue;
    3434            width: 50px;
    35             -webkit-filter: custom(url(../resources/vertex-rotate.vs) url(../resources/color-add.fs), rotateBy 90, add 0.1);
     35            -webkit-filter: custom(url(../resources/vertex-rotate.vs) mix(url(../resources/mix-color.fs) normal source-atop), rotateBy 90, mix_color 1.0 1.0 1.0 0.1);
    3636        }
    3737    </style>
  • trunk/LayoutTests/css3/filters/custom/invalid-custom-filter-shader.html

    r125128 r127615  
    2626            .invalid_fragment_shader
    2727            {
    28                 -webkit-filter: custom(none url('../resources/invalid-shader.vs'));
     28                -webkit-filter: custom(none mix(url('../resources/invalid-shader.vs') normal source-atop));
    2929            }
    3030            .both_shaders_but_invalid_vertex_shader
    3131            {
    32                 -webkit-filter: custom(url('../resources/invalid-shader.vs') url('../resources/color-offset.fs'));
     32                -webkit-filter: custom(url('../resources/invalid-shader.vs') mix(url('../resources/color-offset.fs') normal source-atop));
    3333            }
    3434
    3535            .both_shaders_but_invalid_fragment_shader
    3636            {
    37                 -webkit-filter: custom(url('../resources/vertex-offset.vs') url('../resources/invalid-shader.vs'));
     37                -webkit-filter: custom(url('../resources/vertex-offset.vs') mix(url('../resources/invalid-shader.vs') normal source-atop));
    3838            }
    3939            .both_shaders_invalid
    4040            {
    41                 -webkit-filter: custom(url('../resources/invalid-shader.vs') url('../resources/invalid-shader.vs'));
     41                -webkit-filter: custom(url('../resources/invalid-shader.vs') mix(url('../resources/invalid-shader.vs') normal-source-atop));
    4242            }
    4343        </style>
  • trunk/LayoutTests/css3/filters/custom/missing-custom-filter-shader.html

    r119990 r127615  
    2626            .missing_fragment_shader
    2727            {
    28                 -webkit-filter: custom(none url('../resources/missing-color-offset.fs'));
     28                -webkit-filter: custom(none mix(url('../resources/missing-color-offset.fs') normal source-atop));
    2929            }
    3030            .both_shaders_but_missing_vertex_shader
    3131            {
    32                 -webkit-filter: custom(url('../resources/missing-vertex-offset.vs') url('../resources/color-offset.fs'));
     32                -webkit-filter: custom(url('../resources/missing-vertex-offset.vs') mix(url('../resources/color-offset.fs') normal source-atop));
    3333            }
    3434
    3535            .both_shaders_but_missing_fragment_shader
    3636            {
    37                 -webkit-filter: custom(url('../resources/vertex-offset.vs') url('../resources/missing-color-offset.fs'));
     37                -webkit-filter: custom(url('../resources/vertex-offset.vs') mix(url('../resources/missing-color-offset.fs') normal source-atop));
    3838            }
    3939            .both_shaders_missing
    4040            {
    41                 -webkit-filter: custom(url('../resources/missing-vertex-offset.vs') url('../resources/missing-color-offset.fs'));
     41                -webkit-filter: custom(url('../resources/missing-vertex-offset.vs') mix(url('../resources/missing-color-offset.fs') normal source-atop));
    4242            }
    4343        </style>
  • trunk/LayoutTests/css3/filters/resources/color-fill.fs

    r125044 r127615  
    22uniform vec4 color;
    33varying vec2 v_texCoord;
    4 uniform sampler2D u_texture;
    54void main()
    65{
    7     vec4 sourceColor = texture2D(u_texture, v_texCoord);
    8     // Note that gl_FragColor and sourceColor are unmultiplied.
    9     // Multiply the texture with the color specified as an uniform. Also apply a
    10     // gradient to check for the right direction. The result should be transparent on top.
    11     gl_FragColor = vec4(sourceColor.xyz * color.xyz, sourceColor.a * color.a * v_texCoord.y);
     6    // Mix the texture with the color specified as an uniform.
     7    // Also apply a gradient to check for the right direction.
     8    // The color should be lightest at the top and darkest at the bottom.
     9    css_MixColor = vec4(color.xyz, color.a * v_texCoord.y);
    1210}
  • trunk/LayoutTests/css3/filters/resources/color-offset.fs

    r119990 r127615  
    11precision mediump float;
    2 varying vec2 v_texCoord;
    3 uniform sampler2D u_texture;
    42void main()
    53{
    6     // Offset the color value with 0.3 on each color channel.
    7     gl_FragColor = texture2D(u_texture, v_texCoord) + 0.3;
     4    // Mix some white with the DOM element texture.
     5    css_MixColor = vec4(1.0, 1.0, 1.0, 0.5);
    86}
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r127608 r127615  
    34313431BUGWK94492 WIN LINUX : css3/filters/custom/custom-filter-color-matrix.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
    34323432BUGWK94492 WIN LINUX : css3/filters/custom/custom-filter-composite-source-atop.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3433BUGWK94492 WIN LINUX : css3/filters/custom/custom-filter-shader-cache.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3434BUGWK94492 WIN LINUX : css3/filters/custom/effect-color-check.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3435BUGWK94492 WIN LINUX : css3/filters/custom/effect-custom-combined-missing.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3436BUGWK94492 WIN LINUX : css3/filters/custom/effect-custom.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3437BUGWK94492 WIN LINUX : css3/filters/custom/effect-custom-parameters.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3438BUGWK94492 WIN LINUX : css3/filters/custom/filter-repaint-custom-clipped.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3439BUGWK94492 WIN LINUX : css3/filters/custom/filter-repaint-custom.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
     3440BUGWK94492 WIN LINUX : css3/filters/custom/filter-repaint-custom-rotated.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
    34333441
    34343442// Flaky
Note: See TracChangeset for help on using the changeset viewer.