Diff
Modified: trunk/LayoutTests/ChangeLog (155427 => 155428)
--- trunk/LayoutTests/ChangeLog 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/LayoutTests/ChangeLog 2013-09-10 08:52:07 UTC (rev 155428)
@@ -1,3 +1,16 @@
+2013-09-10 Mario Sanchez Prada <[email protected]>
+
+ [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 <[email protected]>
When deleting editable content, typing style should be reset when moving into another node.
Added: trunk/LayoutTests/accessibility/paragraph-with-linebreaks.html (0 => 155428)
--- trunk/LayoutTests/accessibility/paragraph-with-linebreaks.html (rev 0)
+++ trunk/LayoutTests/accessibility/paragraph-with-linebreaks.html 2013-09-10 08:52:07 UTC (rev 155428)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<script src=""
+</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=""
+
+</body>
+</html>
Added: trunk/LayoutTests/platform/efl/accessibility/paragraph-with-linebreaks-expected.txt (0 => 155428)
--- trunk/LayoutTests/platform/efl/accessibility/paragraph-with-linebreaks-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/efl/accessibility/paragraph-with-linebreaks-expected.txt 2013-09-10 08:52:07 UTC (rev 155428)
@@ -0,0 +1,23 @@
+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
+
Added: trunk/LayoutTests/platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt (0 => 155428)
--- trunk/LayoutTests/platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt 2013-09-10 08:52:07 UTC (rev 155428)
@@ -0,0 +1,23 @@
+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
+
Modified: trunk/Source/WebCore/ChangeLog (155427 => 155428)
--- trunk/Source/WebCore/ChangeLog 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/Source/WebCore/ChangeLog 2013-09-10 08:52:07 UTC (rev 155428)
@@ -1,3 +1,28 @@
+2013-09-10 Mario Sanchez Prada <[email protected]>
+
+ [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 <[email protected]>
When deleting editable content, typing style should be reset when moving into another node.
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (155427 => 155428)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2013-09-10 08:52:07 UTC (rev 155428)
@@ -54,6 +54,7 @@
#include "HTMLOptGroupElement.h"
#include "HTMLOptionElement.h"
#include "HTMLOptionsCollection.h"
+#include "HTMLParserIdioms.h"
#include "HTMLPlugInImageElement.h"
#include "HTMLSelectElement.h"
#include "HTMLTextAreaElement.h"
@@ -1542,6 +1543,15 @@
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();
@@ -1557,7 +1567,7 @@
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;
@@ -1566,13 +1576,13 @@
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
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (155427 => 155428)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2013-09-10 08:52:07 UTC (rev 155428)
@@ -65,6 +65,7 @@
#include "NodeList.h"
#include "Page.h"
#include "ProgressTracker.h"
+#include "RenderBR.h"
#include "RenderButton.h"
#include "RenderFieldset.h"
#include "RenderFileUploadControl.h"
@@ -630,6 +631,10 @@
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).
Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (155427 => 155428)
--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h 2013-09-10 08:52:07 UTC (rev 155428)
@@ -38,6 +38,7 @@
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&);
@@ -92,6 +93,11 @@
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&);
Modified: trunk/Tools/ChangeLog (155427 => 155428)
--- trunk/Tools/ChangeLog 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/Tools/ChangeLog 2013-09-10 08:52:07 UTC (rev 155428)
@@ -1,3 +1,15 @@
+2013-09-10 Mario Sanchez Prada <[email protected]>
+
+ [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 <[email protected]>
Remove more references to the deleted js-test-style.css.
Modified: trunk/Tools/Scripts/run-gtk-tests (155427 => 155428)
--- trunk/Tools/Scripts/run-gtk-tests 2013-09-10 08:51:27 UTC (rev 155427)
+++ trunk/Tools/Scripts/run-gtk-tests 2013-09-10 08:52:07 UTC (rev 155428)
@@ -66,7 +66,6 @@
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),