Title: [196167] trunk
Revision
196167
Author
n_w...@apple.com
Date
2016-02-05 00:53:51 -0800 (Fri, 05 Feb 2016)

Log Message

AX: WebKit hanging when VoiceOver attempts to focus in on page
https://bugs.webkit.org/show_bug.cgi?id=153899
<rdar://problem/24506603>

Reviewed by Chris Fleizach.

Source/WebCore:

The VisiblePosition to CharacterOffset conversion will lead to an infinite loop if the
nextVisiblePostion call is returning the original VisiblePosition. Fixed it by breaking out
of the loop early in that situation.

Test: accessibility/text-marker/character-offset-visible-position-conversion-hang.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::characterOffsetFromVisiblePosition):

LayoutTests:

* accessibility/text-marker/character-offset-visible-position-conversion-hang-expected.txt: Added.
* accessibility/text-marker/character-offset-visible-position-conversion-hang.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (196166 => 196167)


--- trunk/LayoutTests/ChangeLog	2016-02-05 05:57:37 UTC (rev 196166)
+++ trunk/LayoutTests/ChangeLog	2016-02-05 08:53:51 UTC (rev 196167)
@@ -1,3 +1,14 @@
+2016-02-05  Nan Wang  <n_w...@apple.com>
+
+        AX: WebKit hanging when VoiceOver attempts to focus in on page
+        https://bugs.webkit.org/show_bug.cgi?id=153899
+        <rdar://problem/24506603>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/text-marker/character-offset-visible-position-conversion-hang-expected.txt: Added.
+        * accessibility/text-marker/character-offset-visible-position-conversion-hang.html: Added.
+
 2016-02-04  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: InspectorTimelineAgent doesn't need to recompile functions because it now uses the sampling profiler

Added: trunk/LayoutTests/accessibility/text-marker/character-offset-visible-position-conversion-hang-expected.txt (0 => 196167)


--- trunk/LayoutTests/accessibility/text-marker/character-offset-visible-position-conversion-hang-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/text-marker/character-offset-visible-position-conversion-hang-expected.txt	2016-02-05 08:53:51 UTC (rev 196167)
@@ -0,0 +1,13 @@
+Text
+
+This tests that getting the end text marker of the page won't hang.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+request10005.pdf

Added: trunk/LayoutTests/accessibility/text-marker/character-offset-visible-position-conversion-hang.html (0 => 196167)


--- trunk/LayoutTests/accessibility/text-marker/character-offset-visible-position-conversion-hang.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/text-marker/character-offset-visible-position-conversion-hang.html	2016-02-05 08:53:51 UTC (rev 196167)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body" _onload_="loadFunction()">
+
+<p id="text"><b>Text</b></p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that getting the end text marker of the page won't hang.");
+    
+    if (window.accessibilityController) {
+        function loadFunction() {
+            var text = accessibilityController.accessibleElementById("text");
+            var endMarker = text.endTextMarker;
+        }
+    }
+
+</script>
+
+<div class="Apple-web-attachment-container" contenteditable="false" title="attachment.pdf" role="img">
+  <img class="Apple-web-attachment-icon" src="" style="display:none">
+  <canvas class="Apple-web-attachment-canvas" style="width: 126px; height: 79px;" width="100" height="100"></canvas>
+  <div class="Apple-web-attachment-printable-version"><div class="iconContainer">
+    <img src="" height="38.400000" width="38.400000"></div>
+    <div class="filenameContainer">request10005.pdf</div>
+  </div>
+</div>
+
+<script src=""
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (196166 => 196167)


--- trunk/Source/WebCore/ChangeLog	2016-02-05 05:57:37 UTC (rev 196166)
+++ trunk/Source/WebCore/ChangeLog	2016-02-05 08:53:51 UTC (rev 196167)
@@ -1,3 +1,20 @@
+2016-02-05  Nan Wang  <n_w...@apple.com>
+
+        AX: WebKit hanging when VoiceOver attempts to focus in on page
+        https://bugs.webkit.org/show_bug.cgi?id=153899
+        <rdar://problem/24506603>
+
+        Reviewed by Chris Fleizach.
+
+        The VisiblePosition to CharacterOffset conversion will lead to an infinite loop if the
+        nextVisiblePostion call is returning the original VisiblePosition. Fixed it by breaking out
+        of the loop early in that situation. 
+
+        Test: accessibility/text-marker/character-offset-visible-position-conversion-hang.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
+
 2016-02-04  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: InspectorTimelineAgent doesn't need to recompile functions because it now uses the sampling profiler

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (196166 => 196167)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2016-02-05 05:57:37 UTC (rev 196166)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2016-02-05 08:53:51 UTC (rev 196167)
@@ -1753,9 +1753,15 @@
     int characterOffset = 0;
     Position vpDeepPos = vp.deepEquivalent();
     
+    VisiblePosition previousVisiblePos;
     while (!vpDeepPos.isNull() && !deepPos.equals(vpDeepPos)) {
+        previousVisiblePos = vp;
         vp = obj->nextVisiblePosition(vp);
         vpDeepPos = vp.deepEquivalent();
+        // Sometimes nextVisiblePosition will give the same VisiblePostion,
+        // we break here to avoid infinite loop.
+        if (vpDeepPos.equals(previousVisiblePos.deepEquivalent()))
+            break;
         characterOffset++;
     }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to