Bug 1370757 - Don't expand the dirty rect for Mac native widget drawing. r?mattwoodrow
Extending it didn't play well with invalidation; widgets would only be able to
draw outside if the invalidated region of the current paint was larger than the
widget's declared paint rect but not if the widget was the only thing that got
invalidated.
Any legitimate widget overflow should instead be handled by GetWidgetOverflow.
The DrawCellWithSnapping overflow is considered to stay within the focus
ring's bounds.
I fuzzed two reftests which have extremely slight variance when -moz-appearance
is combined with box-shadow. I don't really understand this failure but I don't
think it's worth looking into either.
MozReview-Commit-ID: ECYxnCTafdh
--- a/layout/reftests/css-ui-invalid/default-style/reftest.list
+++ b/layout/reftests/css-ui-invalid/default-style/reftest.list
@@ -1,10 +1,10 @@
== input.html input-ref.html
-fuzzy-if(webrender,1-1,6-6) == button.html button-ref.html
+fuzzy-if(webrender,1-1,6-6) fuzzy-if(cocoaWidget,2,32) == button.html button-ref.html
== textarea.html textarea-ref.html
== select.html select-ref.html
== fieldset.html fieldset-ref.html
== output.html output-ref.html
random-if(winWidget) needs-focus == input-focus.html input-focus-ref.html # Intermittent failures, bug 660224
-needs-focus == button-focus.html button-focus-ref.html
+needs-focus fuzzy-if(cocoaWidget,1,10) == button-focus.html button-focus-ref.html
needs-focus == textarea-focus.html textarea-focus-ref.html
random-if(winWidget) needs-focus == select-focus.html select-focus-ref.html # Intermittent failures, bug 660224
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2296,24 +2296,16 @@ nsNativeThemeCocoa::DrawWidgetBackground
gfx::Rect nativeDirtyRect = NSRectToRect(aDirtyRect, p2a);
gfxRect nativeWidgetRect(aRect.x, aRect.y, aRect.width, aRect.height);
nativeWidgetRect.ScaleInverse(gfxFloat(p2a));
float nativeWidgetHeight = round(nativeWidgetRect.Height());
nativeWidgetRect.Round();
if (nativeWidgetRect.IsEmpty())
return NS_OK; // Don't attempt to draw invisible widgets.
- // Bug 1059031 -
- // Quartz theme drawing often adjusts drawing rects, so make
- // sure our surface is big enough for that.
- // For example, DrawCellWithSnapping snaps the drawing rect, and that can
- // result in us drawing outside of what we thought the bounds were.
- // The 5 is just a guess of how much margin we need to handle that.
- nativeDirtyRect.Inflate(5);
-
AutoRestoreTransform autoRestoreTransform(&aDrawTarget);
bool hidpi = IsHiDPIContext(aFrame->PresContext()->DeviceContext());
if (hidpi) {
// Use high-resolution drawing.
nativeWidgetRect.Scale(0.5f);
nativeWidgetHeight *= 0.5f;
nativeDirtyRect.Scale(0.5f);