Changeset 200318 in webkit


Ignore:
Timestamp:
May 1, 2016 11:14:36 PM (8 years ago)
Author:
n_wang@apple.com
Message:

AX: Crash at WebCore::AccessibilityObject::getAttribute const + 9
https://bugs.webkit.org/show_bug.cgi?id=157256

Reviewed by Chris Fleizach.

Source/WebCore:

When the <label> for the input element has no renderer, it will cause
crash when we ask for the title element text. Fixed it by getting the
aria-label attribute directly from the <label> element instead of its
accessibility object.

Test case covered in accessibility/mac/aria-label-on-label-element.html.

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::titleElementText):

LayoutTests:

  • accessibility/mac/aria-label-on-label-element-expected.txt:
  • accessibility/mac/aria-label-on-label-element.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200315 r200318  
     12016-05-01  Nan Wang  <n_wang@apple.com>
     2
     3        AX: Crash at  WebCore::AccessibilityObject::getAttribute const + 9
     4        https://bugs.webkit.org/show_bug.cgi?id=157256
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/mac/aria-label-on-label-element-expected.txt:
     9        * accessibility/mac/aria-label-on-label-element.html:
     10
    1112016-05-01  Commit Queue  <commit-queue@webkit.org>
    212
  • trunk/LayoutTests/accessibility/mac/aria-label-on-label-element-expected.txt

    r200290 r200318  
    1 Some text  Some other text
     1Some text  Some other text  
    22This tests that the aria-label attribute works on element.
    33
     
    88PASS input1.title is 'AXTitle: aria label'
    99PASS titleUIElement2.isEqual(accessibilityController.accessibleElementById('label2')) is true
     10PASS input3.title is 'AXTitle: hidden aria label'
    1011PASS successfullyParsed is true
    1112
  • trunk/LayoutTests/accessibility/mac/aria-label-on-label-element.html

    r200290 r200318  
    1111<label id="label2" for="input2">Some other text</label>
    1212<input id="input2" type="text" size=20>
     13
     14<label id="label3" for="input3" hidden aria-label="hidden aria label">hidden text</label>
     15<input id="input3" type="text">
    1316
    1417<p id="description"></p>
     
    3134        var titleUIElement2 = input2.titleUIElement();
    3235        shouldBeTrue("titleUIElement2.isEqual(accessibilityController.accessibleElementById('label2'))");
     36       
     37        // Make sure when the input element has no rendered label, it won't cause crash.
     38        var input3 = accessibilityController.accessibleElementById("input3");
     39        shouldBe("input3.title", "'AXTitle: hidden aria label'");
    3340    }
    3441
  • trunk/Source/WebCore/ChangeLog

    r200317 r200318  
     12016-05-01  Nan Wang  <n_wang@apple.com>
     2
     3        AX: Crash at  WebCore::AccessibilityObject::getAttribute const + 9
     4        https://bugs.webkit.org/show_bug.cgi?id=157256
     5
     6        Reviewed by Chris Fleizach.
     7
     8        When the <label> for the input element has no renderer, it will cause
     9        crash when we ask for the title element text. Fixed it by getting the
     10        aria-label attribute directly from the <label> element instead of its
     11        accessibility object.
     12
     13        Test case covered in accessibility/mac/aria-label-on-label-element.html.
     14
     15        * accessibility/AccessibilityNodeObject.cpp:
     16        (WebCore::AccessibilityNodeObject::titleElementText):
     17
    1182016-05-01  Darin Adler  <darin@apple.com>
    219
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r200290 r200318  
    12671267            String innerText = label->innerText();
    12681268           
    1269             const AtomicString& ariaLabel = labelObject->getAttribute(aria_labelAttr);
     1269            const AtomicString& ariaLabel = label->fastGetAttribute(aria_labelAttr);
    12701270            if (!ariaLabel.isEmpty())
    12711271                innerText = ariaLabel;
Note: See TracChangeset for help on using the changeset viewer.