Changeset 286050 in webkit
- Timestamp:
- Nov 19, 2021, 12:51:53 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/SourcesGTK.txt (modified) (1 diff)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp (modified) (4 diffs)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h (modified) (5 diffs)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectHyperlinkAtspi.cpp (added)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp (modified) (2 diffs)
-
Source/WebCore/editing/TextIterator.cpp (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp (modified) (5 diffs)
-
Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286049 r286050 1 2021-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][a11y] Add implementation of hyperlink interface when building with ATSPI 4 https://bugs.webkit.org/show_bug.cgi?id=232707 5 6 Reviewed by Adrian Perez de Castro. 7 8 Add hyperlink implementation and make links be handled as replaced objects too, to ensure all hyperlinks are 9 handled the same way. That's consistent with chromium. 10 11 * SourcesGTK.txt: 12 * accessibility/atspi/AccessibilityObjectAtspi.cpp: 13 (WebCore::AccessibilityObjectAtspi::interfacesForObject): 14 (WebCore::AccessibilityObjectAtspi::path): 15 (WebCore::AccessibilityObjectAtspi::buildInterfaces const): 16 * accessibility/atspi/AccessibilityObjectAtspi.h: 17 * accessibility/atspi/AccessibilityObjectHyperlinkAtspi.cpp: Added. 18 (WebCore::AccessibilityObjectAtspi::url const): 19 (WebCore::AccessibilityObjectAtspi::offsetInParent const): 20 * accessibility/atspi/AccessibilityObjectTextAtspi.cpp: 21 (WebCore::AccessibilityObjectAtspi::characterOffset const): 22 * editing/TextIterator.cpp: 23 (WebCore::isRendererReplacedElement): 24 (WebCore::TextIterator::handleReplacedElement): 25 1 26 2021-11-18 Frédéric Wang <fwang@igalia.com> 2 27 -
trunk/Source/WebCore/SourcesGTK.txt
r285997 r286050 43 43 accessibility/atspi/AccessibilityObjectAtspi.cpp 44 44 accessibility/atspi/AccessibilityObjectComponentAtspi.cpp 45 accessibility/atspi/AccessibilityObjectHyperlinkAtspi.cpp 45 46 accessibility/atspi/AccessibilityObjectTextAtspi.cpp 46 47 accessibility/atspi/AccessibilityObjectValueAtspi.cpp -
trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp
r285997 r286050 31 31 #include "RenderBlock.h" 32 32 #include "RenderObject.h" 33 #include "TextIterator.h" 33 34 #include <glib/gi18n-lib.h> 34 35 #include <wtf/MainThread.h> … … 86 87 if (coreObject.supportsRangeValue()) 87 88 interfaces.add(Interface::Value); 89 90 if (coreObject.isLink() || (isRendererReplacedElement(renderer))) 91 interfaces.add(Interface::Hyperlink); 88 92 89 93 return interfaces; … … 475 479 if (m_interfaces.contains(Interface::Value)) 476 480 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_value_interface), &s_valueFunctions }); 481 if (m_interfaces.contains(Interface::Hyperlink)) 482 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_hyperlink_interface), &s_hyperlinkFunctions }); 477 483 m_path = atspiRoot->atspi().registerObject(*this, WTFMove(interfaces)); 478 484 } … … 1092 1098 if (m_interfaces.contains(Interface::Value)) 1093 1099 g_variant_builder_add(builder, "s", webkit_value_interface.name); 1100 if (m_interfaces.contains(Interface::Hyperlink)) 1101 g_variant_builder_add(builder, "s", webkit_hyperlink_interface.name); 1094 1102 } 1095 1103 -
trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h
r285997 r286050 47 47 Component = 1 << 1, 48 48 Text = 1 << 2, 49 Value = 1 << 3 49 Value = 1 << 3, 50 Hyperlink = 1 << 4 50 51 }; 51 52 const OptionSet<Interface>& interfaces() const { return m_interfaces; } … … 118 119 void valueChanged(double); 119 120 121 WEBCORE_EXPORT URL url() const; 122 120 123 private: 121 124 explicit AccessibilityObjectAtspi(AXCoreObject*); … … 140 143 CString textAtOffset(int, TextGranularity, int&, int&) const; 141 144 int characterAtOffset(int) const; 145 std::optional<unsigned> characterOffset(UChar, int) const; 142 146 IntRect textExtents(int, int, uint32_t) const; 143 147 int offsetAtPoint(const IntPoint&, uint32_t) const; … … 149 153 bool scrollToPoint(int, int, uint32_t, int, int) const; 150 154 155 unsigned offsetInParent() const; 156 151 157 static OptionSet<Interface> interfacesForObject(AXCoreObject&); 152 158 … … 155 161 static GDBusInterfaceVTable s_textFunctions; 156 162 static GDBusInterfaceVTable s_valueFunctions; 163 static GDBusInterfaceVTable s_hyperlinkFunctions; 157 164 158 165 AXCoreObject* m_axObject { nullptr }; -
trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp
r285994 r286050 22 22 23 23 #if ENABLE(ACCESSIBILITY) && USE(ATSPI) 24 #include "AXObjectCache.h" 24 25 #include "AccessibilityAtspiEnums.h" 26 #include "AccessibilityObject.h" 25 27 #include "AccessibilityObjectInterface.h" 28 #include "AccessibilityRootAtspi.h" 26 29 #include "Editing.h" 27 30 #include "PlatformScreen.h" 31 #include "RenderLayer.h" 28 32 #include "SurrogatePairAwareTextIterator.h" 29 33 #include "TextIterator.h" 30 34 #include "VisibleUnits.h" 35 #include <gio/gio.h> 31 36 32 37 namespace WebCore { … … 485 490 } 486 491 492 std::optional<unsigned> AccessibilityObjectAtspi::characterOffset(UChar character, int index) const 493 { 494 auto utf16Text = text(); 495 unsigned start = 0; 496 size_t offset; 497 while ((offset = utf16Text.find(character, start)) != notFound) { 498 start = offset + 1; 499 if (!index) 500 break; 501 index--; 502 } 503 504 if (offset == notFound) 505 return std::nullopt; 506 507 auto mapping = offsetMapping(utf16Text); 508 return UTF16OffsetToUTF8(mapping, offset); 509 } 510 487 511 IntRect AccessibilityObjectAtspi::boundsForRange(unsigned utf16Offset, unsigned length, uint32_t coordinateType) const 488 512 { -
trunk/Source/WebCore/editing/TextIterator.cpp
r285655 r286050 278 278 if (equalLettersIgnoringASCIICase(element.attributeWithoutSynchronization(roleAttr), "img")) 279 279 return true; 280 #if USE(ATSPI) 281 // Links are also replaced with object replacement character in ATSPI. 282 if (element.isLink()) 283 return true; 284 #endif 280 285 } 281 286 … … 751 756 m_hasEmitted = true; 752 757 753 if (m_behaviors.contains(TextIteratorBehavior::EmitsObjectReplacementCharacters) && renderer.isReplaced()) {758 if (m_behaviors.contains(TextIteratorBehavior::EmitsObjectReplacementCharacters)) { 754 759 emitCharacter(objectReplacementCharacter, *m_node->parentNode(), m_node, 0, 1); 755 760 // Don't process subtrees for embedded objects. If the text there is required, -
trunk/Tools/ChangeLog
r286041 r286050 1 2021-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][a11y] Add implementation of hyperlink interface when building with ATSPI 4 https://bugs.webkit.org/show_bug.cgi?id=232707 5 6 Reviewed by Adrian Perez de Castro. 7 8 Add unit tests to check hyperlink interface and implement AccessibilityUIElement::url() in WTR. 9 10 * TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp: 11 (testTextReplacedObjects): 12 (testHyperlinkBasic): 13 (beforeAll): 14 * WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp: 15 (WTR::AccessibilityUIElement::url): 16 1 17 2021-11-18 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp
r285997 r286050 1534 1534 " <body>" 1535 1535 " <p>This is <button>button1</button> and <button>button2</button> in paragraph</p>" 1536 " <p>This is <a href='#'>link1</a> and <a href='#'>link2</a> in paragraph</p>" 1536 1537 " </body>" 1537 1538 "</html>", … … 1544 1545 auto documentWeb = test->findDocumentWeb(testApp.get()); 1545 1546 g_assert_true(ATSPI_IS_ACCESSIBLE(documentWeb.get())); 1546 g_assert_cmpint(atspi_accessible_get_child_count(documentWeb.get(), nullptr), ==, 1);1547 g_assert_cmpint(atspi_accessible_get_child_count(documentWeb.get(), nullptr), ==, 2); 1547 1548 1548 1549 auto p = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 0, nullptr)); … … 1612 1613 g_assert_cmpint(startOffset, ==, 15); 1613 1614 g_assert_cmpint(endOffset, ==, 28); 1615 1616 // Links are also replaced elements. 1617 p = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 1, nullptr)); 1618 g_assert_true(ATSPI_IS_TEXT(p.get())); 1619 g_assert_cmpint(atspi_text_get_character_count(ATSPI_TEXT(p.get()), nullptr), ==, 28); 1620 text.reset(atspi_text_get_text(ATSPI_TEXT(p.get()), 0, -1, nullptr)); 1621 g_assert_cmpstr(text.get(), ==, "This is \357\277\274 and \357\277\274 in paragraph"); 1622 g_assert_cmpint(atspi_accessible_get_child_count(p.get(), nullptr), ==, 2); 1623 1624 auto link1 = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 0, nullptr)); 1625 g_assert_true(ATSPI_IS_TEXT(link1.get())); 1626 text.reset(atspi_text_get_text(ATSPI_TEXT(link1.get()), 0, -1, nullptr)); 1627 g_assert_cmpstr(text.get(), ==, "link1"); 1628 1629 auto link2 = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 1, nullptr)); 1630 g_assert_true(ATSPI_IS_TEXT(link2.get())); 1631 text.reset(atspi_text_get_text(ATSPI_TEXT(link2.get()), 0, -1, nullptr)); 1632 g_assert_cmpstr(text.get(), ==, "link2"); 1614 1633 #endif 1615 1634 } … … 1666 1685 } 1667 1686 1687 static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) 1688 { 1689 test->showInWindow(800, 600); 1690 test->loadHtml( 1691 "<html>" 1692 " <body>" 1693 " <a href='https://www.webkitgtk.org'>WebKitGTK</a>" 1694 " <div role='link'>Link</div>" 1695 " <p>This is <button>button1</button> and <button>button2</button> in a paragraph</p>" 1696 " <p>This is <a href='https://www.webkitgtk.org'>link1</a> and <a href='https://www.gnome.org'>link2</a> in paragraph</p>" 1697 " </body>" 1698 "</html>", 1699 nullptr); 1700 test->waitUntilLoadFinished(); 1701 1702 auto testApp = test->findTestApplication(); 1703 g_assert_true(ATSPI_IS_ACCESSIBLE(testApp.get())); 1704 1705 auto documentWeb = test->findDocumentWeb(testApp.get()); 1706 g_assert_true(ATSPI_IS_ACCESSIBLE(documentWeb.get())); 1707 g_assert_cmpint(atspi_accessible_get_child_count(documentWeb.get(), nullptr), ==, 4); 1708 1709 auto section = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 0, nullptr)); 1710 g_assert_true(ATSPI_IS_ACCESSIBLE(section.get())); 1711 g_assert_cmpint(atspi_accessible_get_role(section.get(), nullptr), ==, ATSPI_ROLE_SECTION); 1712 g_assert_cmpint(atspi_accessible_get_child_count(section.get(), nullptr), ==, 1); 1713 1714 auto a = adoptGRef(atspi_accessible_get_child_at_index(section.get(), 0, nullptr)); 1715 g_assert_true(ATSPI_IS_ACCESSIBLE(a.get())); 1716 g_assert_cmpint(atspi_accessible_get_role(a.get(), nullptr), ==, ATSPI_ROLE_LINK); 1717 auto link = adoptGRef(atspi_accessible_get_hyperlink(a.get())); 1718 g_assert_true(ATSPI_IS_HYPERLINK(link.get())); 1719 g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1720 g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); 1721 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 0); 1722 #if USE(ATSPI) 1723 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1724 #else 1725 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 0); 1726 #endif 1727 GUniquePtr<char> uri(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); 1728 g_assert_cmpstr(uri.get(), ==, "https://www.webkitgtk.org/"); 1729 g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == a.get()); 1730 1731 auto div = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 1, nullptr)); 1732 g_assert_true(ATSPI_IS_ACCESSIBLE(div.get())); 1733 g_assert_cmpint(atspi_accessible_get_role(div.get(), nullptr), ==, ATSPI_ROLE_LINK); 1734 link = adoptGRef(atspi_accessible_get_hyperlink(div.get())); 1735 g_assert_true(ATSPI_IS_HYPERLINK(link.get())); 1736 g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1737 g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); 1738 #if USE(ATSPI) 1739 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 0); 1740 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1741 #else 1742 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 10); 1743 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); 1744 #endif 1745 uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); 1746 g_assert_cmpstr(uri.get(), ==, ""); 1747 g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == div.get()); 1748 1749 auto p = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 2, nullptr)); 1750 g_assert_true(ATSPI_IS_ACCESSIBLE(p.get())); 1751 g_assert_cmpint(atspi_accessible_get_child_count(p.get(), nullptr), ==, 2); 1752 auto button1 = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 0, nullptr)); 1753 g_assert_true(ATSPI_IS_ACCESSIBLE(button1.get())); 1754 link = adoptGRef(atspi_accessible_get_hyperlink(button1.get())); 1755 g_assert_true(ATSPI_IS_HYPERLINK(link.get())); 1756 g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1757 g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); 1758 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 8); 1759 #if USE(ATSPI) 1760 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 9); 1761 #else 1762 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 16); 1763 #endif 1764 uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); 1765 g_assert_cmpstr(uri.get(), ==, ""); 1766 g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == button1.get()); 1767 auto button2 = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 1, nullptr)); 1768 g_assert_true(ATSPI_IS_ACCESSIBLE(button2.get())); 1769 link = adoptGRef(atspi_accessible_get_hyperlink(button2.get())); 1770 g_assert_true(ATSPI_IS_HYPERLINK(link.get())); 1771 g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1772 g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); 1773 #if USE(ATSPI) 1774 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); 1775 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 15); 1776 #else 1777 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 21); 1778 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 29); 1779 #endif 1780 uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); 1781 g_assert_cmpstr(uri.get(), ==, ""); 1782 g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == button2.get()); 1783 1784 p = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 3, nullptr)); 1785 g_assert_true(ATSPI_IS_ACCESSIBLE(p.get())); 1786 g_assert_cmpint(atspi_accessible_get_child_count(p.get(), nullptr), ==, 2); 1787 auto link1 = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 0, nullptr)); 1788 g_assert_true(ATSPI_IS_ACCESSIBLE(link1.get())); 1789 link = adoptGRef(atspi_accessible_get_hyperlink(link1.get())); 1790 g_assert_true(ATSPI_IS_HYPERLINK(link.get())); 1791 g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1792 g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); 1793 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 8); 1794 #if USE(ATSPI) 1795 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 9); 1796 #else 1797 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 13); 1798 #endif 1799 uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); 1800 g_assert_cmpstr(uri.get(), ==, "https://www.webkitgtk.org/"); 1801 g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == link1.get()); 1802 auto link2 = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 1, nullptr)); 1803 g_assert_true(ATSPI_IS_ACCESSIBLE(link2.get())); 1804 link = adoptGRef(atspi_accessible_get_hyperlink(link2.get())); 1805 g_assert_true(ATSPI_IS_HYPERLINK(link.get())); 1806 g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); 1807 g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); 1808 #if USE(ATSPI) 1809 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); 1810 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 15); 1811 #else 1812 g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 18); 1813 g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 23); 1814 #endif 1815 uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); 1816 g_assert_cmpstr(uri.get(), ==, "https://www.gnome.org/"); 1817 g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == link2.get()); 1818 } 1819 1668 1820 void beforeAll() 1669 1821 { … … 1687 1839 AccessibilityTest::add("WebKitAccessibility", "text/replaced-objects", testTextReplacedObjects); 1688 1840 AccessibilityTest::add("WebKitAccessibility", "value/basic", testValueBasic); 1841 AccessibilityTest::add("WebKitAccessibility", "hyperlink/basic", testHyperlinkBasic); 1689 1842 } 1690 1843 -
trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp
r285997 r286050 35 35 #include <WebCore/AccessibilityObjectAtspi.h> 36 36 #include <WebKit/WKBundleFrame.h> 37 #include <wtf/URL.h> 37 38 #include <wtf/text/CString.h> 38 39 #include <wtf/text/StringBuilder.h> … … 1129 1130 JSRetainPtr<JSStringRef> AccessibilityUIElement::url() 1130 1131 { 1131 return JSStringCreateWithCharacters(0, 0); 1132 if (!m_element->interfaces().contains(WebCore::AccessibilityObjectAtspi::Interface::Hyperlink)) 1133 return JSStringCreateWithCharacters(0, 0); 1134 1135 m_element->updateBackingStore(); 1136 auto axURL = m_element->url(); 1137 if (axURL.isNull()) 1138 return JSStringCreateWithUTF8CString("AXURL: (null)"); 1139 1140 if (axURL.isLocalFile()) { 1141 // Do not expose absolute paths. 1142 auto path = axURL.fileSystemPath(); 1143 auto index = path.find("LayoutTests"); 1144 if (index != notFound) 1145 path = path.substring(index); 1146 return OpaqueJSString::tryCreate(makeString("AXURL: ", path)).leakRef(); 1147 } 1148 1149 return OpaqueJSString::tryCreate(makeString("AXURL: ", axURL.string())).leakRef(); 1132 1150 } 1133 1151
Note:
See TracChangeset
for help on using the changeset viewer.