Changeset 216457 in webkit


Ignore:
Timestamp:
May 8, 2017 3:16:27 PM (7 years ago)
Author:
jdiggs@igalia.com
Message:

AX: don't expose empty roledescription
https://bugs.webkit.org/show_bug.cgi?id=163647

Reviewed by Chris Fleizach.

Source/WebCore:

If the value of aria-roledescription is empty or contains only whitespace
characters, ignore the value. Also strip out leading or trailing whitespace
characters in the value.

No new tests: We already had coverage for an empty aria-roledescription value.
That test was updated to reflect the new behavior. New test cases were added
to cover a value that contains only whitespace characters, and a value with
leading and trailing whitespace characters.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::roleDescription):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper roleDescription]):

LayoutTests:

  • accessibility/aria-roledescription-expected.txt: New test cases, updated expectations.
  • accessibility/aria-roledescription.html: New test cases, updated expectations.
  • platform/gtk/accessibility/aria-roledescription-expected.txt: New test cases, updated expectations.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r216456 r216457  
     12017-05-08  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: don't expose empty roledescription
     4        https://bugs.webkit.org/show_bug.cgi?id=163647
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/aria-roledescription-expected.txt: New test cases, updated expectations.
     9        * accessibility/aria-roledescription.html: New test cases, updated expectations.
     10        * platform/gtk/accessibility/aria-roledescription-expected.txt: New test cases, updated expectations.
     11
    1122017-05-08  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/accessibility/aria-roledescription-expected.txt

    r186038 r216457  
    55
    66
    7 Role description: AXRoleDescription: Super Button
    8 Role description: AXRoleDescription:
    9 Role description: AXRoleDescription: button
     7Role description: AXRoleDescription: Super Button.
     8Role description: AXRoleDescription: button.
     9Role description: AXRoleDescription: button.
     10Role description: AXRoleDescription: Super Button.
     11Role description: AXRoleDescription: button.
    1012PASS successfullyParsed is true
    1113
  • trunk/LayoutTests/accessibility/aria-roledescription.html

    r186038 r216457  
    1818
    1919        // Confirm we can override our role description.
    20         debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription);
     20        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
    2121
    22         // Confirm our role description is empty when set to zero length.
     22        // Confirm our role description returns to default when set to zero length.
    2323        document.getElementById("btn").setAttribute("aria-roledescription", "");
    24         debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription);
     24        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
     25
     26        // Confirm our role description returns to default when set to whitespace only.
     27        document.getElementById("btn").setAttribute("aria-roledescription", "     ");
     28        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
     29
     30        // Confirm our role description strips extraneous whitespace characters.
     31        document.getElementById("btn").setAttribute("aria-roledescription", "          Super Button          ");
     32        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
    2533
    2634        // Confirm our role description returns to default when removed.
    2735        document.getElementById("btn").removeAttribute("aria-roledescription");
    28         debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription);
     36        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
    2937    }
    3038}
  • trunk/LayoutTests/platform/gtk/accessibility/aria-roledescription-expected.txt

    r200245 r216457  
    55
    66
    7 Role description: AXRoleDescription: Super Button
    8 Role description: AXRoleDescription:
    9 Role description: AXRoleDescription:
     7Role description: AXRoleDescription: Super Button.
     8Role description: AXRoleDescription: .
     9Role description: AXRoleDescription: .
     10Role description: AXRoleDescription: Super Button.
     11Role description: AXRoleDescription: .
    1012PASS successfullyParsed is true
    1113
  • trunk/Source/WebCore/ChangeLog

    r216456 r216457  
     12017-05-08  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: don't expose empty roledescription
     4        https://bugs.webkit.org/show_bug.cgi?id=163647
     5
     6        Reviewed by Chris Fleizach.
     7
     8        If the value of aria-roledescription is empty or contains only whitespace
     9        characters, ignore the value. Also strip out leading or trailing whitespace
     10        characters in the value.
     11
     12        No new tests: We already had coverage for an empty aria-roledescription value.
     13        That test was updated to reflect the new behavior. New test cases were added
     14        to cover a value that contains only whitespace characters, and a value with
     15        leading and trailing whitespace characters.
     16
     17        * accessibility/AccessibilityObject.cpp:
     18        (WebCore::AccessibilityObject::roleDescription):
     19        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     20        (-[WebAccessibilityObjectWrapper roleDescription]):
     21
    1222017-05-08  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r216102 r216457  
    23332333String AccessibilityObject::roleDescription() const
    23342334{
    2335     return getAttribute(aria_roledescriptionAttr);
     2335    return stripLeadingAndTrailingHTMLSpaces(getAttribute(aria_roledescriptionAttr));
    23362336}
    23372337   
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r216452 r216457  
    22082208
    22092209    const AtomicString& overrideRoleDescription = m_object->roleDescription();
    2210     if (!overrideRoleDescription.isNull())
     2210    if (!overrideRoleDescription.isNull() && !overrideRoleDescription.isEmpty())
    22112211        return overrideRoleDescription;
    22122212   
Note: See TracChangeset for help on using the changeset viewer.