<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[37567] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/37567">37567</a></dd>
<dt>Author</dt> <dd>cfleizach@apple.com</dd>
<dt>Date</dt> <dd>2008-10-13 15:48:19 -0700 (Mon, 13 Oct 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>&lt;rdar://problem/6271864&gt; Links from image maps not being included in AXLinkUIElements

This also fixes the positions of image map links</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorepageAccessibilityImageMapLinkcpp">trunk/WebCore/page/AccessibilityImageMapLink.cpp</a></li>
<li><a href="#trunkWebCorepageAccessibilityImageMapLinkh">trunk/WebCore/page/AccessibilityImageMapLink.h</a></li>
<li><a href="#trunkWebCorepageAccessibilityObjectcpp">trunk/WebCore/page/AccessibilityObject.cpp</a></li>
<li><a href="#trunkWebCorepageAccessibilityObjecth">trunk/WebCore/page/AccessibilityObject.h</a></li>
<li><a href="#trunkWebCorepageAccessibilityRenderObjectcpp">trunk/WebCore/page/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkWebCorepageAccessibilityRenderObjecth">trunk/WebCore/page/AccessibilityRenderObject.h</a></li>
<li><a href="#trunkWebCorepagemacAccessibilityObjectWrappermm">trunk/WebCore/page/mac/AccessibilityObjectWrapper.mm</a></li>
<li><a href="#trunkWebKitToolsChangeLog">trunk/WebKitTools/ChangeLog</a></li>
<li><a href="#trunkWebKitToolsDumpRenderTreeAccessibilityUIElementcpp">trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkWebKitToolsDumpRenderTreeAccessibilityUIElementh">trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.h</a></li>
<li><a href="#trunkWebKitToolsDumpRenderTreemacAccessibilityUIElementMacmm">trunk/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm</a></li>
<li><a href="#trunkWebKitToolsDumpRenderTreewinAccessibilityUIElementWincpp">trunk/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilitydocumentlinksexpectedtxt">trunk/LayoutTests/accessibility/document-links-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitydocumentlinkshtml">trunk/LayoutTests/accessibility/document-links.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/LayoutTests/ChangeLog        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2008-10-13  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        Reviewed by Beth Dakin.
+
+        Added a test to make sure AXLinkUIElements return links in image maps
+
+        * accessibility/document-links-expected.txt: Added.
+        * accessibility/document-links.html: Added.
+
</ins><span class="cx"> 2008-10-13  David Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add test case for custom CSS listbox scrollbars.
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitydocumentlinksexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/document-links-expected.txt (0 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/document-links-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/document-links-expected.txt        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+
+----------------------
+AXRole: AXLink
+AXSubrole: (null)
+AXRoleDescription: link
+AXChildren: &lt;array of size 0&gt;
+AXHelp: 
+AXParent: &lt;AXLink: 'Link1'&gt;
+AXSize: NSSize: {123, 62}
+AXTitle: Link1
+AXDescription: 
+AXValue: 
+AXFocused: 0
+AXEnabled: 0
+AXWindow: &lt;AXLink: 'Link1'&gt;
+AXSelectedTextMarkerRange: (null)
+AXStartTextMarker: (null)
+AXEndTextMarker: (null)
+AXVisited: 0
+AXLinkedUIElements: (null)
+AXSelected: 0
+AXBlockQuoteLevel: (null)
+AXTopLevelUIElement: &lt;AXLink: 'Link1'&gt;
+
+------------
+AXRole: AXLink
+AXSubrole: (null)
+AXRoleDescription: link
+AXChildren: &lt;array of size 0&gt;
+AXHelp: 
+AXParent: &lt;AXLink: 'Link2'&gt;
+AXSize: NSSize: {113, 22}
+AXTitle: Link2
+AXDescription: 
+AXValue: 
+AXFocused: 0
+AXEnabled: 0
+AXWindow: &lt;AXLink: 'Link2'&gt;
+AXSelectedTextMarkerRange: (null)
+AXStartTextMarker: (null)
+AXEndTextMarker: (null)
+AXVisited: 0
+AXLinkedUIElements: (null)
+AXSelected: 0
+AXBlockQuoteLevel: (null)
+AXTopLevelUIElement: &lt;AXLink: 'Link2'&gt;
+
+------------
+AXRole: AXLink
+AXSubrole: (null)
+AXRoleDescription: link
+AXChildren: &lt;array of size 1&gt;
+AXHelp: 
+AXParent: &lt;AXLink: 'link 3'&gt;
+AXSize: NSSize: {36, 18}
+AXTitle: link 3
+AXDescription: 
+AXValue: 
+AXFocused: 0
+AXEnabled: 1
+AXWindow: &lt;AXLink: 'link 3'&gt;
+AXSelectedTextMarkerRange: (null)
+AXStartTextMarker: &lt;AXLink: 'link 3'&gt;
+AXEndTextMarker: &lt;AXLink: 'link 3'&gt;
+AXVisited: 0
+AXLinkedUIElements: (null)
+AXSelected: 0
+AXBlockQuoteLevel: 0
+AXTopLevelUIElement: &lt;AXLink: 'link 3'&gt;
+AXURL: http://webkit.org/
+
+------------
+AXRole: AXLink
+AXSubrole: (null)
+AXRoleDescription: link
+AXChildren: &lt;array of size 1&gt;
+AXHelp: 
+AXParent: &lt;AXLink: 'link 4'&gt;
+AXSize: NSSize: {36, 18}
+AXTitle: link 4
+AXDescription: 
+AXValue: 
+AXFocused: 0
+AXEnabled: 1
+AXWindow: &lt;AXLink: 'link 4'&gt;
+AXSelectedTextMarkerRange: (null)
+AXStartTextMarker: &lt;AXLink: 'link 4'&gt;
+AXEndTextMarker: &lt;AXLink: 'link 4'&gt;
+AXVisited: 0
+AXLinkedUIElements: (null)
+AXSelected: 0
+AXBlockQuoteLevel: 0
+AXTopLevelUIElement: &lt;AXLink: 'link 4'&gt;
+AXURL: LayoutTests/accessibility/document-links.html#asdf
+
+------------
+
+
+ link 3 link 4
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitydocumentlinkshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/document-links.html (0 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/document-links.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/document-links.html        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;html&gt;
+&lt;script&gt;
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+&lt;/script&gt;
+&lt;body id=&quot;body&quot;&gt;
+    
+    &lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
+    
+    &lt;!-- This test passes if it finds all four links in this page --&gt;
+
+    &lt;map id=&quot;apple&quot; name=&quot;imagemap1&quot;&gt;
+      &lt;area shape=&quot;rect&quot; coords=&quot;10,10,133,72&quot; href=&quot;http://www.apple.com&quot; title=&quot;Link1&quot; /&gt;
+      &lt;area shape=&quot;rect&quot; coords=&quot;20,50,133,72&quot; href=&quot;http://www.apple.com&quot; title=&quot;Link2&quot; /&gt;
+    &lt;/map&gt;
+
+    &lt;img src=&quot;resources/cake.png&quot;  border=&quot;0&quot; align=&quot;left&quot; usemap=&quot;#imagemap1&quot; vspace=&quot;1&quot;&gt;
+
+    &lt;a href=&quot;http://webkit.org&quot;&gt;link 3&lt;/a&gt;
+    &lt;a href=&quot;#asdf&quot;&gt;link 4&lt;/a&gt;
+     
+    &lt;script&gt;
+        if (window.accessibilityController) {
+            var result = document.getElementById(&quot;result&quot;);
+
+            var body = document.getElementById(&quot;body&quot;);
+            body.focus();
+            result.innerText += &quot;\n----------------------\n&quot;;
+            result.innerText += accessibilityController.focusedElement.attributesOfDocumentLinks() + &quot;\n\n&quot;; 
+        }
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/ChangeLog        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2008-10-13  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        Reviewed by Beth Dakin.
+
+        &lt;rdar://problem/6271864&gt; Links from image maps not being included in AXLinkUIElements
+
+        Links from image maps were not being included in the web area's AXLinkUIElements attribute.
+        The position of image map links was being reported incorrectly and the parent-chain
+        hierarchy for image map links was incorrect because image map links did not have a reference
+        to their parent image. 
+
+        Test: accessibility/document-links.html
+
+        * page/AccessibilityImageMapLink.cpp:
+        (WebCore::AccessibilityImageMapLink::parentObject):
+        (WebCore::AccessibilityImageMapLink::actionElement):
+        (WebCore::AccessibilityImageMapLink::elementRect):
+        * page/AccessibilityImageMapLink.h:
+        (WebCore::AccessibilityImageMapLink::setHTMLMapElement):
+        (WebCore::AccessibilityImageMapLink::setParent):
+        * page/AccessibilityObject.cpp:
+        * page/AccessibilityObject.h:
+        * page/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
+        (WebCore::AccessibilityRenderObject::getDocumentLinks):
+        (WebCore::AccessibilityRenderObject::addChildren):
+        * page/AccessibilityRenderObject.h:
+        * page/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+
</ins><span class="cx"> 2008-10-13  David Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make RenderListBox work with CSS scrollbars.  Refactoring this code to support creation/destruction in
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityImageMapLinkcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityImageMapLink.cpp (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityImageMapLink.cpp        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/AccessibilityImageMapLink.cpp        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -29,10 +29,12 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;AccessibilityImageMapLink.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;AccessibilityRenderObject.h&quot;
</ins><span class="cx"> #include &quot;AXObjectCache.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;IntRect.h&quot;
</span><ins>+#include &quot;RenderObject.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> using namespace std;
</span><span class="cx"> 
</span><span class="lines">@@ -57,12 +59,20 @@
</span><span class="cx"> 
</span><span class="cx"> AccessibilityObject* AccessibilityImageMapLink::parentObject() const
</span><span class="cx"> {
</span><ins>+    if (m_parent)
+        return m_parent;
+    
</ins><span class="cx">     if (!m_mapElement || !m_mapElement-&gt;renderer())
</span><span class="cx">         return 0;
</span><span class="cx">     
</span><span class="cx">     return m_mapElement-&gt;document()-&gt;axObjectCache()-&gt;get(m_mapElement-&gt;renderer());
</span><span class="cx"> }
</span><span class="cx">     
</span><ins>+Element* AccessibilityImageMapLink::actionElement() const
+{
+    return anchorElement();
+}
+    
</ins><span class="cx"> Element* AccessibilityImageMapLink::anchorElement() const
</span><span class="cx"> {
</span><span class="cx">     return m_areaElement;
</span><span class="lines">@@ -97,10 +107,19 @@
</span><span class="cx">     
</span><span class="cx"> IntRect AccessibilityImageMapLink::elementRect() const
</span><span class="cx"> {
</span><del>-    if (!m_areaElement)
</del><ins>+    if (!m_mapElement || !m_areaElement)
</ins><span class="cx">         return IntRect();
</span><ins>+
+    RenderObject* renderer;
+    if (m_parent &amp;&amp; m_parent-&gt;isAccessibilityRenderObject())
+        renderer = static_cast&lt;AccessibilityRenderObject*&gt;(m_parent)-&gt;renderer();
+    else
+        renderer = m_mapElement-&gt;renderer();
</ins><span class="cx">     
</span><del>-    return m_areaElement-&gt;getRect(m_mapElement-&gt;renderer());
</del><ins>+    if (!renderer)
+        return IntRect();
+    
+    return m_areaElement-&gt;getRect(renderer);
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> IntSize AccessibilityImageMapLink::size() const
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityImageMapLinkh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityImageMapLink.h (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityImageMapLink.h        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/AccessibilityImageMapLink.h        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -44,13 +44,16 @@
</span><span class="cx">     virtual ~AccessibilityImageMapLink();
</span><span class="cx">     
</span><span class="cx">     void setHTMLAreaElement(HTMLAreaElement* element) { m_areaElement = element; }
</span><del>-    void setHTMLMapElement(HTMLMapElement* element) { m_mapElement = element; }
-    
</del><ins>+    void setHTMLMapElement(HTMLMapElement* element) { m_mapElement = element; }    
+    void setParent(AccessibilityObject* parent) { m_parent = parent; }
+        
</ins><span class="cx">     virtual AccessibilityRole roleValue() const { return WebCoreLinkRole; }
</span><span class="cx">     virtual bool accessibilityIsIgnored() const { return false; }
</span><span class="cx"> 
</span><span class="cx">     virtual AccessibilityObject* parentObject() const;
</span><span class="cx">     virtual Element* anchorElement() const;
</span><ins>+    virtual Element* actionElement() const;
+    
</ins><span class="cx">     virtual bool isLink() const { return true; } 
</span><span class="cx">     virtual String title() const;
</span><span class="cx">     virtual String accessibilityDescription() const;
</span><span class="lines">@@ -61,6 +64,7 @@
</span><span class="cx"> private:    
</span><span class="cx">     HTMLAreaElement* m_areaElement;
</span><span class="cx">     HTMLMapElement* m_mapElement;
</span><ins>+    AccessibilityObject* m_parent;
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityObject.cpp (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityObject.cpp        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/AccessibilityObject.cpp        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -301,10 +301,6 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AccessibilityObject::getDocumentLinks(AccessibilityChildrenVector&amp; result) const
-{
-}
-
</del><span class="cx"> Widget* AccessibilityObject::widget() const
</span><span class="cx"> {
</span><span class="cx">     return 0;
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityObject.h (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityObject.h        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/AccessibilityObject.h        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -300,7 +300,6 @@
</span><span class="cx">     const String&amp; actionVerb() const;
</span><span class="cx">     virtual Widget* widget() const;
</span><span class="cx">     virtual Widget* widgetForAttachmentView() const;
</span><del>-    virtual void getDocumentLinks(Vector&lt; RefPtr&lt;AccessibilityObject&gt; &gt;&amp;) const;
</del><span class="cx">     virtual Document* document() const { return 0; }
</span><span class="cx">     virtual FrameView* topDocumentFrameView() const { return 0; }
</span><span class="cx">     virtual FrameView* documentFrameView() const;
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityRenderObject.cpp (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityRenderObject.cpp        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/AccessibilityRenderObject.cpp        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -1440,8 +1440,29 @@
</span><span class="cx">     return m_renderer-&gt;document()-&gt;axObjectCache();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector&amp; result) const
</del><ins>+AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(HTMLMapElement* map) const
</ins><span class="cx"> {
</span><ins>+    // find an image that is using this map
+    if (!m_renderer || !map)
+        return 0;
+
+    RefPtr&lt;HTMLCollection&gt; coll = m_renderer-&gt;document()-&gt;images();
+    for (Node* curr = coll-&gt;firstItem(); curr; curr = coll-&gt;nextItem()) {
+        RenderObject* obj = curr-&gt;renderer();
+        if (!obj || !curr-&gt;hasTagName(imgTag))
+            continue;
+        
+        // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning,
+        // which has to be stripped off
+        if (static_cast&lt;HTMLImageElement*&gt;(curr)-&gt;useMap().substring(1) == map-&gt;getName())
+            return axObjectCache()-&gt;get(obj);
+    }
+    
+    return 0;
+}
+    
+void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector&amp; result)
+{
</ins><span class="cx">     Document* document = m_renderer-&gt;document();
</span><span class="cx">     RefPtr&lt;HTMLCollection&gt; coll = document-&gt;links();
</span><span class="cx">     Node* curr = coll-&gt;firstItem();
</span><span class="lines">@@ -1453,6 +1474,16 @@
</span><span class="cx">             ASSERT(axobj-&gt;roleValue() == WebCoreLinkRole);
</span><span class="cx">             if (!axobj-&gt;accessibilityIsIgnored())
</span><span class="cx">                 result.append(axobj);
</span><ins>+        } else {
+            Node* parent = curr-&gt;parent();
+            if (parent &amp;&amp; curr-&gt;hasTagName(areaTag) &amp;&amp; parent-&gt;hasTagName(mapTag)) {
+                AccessibilityImageMapLink* areaObject = static_cast&lt;AccessibilityImageMapLink*&gt;(axObjectCache()-&gt;get(ImageMapLinkRole));
+                areaObject-&gt;setHTMLAreaElement(static_cast&lt;HTMLAreaElement*&gt;(curr));
+                areaObject-&gt;setHTMLMapElement(static_cast&lt;HTMLMapElement*&gt;(parent));
+                areaObject-&gt;setParent(accessibilityParentForImageMap(static_cast&lt;HTMLMapElement*&gt;(parent)));
+
+                result.append(areaObject);
+            }
</ins><span class="cx">         }
</span><span class="cx">         curr = coll-&gt;nextItem();
</span><span class="cx">     }
</span><span class="lines">@@ -2225,9 +2256,10 @@
</span><span class="cx"> 
</span><span class="cx">                 // add an &lt;area&gt; element for this child if it has a link
</span><span class="cx">                 if (current-&gt;isLink()) {
</span><del>-                    AccessibilityObject* areaObject = m_renderer-&gt;document()-&gt;axObjectCache()-&gt;get(ImageMapLinkRole);
-                    static_cast&lt;AccessibilityImageMapLink*&gt;(areaObject)-&gt;setHTMLAreaElement(static_cast&lt;HTMLAreaElement*&gt;(current));
-                    static_cast&lt;AccessibilityImageMapLink*&gt;(areaObject)-&gt;setHTMLMapElement(map);
</del><ins>+                    AccessibilityImageMapLink* areaObject = static_cast&lt;AccessibilityImageMapLink*&gt;(m_renderer-&gt;document()-&gt;axObjectCache()-&gt;get(ImageMapLinkRole));
+                    areaObject-&gt;setHTMLAreaElement(static_cast&lt;HTMLAreaElement*&gt;(current));
+                    areaObject-&gt;setHTMLMapElement(map);
+                    areaObject-&gt;setParent(this);
</ins><span class="cx"> 
</span><span class="cx">                     m_children.append(areaObject);
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityRenderObject.h (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityRenderObject.h        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/AccessibilityRenderObject.h        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">     virtual const String&amp; actionVerb() const;
</span><span class="cx">     virtual Widget* widget() const;
</span><span class="cx">     virtual Widget* widgetForAttachmentView() const;
</span><del>-    virtual void getDocumentLinks(AccessibilityChildrenVector&amp;) const;
</del><ins>+    virtual void getDocumentLinks(AccessibilityChildrenVector&amp;);
</ins><span class="cx">     virtual FrameView* documentFrameView() const;
</span><span class="cx">     
</span><span class="cx">     virtual const AccessibilityChildrenVector&amp; children();
</span><span class="lines">@@ -227,6 +227,8 @@
</span><span class="cx">     IntRect checkboxOrRadioRect() const;
</span><span class="cx">     void addRadioButtonGroupMembers(AccessibilityChildrenVector&amp; linkedUIElements) const;
</span><span class="cx">     AccessibilityObject* internalLinkElement() const;
</span><ins>+    AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement* map) const;
+
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCorepagemacAccessibilityObjectWrappermm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/mac/AccessibilityObjectWrapper.mm (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/mac/AccessibilityObjectWrapper.mm        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebCore/page/mac/AccessibilityObjectWrapper.mm        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -1135,7 +1135,7 @@
</span><span class="cx">     if (m_object-&gt;isWebArea()) {
</span><span class="cx">         if ([attributeName isEqualToString: @&quot;AXLinkUIElements&quot;]) {
</span><span class="cx">             AccessibilityObject::AccessibilityChildrenVector links;
</span><del>-            m_object-&gt;getDocumentLinks(links);
</del><ins>+            static_cast&lt;AccessibilityRenderObject*&gt;(m_object)-&gt;getDocumentLinks(links);
</ins><span class="cx">             return convertToNSArray(links);
</span><span class="cx">         }
</span><span class="cx">         if ([attributeName isEqualToString: @&quot;AXLoaded&quot;])
</span></span></pre></div>
<a id="trunkWebKitToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/ChangeLog (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/ChangeLog        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebKitTools/ChangeLog        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2008-10-13  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        Reviewed by Beth Dakin.
+
+        Added a method to get the links in a webpage
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (attributesOfDocumentLinksCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::getDocumentLinks):
+        (AccessibilityUIElement::attributesOfDocumentLinks):
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::getDocumentLinks):
+        (AccessibilityUIElement::attributesOfDocumentLinks):
+
</ins><span class="cx"> 2008-10-13  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Bug 21457: resolve-ChangeLogs should be able to operate on a git revision range
</span></span></pre></div>
<a id="trunkWebKitToolsDumpRenderTreeAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -47,6 +47,12 @@
</span><span class="cx">     return JSValueMakeString(context, linkedUIDescription.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static JSValueRef attributesOfDocumentLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    JSRetainPtr&lt;JSStringRef&gt; linkedUIDescription(Adopt, toAXElement(thisObject)-&gt;attributesOfDocumentLinks());
+    return JSValueMakeString(context, linkedUIDescription.get());
+}
+
</ins><span class="cx"> static JSValueRef attributesOfChildrenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="cx"> {
</span><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; childrenDescription(Adopt, toAXElement(thisObject)-&gt;attributesOfChildren());
</span><span class="lines">@@ -265,6 +271,7 @@
</span><span class="cx">     static JSStaticFunction staticFunctions[] = {
</span><span class="cx">         { &quot;allAttributes&quot;, allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;attributesOfLinkedUIElements&quot;, attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+        { &quot;attributesOfDocumentLinks&quot;, attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx">         { &quot;attributesOfChildren&quot;, attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;parameterizedAttributeNames&quot;, parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;lineForIndex&quot;, lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span></span></pre></div>
<a id="trunkWebKitToolsDumpRenderTreeAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.h (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.h        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.h        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx">     static JSObjectRef makeJSAccessibilityUIElement(JSContextRef, const AccessibilityUIElement&amp;);
</span><span class="cx"> 
</span><span class="cx">     void getLinkedUIElements(Vector&lt;AccessibilityUIElement&gt;&amp;);
</span><ins>+    void getDocumentLinks(Vector&lt;AccessibilityUIElement&gt;&amp;);
</ins><span class="cx">     void getChildren(Vector&lt;AccessibilityUIElement&gt;&amp;);
</span><span class="cx">     AccessibilityUIElement getChildAtIndex(unsigned);
</span><span class="cx">     AccessibilityUIElement titleUIElement();
</span><span class="lines">@@ -66,6 +67,7 @@
</span><span class="cx">     // Methods - platform-independent implementations
</span><span class="cx">     JSStringRef allAttributes();
</span><span class="cx">     JSStringRef attributesOfLinkedUIElements();
</span><ins>+    JSStringRef attributesOfDocumentLinks();
</ins><span class="cx">     JSStringRef attributesOfChildren();
</span><span class="cx">     JSStringRef parameterizedAttributeNames();
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkWebKitToolsDumpRenderTreemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -167,6 +167,12 @@
</span><span class="cx">     convertNSArrayToVector(linkedElements, elementVector);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AccessibilityUIElement::getDocumentLinks(Vector&lt;AccessibilityUIElement&gt;&amp; elementVector)
+{
+    NSArray* linkElements = [m_element accessibilityAttributeValue:@&quot;AXLinkUIElements&quot;];
+    convertNSArrayToVector(linkElements, elementVector);
+}
+
</ins><span class="cx"> void AccessibilityUIElement::getChildren(Vector&lt;AccessibilityUIElement&gt;&amp; elementVector)
</span><span class="cx"> {
</span><span class="cx">     NSArray* children = [m_element accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
</span><span class="lines">@@ -199,6 +205,13 @@
</span><span class="cx">     return descriptionOfElements(linkedElements);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
+{
+    Vector&lt;AccessibilityUIElement&gt; linkElements;
+    getDocumentLinks(linkElements);
+    return descriptionOfElements(linkElements);
+}
+
</ins><span class="cx"> JSStringRef AccessibilityUIElement::attributesOfChildren()
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;AccessibilityUIElement&gt; children;
</span></span></pre></div>
<a id="trunkWebKitToolsDumpRenderTreewinAccessibilityUIElementWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp (37566 => 37567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp        2008-10-13 22:42:59 UTC (rev 37566)
+++ trunk/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp        2008-10-13 22:48:19 UTC (rev 37567)
</span><span class="lines">@@ -48,6 +48,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AccessibilityUIElement::getDocumentLinks(Vector&lt;AccessibilityUIElement&gt;&amp;)
+{
+}
+
</ins><span class="cx"> void AccessibilityUIElement::getChildren(Vector&lt;AccessibilityUIElement&gt;&amp; children)
</span><span class="cx"> {
</span><span class="cx">     long childCount;
</span><span class="lines">@@ -80,6 +84,10 @@
</span><span class="cx">     return JSStringCreateWithCharacters(0, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
+{
+    return JSStringCreateWithCharacters(0, 0);
+}
</ins><span class="cx"> AccessibilityUIElement AccessibilityUIElement::titleUIElement()
</span><span class="cx"> {
</span><span class="cx">     return 0;
</span></span></pre>
</div>
</div>

</body>
</html>