mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1059991 - Do new-style focus drawing on 10.10 even when building against a pre-10.8 SDK. r=smichaud
This commit is contained in:
parent
cdb6f62835
commit
c713437615
@ -115,21 +115,33 @@ DrawFocusRingForCellIfNeeded(NSCell* aCell, NSRect aWithFrame, NSView* aInView)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DrawCellIncludingFocusRing(NSCell* aCell, NSRect aWithFrame, NSView* aInView)
|
||||
static bool
|
||||
FocusIsDrawnByDrawWithFrame()
|
||||
{
|
||||
[aCell drawWithFrame:aWithFrame inView:aInView];
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
||||
// When building with the 10.8 SDK or higher, focus rings don't draw as part
|
||||
// of -[NSCell drawWithFrame:inView:] and must be drawn by a separate call
|
||||
// to -[NSCell drawFocusRingMaskWithFrame:inView:]; .
|
||||
// See the NSButtonCell section under
|
||||
// https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#X10_8Notes
|
||||
DrawFocusRingForCellIfNeeded(aCell, aWithFrame, aInView);
|
||||
return false;
|
||||
#else
|
||||
// On 10.10 and up, this is the case even when building against the 10.7 SDK
|
||||
// or lower.
|
||||
return !nsCocoaFeatures::OnYosemiteOrLater();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
DrawCellIncludingFocusRing(NSCell* aCell, NSRect aWithFrame, NSView* aInView)
|
||||
{
|
||||
[aCell drawWithFrame:aWithFrame inView:aInView];
|
||||
|
||||
if (!FocusIsDrawnByDrawWithFrame()) {
|
||||
DrawFocusRingForCellIfNeeded(aCell, aWithFrame, aInView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* NSProgressBarCell is used to draw progress bars of any size.
|
||||
*/
|
||||
@ -306,12 +318,9 @@ static BOOL IsToolbarStyleContainer(nsIFrame* aFrame)
|
||||
{
|
||||
[super drawWithFrame:rect inView:controlView];
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_8) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
|
||||
// When building against the 10.8 SDK and up, DrawCellIncludingFocusRing will
|
||||
// invoke DrawFocusRingForCellIfNeeded for us, but when building
|
||||
// against earlier SDKs we have to do it here.
|
||||
DrawFocusRingForCellIfNeeded(self, rect, controlView);
|
||||
#endif
|
||||
if (FocusIsDrawnByDrawWithFrame()) {
|
||||
DrawFocusRingForCellIfNeeded(self, rect, controlView);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)drawFocusRingMaskWithFrame:(NSRect)rect inView:(NSView*)controlView
|
||||
|
Loading…
Reference in New Issue
Block a user