Changeset 93386 in webkit


Ignore:
Timestamp:
Aug 18, 2011 9:51:38 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[skia] -webkit-transform breaks -webkit-mask
https://bugs.webkit.org/show_bug.cgi?id=66442

Source/WebCore:

The problem here is that in RenderBox::paintMaskImages, if we are in
a transform with a rotation, scale or skew we set the composite mode to
be DestinationIn and then create a transparency layer, then paint the
mask with SourceOver and end the transparency layer. (The normal case
is just to use DestinationIn to paint the mask.)

In skia when we create transparency layers we don't pass on the composite
mode, so when we end the transparency layer it is composited back using
SourceOver. The fix is to pass on the composite mode when creating
transparency layers in skia.

Patch by Ben Wells <benwells@chromium.org> on 2011-08-18
Reviewed by Stephen White.

  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::beginTransparencyLayer):

  • platform/graphics/skia/PlatformContextSkia.cpp:

(WebCore::PlatformContextSkia::getXfermodeMode):

  • platform/graphics/skia/PlatformContextSkia.h:

LayoutTests:

Patch by Ben Wells <benwells@chromium.org> on 2011-08-18
Reviewed by Stephen White.

  • platform/chromium-linux/fast/css/transformed-mask-expected.png: Added.
  • platform/chromium-linux/fast/css/transformed-mask-expected.txt: Added.
  • platform/chromium/test_expectations.txt:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r93382 r93386  
     12011-08-18  Ben Wells  <benwells@chromium.org>
     2
     3        [skia] -webkit-transform breaks -webkit-mask
     4        https://bugs.webkit.org/show_bug.cgi?id=66442
     5
     6        Reviewed by Stephen White.
     7
     8        * platform/chromium-linux/fast/css/transformed-mask-expected.png: Added.
     9        * platform/chromium-linux/fast/css/transformed-mask-expected.txt: Added.
     10        * platform/chromium/test_expectations.txt:
     11
    1122011-08-18  Kent Tamura  <tkent@chromium.org>
    213
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r93370 r93386  
    22862286BUGCR10479 MAC WIN : svg/hixie/perf/002.xml = PASS IMAGE
    22872287
    2288 // From r69334. Mask seems broken on the reflected image.
    2289 BUGCR58358 LINUX WIN : fast/css/transformed-mask.html = IMAGE+TEXT
    2290 
    22912288// FileWriter isn't in TestShell yet.
    22922289BUGCR58587 SKIP : fast/filesystem/file-writer-gc-blob.html = FAIL
     
    29722969BUGCR79110 LINUX WIN : fast/overflow/infiniteRecursionGuard.html = IMAGE+TEXT
    29732970
     2971// Needs rebaseline after fix for wk66442 lands
     2972BUGWK66442 WIN : fast/css/transformed-mask.html = IMAGE+TEXT
    29742973
    29752974BUGWK58308 LINUX WIN DEBUG GPU : compositing/z-order/negative-z-index.html = PASS CRASH
  • trunk/Source/WebCore/ChangeLog

    r93385 r93386  
     12011-08-18  Ben Wells  <benwells@chromium.org>
     2
     3        [skia] -webkit-transform breaks -webkit-mask
     4        https://bugs.webkit.org/show_bug.cgi?id=66442
     5
     6        The problem here is that in RenderBox::paintMaskImages, if we are in
     7        a transform with a rotation, scale or skew we set the composite mode to
     8        be DestinationIn and then create a transparency layer, then paint the
     9        mask with SourceOver and end the transparency layer. (The normal case
     10        is just to use DestinationIn to paint the mask.)
     11
     12        In skia when we create transparency layers we don't pass on the composite
     13        mode, so when we end the transparency layer it is composited back using
     14        SourceOver. The fix is to pass on the composite mode when creating
     15        transparency layers in skia.
     16
     17        Reviewed by Stephen White.
     18
     19        * platform/graphics/skia/GraphicsContextSkia.cpp:
     20        (WebCore::GraphicsContext::beginTransparencyLayer):
     21        * platform/graphics/skia/PlatformContextSkia.cpp:
     22        (WebCore::PlatformContextSkia::getXfermodeMode):
     23        * platform/graphics/skia/PlatformContextSkia.h:
     24
    1252011-08-18  Hayato Ito  <hayato@chromium.org>
    226
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r93157 r93386  
    272272    // Without explicitly setting the alpha flag, the layer will inherit the
    273273    // opaque setting of the base and some things won't work properly.
    274     platformContext()->canvas()->saveLayerAlpha(
     274
     275    SkPaint layerPaint;
     276    layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255));
     277    layerPaint.setXfermodeMode(platformContext()->getXfermodeMode());
     278
     279    platformContext()->canvas()->saveLayer(
    275280        0,
    276         static_cast<unsigned char>(opacity * 255),
     281        &layerPaint,
    277282        static_cast<SkCanvas::SaveFlags>(SkCanvas::kHasAlphaLayer_SaveFlag |
    278283                                         SkCanvas::kFullColorLayer_SaveFlag));
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r93157 r93386  
    512512}
    513513
     514SkXfermode::Mode PlatformContextSkia::getXfermodeMode() const
     515{
     516    return m_state->m_xferMode;
     517}
     518
    514519void PlatformContextSkia::setTextDrawingMode(TextDrawingModeFlags mode)
    515520{
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r93157 r93386  
    137137    float getAlpha() const;
    138138    int getNormalizedAlpha() const;
     139    SkXfermode::Mode getXfermodeMode() const;
    139140
    140141    void canvasClipPath(const SkPath&);
Note: See TracChangeset for help on using the changeset viewer.