Bug 44006 - [Qt] Refactor shadow state handling in GraphicsContextQt
Summary: [Qt] Refactor shadow state handling in GraphicsContextQt
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Normal
Assignee: Ariya Hidayat
URL:
Keywords: HTML5, Qt
Depends on:
Blocks: 34479
  Show dependency treegraph
 
Reported: 2010-08-13 23:01 PDT by Ariya Hidayat
Modified: 2010-08-14 01:24 PDT (History)
1 user (show)

See Also:


Attachments
Patch (14.60 KB, patch)
2010-08-14 00:18 PDT, Ariya Hidayat
kenneth: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ariya Hidayat 2010-08-13 23:01:23 PDT
Instead of repeatedly using getShadow(), the shadow state handling should be implemented in setPlatformShadow().
Comment 1 Ariya Hidayat 2010-08-14 00:18:15 PDT
Created attachment 64412 [details]
Patch
Comment 2 Ariya Hidayat 2010-08-14 00:23:31 PDT
The patch is just the slightly minor version from Patch 1 in https://bugs.webkit.org/show_bug.cgi?id=34479, which I rolled out because it breaks:

canvas/philip/tests/2d.shadow.enable.blur.html
canvas/philip/tests/2d.shadow.offset.positiveX.html
canvas/philip/tests/2d.shadow.offset.positiveY.html
fast/canvas/canvas-shadow.html

Now the problem is tackled propery. The small diff against the previous is:

diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index a409328..94e6f67 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -665,7 +665,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
         shadowDestRect.translate(m_data->shadowOffset);
 
         pShadow->setCompositionMode(QPainter::CompositionMode_Source);
-        pShadow->fillRect(shadowDestRect, m_data->shadowColor);
+        pShadow->fillRect(shadowImage->rect(), m_data->shadowColor);
         pShadow->setCompositionMode(QPainter::CompositionMode_DestinationIn);
     }
 
@@ -895,7 +895,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const
         // Can't paint the shadow with invalid or invisible color.
         m_data->shadowType = GraphicsContextPlatformPrivate::NoShadow;
     } else {
-        if (blur >= 1) {
+        if (blur > 0) {
             // Shadow is always blurred, even the offset is zero.
             m_data->shadowType = GraphicsContextPlatformPrivate::BlurShadow;
         } else {
Comment 3 Ariya Hidayat 2010-08-14 01:24:06 PDT
Manually committed r65362: http://trac.webkit.org/changeset/65362