[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

cfleizach at apple.com cfleizach at apple.com
Wed Dec 22 13:18:14 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 01ee2ed90f3d05b1fce7e783ec5bcb9e8ea33e4a
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 10 18:34:45 2010 +0000

    WebCore: Use String::fromUTF8 instead of UTF8Encoding().decode
    in the libxml XMLDocumentParser
    https://bugs.webkit.org/show_bug.cgi?id=45488
    
    Patch by Patrick Gansterer <paroga at paroga.com> on 2010-09-10
    Reviewed by Darin Adler.
    
    * dom/XMLDocumentParserLibxml2.cpp:
    (WebCore::toString):
    
    LayoutTests: Land new expected results for some tests on Windows
    
    Patch by Adam Roben <aroben at apple.com> on 2010-09-10
    Rubber-stamped in advance by Simon Fraser.
    
    * platform/win/fast/text/hyphenate-first-word-actual.txt: Added.
    * platform/win/fast/text/hyphenate-locale-actual.txt: Added.
    Windows doesn't support hyphenation.
    
    * platform/win/html5lib/runner-actual.txt: Added.
    We don't implement <keygen> on Windows, so we pass some tests that
    expect <keygen> to have no child elements (on Mac, the child elements
    are real DOM elements, rather than living in the shadow DOM tree like
    HTML5 mandates, so the tests fail).
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index cf0b36d..379342c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -63,6 +63,16 @@
 
         Reviewed by David Kilzer.
 
+        AX: accessibility not returning strings when visibility is hidden
+        https://bugs.webkit.org/show_bug.cgi?id=45116
+
+        * platform/mac/accessibility/clipped-text-under-element-expected.txt: Added.
+        * platform/mac/accessibility/clipped-text-under-element.html: Added.
+
+2010-09-10  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by David Kilzer.
+
         Mail crashes with searching for next misspelled word with VoiceOver
         https://bugs.webkit.org/show_bug.cgi?id=45501
 
diff --git a/LayoutTests/platform/mac/accessibility/clipped-text-under-element-expected.txt b/LayoutTests/platform/mac/accessibility/clipped-text-under-element-expected.txt
new file mode 100644
index 0000000..0952d94
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/clipped-text-under-element-expected.txt
@@ -0,0 +1,13 @@
+I am the visible link text.
+
+This tests that even if an element is not visible, textUnderElement() will still give the text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS hiddenLink.title is 'AXTitle: I am the hidden link text.'
+PASS visibleLink.title is 'AXTitle: I am the visible link text.'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/clipped-text-under-element.html b/LayoutTests/platform/mac/accessibility/clipped-text-under-element.html
new file mode 100644
index 0000000..c8bce73
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/clipped-text-under-element.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<style>
+.hidden {
+  height: 0;
+  overflow: hidden;
+}
+</style>
+
+<div class="hidden">
+  <h1><a id="hidden-link" tabindex=0 href="http://domain.com/path/i-am-the-URL?id=1234">I am the hidden link text.</a></h1>
+</div>
+
+<hr>
+
+<div>
+  <h1><a id="visible-link" tabindex=0 href="http://domain.com/path/i-am-the-URL?id=1234">I am the visible link text.</a></h1>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that even if an element is not visible, textUnderElement() will still give the text.");
+
+    if (window.accessibilityController) {
+        document.getElementById("hidden-link").focus();
+        var hiddenLink = accessibilityController.focusedElement;
+        shouldBe("hiddenLink.title", "'AXTitle: I am the hidden link text.'");
+
+        document.getElementById("visible-link").focus();
+        var visibleLink = accessibilityController.focusedElement;
+        shouldBe("visibleLink.title", "'AXTitle: I am the visible link text.'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index be395ce..73f85f4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -13,6 +13,39 @@
 
         Reviewed by David Kilzer.
 
+        AX: accessibility not returning strings when visibility is hidden
+        https://bugs.webkit.org/show_bug.cgi?id=45116
+
+        AX code uses plainText() in TextIterator to get the text for a node.
+        However, when that node is not visible, no text is returned because TextIterator ignores
+        clipped nodes and other hidden elements.
+
+        Solution is to add a new text iterator behavior for ignoring style visiblity. This allows
+        for text to allows be returned for accessibility purposes.
+
+        Test: platform/mac/accessibility/clipped-text-under-element.html
+
+        * WebCore.exp.in:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::textUnderElement):
+        (WebCore::AccessibilityRenderObject::stringValue):
+           Use the new flag for plainText
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::TextIterator):
+        (WebCore::TextIterator::handleTextNode):
+        (WebCore::TextIterator::handleTextBox):
+        (WebCore::TextIterator::handleTextNodeFirstLetter):
+        (WebCore::TextIterator::handleReplacedElement):
+           Use the new flag to NOT skip hidden elements.
+        (WebCore::plainTextToMallocAllocatedBuffer):
+        (WebCore::plainText):
+        * editing/TextIterator.h:
+           Add the new text iterator behavior.
+
+2010-09-10  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by David Kilzer.
+
         Mail crashes with searching for next misspelled word with VoiceOver
         https://bugs.webkit.org/show_bug.cgi?id=45501
 
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index a2d5a39..d5135a3 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -517,7 +517,7 @@ __ZN7WebCore31contextMenuItemTagMakeUpperCaseEv
 __ZN7WebCore31contextMenuItemTagStartSpeakingEv
 __ZN7WebCore32contextMenuItemTagInspectElementEv
 __ZN7WebCore32contextMenuItemTagSmartCopyPasteEv
-__ZN7WebCore32plainTextToMallocAllocatedBufferEPKNS_5RangeERjb
+__ZN7WebCore32plainTextToMallocAllocatedBufferEPKNS_5RangeERjbNS_20TextIteratorBehaviorE
 __ZN7WebCore33contextMenuItemTagTextReplacementEv
 __ZN7WebCore33setDefaultThreadViolationBehaviorENS_23ThreadViolationBehaviorENS_20ThreadViolationRoundE
 __ZN7WebCore34contextMenuItemTagDefaultDirectionEv
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index e292971..0d5bf49 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -1025,7 +1025,7 @@ String AccessibilityRenderObject::textUnderElement() const
             // catch stale WebCoreAXObject (see <rdar://problem/3960196>)
             if (frame->document() != node->document())
                 return String();
-            return plainText(rangeOfContents(node).get());
+            return plainText(rangeOfContents(node).get(), TextIteratorIgnoresStyleVisibility);
         }
     }
     
@@ -1140,7 +1140,7 @@ String AccessibilityRenderObject::stringValue() const
         if (startVisiblePosition.isNull() || endVisiblePosition.isNull())
             return String();
         
-        return plainText(makeRange(startVisiblePosition, endVisiblePosition).get());
+        return plainText(makeRange(startVisiblePosition, endVisiblePosition).get(), TextIteratorIgnoresStyleVisibility);
     }
     
     if (isTextControl())
diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp
index daba80e..d5a03ef 100644
--- a/WebCore/editing/TextIterator.cpp
+++ b/WebCore/editing/TextIterator.cpp
@@ -261,6 +261,7 @@ TextIterator::TextIterator()
     , m_entersTextControls(false)
     , m_emitsTextWithoutTranscoding(false)
     , m_handledFirstLetter(false)
+    , m_ignoresStyleVisibility(false)
 {
 }
 
@@ -278,6 +279,7 @@ TextIterator::TextIterator(const Range* r, TextIteratorBehavior behavior)
     , m_entersTextControls(behavior & TextIteratorEntersTextControls)
     , m_emitsTextWithoutTranscoding(behavior & TextIteratorEmitsTextsWithoutTranscoding)
     , m_handledFirstLetter(false)
+    , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility)
 {
     // FIXME: should support TextIteratorEndsAtEditingBoundary http://webkit.org/b/43609
     ASSERT(behavior != TextIteratorEndsAtEditingBoundary);
@@ -444,7 +446,7 @@ void TextIterator::advance()
 
 bool TextIterator::handleTextNode()
 {
-    if (m_fullyClippedStack.top())
+    if (m_fullyClippedStack.top() && !m_ignoresStyleVisibility)
         return false;
 
     RenderText* renderer = toRenderText(m_node->renderer());
@@ -469,7 +471,7 @@ bool TextIterator::handleTextNode()
                 return false;
             }
         }
-        if (renderer->style()->visibility() != VISIBLE)
+        if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility)
             return false;
         int strLength = str.length();
         int end = (m_node == m_endContainer) ? m_endOffset : INT_MAX;
@@ -490,7 +492,7 @@ bool TextIterator::handleTextNode()
                 return false;
             }
         }
-        if (renderer->style()->visibility() != VISIBLE)
+        if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility)
             return false;
         m_lastTextNodeEndedWithCollapsedSpace = true; // entire block is collapsed space
         return true;
@@ -516,7 +518,7 @@ bool TextIterator::handleTextNode()
 void TextIterator::handleTextBox()
 {    
     RenderText* renderer = m_firstLetterText ? m_firstLetterText : toRenderText(m_node->renderer());
-    if (renderer->style()->visibility() != VISIBLE) {
+    if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility) {
         m_textBox = 0;
         return;
     }
@@ -600,7 +602,7 @@ void TextIterator::handleTextNodeFirstLetter(RenderTextFragment* renderer)
 {
     if (renderer->firstLetter()) {
         RenderObject* r = renderer->firstLetter();
-        if (r->style()->visibility() != VISIBLE)
+        if (r->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility)
             return;
         for (RenderObject *currChild = r->firstChild(); currChild; currChild->nextSibling()) {
             if (currChild->isText()) {
@@ -622,7 +624,7 @@ bool TextIterator::handleReplacedElement()
         return false;
 
     RenderObject* renderer = m_node->renderer();
-    if (renderer->style()->visibility() != VISIBLE)
+    if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility)
         return false;
 
     if (m_lastTextNodeEndedWithCollapsedSpace) {
@@ -2214,7 +2216,7 @@ PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(Element* scope, int r
 
 // --------
     
-UChar* plainTextToMallocAllocatedBuffer(const Range* r, unsigned& bufferLength, bool isDisplayString)
+UChar* plainTextToMallocAllocatedBuffer(const Range* r, unsigned& bufferLength, bool isDisplayString, TextIteratorBehavior defaultBehavior)
 {
     UChar* result = 0;
 
@@ -2226,7 +2228,11 @@ UChar* plainTextToMallocAllocatedBuffer(const Range* r, unsigned& bufferLength,
     OwnPtr<Vector<TextSegment> > textSegments;
     Vector<UChar> textBuffer;
     textBuffer.reserveInitialCapacity(cMaxSegmentSize);
-    for (TextIterator it(r, isDisplayString ? TextIteratorDefaultBehavior : TextIteratorEmitsTextsWithoutTranscoding); !it.atEnd(); it.advance()) {
+    TextIteratorBehavior behavior = defaultBehavior;
+    if (!isDisplayString)
+        behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsTextsWithoutTranscoding);
+    
+    for (TextIterator it(r, behavior); !it.atEnd(); it.advance()) {
         if (textBuffer.size() && textBuffer.size() + it.length() > cMaxSegmentSize) {
             UChar* newSegmentBuffer = static_cast<UChar*>(malloc(textBuffer.size() * sizeof(UChar)));
             if (!newSegmentBuffer)
@@ -2275,10 +2281,10 @@ exit:
     return result;
 }
 
-String plainText(const Range* r)
+String plainText(const Range* r, TextIteratorBehavior defaultBehavior)
 {
     unsigned length;
-    UChar* buf = plainTextToMallocAllocatedBuffer(r, length, false);
+    UChar* buf = plainTextToMallocAllocatedBuffer(r, length, false, defaultBehavior);
     if (!buf)
         return "";
     String result(buf, length);
diff --git a/WebCore/editing/TextIterator.h b/WebCore/editing/TextIterator.h
index 805e060..7fd87bd 100644
--- a/WebCore/editing/TextIterator.h
+++ b/WebCore/editing/TextIterator.h
@@ -35,6 +35,15 @@ namespace WebCore {
 class RenderText;
 class RenderTextFragment;
 
+enum TextIteratorBehavior {
+    TextIteratorDefaultBehavior = 0,
+    TextIteratorEmitsCharactersBetweenAllVisiblePositions = 1 << 0,
+    TextIteratorEntersTextControls = 1 << 1,
+    TextIteratorEmitsTextsWithoutTranscoding = 1 << 2,
+    TextIteratorEndsAtEditingBoundary = 1 << 3,
+    TextIteratorIgnoresStyleVisibility = 1 << 4
+};
+    
 // FIXME: Can't really answer this question correctly without knowing the white-space mode.
 // FIXME: Move this somewhere else in the editing directory. It doesn't belong here.
 inline bool isCollapsibleWhitespace(UChar c)
@@ -48,8 +57,8 @@ inline bool isCollapsibleWhitespace(UChar c)
     }
 }
 
-String plainText(const Range*);
-UChar* plainTextToMallocAllocatedBuffer(const Range*, unsigned& bufferLength, bool isDisplayString);
+String plainText(const Range*, TextIteratorBehavior defaultBehavior = TextIteratorDefaultBehavior);
+UChar* plainTextToMallocAllocatedBuffer(const Range*, unsigned& bufferLength, bool isDisplayString, TextIteratorBehavior defaultBehavior = TextIteratorDefaultBehavior);
 PassRefPtr<Range> findPlainText(const Range*, const String&, bool forward, bool caseSensitive);
 
 class BitStack {
@@ -71,14 +80,6 @@ private:
 // at points where replaced elements break up the text flow.  The text comes back in
 // chunks so as to optimize for performance of the iteration.
 
-enum TextIteratorBehavior {
-    TextIteratorDefaultBehavior = 0,
-    TextIteratorEmitsCharactersBetweenAllVisiblePositions = 1 << 0,
-    TextIteratorEntersTextControls = 1 << 1,
-    TextIteratorEmitsTextsWithoutTranscoding = 1 << 2,
-    TextIteratorEndsAtEditingBoundary = 1 << 3
-};
-
 class TextIterator {
 public:
     TextIterator();
@@ -173,6 +174,8 @@ private:
     bool m_emitsTextWithoutTranscoding;
     // Used when deciding text fragment created by :first-letter should be looked into.
     bool m_handledFirstLetter;
+    // Used when the visibility of the style should not affect text gathering.
+    bool m_ignoresStyleVisibility;
 };
 
 // Iterates through the DOM range, returning all the text, and 0-length boundaries

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list