Title: [270331] trunk/Source/WebCore
Revision
270331
Author
[email protected]
Date
2020-12-01 16:44:23 -0800 (Tue, 01 Dec 2020)

Log Message

Fix for multiple LayoutTests/accessibility tests in isolated tree mode that rely on PlainTextRange.
https://bugs.webkit.org/show_bug.cgi?id=219411

Reviewed by Chris Fleizach.

Tests:
accessibility/insert-newline.html
accessibility/mac/input-string-for-range-crash.html
accessibility/mac/range-for-contenteditable-newline.html
accessibility/mac/range-for-line-textarea.html
accessibility/set-selected-text-range-after-newline.html
accessibility/textarea-line-for-index.html
accessibility/mac/select-element-selection-with-optgroups.html

Implementation of AXIsolatedObject methods that take or return PlainTextRanges.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::selectedTextRange const):
(WebCore::AXIsolatedObject::doAXRangeForLine const):
(WebCore::AXIsolatedObject::doAXStringForRange const):
(WebCore::AXIsolatedObject::doAXRangeForPosition const):
(WebCore::AXIsolatedObject::doAXRangeForIndex const):
(WebCore::AXIsolatedObject::doAXStyleRangeForIndex const):
(WebCore::AXIsolatedObject::doAXBoundsForRange const):
(WebCore::AXIsolatedObject::doAXLineForIndex):
* accessibility/isolatedtree/AXIsolatedObject.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270330 => 270331)


--- trunk/Source/WebCore/ChangeLog	2020-12-02 00:40:44 UTC (rev 270330)
+++ trunk/Source/WebCore/ChangeLog	2020-12-02 00:44:23 UTC (rev 270331)
@@ -1,3 +1,32 @@
+2020-12-01  Andres Gonzalez  <[email protected]>
+
+        Fix for multiple LayoutTests/accessibility tests in isolated tree mode that rely on PlainTextRange.
+        https://bugs.webkit.org/show_bug.cgi?id=219411
+
+        Reviewed by Chris Fleizach.
+
+        Tests:
+        accessibility/insert-newline.html
+        accessibility/mac/input-string-for-range-crash.html
+        accessibility/mac/range-for-contenteditable-newline.html
+        accessibility/mac/range-for-line-textarea.html
+        accessibility/set-selected-text-range-after-newline.html
+        accessibility/textarea-line-for-index.html
+        accessibility/mac/select-element-selection-with-optgroups.html
+
+        Implementation of AXIsolatedObject methods that take or return PlainTextRanges.
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::selectedTextRange const):
+        (WebCore::AXIsolatedObject::doAXRangeForLine const):
+        (WebCore::AXIsolatedObject::doAXStringForRange const):
+        (WebCore::AXIsolatedObject::doAXRangeForPosition const):
+        (WebCore::AXIsolatedObject::doAXRangeForIndex const):
+        (WebCore::AXIsolatedObject::doAXStyleRangeForIndex const):
+        (WebCore::AXIsolatedObject::doAXBoundsForRange const):
+        (WebCore::AXIsolatedObject::doAXLineForIndex):
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+
 2020-12-01  Aditya Keerthi  <[email protected]>
 
         [iOS] <button> with multi-line content does not render properly

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (270330 => 270331)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-12-02 00:40:44 UTC (rev 270330)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-12-02 00:44:23 UTC (rev 270331)
@@ -1155,10 +1155,73 @@
     return Accessibility::retrieveValueFromMainThread<PlainTextRange>([this] () -> PlainTextRange {
         if (auto* object = associatedAXObject())
             return object->selectedTextRange();
-        return PlainTextRange();
+        return { };
     });
 }
 
+PlainTextRange AXIsolatedObject::doAXRangeForLine(unsigned lineIndex) const
+{
+    return Accessibility::retrieveValueFromMainThread<PlainTextRange>([&lineIndex, this] () -> PlainTextRange {
+        if (auto* object = associatedAXObject())
+            return object->doAXRangeForLine(lineIndex);
+        return { };
+    });
+}
+
+String AXIsolatedObject::doAXStringForRange(const PlainTextRange& axRange) const
+{
+    return Accessibility::retrieveValueFromMainThread<String>([&axRange, this] () -> String {
+        if (auto* object = associatedAXObject())
+            return object->doAXStringForRange(axRange);
+        return { };
+    });
+}
+
+PlainTextRange AXIsolatedObject::doAXRangeForPosition(const IntPoint& point) const
+{
+    return Accessibility::retrieveValueFromMainThread<PlainTextRange>([&point, this] () -> PlainTextRange {
+        if (auto* object = associatedAXObject())
+            return object->doAXRangeForPosition(point);
+        return { };
+    });
+}
+
+PlainTextRange AXIsolatedObject::doAXRangeForIndex(unsigned index) const
+{
+    return Accessibility::retrieveValueFromMainThread<PlainTextRange>([&index, this] () -> PlainTextRange {
+        if (auto* object = associatedAXObject())
+            return object->doAXRangeForIndex(index);
+        return { };
+    });
+}
+
+PlainTextRange AXIsolatedObject::doAXStyleRangeForIndex(unsigned index) const
+{
+    return Accessibility::retrieveValueFromMainThread<PlainTextRange>([&index, this] () -> PlainTextRange {
+        if (auto* object = associatedAXObject())
+            return object->doAXStyleRangeForIndex(index);
+        return { };
+    });
+}
+
+IntRect AXIsolatedObject::doAXBoundsForRange(const PlainTextRange& axRange) const
+{
+    return Accessibility::retrieveValueFromMainThread<IntRect>([&axRange, this] () -> IntRect {
+        if (auto* object = associatedAXObject())
+            return object->doAXBoundsForRange(axRange);
+        return { };
+    });
+}
+
+unsigned AXIsolatedObject::doAXLineForIndex(unsigned index)
+{
+    return Accessibility::retrieveValueFromMainThread<unsigned>([&index, this] () -> unsigned {
+        if (auto* object = associatedAXObject())
+            return object->doAXLineForIndex(index);
+        return 0;
+    });
+}
+
 VisibleSelection AXIsolatedObject::selection() const
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (270330 => 270331)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-12-02 00:40:44 UTC (rev 270330)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-12-02 00:44:23 UTC (rev 270331)
@@ -366,9 +366,19 @@
     String documentEncoding() const override;
     bool preventKeyboardDOMEventDispatch() const override;
 
+    // PlainTextRange support.
     PlainTextRange selectedTextRange() const override;
+    PlainTextRange doAXRangeForLine(unsigned) const override;
+    String doAXStringForRange(const PlainTextRange&) const override;
+    PlainTextRange doAXRangeForPosition(const IntPoint&) const override;
+    PlainTextRange doAXRangeForIndex(unsigned) const override;
+    PlainTextRange doAXStyleRangeForIndex(unsigned) const override;
+    IntRect doAXBoundsForRange(const PlainTextRange&) const override;
+    unsigned doAXLineForIndex(unsigned) override;
+
     VisibleSelection selection() const override;
     void setSelectedVisiblePositionRange(const VisiblePositionRange&) const override;
+
     // TODO: Text ranges and selection.
     unsigned selectionStart() const override { return 0; }
     unsigned selectionEnd() const override { return 0; }
@@ -411,14 +421,7 @@
     PlainTextRange plainTextRangeForVisiblePositionRange(const VisiblePositionRange&) const override { return PlainTextRange(); }
     int index(const VisiblePosition&) const override { return 0; }
     void lineBreaks(Vector<int>&) const override { }
-    PlainTextRange doAXRangeForLine(unsigned) const override { return PlainTextRange(); }
-    PlainTextRange doAXRangeForPosition(const IntPoint&) const override { return PlainTextRange(); }
-    PlainTextRange doAXRangeForIndex(unsigned) const override { return PlainTextRange(); }
-    PlainTextRange doAXStyleRangeForIndex(unsigned) const override { return PlainTextRange(); }
-    String doAXStringForRange(const PlainTextRange&) const override { return String(); }
-    IntRect doAXBoundsForRange(const PlainTextRange&) const override { return IntRect(); }
     IntRect doAXBoundsForRangeUsingCharacterOffset(const PlainTextRange&) const override { return IntRect(); }
-    unsigned doAXLineForIndex(unsigned) override { return 0; }
 
     // Attribute setters.
     void setARIAGrabbed(bool) override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to