https://bugs.webkit.org/show_bug.cgi?id=105538
Reviewed by Chris Fleizach.
Source/WebCore:
Expose '\n' for linebreaks when they were explicitly set by the
author of the web content with a <br> tag.
Tests: accessibility/paragraph-with-linebreaks.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::shouldAddSpaceBeforeAppendingNextElement): Helper
function to decide when to append spaces when building the text
under an element, considering line breaks.
(WebCore::AccessibilityNodeObject::textUnderElement): Use the
shouldAddSpaceBeforeAppendingNextElement() function here.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement): Return the
renderer's text for accessibility objects exposing <br> elements.
* html/parser/HTMLParserIdioms.h:
(WebCore::isHTMLSpaceButNotLineBreak): New helper function, useful
to be passed to other functions like simplifyWhiteSpace().
Tools:
Unskip passing test getTextInParagraphAndBodyModerate.
* Scripts/run-gtk-tests:
(TestRunner): Unskip pasing test.
LayoutTests:
Added new Layout test and platform specific expectations.
* platform/efl/accessibility/paragraph-with-linebreaks-expected.txt: Added.
* platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt: Added.
* accessibility/paragraph-with-linebreaks.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155428
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-09-10 Mario Sanchez Prada <mario.prada@samsung.com>
+
+ [GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
+ https://bugs.webkit.org/show_bug.cgi?id=105538
+
+ Reviewed by Chris Fleizach.
+
+ Added new Layout test and platform specific expectations.
+
+ * platform/efl/accessibility/paragraph-with-linebreaks-expected.txt: Added.
+ * platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt: Added.
+ * accessibility/paragraph-with-linebreaks.html: Added.
+
2013-09-10 Arpita Bahuguna <a.bah@samsung.com>
When deleting editable content, typing style should be reset when moving into another node.
--- /dev/null
+<html>
+<head>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<p>
+ Lorem ipsum dolor sit amet,<br>
+ consectetur adipiscing elit.<br>
+ Aliquam faucibus diam sit amet nunc vestibulum auctor.
+</p>
+
+<p style="max-width:150px;">
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam faucibus diam sit amet nunc vestibulum auctor.
+</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+description("This test checks that linebreaks explicitly set by the author are properly exposed to ATs.");
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+
+ if (window.accessibilityController) {
+
+ document.body.focus();
+ var webArea = accessibilityController.focusedElement;
+
+ var brokenParagraph = webArea.childAtIndex(0);
+ debug("Role of the paragraph with break lines: " + brokenParagraph.role);
+ debug("Value of the paragraph with break lines: " + brokenParagraph.stringValue);
+ debug("<br>");
+
+ var wrappedParagraph = webArea.childAtIndex(1);
+ debug("Role of the paragraph with wrapped lines: " + wrappedParagraph.role);
+ debug("Value of the paragraph with wrapped lines: " + wrappedParagraph.stringValue);
+ debug("<br>");
+ }
+}
+</script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
+
+</body>
+</html>
--- /dev/null
+Lorem ipsum dolor sit amet,
+consectetur adipiscing elit.
+Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+This test checks that linebreaks explicitly set by the author are properly exposed to ATs.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Role of the paragraph with break lines: AXRole: AXParagraph
+Value of the paragraph with break lines: AXValue: Lorem ipsum dolor sit amet,<\n>consectetur adipiscing elit.<\n>Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+
+Role of the paragraph with wrapped lines: AXRole: AXParagraph
+Value of the paragraph with wrapped lines: AXValue: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+Lorem ipsum dolor sit amet,
+consectetur adipiscing elit.
+Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+This test checks that linebreaks explicitly set by the author are properly exposed to ATs.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Role of the paragraph with break lines: AXRole: AXParagraph
+Value of the paragraph with break lines: AXValue: Lorem ipsum dolor sit amet,<\n>consectetur adipiscing elit.<\n>Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+
+Role of the paragraph with wrapped lines: AXRole: AXParagraph
+Value of the paragraph with wrapped lines: AXValue: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam faucibus diam sit amet nunc vestibulum auctor.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+2013-09-10 Mario Sanchez Prada <mario.prada@samsung.com>
+
+ [GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
+ https://bugs.webkit.org/show_bug.cgi?id=105538
+
+ Reviewed by Chris Fleizach.
+
+ Expose '\n' for linebreaks when they were explicitly set by the
+ author of the web content with a <br> tag.
+
+ Tests: accessibility/paragraph-with-linebreaks.html
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::shouldAddSpaceBeforeAppendingNextElement): Helper
+ function to decide when to append spaces when building the text
+ under an element, considering line breaks.
+ (WebCore::AccessibilityNodeObject::textUnderElement): Use the
+ shouldAddSpaceBeforeAppendingNextElement() function here.
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::textUnderElement): Return the
+ renderer's text for accessibility objects exposing <br> elements.
+ * html/parser/HTMLParserIdioms.h:
+ (WebCore::isHTMLSpaceButNotLineBreak): New helper function, useful
+ to be passed to other functions like simplifyWhiteSpace().
+
2013-09-10 Arpita Bahuguna <a.bah@samsung.com>
When deleting editable content, typing style should be reset when moving into another node.
#include "HTMLOptGroupElement.h"
#include "HTMLOptionElement.h"
#include "HTMLOptionsCollection.h"
+#include "HTMLParserIdioms.h"
#include "HTMLPlugInImageElement.h"
#include "HTMLSelectElement.h"
#include "HTMLTextAreaElement.h"
return true;
}
+static bool shouldAddSpaceBeforeAppendingNextElement(StringBuilder& builder, String& childText)
+{
+ if (!builder.length() || !childText.length())
+ return false;
+
+ // We don't need to add an additional space before or after a line break.
+ return !(isHTMLLineBreak(childText[0]) || isHTMLLineBreak(builder[builder.length() - 1]));
+}
+
String AccessibilityNodeObject::textUnderElement(AccessibilityTextUnderElementMode mode) const
{
Node* node = this->node();
Vector<AccessibilityText> textOrder;
toAccessibilityNodeObject(child)->alternativeText(textOrder);
if (textOrder.size() > 0 && textOrder[0].text.length()) {
- if (builder.length())
+ if (shouldAddSpaceBeforeAppendingNextElement(builder, textOrder[0].text))
builder.append(' ');
builder.append(textOrder[0].text);
continue;
String childText = child->textUnderElement(mode);
if (childText.length()) {
- if (builder.length())
+ if (shouldAddSpaceBeforeAppendingNextElement(builder, childText))
builder.append(' ');
builder.append(childText);
}
}
- return builder.toString().stripWhiteSpace().simplifyWhiteSpace();
+ return builder.toString().stripWhiteSpace().simplifyWhiteSpace(isHTMLSpaceButNotLineBreak);
}
String AccessibilityNodeObject::title() const
#include "NodeList.h"
#include "Page.h"
#include "ProgressTracker.h"
+#include "RenderBR.h"
#include "RenderButton.h"
#include "RenderFieldset.h"
#include "RenderFileUploadControl.h"
if (m_renderer->isFileUploadControl())
return toRenderFileUploadControl(m_renderer)->buttonValue();
+ // Reflect when a content author has explicitly marked a line break.
+ if (m_renderer->isBR())
+ return toRenderBR(*m_renderer).text();
+
#if ENABLE(MATHML)
// Math operators create RenderText nodes on the fly that are not tied into the DOM in a reasonable way,
// so rangeOfContents does not work for them (nor does regular text selection).
bool isHTMLSpace(UChar);
bool isHTMLLineBreak(UChar);
bool isNotHTMLSpace(UChar);
+bool isHTMLSpaceButNotLineBreak(UChar character);
// Strip leading and trailing whitespace as defined by the HTML specification.
String stripLeadingAndTrailingHTMLSpaces(const String&);
return !isHTMLSpace(character);
}
+inline bool isHTMLSpaceButNotLineBreak(UChar character)
+{
+ return isHTMLSpace(character) && !isHTMLLineBreak(character);
+}
+
bool threadSafeMatch(const QualifiedName&, const QualifiedName&);
#if ENABLE(THREADED_HTML_PARSER)
bool threadSafeMatch(const HTMLIdentifier&, const QualifiedName&);
+2013-09-10 Mario Sanchez Prada <mario.prada@samsung.com>
+
+ [GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
+ https://bugs.webkit.org/show_bug.cgi?id=105538
+
+ Reviewed by Chris Fleizach.
+
+ Unskip passing test getTextInParagraphAndBodyModerate.
+
+ * Scripts/run-gtk-tests:
+ (TestRunner): Unskip pasing test.
+
2013-09-09 Mark Lam <mark.lam@apple.com>
Remove more references to the deleted js-test-style.css.
SkippedTest("unittests/testwebresource", "/webkit/webresource/loading", "Test fails", 104689),
SkippedTest("unittests/testwebresource", "/webkit/webresource/sub_resource_loading", "Test fails in GTK Linux 64-bit Release bot", 82330),
SkippedTest("unittests/testwebview", "/webkit/webview/icon-uri", "Test times out in GTK Linux 64-bit Release bot", 82328),
- SkippedTest("unittests/testatk", "/webkit/atk/getTextInParagraphAndBodyModerate", "Test fails", 105538),
SkippedTest("WebKit2APITests/TestResources", "/webkit2/WebKitWebView/resources", "Test is flaky in GTK Linux 32-bit Release bot", 82868),
SkippedTest("WebKit2APITests/TestWebKitWebView", SkippedTest.ENTIRE_SUITE, "Test times out after r150890", 117689),
SkippedTest("WebKit2APITests/TestContextMenu", SkippedTest.ENTIRE_SUITE, "Test times out after r150890", 117689),