diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 05699226ee6b..941d12de22dc 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -2147,10 +2147,13 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext, nsITheme *theme = aPresContext->GetTheme(); if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame, displayData->mAppearance)) { - nsRect dirty; - dirty.IntersectRect(aDirtyRect, aBorderArea); + nsRect drawing(aBorderArea); + theme->GetWidgetOverflow(aPresContext->DeviceContext(), + aForFrame, displayData->mAppearance, &drawing); + drawing.IntersectRect(drawing, aDirtyRect); theme->DrawWidgetBackground(&aRenderingContext, aForFrame, - displayData->mAppearance, aBorderArea, dirty); + displayData->mAppearance, aBorderArea, + drawing); return; } } diff --git a/layout/reftests/native-theme/checkbox-dynamic-1-ref.html b/layout/reftests/native-theme/checkbox-dynamic-1-ref.html new file mode 100644 index 000000000000..8d745c4a6407 --- /dev/null +++ b/layout/reftests/native-theme/checkbox-dynamic-1-ref.html @@ -0,0 +1,18 @@ + + + + + + +
+ +
+ + diff --git a/layout/reftests/native-theme/checkbox-dynamic-1.html b/layout/reftests/native-theme/checkbox-dynamic-1.html new file mode 100644 index 000000000000..bab50a8666e6 --- /dev/null +++ b/layout/reftests/native-theme/checkbox-dynamic-1.html @@ -0,0 +1,39 @@ + + + + + + +
+ +
+
+
+ + + diff --git a/layout/reftests/native-theme/reftest.list b/layout/reftests/native-theme/reftest.list index 700a2281b0b1..d9e98161f510 100644 --- a/layout/reftests/native-theme/reftest.list +++ b/layout/reftests/native-theme/reftest.list @@ -57,3 +57,5 @@ skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") == resizer-bottomend-rtl.xul resizer-bottome # Windows-only, depends on native scrollbar metrics skip-if(MOZ_WIDGET_TOOLKIT!="windows") == scroll-thumb-minimum-size-notheme.html scroll-thumb-minimum-size-notheme-ref.html # skip-if(MOZ_WIDGET_TOOLKIT!="windows") == scroll-thumb-minimum-size-theme.html scroll-thumb-minimum-size-theme-ref.html # Bug 512206 + +== checkbox-dynamic-1.html checkbox-dynamic-1-ref.html diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index c044826c03d4..231fc926019d 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -748,23 +748,21 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext, // GTK themes can only draw an integer number of pixels // (even when not snapped). nsIntRect widgetRect(0, 0, NS_lround(rect.Width()), NS_lround(rect.Height())); + nsIntRect overflowRect(widgetRect); + nsIntMargin extraSize; + if (GetExtraSizeForWidget(aWidgetType, state.isDefault, &extraSize)) { + overflowRect.Inflate(extraSize); + } // This is the rectangle that will actually be drawn, in gdk pixels nsIntRect drawingRect(PRInt32(dirtyRect.X()), PRInt32(dirtyRect.Y()), PRInt32(dirtyRect.Width()), PRInt32(dirtyRect.Height())); - if (!drawingRect.IntersectRect(widgetRect, drawingRect)) + if (widgetRect.IsEmpty() + || !drawingRect.IntersectRect(overflowRect, drawingRect)) return NS_OK; - nsIntMargin extraSize; - // The margin should be applied to the widget rect rather than the dirty - // rect but nsCSSRendering::PaintBackgroundWithSC has already intersected - // the dirty rect with the uninflated widget rect. - if (GetExtraSizeForWidget(aWidgetType, state.isDefault, &extraSize)) { - drawingRect.Inflate(extraSize); - } - // gdk rectangles are wrt the drawing rect. // The gdk_clip is just advisory here, meaning "you don't diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 3aa10fdb36da..d5fe2167f61d 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -1485,7 +1485,7 @@ nsNativeThemeWin::GetWidgetOverflow(nsIDeviceContext* aContext, nsRect* aResult) { /* This is disabled for now, because it causes invalidation problems -- - * see bug 402381. The effect of not updating the overflow area is that + * see bug 420381. The effect of not updating the overflow area is that * for dropdown buttons in content areas, there is a 1px border on 3 sides * where, if invalidated, the dropdown control probably won't be repainted. * This is fairly minor, as by default there is nothing in that area, and