⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 155428 in webkit


Ignore:
Timestamp:
Sep 10, 2013, 1:52:07 AM (13 years ago)
Author:
mario@webkit.org
Message:

[GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
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.
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r155425 r155428  
     12013-09-10  Mario Sanchez Prada  <mario.prada@samsung.com>
     2
     3        [GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
     4        https://bugs.webkit.org/show_bug.cgi?id=105538
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Added new Layout test and platform specific expectations.
     9
     10        * platform/efl/accessibility/paragraph-with-linebreaks-expected.txt: Added.
     11        * platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt: Added.
     12        * accessibility/paragraph-with-linebreaks.html: Added.
     13
    1142013-09-10  Arpita Bahuguna  <a.bah@samsung.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r155425 r155428  
     12013-09-10  Mario Sanchez Prada  <mario.prada@samsung.com>
     2
     3        [GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
     4        https://bugs.webkit.org/show_bug.cgi?id=105538
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Expose '\n' for linebreaks when they were explicitly set by the
     9        author of the web content with a <br> tag.
     10
     11        Tests: accessibility/paragraph-with-linebreaks.html
     12
     13        * accessibility/AccessibilityNodeObject.cpp:
     14        (WebCore::shouldAddSpaceBeforeAppendingNextElement): Helper
     15        function to decide when to append spaces when building the text
     16        under an element, considering line breaks.
     17        (WebCore::AccessibilityNodeObject::textUnderElement): Use the
     18        shouldAddSpaceBeforeAppendingNextElement() function here.
     19        * accessibility/AccessibilityRenderObject.cpp:
     20        (WebCore::AccessibilityRenderObject::textUnderElement): Return the
     21        renderer's text for accessibility objects exposing <br> elements.
     22        * html/parser/HTMLParserIdioms.h:
     23        (WebCore::isHTMLSpaceButNotLineBreak): New helper function, useful
     24        to be passed to other functions like simplifyWhiteSpace().
     25
    1262013-09-10  Arpita Bahuguna  <a.bah@samsung.com>
    227
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r155191 r155428  
    5555#include "HTMLOptionElement.h"
    5656#include "HTMLOptionsCollection.h"
     57#include "HTMLParserIdioms.h"
    5758#include "HTMLPlugInImageElement.h"
    5859#include "HTMLSelectElement.h"
     
    15431544}
    15441545
     1546static bool shouldAddSpaceBeforeAppendingNextElement(StringBuilder& builder, String& childText)
     1547{
     1548    if (!builder.length() || !childText.length())
     1549        return false;
     1550
     1551    // We don't need to add an additional space before or after a line break.
     1552    return !(isHTMLLineBreak(childText[0]) || isHTMLLineBreak(builder[builder.length() - 1]));
     1553}
     1554
    15451555String AccessibilityNodeObject::textUnderElement(AccessibilityTextUnderElementMode mode) const
    15461556{
     
    15581568            toAccessibilityNodeObject(child)->alternativeText(textOrder);
    15591569            if (textOrder.size() > 0 && textOrder[0].text.length()) {
    1560                 if (builder.length())
     1570                if (shouldAddSpaceBeforeAppendingNextElement(builder, textOrder[0].text))
    15611571                    builder.append(' ');
    15621572                builder.append(textOrder[0].text);
     
    15671577        String childText = child->textUnderElement(mode);
    15681578        if (childText.length()) {
    1569             if (builder.length())
     1579            if (shouldAddSpaceBeforeAppendingNextElement(builder, childText))
    15701580                builder.append(' ');
    15711581            builder.append(childText);
     
    15731583    }
    15741584
    1575     return builder.toString().stripWhiteSpace().simplifyWhiteSpace();
     1585    return builder.toString().stripWhiteSpace().simplifyWhiteSpace(isHTMLSpaceButNotLineBreak);
    15761586}
    15771587
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r155374 r155428  
    6666#include "Page.h"
    6767#include "ProgressTracker.h"
     68#include "RenderBR.h"
    6869#include "RenderButton.h"
    6970#include "RenderFieldset.h"
     
    631632        return toRenderFileUploadControl(m_renderer)->buttonValue();
    632633   
     634    // Reflect when a content author has explicitly marked a line break.
     635    if (m_renderer->isBR())
     636        return toRenderBR(*m_renderer).text();
     637
    633638#if ENABLE(MATHML)
    634639    // Math operators create RenderText nodes on the fly that are not tied into the DOM in a reasonable way,
  • trunk/Source/WebCore/html/parser/HTMLParserIdioms.h

    r153733 r155428  
    3939bool isHTMLLineBreak(UChar);
    4040bool isNotHTMLSpace(UChar);
     41bool isHTMLSpaceButNotLineBreak(UChar character);
    4142
    4243// Strip leading and trailing whitespace as defined by the HTML specification.
     
    9394}
    9495
     96inline bool isHTMLSpaceButNotLineBreak(UChar character)
     97{
     98    return isHTMLSpace(character) && !isHTMLLineBreak(character);
     99}
     100
    95101bool threadSafeMatch(const QualifiedName&, const QualifiedName&);
    96102#if ENABLE(THREADED_HTML_PARSER)
  • trunk/Tools/ChangeLog

    r155423 r155428  
     12013-09-10  Mario Sanchez Prada  <mario.prada@samsung.com>
     2
     3        [GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
     4        https://bugs.webkit.org/show_bug.cgi?id=105538
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Unskip passing test getTextInParagraphAndBodyModerate.
     9
     10        * Scripts/run-gtk-tests:
     11        (TestRunner): Unskip pasing test.
     12
    1132013-09-09  Mark Lam  <mark.lam@apple.com>
    214
  • trunk/Tools/Scripts/run-gtk-tests

    r155038 r155428  
    6767        SkippedTest("unittests/testwebresource", "/webkit/webresource/sub_resource_loading", "Test fails in GTK Linux 64-bit Release bot", 82330),
    6868        SkippedTest("unittests/testwebview", "/webkit/webview/icon-uri", "Test times out in GTK Linux 64-bit Release bot", 82328),
    69         SkippedTest("unittests/testatk", "/webkit/atk/getTextInParagraphAndBodyModerate", "Test fails", 105538),
    7069        SkippedTest("WebKit2APITests/TestResources", "/webkit2/WebKitWebView/resources", "Test is flaky in GTK Linux 32-bit Release bot", 82868),
    7170        SkippedTest("WebKit2APITests/TestWebKitWebView", SkippedTest.ENTIRE_SUITE, "Test times out after r150890", 117689),
Note: See TracChangeset for help on using the changeset viewer.