Fix for accessibility attributed string tests in isolated mode.
https://bugs.webkit.org/show_bug.cgi?id=219419
Reviewed by Chris Fleizach.
Tests:
accessibility/mac/attributed-string-includes-misspelled-with-selection.html
accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html
accessibility/mac/misspelled-attributed-string.html
Implemented AXIsolatedObject::rangeForPlainTextRange which is needed to
build the attributed string for a given range.
Also Implemented AXIsolatedObject::doAXBoundsForRangeUsingCharacterOffset
and makeRangeVisible as a follow up to the previous patch to support
PlaintTextRanges in isolated tree mode.
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::rangeForPlainTextRange const):
(WebCore::AXIsolatedObject::makeRangeVisible):
(WebCore::AXIsolatedObject::doAXBoundsForRangeUsingCharacterOffset const):
* accessibility/isolatedtree/AXIsolatedObject.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@270340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 06c76a6..2f310f5 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2020-12-01 Andres Gonzalez <andresg_22@apple.com>
+
+ Fix for accessibility attributed string tests in isolated mode.
+ https://bugs.webkit.org/show_bug.cgi?id=219419
+
+ Reviewed by Chris Fleizach.
+
+ Tests:
+ accessibility/mac/attributed-string-includes-misspelled-with-selection.html
+ accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html
+ accessibility/mac/misspelled-attributed-string.html
+
+ Implemented AXIsolatedObject::rangeForPlainTextRange which is needed to
+ build the attributed string for a given range.
+ Also Implemented AXIsolatedObject::doAXBoundsForRangeUsingCharacterOffset
+ and makeRangeVisible as a follow up to the previous patch to support
+ PlaintTextRanges in isolated tree mode.
+
+ * accessibility/isolatedtree/AXIsolatedObject.cpp:
+ (WebCore::AXIsolatedObject::rangeForPlainTextRange const):
+ (WebCore::AXIsolatedObject::makeRangeVisible):
+ (WebCore::AXIsolatedObject::doAXBoundsForRangeUsingCharacterOffset const):
+ * accessibility/isolatedtree/AXIsolatedObject.h:
+
2020-12-01 Devin Rousso <drousso@apple.com>
Toggling pointer-events on body does not re-enable scrolling on child
diff --git a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp b/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
index c8c0c8b..b05b85d 100644
--- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
+++ b/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
@@ -939,6 +939,13 @@
tree->applyPendingChanges();
}
+Optional<SimpleRange> AXIsolatedObject::rangeForPlainTextRange(const PlainTextRange& axRange) const
+{
+ ASSERT(isMainThread());
+ auto* axObject = associatedAXObject();
+ return axObject ? axObject->rangeForPlainTextRange(axRange) : WTF::nullopt;
+}
+
String AXIsolatedObject::stringForRange(const SimpleRange& range) const
{
return Accessibility::retrieveValueFromMainThread<String>([&range, this] () -> String {
@@ -1022,6 +1029,13 @@
});
}
+void AXIsolatedObject::makeRangeVisible(const PlainTextRange& axRange)
+{
+ performFunctionOnMainThread([&axRange] (AXCoreObject* axObject) {
+ axObject->makeRangeVisible(axRange);
+ });
+}
+
bool AXIsolatedObject::press()
{
if (auto* object = associatedAXObject())
@@ -1213,6 +1227,15 @@
return { };
});
}
+IntRect AXIsolatedObject::doAXBoundsForRangeUsingCharacterOffset(const PlainTextRange& axRange) const
+{
+ return Accessibility::retrieveValueFromMainThread<IntRect>([&axRange, this] () -> IntRect {
+ if (auto* object = associatedAXObject())
+ return object->doAXBoundsForRangeUsingCharacterOffset(axRange);
+ return { };
+ });
+}
+
unsigned AXIsolatedObject::doAXLineForIndex(unsigned index)
{
diff --git a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h b/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
index 897a838..468270c 100644
--- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
+++ b/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
@@ -374,6 +374,7 @@
PlainTextRange doAXRangeForPosition(const IntPoint&) const override;
PlainTextRange doAXRangeForIndex(unsigned) const override;
PlainTextRange doAXStyleRangeForIndex(unsigned) const override;
+ IntRect doAXBoundsForRangeUsingCharacterOffset(const PlainTextRange&) const override;
IntRect doAXBoundsForRange(const PlainTextRange&) const override;
unsigned doAXLineForIndex(unsigned) override;
@@ -397,7 +398,7 @@
VisiblePositionRange styleRangeForPosition(const VisiblePosition&) const override;
VisiblePositionRange visiblePositionRangeForRange(const PlainTextRange&) const override;
VisiblePositionRange lineRangeForPosition(const VisiblePosition&) const override;
- Optional<SimpleRange> rangeForPlainTextRange(const PlainTextRange&) const override { return WTF::nullopt; }
+ Optional<SimpleRange> rangeForPlainTextRange(const PlainTextRange&) const override;
String stringForRange(const SimpleRange&) const override;
IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const override { return IntRect(); }
IntRect boundsForRange(const SimpleRange&) const override { return IntRect(); }
@@ -422,7 +423,6 @@
PlainTextRange plainTextRangeForVisiblePositionRange(const VisiblePositionRange&) const override { return PlainTextRange(); }
int index(const VisiblePosition&) const override { return 0; }
void lineBreaks(Vector<int>&) const override { }
- IntRect doAXBoundsForRangeUsingCharacterOffset(const PlainTextRange&) const override { return IntRect(); }
// Attribute setters.
void setARIAGrabbed(bool) override;
@@ -451,7 +451,7 @@
void scrollToGlobalPoint(const IntPoint&) const override;
bool replaceTextInRange(const String&, const PlainTextRange&) override;
bool insertText(const String&) override;
- void makeRangeVisible(const PlainTextRange&) override { }
+ void makeRangeVisible(const PlainTextRange&) override;
bool press() override;
bool performDefaultAction() override;