mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 404816 - "Visual bug in list view header" [p=twanno@lycos.nl (Teune van Steeg) r+sr=roc a1.9=damons]
This commit is contained in:
parent
d9ec6b9a1f
commit
81fd480d40
@ -22,6 +22,7 @@
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com> (Original Author)
|
||||
* Michael Ventnor <m.ventnor@gmail.com>
|
||||
* Teune van Steeg <t.vansteeg@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -620,6 +621,27 @@ ConvertToGdkRect(const nsRect &aRect, PRInt32 aP2A)
|
||||
return gdk_rect;
|
||||
}
|
||||
|
||||
static GdkRectangle
|
||||
ConvertGfxToGdkRect(const gfxRect &aRect, const gfxPoint &aTranslation)
|
||||
{
|
||||
GdkRectangle gdk_rect;
|
||||
gdk_rect.x = NSToIntRound(aRect.X()) - NSToIntRound(aTranslation.x);
|
||||
gdk_rect.y = NSToIntRound(aRect.Y()) - NSToIntRound(aTranslation.y);
|
||||
gdk_rect.width = NSToIntRound(aRect.Width());
|
||||
gdk_rect.height = NSToIntRound(aRect.Height());
|
||||
return gdk_rect;
|
||||
}
|
||||
|
||||
static gfxRect
|
||||
ConvertToGfxRect(const nsRect &aRect, PRInt32 aP2A)
|
||||
{
|
||||
gfxRect rect(NSAppUnitsToFloatPixels(aRect.x, aP2A),
|
||||
NSAppUnitsToFloatPixels(aRect.y, aP2A),
|
||||
NSAppUnitsToFloatPixels(aRect.width, aP2A),
|
||||
NSAppUnitsToFloatPixels(aRect.height, aP2A));
|
||||
return rect;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
@ -663,26 +685,38 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
||||
oldHandler = XSetErrorHandler(NativeThemeErrorHandler);
|
||||
}
|
||||
|
||||
gfxContext* ctx =
|
||||
(gfxContext*)aContext->GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
|
||||
gfxMatrix current = ctx->CurrentMatrix();
|
||||
|
||||
// We require the use of the default display and visual
|
||||
// because I'm afraid that otherwise the GTK theme may explode.
|
||||
// Some themes (e.g. Clearlooks) just don't clip properly to any
|
||||
// clip rect we provide, so we cannot advertise support for clipping within the
|
||||
// widget bounds. The gdk_clip is just advisory here, meanining "you don't
|
||||
// need to draw outside this rect if you don't feel like it!"
|
||||
PRUint32 rendererFlags = gfxXlibNativeRenderer::DRAW_SUPPORTS_OFFSET;
|
||||
GdkRectangle gdk_rect = ConvertToGdkRect(aRect - drawingRect.TopLeft(), p2a);
|
||||
GdkRectangle gdk_clip = ConvertToGdkRect(aClipRect - drawingRect.TopLeft(), p2a);
|
||||
GdkRectangle gdk_rect, gdk_clip;
|
||||
gfxRect gfx_rect = ConvertToGfxRect(aRect - drawingRect.TopLeft(), p2a);
|
||||
gfxRect gfx_clip = ConvertToGfxRect(aClipRect - drawingRect.TopLeft(), p2a);
|
||||
if (ctx->UserToDevicePixelSnapped(gfx_rect) &&
|
||||
ctx->UserToDevicePixelSnapped(gfx_clip)) {
|
||||
gfxPoint currentTranslation = current.GetTranslation();
|
||||
gdk_rect = ConvertGfxToGdkRect(gfx_rect, currentTranslation);
|
||||
gdk_clip = ConvertGfxToGdkRect(gfx_clip, currentTranslation);
|
||||
}
|
||||
else {
|
||||
gdk_rect = ConvertToGdkRect(aRect - drawingRect.TopLeft(), p2a);
|
||||
gdk_clip = ConvertToGdkRect(aClipRect - drawingRect.TopLeft(), p2a);
|
||||
}
|
||||
ThemeRenderer renderer(state, gtkWidgetType, flags, gdk_rect, gdk_clip);
|
||||
|
||||
gfxContext* ctx =
|
||||
(gfxContext*)aContext->GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
|
||||
|
||||
// XXXbz do we really want to round here, then snap, then round again?
|
||||
gfxRect rect(0, 0, NSAppUnitsToIntPixels(drawingRect.width, p2a),
|
||||
NSAppUnitsToIntPixels(drawingRect.height, p2a));
|
||||
|
||||
PRUint32 rendererFlags = gfxXlibNativeRenderer::DRAW_SUPPORTS_OFFSET;
|
||||
// Don't snap if it's a non-unit scale factor. We're going to have to take
|
||||
// slow paths then in any case.
|
||||
gfxMatrix current = ctx->CurrentMatrix();
|
||||
PRBool snapXY = ctx->UserToDevicePixelSnapped(rect) &&
|
||||
!current.HasNonTranslation();
|
||||
if (snapXY) {
|
||||
|
Loading…
Reference in New Issue
Block a user