Modified: trunk/Source/WebCore/ChangeLog (123763 => 123764)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 16:45:07 UTC (rev 123763)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 16:50:44 UTC (rev 123764)
@@ -1,3 +1,18 @@
+2012-07-26 Patrick Gansterer <[email protected]>
+
+ Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext)
+ https://bugs.webkit.org/show_bug.cgi?id=92113
+
+ Reviewed by Simon Hausmann.
+
+ Cleanup the definition of the two methods across different ports and
+ replace the calls to them with LocalWindowsContext where possible.
+
+ * platform/graphics/GraphicsContext.h:
+ (GraphicsContext):
+ * platform/win/ScrollbarThemeWin.cpp:
+ (WebCore::ScrollbarThemeWin::paintThumb):
+
2012-07-26 Vsevolod Vlasov <[email protected]>
Web Inspector: Introduce generic LiveLocation, make Script.Location inherit it.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (123763 => 123764)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2012-07-26 16:45:07 UTC (rev 123763)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2012-07-26 16:50:44 UTC (rev 123764)
@@ -431,7 +431,11 @@
void applyDeviceScaleFactor(float);
void platformApplyDeviceScaleFactor(float);
-#if OS(WINCE) && !PLATFORM(QT)
+#if OS(WINDOWS)
+ HDC getWindowsContext(const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
+ void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap); // The passed in HDC should be the one handed back by getWindowsContext.
+#if PLATFORM(WIN)
+#if OS(WINCE)
void setBitmap(PassRefPtr<SharedBitmap>);
const AffineTransform& affineTransform() const;
AffineTransform& affineTransform();
@@ -444,13 +448,9 @@
void drawBitmap(SharedBitmap*, const IntRect& dstRect, const IntRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp);
void drawBitmapPattern(SharedBitmap*, const FloatRect& tileRectIn, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, const IntSize& origSourceSize);
void drawIcon(HICON icon, const IntRect& dstRect, UINT flags);
- HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
- void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext.
void drawRoundCorner(bool newClip, RECT clipRect, RECT rectWin, HDC dc, int width, int height);
-#elif PLATFORM(WIN)
+#else
GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed.
- HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
- void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext.
// When set to true, child windows should be rendered into this context
// rather than allowing them just to render to the screen. Defaults to
@@ -487,12 +487,10 @@
// The bitmap should be non-premultiplied.
void drawWindowsBitmap(WindowsBitmap*, const IntPoint&);
#endif
-
-#if (PLATFORM(GTK) && OS(WINDOWS)) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
- HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);
- void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);
+#else // PLATFORM(WIN)
bool shouldIncludeChildWindows() const { return false; }
-#endif
+#endif // PLATFORM(WIN)
+#endif // OS(WINDOWS)
#if PLATFORM(WX)
// This is needed because of a bug whereby getting an HDC from a GDI+ context
Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (123763 => 123764)
--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp 2012-07-26 16:45:07 UTC (rev 123763)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp 2012-07-26 16:50:44 UTC (rev 123764)
@@ -375,19 +375,18 @@
bool alphaBlend = false;
if (scrollbarTheme)
alphaBlend = IsThemeBackgroundPartiallyTransparent(scrollbarTheme, scrollbar->orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state);
- HDC hdc = context->getWindowsContext(rect, alphaBlend);
+ LocalWindowsContext windowsContext(context, rect, alphaBlend);
RECT themeRect(rect);
if (scrollbarTheme) {
- DrawThemeBackground(scrollbarTheme, hdc, scrollbar->orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state, &themeRect, 0);
- paintGripper(scrollbar, hdc, gripperRect(scrollbarThickness(), rect));
+ DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), scrollbar->orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state, &themeRect, 0);
+ paintGripper(scrollbar, windowsContext.hdc(), gripperRect(scrollbarThickness(), rect));
} else
- ::DrawEdge(hdc, &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
+ ::DrawEdge(windowsContext.hdc(), &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
#if !OS(WINCE)
if (!alphaBlend && !context->isInTransparencyLayer())
- DIBPixelData::setRGBABitmapAlpha(hdc, rect, 255);
+ DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255);
#endif
- context->releaseWindowsContext(hdc, rect, alphaBlend);
}
}