[GTK] Expose image links properly
authormario@webkit.org <mario@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 16:23:30 +0000 (16:23 +0000)
committermario@webkit.org <mario@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 16:23:30 +0000 (16:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84044

Reviewed by Chris Fleizach.

Tools:

Expose the accessible URL if present, as yet another attribute
for the AccessibilityUIElement wrapper. For coherence with what
the Mac port does (and what you would expect as the output of
the layout test), we strip the absolute URL path for relative
references, if it's the case, leaving the base of the URL path
out of the exposed string.

* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(attributesOfElement): Print the AXURL, if available.
(AccessibilityUIElement::url): Expose the URL if present. That
is, if the wrapped AtkObject implements AtkHyperlinkImpl.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(attributesOfElement): Print the AXURL, if available.
(WTR::AccessibilityUIElement::url): Expose the URL if present.
That is, if the wrapped AtkObject implements AtkHyperlinkImpl.

LayoutTests:

Rebaseline some tests that would now be printing the new
AXURL string for implementations of AtkHyperlinkImpl.

* platform/efl-wk1/accessibility/image-link-expected.txt: Updated.
* platform/efl-wk1/accessibility/image-map2-expected.txt: Ditto.
* platform/efl-wk2/accessibility/image-link-expected.txt: Ditto.
* platform/efl-wk2/accessibility/image-map2-expected.txt: Ditto.
* platform/gtk/accessibility/image-link-expected.txt: Ditto.
* platform/gtk/accessibility/image-map2-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/efl-wk1/accessibility/image-link-expected.txt
LayoutTests/platform/efl-wk1/accessibility/image-map2-expected.txt
LayoutTests/platform/efl-wk2/accessibility/image-link-expected.txt
LayoutTests/platform/efl-wk2/accessibility/image-map2-expected.txt
LayoutTests/platform/gtk/accessibility/image-link-expected.txt
LayoutTests/platform/gtk/accessibility/image-map2-expected.txt
Tools/ChangeLog
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

index cbcce21..22f6a84 100644 (file)
@@ -1,3 +1,20 @@
+2013-10-23  Mario Sanchez Prada  <mario.prada@samsung.com>
+
+        [GTK] Expose image links properly
+        https://bugs.webkit.org/show_bug.cgi?id=84044
+
+        Reviewed by Chris Fleizach.
+
+        Rebaseline some tests that would now be printing the new
+        AXURL string for implementations of AtkHyperlinkImpl.
+
+        * platform/efl-wk1/accessibility/image-link-expected.txt: Updated.
+        * platform/efl-wk1/accessibility/image-map2-expected.txt: Ditto.
+        * platform/efl-wk2/accessibility/image-link-expected.txt: Ditto.
+        * platform/efl-wk2/accessibility/image-map2-expected.txt: Ditto.
+        * platform/gtk/accessibility/image-link-expected.txt: Ditto.
+        * platform/gtk/accessibility/image-map2-expected.txt: Ditto.
+
 2013-10-23  Krzysztof Wolanski  <k.wolanski@samsung.com>
 
         [GTK] accessibility/self-referencing-aria-labelledby.html is failing
index 39d816a..1a270eb 100644 (file)
@@ -20,6 +20,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.wowhead.com/?item=33924
 AXPlatformAttributes: html-id:test, toolkit:WebKitEfl
 
 Child 0:
@@ -39,6 +40,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: LayoutTests/accessibility/resources/cake.png
 AXPlatformAttributes: toolkit:WebKitEfl
 
 
index f3a6120..ae13dd8 100644 (file)
@@ -35,6 +35,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.apple.com/
 AXPlatformAttributes: toolkit:WebKitEfl
 ------------
 AXRole: AXLink
@@ -53,6 +54,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.apple.com/
 AXPlatformAttributes: toolkit:WebKitEfl
 ------------
 
index a7e858c..8d3a92d 100644 (file)
@@ -20,6 +20,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.wowhead.com/?item=33924
 AXPlatformAttributes: html-id:test, toolkit:WebKitEfl
 
 Child 0:
@@ -39,6 +40,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: LayoutTests/accessibility/resources/cake.png
 AXPlatformAttributes: toolkit:WebKitEfl
 
 
index 3a88f5d..287893e 100644 (file)
@@ -35,6 +35,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.apple.com/
 AXPlatformAttributes: toolkit:WebKitEfl
 ------------
 AXRole: AXLink
@@ -53,6 +54,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.apple.com/
 AXPlatformAttributes: toolkit:WebKitEfl
 ------------
 
index 0c67923..a83f7bc 100644 (file)
@@ -20,6 +20,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.wowhead.com/?item=33924
 AXPlatformAttributes: html-id:test, toolkit:WebKitGtk
 
 Child 0:
@@ -39,6 +40,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: LayoutTests/accessibility/resources/cake.png
 AXPlatformAttributes: toolkit:WebKitGtk
 
 
index d617a1f..79c54d7 100644 (file)
@@ -35,6 +35,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.apple.com/
 AXPlatformAttributes: toolkit:WebKitGtk
 ------------
 AXRole: AXLink
@@ -53,6 +54,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
+AXURL: http://www.apple.com/
 AXPlatformAttributes: toolkit:WebKitGtk
 ------------
 
index af26c0e..679a762 100644 (file)
@@ -1,3 +1,26 @@
+2013-10-23  Mario Sanchez Prada  <mario.prada@samsung.com>
+
+        [GTK] Expose image links properly
+        https://bugs.webkit.org/show_bug.cgi?id=84044
+
+        Reviewed by Chris Fleizach.
+
+        Expose the accessible URL if present, as yet another attribute
+        for the AccessibilityUIElement wrapper. For coherence with what
+        the Mac port does (and what you would expect as the output of
+        the layout test), we strip the absolute URL path for relative
+        references, if it's the case, leaving the base of the URL path
+        out of the exposed string.
+
+        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+        (attributesOfElement): Print the AXURL, if available.
+        (AccessibilityUIElement::url): Expose the URL if present. That
+        is, if the wrapped AtkObject implements AtkHyperlinkImpl.
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (attributesOfElement): Print the AXURL, if available.
+        (WTR::AccessibilityUIElement::url): Expose the URL if present.
+        That is, if the wrapped AtkObject implements AtkHyperlinkImpl.
+
 2013-10-23  Simon Fraser  <simon.fraser@apple.com>
 
         Remove Lion bots.
index 5b32db2..6080a4c 100644 (file)
@@ -356,6 +356,10 @@ String attributesOfElement(AccessibilityUIElement* element)
     builder.append(String::format("AXRequired: %d\n", element->isRequired()));
     builder.append(String::format("AXChecked: %d\n", element->isChecked()));
 
+    String url = element->url()->string();
+    if (!url.isEmpty())
+        builder.append(String::format("%s\n", url.utf8().data()));
+
     // We append the ATK specific attributes as a single line at the end.
     builder.append("AXPlatformAttributes: ");
     builder.append(getAtkAttributeSetAsString(element->platformUIElement(), ObjectAttributeType));
@@ -1176,8 +1180,16 @@ JSStringRef AccessibilityUIElement::documentURI()
 
 JSStringRef AccessibilityUIElement::url()
 {
-    // FIXME: implement
-    return JSStringCreateWithCharacters(0, 0);
+    if (!ATK_IS_HYPERLINK_IMPL(m_element))
+        return JSStringCreateWithCharacters(0, 0);
+
+    AtkHyperlink* hyperlink = atk_hyperlink_impl_get_hyperlink(ATK_HYPERLINK_IMPL(m_element));
+    GOwnPtr<char> hyperlinkURI(atk_hyperlink_get_uri(hyperlink, 0));
+
+    // Build the result string, stripping the absolute URL paths if present.
+    char* localURI = g_strstr_len(hyperlinkURI.get(), -1, "LayoutTests");
+    String axURL = String::format("AXURL: %s", localURI ? localURI : hyperlinkURI.get());
+    return JSStringCreateWithUTF8CString(axURL.utf8().data());
 }
 
 bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback)
index 096a0ea..2605f02 100644 (file)
@@ -421,6 +421,10 @@ String attributesOfElement(AccessibilityUIElement* element)
     builder.append(String::format("AXRequired: %d\n", element->isRequired()));
     builder.append(String::format("AXChecked: %d\n", element->isChecked()));
 
+    String url = element->url()->string();
+    if (!url.isEmpty())
+        builder.append(String::format("%s\n", url.utf8().data()));
+
     // We append the ATK specific attributes as a single line at the end.
     builder.append("AXPlatformAttributes: ");
     builder.append(getAtkAttributeSetAsString(element->platformUIElement().get(), ObjectAttributeType));
@@ -1225,8 +1229,16 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::documentURI()
 
 JSRetainPtr<JSStringRef> AccessibilityUIElement::url()
 {
-    // FIXME: implement
-    return JSStringCreateWithCharacters(0, 0);
+    if (!ATK_IS_HYPERLINK_IMPL(m_element.get()))
+        return JSStringCreateWithCharacters(0, 0);
+
+    AtkHyperlink* hyperlink = atk_hyperlink_impl_get_hyperlink(ATK_HYPERLINK_IMPL(m_element.get()));
+    GOwnPtr<char> hyperlinkURI(atk_hyperlink_get_uri(hyperlink, 0));
+
+    // Build the result string, stripping the absolute URL paths if present.
+    char* localURI = g_strstr_len(hyperlinkURI.get(), -1, "LayoutTests");
+    String axURL = String::format("AXURL: %s", localURI ? localURI : hyperlinkURI.get());
+    return JSStringCreateWithUTF8CString(axURL.utf8().data());
 }
 
 bool AccessibilityUIElement::addNotificationListener(JSValueRef functionCallback)