Bug 40192

Summary: AX: link won't return linked element if URL contains #
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: chris fleizach <cfleizach>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, ddkilzer, gustavo, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch darin: review+

Description chris fleizach 2010-06-04 17:37:43 PDT
If you click on an internal link, so that the document URL contains a frament in it, subsequent calls to ask for linkedElements will not work
Comment 1 chris fleizach 2010-06-04 17:47:32 PDT
So i don't forget

Index: WebCore/accessibility/AccessibilityRenderObject.cpp
===================================================================
--- WebCore/accessibility/AccessibilityRenderObject.cpp	(revision 230881)
+++ WebCore/accessibility/AccessibilityRenderObject.cpp	(working copy)
@@ -1247,7 +1247,9 @@ AccessibilityObject* AccessibilityRender
     
     // check if URL is the same as current URL
     linkURL.removeFragmentIdentifier();
-    if (m_renderer->document()->url() != linkURL)
+    KURL documentURL = m_renderer->document()->url();
+    documentURL.removeFragmentIdentifier();
+    if (documentURL != linkURL)
         return 0;
Comment 2 chris fleizach 2010-06-11 10:57:23 PDT
Created attachment 58486 [details]
Patch
Comment 3 WebKit Review Bot 2010-06-11 11:08:14 PDT
Attachment 58486 [details] did not build on gtk:
Build output: http://webkit-commit-queue.appspot.com/results/3222217
Comment 4 chris fleizach 2010-06-11 11:25:19 PDT
Created attachment 58489 [details]
Patch
Comment 5 WebKit Review Bot 2010-06-11 11:32:29 PDT
Attachment 58486 [details] did not build on win:
Build output: http://webkit-commit-queue.appspot.com/results/3238275
Comment 6 Darin Adler 2010-06-12 19:13:37 PDT
Comment on attachment 58489 [details]
Patch

>      linkURL.removeFragmentIdentifier();
> -    if (m_renderer->document()->url() != linkURL)
> +    KURL documentURL = m_renderer->document()->url();
> +    documentURL.removeFragmentIdentifier();
> +    if (documentURL != linkURL)
>          return 0;

There's also a equalIgnoringFragmentIdentifier function in KURL.h that can be used for cases like this.
Comment 7 chris fleizach 2010-06-13 21:01:30 PDT
http://trac.webkit.org/changeset/61103