Title: [270340] trunk/Source/WebCore
Revision
270340
Author
[email protected]
Date
2020-12-01 19:41:17 -0800 (Tue, 01 Dec 2020)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270339 => 270340)


--- trunk/Source/WebCore/ChangeLog	2020-12-02 03:35:37 UTC (rev 270339)
+++ trunk/Source/WebCore/ChangeLog	2020-12-02 03:41:17 UTC (rev 270340)
@@ -1,3 +1,27 @@
+2020-12-01  Andres Gonzalez  <[email protected]>
+
+        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  <[email protected]>
 
         Toggling pointer-events on body does not re-enable scrolling on child

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (270339 => 270340)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-12-02 03:35:37 UTC (rev 270339)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-12-02 03:41:17 UTC (rev 270340)
@@ -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,7 +1227,16 @@
         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)
 {
     return Accessibility::retrieveValueFromMainThread<unsigned>([&index, this] () -> unsigned {

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (270339 => 270340)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-12-02 03:35:37 UTC (rev 270339)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-12-02 03:41:17 UTC (rev 270340)
@@ -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;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to