Title: [90053] trunk/Source/WebCore
Revision
90053
Author
[email protected]
Date
2011-06-29 15:11:47 -0700 (Wed, 29 Jun 2011)

Log Message

2011-06-29  Xu Fan  <[email protected]>

        Reviewed by Brent Fulgham.

        Fix Scrollbars Transparent in Windows XP if WebKit is using Layered Window
        https://bugs.webkit.org/show_bug.cgi?id=61136

        * platform/graphics/win/DIBPixelData.h: add a static method setRGBABitmapAlpha
        * platform/graphics/win/DIBPixelData.cpp: add implementation
        * platform/win/ScrollbarThemeWin.cpp: fix scroolbar transparent
        * rendering/RenderThemeWin.cpp: fix textbox and button transparent

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90052 => 90053)


--- trunk/Source/WebCore/ChangeLog	2011-06-29 22:04:29 UTC (rev 90052)
+++ trunk/Source/WebCore/ChangeLog	2011-06-29 22:11:47 UTC (rev 90053)
@@ -1,3 +1,15 @@
+2011-06-29  Xu Fan  <[email protected]>
+
+        Reviewed by Brent Fulgham.
+
+        Fix Scrollbars Transparent in Windows XP if WebKit is using Layered Window
+        https://bugs.webkit.org/show_bug.cgi?id=61136
+
+        * platform/graphics/win/DIBPixelData.h: add a static method setRGBABitmapAlpha
+        * platform/graphics/win/DIBPixelData.cpp: add implementation
+        * platform/win/ScrollbarThemeWin.cpp: fix scroolbar transparent
+        * rendering/RenderThemeWin.cpp: fix textbox and button transparent
+
 2011-06-29  Emil A Eklund  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/platform/graphics/win/DIBPixelData.cpp (90052 => 90053)


--- trunk/Source/WebCore/platform/graphics/win/DIBPixelData.cpp	2011-06-29 22:04:29 UTC (rev 90052)
+++ trunk/Source/WebCore/platform/graphics/win/DIBPixelData.cpp	2011-06-29 22:11:47 UTC (rev 90053)
@@ -84,4 +84,39 @@
 }
 #endif
 
+void DIBPixelData::setRGBABitmapAlpha(HDC hdc, const IntRect& dstRect, unsigned char level)
+{
+    HBITMAP bitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP));
+    DIBPixelData pixelData(bitmap);
+    ASSERT(pixelData.bitsPerPixel() == 32);
+
+    XFORM trans;
+    GetWorldTransform(hdc, &trans);
+    IntSize transformedPosition(trans.eDx, trans.eDy);
+    IntRect drawRect(dstRect);
+    drawRect.move(transformedPosition);
+
+    int pixelDataWidth = pixelData.size().width();
+    int pixelDataHeight = pixelData.size().height();
+    IntRect bitmapRect(0, 0, pixelDataWidth, pixelDataHeight);
+    drawRect.intersect(bitmapRect);
+    if (drawRect.isEmpty())
+        return;
+
+    RGBQUAD* bytes = reinterpret_cast<RGBQUAD*>(pixelData.buffer());
+    bytes += drawRect.y() * pixelDataWidth;
+
+    size_t width = drawRect.width();
+    size_t height = drawRect.height();
+    int x = drawRect.x();
+    for (size_t i = 0; i < height; i++) {
+        RGBQUAD* p = bytes + x;
+        for (size_t j = 0; j < width; j++) {
+            p->rgbReserved = level;
+            p++;
+        }
+        bytes += pixelDataWidth;
+    }
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/win/DIBPixelData.h (90052 => 90053)


--- trunk/Source/WebCore/platform/graphics/win/DIBPixelData.h	2011-06-29 22:04:29 UTC (rev 90052)
+++ trunk/Source/WebCore/platform/graphics/win/DIBPixelData.h	2011-06-29 22:11:47 UTC (rev 90053)
@@ -26,6 +26,7 @@
 #ifndef DIBPixelData_h
 #define DIBPixelData_h
 
+#include "IntRect.h"
 #include "IntSize.h"
 #include <windows.h>
 
@@ -58,6 +59,7 @@
         const IntSize& size() const { return m_size; }
         unsigned bytesPerRow() const { return m_bytesPerRow; }
         unsigned short bitsPerPixel() const { return m_bitsPerPixel; }
+        static void setRGBABitmapAlpha(HDC, const IntRect&, unsigned char);
 
     private:
         UInt8* m_bitmapBuffer;

Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (90052 => 90053)


--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2011-06-29 22:04:29 UTC (rev 90052)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2011-06-29 22:11:47 UTC (rev 90053)
@@ -269,6 +269,9 @@
             ::DeleteObject(patternBitmap);
         }
     }
+
+    if (!alphaBlend && !context->inTransparencyLayer())
+        DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255);
 }
 
 void ScrollbarThemeWin::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part)
@@ -318,6 +321,9 @@
         DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), SP_BUTTON, xpState, &themeRect, 0);
     else
         ::DrawFrameControl(windowsContext.hdc(), &themeRect, DFC_SCROLL, classicState);
+
+    if (!alphaBlend && !context->inTransparencyLayer())
+        DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255);
 }
 
 static IntRect gripperRect(int thickness, const IntRect& thumbRect)
@@ -372,6 +378,9 @@
         paintGripper(scrollbar, hdc, gripperRect(scrollbarThickness(), rect));
     } else
         ::DrawEdge(hdc, &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
+
+    if (!alphaBlend && !context->inTransparencyLayer())
+        DIBPixelData::setRGBABitmapAlpha(hdc, rect, 255);
     context->releaseWindowsContext(hdc, rect, alphaBlend);
 }
 

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (90052 => 90053)


--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2011-06-29 22:04:29 UTC (rev 90052)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2011-06-29 22:11:47 UTC (rev 90053)
@@ -671,6 +671,9 @@
             ::DrawFrameControl(hdc, &widgetRect, themeData.m_part, themeData.m_state);
         }
     }
+
+    if (!alphaBlend && !context->inTransparencyLayer())
+        DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), r, 255);
 }
 
 bool RenderThemeWin::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to