Skip to content

Commit

Permalink
2011-04-28 Mike Reed <reed@google.com>
Browse files Browse the repository at this point in the history
        Reviewed by Eric Seidel.

        fix shadw behavior for both CSS and Canvas
        https://bugs.webkit.org/show_bug.cgi?id=59700

        * platform/chromium/test_expectations.txt:
2011-04-28  Mike Reed  <reed@google.com>

        Reviewed by Eric Seidel.

        fix shadw behavior for both CSS and Canvas -- skia only
        https://bugs.webkit.org/show_bug.cgi?id=59700

        Test:
        canvas/philip/tests/2d.shadow.alpha.3.html
        canvas/philip/tests/2d.shadow.alpha.4.html
        canvas/philip/tests/2d.shadow.alpha.5.html
        fast/canvas/canvas-fillPath-alpha-shadow.html
        fast/canvas/canvas-strokePath-alpha-shadow.html
        fast/canvas/canvas-strokeRect-alpha-shadow.html
        fast/css/text-input-with-webkit-border-radius.html
        fast/repaint/shadow-multiple-horizontal.html
        fast/repaint/shadow-multiple-strict-horizontal.html
        fast/repaint/shadow-multiple-strict-vertical.html
        fast/repaint/shadow-multiple-vertical.html
        fast/canvas/canvas-getImageData.html

        * platform/graphics/chromium/FontChromiumWin.cpp:
        (WebCore::Font::drawGlyphs):
        * platform/graphics/skia/GraphicsContextSkia.cpp:
        (WebCore::GraphicsContext::setPlatformShadow):

Canonical link: https://commits.webkit.org/74975@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Apr 28, 2011
1 parent dd259e4 commit 1b1e235
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 52 deletions.
9 changes: 9 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
2011-04-28 Mike Reed <reed@google.com>

Reviewed by Eric Seidel.

fix shadw behavior for both CSS and Canvas
https://bugs.webkit.org/show_bug.cgi?id=59700

* platform/chromium/test_expectations.txt:

2011-04-28 Ojan Vafai <ojan@chromium.org>

Reviewed by Darin Adler.
Expand Down
35 changes: 9 additions & 26 deletions LayoutTests/platform/chromium/test_expectations.txt
Expand Up @@ -1011,11 +1011,6 @@ BUGCR24209 : fast/js/pic/cached-prototype-setter.html = FAIL
// It appears we're not obeying the "transparent" fill color.
BUGCR10317 LINUX : fast/css/shadow-multiple.html = FAIL

// Problems with getImageData and toDataURL.
// This test requires us to do alpha blending exactly the way CG does it,
// which Skia may never do (see bug).
// BUGCR22700 CPU WIN-WIN7 : fast/canvas/canvas-getImageData.html = FAIL TIMEOUT

// We're much closer now. To fully pass this we need encoders for jpg
// and gif, which is a low priority.
BUGCR10318 : fast/canvas/toDataURL-supportedTypes.html = FAIL
Expand Down Expand Up @@ -2026,9 +2021,6 @@ BUGWK45991 CPU LINUX WIN : canvas/philip/tests/2d.path.arcTo.shape.curve2.html =
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.pattern.paint.norepeat.coord3.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.pattern.paint.repeatx.coord1.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.pattern.paint.repeaty.coord1.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.shadow.alpha.3.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.shadow.alpha.4.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.shadow.alpha.5.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.shadow.canvas.alpha.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.shadow.canvas.basic.html = TEXT
BUGWK45991 LINUX WIN : canvas/philip/tests/2d.shadow.canvas.transparent.2.html = TEXT
Expand Down Expand Up @@ -2531,10 +2523,9 @@ BUGCR61739 DEBUG : animations/suspend-resume-animation-events.html = CRASH TEXT
BUGWK52509 WIN LINUX : svg/css/rect-gradient-stroke-shadow.svg = IMAGE
BUGWK52509 MAC LEOPARD : svg/css/rect-gradient-stroke-shadow.svg = IMAGE
BUGCR63921 CPU LINUX WIN : fast/canvas/canvas-fillPath-shadow.html = TEXT
BUGCR63921 CPU LINUX WIN : fast/canvas/canvas-fillPath-alpha-shadow.html = TEXT
BUGCR63921 GPU LINUX WIN : fast/canvas/canvas-fillPath-alpha-shadow.html = TEXT TIMEOUT
BUGCR63921 GPU LINUX WIN : fast/canvas/canvas-strokeRect-alpha-shadow.html = TEXT TIMEOUT
BUGCR63921 GPU LINUX WIN : fast/canvas/canvas-strokePath-alpha-shadow.html = TEXT TIMEOUT
BUGCR63921 GPU : fast/canvas/canvas-fillPath-alpha-shadow.html = TEXT TIMEOUT
BUGCR63921 GPU : fast/canvas/canvas-strokeRect-alpha-shadow.html = TEXT TIMEOUT
BUGCR63921 GPU : fast/canvas/canvas-strokePath-alpha-shadow.html = TEXT TIMEOUT

// Mainly flaky with mac debug, but also intermittent crashes seen on linux and windows
BUGCR64129 WIN MAC LINUX : fast/files/revoke-blob-url.html = CRASH PASS
Expand Down Expand Up @@ -3759,9 +3750,6 @@ BUGDPRANKE : fast/dom/Document/document-reopen.html = TEXT PASS
BUGDPRANKE : fast/parser/javascript-url-compat-mode.html = TEXT PASS
BUGDPRANKE : inspector/console/console-tests.html = TEXT PASS TIMEOUT

BUGWK59158 CPU WIN LINUX : fast/canvas/canvas-strokePath-alpha-shadow.html = TEXT
BUGWK59158 CPU WIN LINUX : fast/canvas/canvas-strokeRect-alpha-shadow.html = TEXT

// these tests were introduced in r58522. Needed new baselines, but I'm
// not sure why debug is timing out.
BUGWK59166 WIN LINUX DEBUG CPU : svg/dynamic-updates/SVGFEDropShadowElement-dom-dx-attr.html = TIMEOUT
Expand Down Expand Up @@ -3835,17 +3823,12 @@ BUGCR80301 MAC LEOPARD : fast/canvas/canvas-largedraws.html = TIMEOUT
BUGDPRANKE : fast/dom/dataset-gc.html = TEXT
BUGDPRANKE WIN LINUX : fast/backgrounds/gradient-background-leakage.html = IMAGE
BUGDPRANKE : fast/forms/validation-message-appearance.html = IMAGE
BUGDPRANKE LINUX : fast/multicol/shadow-breaking.html = IMAGE
BUGDPRANKE WIN XP : fast/multicol/shadow-breaking.html = IMAGE
BUGDPRANKE WIN XP : fast/repaint/shadow-multiple-horizontal.html = IMAGE
BUGDPRANKE WIN XP : fast/repaint/shadow-multiple-strict-horizontal.html = IMAGE
BUGDPRANKE WIN XP : fast/repaint/shadow-multiple-strict-vertical.html = IMAGE
BUGDPRANKE WIN XP : fast/repaint/shadow-multiple-vertical.html = IMAGE
BUGDPRANKE WIN XP : fast/text/shadow-translucent-fill.html = IMAGE
BUGDPRANKE WIN XP : fast/transforms/shadows.html = IMAGE
BUGDPRANKE WIN XP : svg/css/group-with-shadow.svg = IMAGE
BUGDPRANKE WIN XP : svg/css/text-shadow-multiple.xhtml = IMAGE
BUGDPRANKE WIN XP : transitions/svg-text-shadow-transition.html = IMAGE
BUGDPRANKE : fast/multicol/shadow-breaking.html = IMAGE
BUGDPRANKE WIN : fast/text/shadow-translucent-fill.html = IMAGE
BUGDPRANKE WIN : fast/transforms/shadows.html = IMAGE
BUGDPRANKE WIN : svg/css/group-with-shadow.svg = IMAGE
BUGDPRANKE WIN : svg/css/text-shadow-multiple.xhtml = IMAGE
BUGDPRANKE WIN : transitions/svg-text-shadow-transition.html = IMAGE

// flakiness on deps bots from r84685:r84721??
BUGDPRANKE MAC LEOPARD DEBUG : http/tests/local/stylesheet-and-script-load-order.html = CRASH PASS
Expand Down
26 changes: 26 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,29 @@
2011-04-28 Mike Reed <reed@google.com>

Reviewed by Eric Seidel.

fix shadw behavior for both CSS and Canvas -- skia only
https://bugs.webkit.org/show_bug.cgi?id=59700

Test:
canvas/philip/tests/2d.shadow.alpha.3.html
canvas/philip/tests/2d.shadow.alpha.4.html
canvas/philip/tests/2d.shadow.alpha.5.html
fast/canvas/canvas-fillPath-alpha-shadow.html
fast/canvas/canvas-strokePath-alpha-shadow.html
fast/canvas/canvas-strokeRect-alpha-shadow.html
fast/css/text-input-with-webkit-border-radius.html
fast/repaint/shadow-multiple-horizontal.html
fast/repaint/shadow-multiple-strict-horizontal.html
fast/repaint/shadow-multiple-strict-vertical.html
fast/repaint/shadow-multiple-vertical.html
fast/canvas/canvas-getImageData.html

* platform/graphics/chromium/FontChromiumWin.cpp:
(WebCore::Font::drawGlyphs):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::setPlatformShadow):

2011-04-28 David Kilzer <ddkilzer@apple.com>

<http://webkit.org/b/59755> AXObjectCache::attachWrapper() over-retains an AccessibilityObjectWrapper
Expand Down
19 changes: 1 addition & 18 deletions Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
Expand Up @@ -454,25 +454,8 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext,
// Skip 100% transparent text; no need to draw anything.
if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStroke && !graphicsContext->hasShadow())
return;
if (!alpha || windowsCanHandleDrawTextShadow(graphicsContext) || !windowsCanHandleTextDrawingWithoutShadow(graphicsContext)) {
drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
return;
}
// Draw in two passes: skia for the shadow, GDI for foreground text
// pass1: shadow (will use skia)
graphicsContext->save();
graphicsContext->setFillColor(Color::transparent, graphicsContext->fillColorSpace());
drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
graphicsContext->restore();
// pass2: foreground text (will use GDI)
FloatSize shadowOffset;
float shadowBlur;
Color shadowColor;
ColorSpace shadowColorSpace;
graphicsContext->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
graphicsContext->setShadow(shadowOffset, shadowBlur, Color::transparent, shadowColorSpace);

drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point);
graphicsContext->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
}

FloatRect Font::selectionRectForComplexText(const TextRun& run,
Expand Down
16 changes: 8 additions & 8 deletions Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
Expand Up @@ -1047,6 +1047,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size,
double blur = blurFloat;

uint32_t mfFlags = SkBlurMaskFilter::kHighQuality_BlurFlag;
SkXfermode::Mode colorMode = SkXfermode::kSrc_Mode;

if (m_state.shadowsIgnoreTransforms) {
// Currently only the GraphicsContext associated with the
Expand All @@ -1055,6 +1056,12 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size,
// with a CanvasRenderingContext.
mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag;

// CSS wants us to ignore the original's alpha, but Canvas wants us to
// modulate with it. Using shadowsIgnoreTransforms to tell us that we're
// in a Canvas, we change the colormode to kDst_Mode, so we don't overwrite
// it with our layer's (default opaque-black) color.
colorMode = SkXfermode::kDst_Mode;

// CG uses natural orientation for Y axis, but the HTML5 canvas spec
// does not.
// So we now flip the height since it was flipped in
Expand All @@ -1080,16 +1087,9 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size,
// lower layer contains our offset, blur, and colorfilter
SkLayerDrawLooper::LayerInfo info;

/*
WebKit's interpretation of shadow color is that it does not pay
attention to the alpha in the fill color, so we pass kSrc_Mode for
fColorMode so that we overwrite the drawing paint's color and use ours,
which is 0xFF000000. This works fine, since by passing kSrcIn_Mode to
the colorfilter, we will only modulate with the alpha, which is 0xFF.
*/
info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit; // our blur
info.fPaintBits |= SkLayerDrawLooper::kColorFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
info.fColorMode = colorMode;
info.fOffset.set(width, height);
info.fPostTranslate = m_state.shadowsIgnoreTransforms;

Expand Down

0 comments on commit 1b1e235

Please sign in to comment.