Skip to content

Commit

Permalink
Removed following non-public API(s)
Browse files Browse the repository at this point in the history
framework: '/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit'
: NSAccessibilityUnregisterUniqueIdForUIElement
: NSTextInputReplacementRangeAttributeName

framework: '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices'
: AXTextMarkerCreate
: AXTextMarkerGetBytePtr
: AXTextMarkerRangeCopyEndMarker
: AXTextMarkerRangeCopyStartMarker
: AXTextMarkerRangeCreate
: CGSSetWindowBackgroundBlurRadius
: CTFontCopyDefaultCascadeList
  • Loading branch information
Cong Liu committed Aug 19, 2016
1 parent 80192a0 commit 318e429
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions content/browser/accessibility/browser_accessibility_cocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@
@property(nonatomic, readonly) NSNumber* enabled;
// Returns a text marker that points to the last character in the document that
// can be selected with Voiceover.
#if !defined(NWJS_MAS)
@property(nonatomic, readonly) id endTextMarker;
#endif
@property(nonatomic, readonly) NSNumber* expanded;
@property(nonatomic, readonly) NSNumber* focused;
@property(nonatomic, readonly) NSString* help;
Expand Down Expand Up @@ -112,11 +114,15 @@
@property(nonatomic, readonly) NSValue* rowIndexRange;
@property(nonatomic, readonly) NSArray* rows;
@property(nonatomic, readonly) NSArray* selectedChildren;
#if !defined(NWJS_MAS)
@property(nonatomic, readonly) id selectedTextMarkerRange;
#endif
@property(nonatomic, readonly) NSValue* size;
#if !defined(NWJS_MAS)
// Returns a text marker that points to the first character in the document that
// can be selected with Voiceover.
@property(nonatomic, readonly) id startTextMarker;
#endif
// A string indicating the subrole of this object as far as accessibility
// is concerned.
@property(nonatomic, readonly) NSString* subrole;
Expand Down
18 changes: 18 additions & 0 deletions content/browser/accessibility/browser_accessibility_cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
// VoiceOver uses -1 to mean "no limit" for AXResultsLimit.
const int kAXResultsLimitNoLimit = -1;

#if !defined(NWJS_MAS)
extern "C" {

// See http://openradar.appspot.com/9896491. This SPI has been tested on 10.5,
Expand Down Expand Up @@ -195,6 +196,7 @@ bool GetTextMarkerRange(AXTextMarkerRangeRef marker_range,
return base::SysUTF16ToNSString(BrowserAccessibilityManager::GetTextForRange(
*start_object, start_offset, *end_object, end_offset));
}
#endif

// Returns an autoreleased copy of the AXNodeData's attribute.
NSString* NSStringForStringAttribute(
Expand Down Expand Up @@ -415,7 +417,9 @@ + (void)initialize {
{NSAccessibilityDisclosureLevelAttribute, @"disclosureLevel"},
{NSAccessibilityDisclosedRowsAttribute, @"disclosedRows"},
{NSAccessibilityEnabledAttribute, @"enabled"},
#if !defined(NWJS_MAS)
{NSAccessibilityEndTextMarkerAttribute, @"endTextMarker"},
#endif
{NSAccessibilityExpandedAttribute, @"expanded"},
{NSAccessibilityFocusedAttribute, @"focused"},
{NSAccessibilityHeaderAttribute, @"header"},
Expand All @@ -438,10 +442,14 @@ + (void)initialize {
{NSAccessibilityRowsAttribute, @"rows"},
// TODO(aboxhall): expose
// NSAccessibilityServesAsTitleForUIElementsAttribute
#if !defined(NWJS_MAS)
{NSAccessibilityStartTextMarkerAttribute, @"startTextMarker"},
#endif
{NSAccessibilitySelectedChildrenAttribute, @"selectedChildren"},
#if !defined(NWJS_MAS)
{NSAccessibilitySelectedTextMarkerRangeAttribute,
@"selectedTextMarkerRange"},
#endif
{NSAccessibilitySizeAttribute, @"size"},
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
{NSAccessibilitySubroleAttribute, @"subrole"},
Expand Down Expand Up @@ -489,10 +497,12 @@ - (id)initWithObject:(BrowserAccessibility*)accessibility {
}

- (void)detach {
#if !defined(NWJS_MAS)
if (browserAccessibility_) {
NSAccessibilityUnregisterUniqueIdForUIElement(self);
browserAccessibility_ = NULL;
}
#endif
}

- (NSString*)accessKey {
Expand Down Expand Up @@ -740,6 +750,7 @@ - (NSNumber*)enabled {
GetState(browserAccessibility_, ui::AX_STATE_ENABLED)];
}

#if !defined(NWJS_MAS)
// Returns a text marker that points to the last character in the document that
// can be selected with VoiceOver.
- (id)endTextMarker {
Expand Down Expand Up @@ -767,6 +778,7 @@ - (id)endTextMarker {
return CreateTextMarker(*last_text_object,
last_text_object->GetText().length());
}
#endif

- (NSNumber*)expanded {
return [NSNumber numberWithBool:
Expand Down Expand Up @@ -1280,6 +1292,7 @@ - (NSArray*)selectedChildren {
return ret;
}

#if !defined(NWJS_MAS)
- (id)selectedTextMarkerRange {
if (!browserAccessibility_)
return nil;
Expand All @@ -1306,6 +1319,7 @@ - (id)selectedTextMarkerRange {
return CreateTextMarkerRange(*anchorObject, anchorOffset, *focusObject,
focusOffset);
}
#endif

- (NSValue*)size {
gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect();
Expand Down Expand Up @@ -1337,6 +1351,7 @@ - (NSString*)sortDirection {
return nil;
}

#if !defined(NWJS_MAS)
// Returns a text marker that points to the first character in the document that
// can be selected with VoiceOver.
- (id)startTextMarker {
Expand All @@ -1363,6 +1378,7 @@ - (id)startTextMarker {

return CreateTextMarker(*first_text_object, 0);
}
#endif

// Returns a subrole based upon the role.
- (NSString*) subrole {
Expand Down Expand Up @@ -1745,6 +1761,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
return nil;
}

#if !defined(NWJS_MAS)
if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) {
BrowserAccessibility* object;
int offset;
Expand Down Expand Up @@ -1834,6 +1851,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
NSString* text = GetTextForTextMarkerRange(parameter);
return [NSNumber numberWithInt:[text length]];
}
#endif

if ([attribute isEqualToString:
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@
@"AXTextSelectionGranularity";
NSString* const NSAccessibilityTextSelectionChangedFocus =
@"AXTextSelectionChangedFocus";
#if !defined(NWJS_MAS)
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
@"AXSelectedTextMarkerRange";
#endif
NSString* const NSAccessibilityTextChangeElement = @"AXTextChangeElement";

} // namespace
Expand Down Expand Up @@ -320,8 +322,10 @@
focus_object = focus_object->GetClosestPlatformObject();
auto native_focus_object = focus_object->ToBrowserAccessibilityCocoa();
if (native_focus_object) {
#if !defined(NWJS_MAS)
[user_info setObject:[native_focus_object selectedTextMarkerRange]
forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
#endif
[user_info setObject:native_focus_object
forKey:NSAccessibilityTextChangeElement];
}
Expand Down
6 changes: 6 additions & 0 deletions content/browser/renderer_host/render_widget_host_view_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2920,6 +2920,7 @@ - (id)accessibilityFocusedUIElement {
// Since this implementation doesn't have to wait any IPC calls, this doesn't
// make any key-typing jank. --hbono 7/23/09
//
#if !defined(NWJS_MAS)
extern "C" {
extern NSString *NSTextInputReplacementRangeAttributeName;
}
Expand All @@ -2936,6 +2937,11 @@ - (NSArray *)validAttributesForMarkedText {
}
return validAttributesForMarkedText_.get();
}
#else
- (NSArray *)validAttributesForMarkedText {
return @[];
}
#endif

- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint {
DCHECK([self window]);
Expand Down
6 changes: 6 additions & 0 deletions ui/gfx/font_fallback_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#import "base/strings/sys_string_conversions.h"
#include "ui/gfx/font.h"

#if !defined(NWJS_MAS)
// CTFontCopyDefaultCascadeListForLanguages() doesn't exist in the 10.6 SDK.
// There is only the following. It doesn't exist in the public header files,
// but is an exported symbol so should always link.
extern "C" CFArrayRef CTFontCopyDefaultCascadeList(CTFontRef font_ref);
#endif

namespace {

Expand All @@ -31,12 +33,16 @@ CFArrayRef CTFontCopyDefaultCascadeListForLanguagesWrapper(
static const MountainLionPrototype cascade_with_languages_function =
reinterpret_cast<MountainLionPrototype>(
dlsym(RTLD_DEFAULT, "CTFontCopyDefaultCascadeListForLanguages"));
#if !defined(NWJS_MAS)
if (cascade_with_languages_function)
return cascade_with_languages_function(font_ref, language_pref_list);

// Fallback to the 10.6 Private API.
DCHECK(base::mac::IsOSLionOrEarlier());
return CTFontCopyDefaultCascadeList(font_ref);
#else
return cascade_with_languages_function(font_ref, language_pref_list);
#endif
}

} // namespace
Expand Down
7 changes: 7 additions & 0 deletions ui/views/cocoa/bridged_native_widget.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@
#include "ui/views/widget/widget_aura_utils.h"
#include "ui/views/widget/widget_delegate.h"

#if !defined(NWJS_MAS)
extern "C" {

typedef int32_t CGSConnection;

CGSConnection _CGSDefaultConnection();
CGError CGSSetWindowBackgroundBlurRadius(CGSConnection connection,
NSInteger windowNumber,
int radius);

}
#endif

// The NSView that hosts the composited CALayer drawing the UI. It fills the
// window but is not hittable so that accessibility hit tests always go to the
Expand Down Expand Up @@ -85,7 +88,9 @@ - (void)setCurrentProgress:(NSAnimationProgress)progress {

const CGFloat kMavericksMenuOpacity = 251.0 / 255.0;
const CGFloat kYosemiteMenuOpacity = 194.0 / 255.0;
#if !defined(NWJS_MAS)
const int kYosemiteMenuBlur = 80;
#endif

// Margin at edge and corners of the window that trigger resizing. These match
// actual Cocoa resize margins.
Expand Down Expand Up @@ -1145,8 +1150,10 @@ void SetupDragEventMonitor() {
// solid background, but make the CALayer transparent.
if (base::mac::IsOSYosemiteOrLater()) {
[background_layer setOpacity:kYosemiteMenuOpacity];
#if !defined(NWJS_MAS)
CGSSetWindowBackgroundBlurRadius(
_CGSDefaultConnection(), [window_ windowNumber], kYosemiteMenuBlur);
#endif
// The blur effect does not occur with a fully transparent (or fully
// layer-backed) window. Setting a window background will use square
// corners, so ask the contentView to draw one instead.
Expand Down

0 comments on commit 318e429

Please sign in to comment.