Title: [203694] trunk
Revision
203694
Author
n_w...@apple.com
Date
2016-07-25 12:15:05 -0700 (Mon, 25 Jul 2016)

Log Message

AX: AccessibilityRenderObject is adding duplicated children when CSS first-letter is being used.
https://bugs.webkit.org/show_bug.cgi?id=160155

Reviewed by Chris Fleizach.

Source/WebCore:

We were adding the same text node twice if CSS first-letter selector was being used. Added a
check for the inline continuation so that we only add it once.

Test: accessibility/mac/css-first-letter-children.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::firstChildConsideringContinuation):

LayoutTests:

* accessibility/mac/css-first-letter-children-expected.txt: Added.
* accessibility/mac/css-first-letter-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203693 => 203694)


--- trunk/LayoutTests/ChangeLog	2016-07-25 19:04:16 UTC (rev 203693)
+++ trunk/LayoutTests/ChangeLog	2016-07-25 19:15:05 UTC (rev 203694)
@@ -1,3 +1,13 @@
+2016-07-25  Nan Wang  <n_w...@apple.com>
+
+        AX: AccessibilityRenderObject is adding duplicated children when CSS first-letter is being used.
+        https://bugs.webkit.org/show_bug.cgi?id=160155
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/css-first-letter-children-expected.txt: Added.
+        * accessibility/mac/css-first-letter-children.html: Added.
+
 2016-07-24  Wenson Hsieh  <wenson_hs...@apple.com>
 
         The web process hangs when computing elements-based snap points for a container with large max scroll offset

Added: trunk/LayoutTests/accessibility/mac/css-first-letter-children-expected.txt (0 => 203694)


--- trunk/LayoutTests/accessibility/mac/css-first-letter-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/css-first-letter-children-expected.txt	2016-07-25 19:15:05 UTC (rev 203694)
@@ -0,0 +1,14 @@
+Test text
+
+This tests that we are adding children correctly when having CSS first-letter selector.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXGroup AXValue: 
+  AXRole: AXStaticText AXValue: Test text
+PASS content.childrenCount is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/css-first-letter-children.html (0 => 203694)


--- trunk/LayoutTests/accessibility/mac/css-first-letter-children.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/css-first-letter-children.html	2016-07-25 19:15:05 UTC (rev 203694)
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+    function dumpAccessibilityChildren(element, level) {
+        if (element.stringValue.indexOf('End of test') >= 0)
+            return false;
+
+        var indent = "";
+        for (var k = 0; k < level; k++) { indent += "  "; }
+        debug(indent + element.role + " " + element.stringValue);
+        var childrenCount = element.childrenCount;
+        for (var k = 0; k < childrenCount; k++) {
+            if (!dumpAccessibilityChildren(element.childAtIndex(k), level+1))
+                return false;
+        }
+        return true;
+    }
+</script>
+
+<style>
+p::first-letter {
+    font-size: 200%;
+}
+</style>
+</head>
+
+<body id="body">
+
+<div>
+<p id="text">Test text</p>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    if (window.accessibilityController) {
+        description("This tests that we are adding children correctly when having CSS first-letter selector.");
+
+        var content = accessibilityController.accessibleElementById("text");
+        dumpAccessibilityChildren(content, 0);
+        
+        shouldBe("content.childrenCount", "1");
+    }
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (203693 => 203694)


--- trunk/Source/WebCore/ChangeLog	2016-07-25 19:04:16 UTC (rev 203693)
+++ trunk/Source/WebCore/ChangeLog	2016-07-25 19:15:05 UTC (rev 203694)
@@ -1,3 +1,18 @@
+2016-07-25  Nan Wang  <n_w...@apple.com>
+
+        AX: AccessibilityRenderObject is adding duplicated children when CSS first-letter is being used.
+        https://bugs.webkit.org/show_bug.cgi?id=160155
+
+        Reviewed by Chris Fleizach.
+
+        We were adding the same text node twice if CSS first-letter selector was being used. Added a
+        check for the inline continuation so that we only add it once. 
+
+        Test: accessibility/mac/css-first-letter-children.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::firstChildConsideringContinuation):
+
 2016-07-25  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Media controls on apple.com don't disappear when movie finishes playing

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (203693 => 203694)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-07-25 19:04:16 UTC (rev 203693)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-07-25 19:15:05 UTC (rev 203694)
@@ -186,6 +186,12 @@
 {
     RenderObject* firstChild = renderer.firstChildSlow();
 
+    // We don't want to include the end of a continuation as the firstChild of the
+    // anonymous parent, because everything has already been linked up via continuation.
+    // CSS first-letter selector is an example of this case.
+    if (renderer.isAnonymous() && firstChild && firstChild->isInlineElementContinuation())
+        firstChild = nullptr;
+    
     if (!firstChild && isInlineWithContinuation(renderer))
         firstChild = firstChildInContinuation(downcast<RenderInline>(renderer));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to