Skip to content
Permalink
Browse files
Fix for LayoutTests/accessibility/mac/search-predicate.html in isolat…
…ed tree mode.

https://bugs.webkit.org/show_bug.cgi?id=218732

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/mac/search-predicate.html.

- Implemented AXIsolatedObject::scrollXXX methods.
- Added handling of "AXIsOnScreen" attribute to WebAccessibilityOobjectWrapperMac.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::performFunctionOnMainThread const):
(WebCore::AXIsolatedObject::scrollToMakeVisible const):
(WebCore::AXIsolatedObject::scrollToMakeVisibleWithSubFocus const):
(WebCore::AXIsolatedObject::scrollToGlobalPoint const):
(WebCore::AXIsolatedObject::performFunctionOnMainThread): Deleted.
(WebCore::AXIsolatedObject::isVisible const): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

Exposed isOnScreen method to JS.

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::isOnScreen const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::isOnScreen const):

LayoutTests:

This test now passes in both isolated tree mode on and off.

* accessibility/mac/search-predicate.html:


Canonical link: https://commits.webkit.org/231425@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
AndresGonzalezApple committed Nov 10, 2020
1 parent ff7e460 commit 2d3ff9ae08e18abc46fb00bd90cd1b0fbb0b591e
Showing 14 changed files with 209 additions and 105 deletions.
@@ -1,3 +1,14 @@
2020-11-10 Andres Gonzalez <andresg_22@apple.com>

Fix for LayoutTests/accessibility/mac/search-predicate.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=218732

Reviewed by Chris Fleizach.

This test now passes in both isolated tree mode on and off.

* accessibility/mac/search-predicate.html:

2020-11-10 Chris Dumez <cdumez@apple.com>

Crash when accessing OfflineAudioContext.length after failing to construct rendering AudioBuffer

Large diffs are not rendered by default.

@@ -1,3 +1,26 @@
2020-11-10 Andres Gonzalez <andresg_22@apple.com>

Fix for LayoutTests/accessibility/mac/search-predicate.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=218732

Reviewed by Chris Fleizach.

Test: accessibility/mac/search-predicate.html.

- Implemented AXIsolatedObject::scrollXXX methods.
- Added handling of "AXIsOnScreen" attribute to WebAccessibilityOobjectWrapperMac.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::performFunctionOnMainThread const):
(WebCore::AXIsolatedObject::scrollToMakeVisible const):
(WebCore::AXIsolatedObject::scrollToMakeVisibleWithSubFocus const):
(WebCore::AXIsolatedObject::scrollToGlobalPoint const):
(WebCore::AXIsolatedObject::performFunctionOnMainThread): Deleted.
(WebCore::AXIsolatedObject::isVisible const): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

2020-11-10 Chris Dumez <cdumez@apple.com>

Crash when accessing OfflineAudioContext.length after failing to construct rendering AudioBuffer
@@ -622,7 +622,7 @@ AXCoreObject* AXIsolatedObject::scrollBar(AccessibilityOrientation orientation)
}

template<typename U>
void AXIsolatedObject::performFunctionOnMainThread(U&& lambda)
void AXIsolatedObject::performFunctionOnMainThread(U&& lambda) const
{
Accessibility::performFunctionOnMainThread([&lambda, this] () {
if (auto* object = associatedAXObject())
@@ -653,6 +653,27 @@ bool AXIsolatedObject::performDismissAction()
});
}

void AXIsolatedObject::scrollToMakeVisible() const
{
performFunctionOnMainThread([] (AXCoreObject* axObject) {
axObject->scrollToMakeVisible();
});
}

void AXIsolatedObject::scrollToMakeVisibleWithSubFocus(const IntRect& rect) const
{
performFunctionOnMainThread([&rect] (AXCoreObject* axObject) {
axObject->scrollToMakeVisibleWithSubFocus(rect);
});
}

void AXIsolatedObject::scrollToGlobalPoint(const IntPoint& point) const
{
performFunctionOnMainThread([&point] (AXCoreObject* axObject) {
axObject->scrollToGlobalPoint(point);
});
}

bool AXIsolatedObject::setValue(float value)
{
return Accessibility::retrieveValueFromMainThread<bool>([&value, this] () -> bool {
@@ -1273,12 +1294,6 @@ bool AXIsolatedObject::isLinked() const
return false;
}

bool AXIsolatedObject::isVisible() const
{
ASSERT_NOT_REACHED();
return false;
}

bool AXIsolatedObject::isCollapsed() const
{
ASSERT_NOT_REACHED();
@@ -113,7 +113,7 @@ class AXIsolatedObject final : public AXCoreObject {
void fillChildrenVectorForProperty(AXPropertyName, AccessibilityChildrenVector&) const;
void setMathscripts(AXPropertyName, AXCoreObject&);
void insertMathPairs(Vector<std::pair<AXID, AXID>>&, AccessibilityMathMultiscriptPairs&);
template<typename U> void performFunctionOnMainThread(U&&);
template<typename U> void performFunctionOnMainThread(U&&) const;

// Attribute retrieval overrides.
bool isHeading() const override { return boolAttributeValue(AXPropertyName::IsHeading); }
@@ -455,9 +455,9 @@ class AXIsolatedObject final : public AXCoreObject {
void increment() override;
void decrement() override;
bool performDismissAction() override;
void scrollToMakeVisible() const override { }
void scrollToMakeVisibleWithSubFocus(const IntRect&) const override { }
void scrollToGlobalPoint(const IntPoint&) const override { }
void scrollToMakeVisible() const override;
void scrollToMakeVisibleWithSubFocus(const IntRect&) const override;
void scrollToGlobalPoint(const IntPoint&) const override;
bool replaceTextInRange(const String&, const PlainTextRange&) override;
bool insertText(const String&) override;
void makeRangeVisible(const PlainTextRange&) override { }
@@ -503,7 +503,7 @@ class AXIsolatedObject final : public AXCoreObject {
bool isPressed() const override;
bool isUnvisited() const override { return boolAttributeValue(AXPropertyName::IsUnvisited); }
bool isLinked() const override;
bool isVisible() const override;
bool isVisible() const override { return boolAttributeValue(AXPropertyName::IsVisible); }
bool isCollapsed() const override;
bool isSelectedOptionActive() const override;
bool hasBoldFont() const override { return boolAttributeValue(AXPropertyName::HasBoldFont); }
@@ -3100,6 +3100,9 @@ - (id)accessibilityAttributeValue:(NSString*)attributeName
return object ? object->wrapper() : nil;
}

if ([attributeName isEqualToString:@"AXIsOnScreen"])
return [NSNumber numberWithBool:backingObject->isOnScreen()];

return nil;
}

@@ -1,3 +1,19 @@
2020-11-10 Andres Gonzalez <andresg_22@apple.com>

Fix for LayoutTests/accessibility/mac/search-predicate.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=218732

Reviewed by Chris Fleizach.

Exposed isOnScreen method to JS.

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::isOnScreen const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::isOnScreen const):

2020-11-10 Aakash Jain <aakash_jain@apple.com>

[build.webkit.org] Only upload to S3 when running on production server
@@ -1381,6 +1381,11 @@ static JSValueRef getIsVisibleCallback(JSContextRef context, JSObjectRef thisObj
return JSValueMakeBoolean(context, toAXElement(thisObject)->isVisible());
}

static JSValueRef getIsOnScreenCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
{
return JSValueMakeBoolean(context, toAXElement(thisObject)->isOnScreen());
}

static JSValueRef getIsOffScreenCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
{
return JSValueMakeBoolean(context, toAXElement(thisObject)->isOffScreen());
@@ -1637,6 +1642,7 @@ bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement)

#if !PLATFORM(MAC)
void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
bool AccessibilityUIElement::isOnScreen() const { return true; }
#endif

#if !SUPPORTS_AX_TEXTMARKERS
@@ -1891,6 +1897,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
{ "isChecked", getIsCheckedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isIndeterminate", getIsIndeterminate, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isVisible", getIsVisibleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isOnScreen", getIsOnScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isOffScreen", getIsOffScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "hasPopup", getHasPopupCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -153,6 +153,7 @@ class AccessibilityUIElement {
bool isExpanded() const;
bool isChecked() const;
bool isVisible() const;
bool isOnScreen() const;
bool isOffScreen() const;
bool isCollapsed() const;
bool isIgnored() const;
@@ -1540,6 +1540,17 @@ - (void)_accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName;
return false;
}

bool AccessibilityUIElement::isOnScreen() const
{
BEGIN_AX_OBJC_EXCEPTIONS
id value = [m_element accessibilityAttributeValue:@"AXIsOnScreen"];
if ([value isKindOfClass:[NSNumber class]])
return [value boolValue];
END_AX_OBJC_EXCEPTIONS

return false;
}

bool AccessibilityUIElement::isOffScreen() const
{
// FIXME: implement
@@ -104,6 +104,7 @@ void AccessibilityUIElement::resetSelectedTextMarkerRange() { }
void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
void AccessibilityUIElement::setValue(JSStringRef) { }
JSValueRef AccessibilityUIElement::searchTextWithCriteria(JSContextRef, JSValueRef, JSStringRef, JSStringRef) { return nullptr; }
bool AccessibilityUIElement::isOnScreen() const { return true; }
#endif

#if !PLATFORM(COCOA) || !HAVE(ACCESSIBILITY)
@@ -175,6 +175,7 @@ class AccessibilityUIElement : public JSWrappable {
bool isChecked() const;
bool isIndeterminate() const;
bool isVisible() const;
bool isOnScreen() const;
bool isOffScreen() const;
bool isCollapsed() const;
bool isIgnored() const;
@@ -99,6 +99,7 @@
readonly attribute boolean isIgnored;
readonly attribute boolean isSingleLine;
readonly attribute boolean isMultiLine;
readonly attribute boolean isOnScreen;
readonly attribute boolean isOffScreen;
readonly attribute boolean isValid;
readonly attribute long hierarchicalLevel;
@@ -1613,6 +1613,14 @@ void setAttributeValue(id element, NSString* attribute, id value, bool synchrono
return false;
}

bool AccessibilityUIElement::isOnScreen() const
{
id value = attributeValue(m_element.get(), @"AXIsOnScreen");
if ([value isKindOfClass:[NSNumber class]])
return [value boolValue];
return false;
}

bool AccessibilityUIElement::isOffScreen() const
{
return false;

0 comments on commit 2d3ff9a

Please sign in to comment.