Skip to content

Commit

Permalink
Automatic merge of jdk:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Nov 20, 2020
2 parents bedf91c + 4c09525 commit e531729
Showing 1 changed file with 44 additions and 1 deletion.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -127,6 +127,23 @@ - (NSArray *)accessibilityColumnsAttribute;
@end


// In order to use a new NSAccessibility API and since our components
// are represented as a custom UI elements we need to implement a set
// of custom protocols. Definitions of these protocols will start here.

// This is a root interface in the NSAccessibility* protocols hierarchy
// and all the component-specific protocols should be derived from it.
// It is also a place for the functions that might be exposed by all the
// component accessibility peers.
// Please see https://developer.apple.com/documentation/appkit/nsaccessibilityprotocol
// for more details.
@interface CommonComponentAccessibility : JavaComponentAccessibility <NSAccessibilityElement> {

}
- (NSRect)accessibilityFrame;
- (nullable id)accessibilityParent;
@end

@implementation JavaComponentAccessibility

- (NSString *)description
Expand Down Expand Up @@ -1917,6 +1934,32 @@ - (id)accessibilityColumnCountAttribute {
}
@end

@implementation CommonComponentAccessibility
// NSAccessibilityElement protocol implementation
- (NSRect)accessibilityFrame
{
JNIEnv* env = [ThreadUtilities getJNIEnv];
jobject axComponent = JNFCallStaticObjectMethod(env, sjm_getAccessibleComponent,
fAccessible, fComponent);

NSSize size = getAxComponentSize(env, axComponent, fComponent);
NSPoint point = getAxComponentLocationOnScreen(env, axComponent, fComponent);
(*env)->DeleteLocalRef(env, axComponent);
point.y += size.height;

point.y = [[[[self view] window] screen] frame].size.height - point.y;

NSRect retval = NSMakeRect(point.x, point.y, size.width, size.height);
return retval;
}

- (nullable id)accessibilityParent
{
return [self accessibilityParentAttribute];
}

@end

/*
* Returns Object.equals for the two items
* This may use LWCToolkit.invokeAndWait(); don't call while holding fLock
Expand Down

0 comments on commit e531729

Please sign in to comment.