Changeset 222790 in webkit


Ignore:
Timestamp:
Oct 3, 2017 11:24:44 AM (7 years ago)
Author:
Alan Bujtas
Message:

[AX] Do not trigger redundant layout on tables.
https://bugs.webkit.org/show_bug.cgi?id=177781
<rdar://problem/34777030>

Reviewed by Antti Koivisto.

Source/WebCore:

RenderTable::forceSectionsRecalc() marks the RenderTable dirty and schedules a layout.
Every time AccessibilityTable asks for the table element (including during construction),
we end up triggering a layout. This call was added (r191357) to ensure RenderTable's m_firstBody is always
up-to-date (in case of anonymous wrapper table renderer). Instead of relying on the m_firstBody,
let's just use the first child to find the table element. The first child always points to a valid
renderer (or nullptr), while m_firstBody is the result of section computation.

Covered by existing tests.

  • accessibility/AccessibilityTable.cpp:

(WebCore::AccessibilityTable::tableElement const):

LayoutTests:

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r222788 r222790  
     12017-10-03  Zalan Bujtas  <zalan@apple.com>
     2
     3        [AX] Do not trigger redundant layout on tables.
     4        https://bugs.webkit.org/show_bug.cgi?id=177781
     5        <rdar://problem/34777030>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * TestExpectations: see webkit.org/b/177799
     10
    1112017-10-03  Daniel Bates  <dabates@apple.com>
    212
  • trunk/LayoutTests/TestExpectations

    r222778 r222790  
    15091509imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-002.html [ ImageOnlyFailure ]
    15101510imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-003.html [ ImageOnlyFailure ]
     1511
     1512webkit.org/b/177799 accessibility/table-detection.html [ Pass Failure ]
  • trunk/Source/WebCore/ChangeLog

    r222788 r222790  
     12017-10-03  Zalan Bujtas  <zalan@apple.com>
     2
     3        [AX] Do not trigger redundant layout on tables.
     4        https://bugs.webkit.org/show_bug.cgi?id=177781
     5        <rdar://problem/34777030>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        RenderTable::forceSectionsRecalc() marks the RenderTable dirty and schedules a layout.
     10        Every time AccessibilityTable asks for the table element (including during construction),
     11        we end up triggering a layout. This call was added (r191357) to ensure RenderTable's m_firstBody is always
     12        up-to-date (in case of anonymous wrapper table renderer). Instead of relying on the m_firstBody,
     13        let's just use the first child to find the table element. The first child always points to a valid
     14        renderer (or nullptr), while m_firstBody is the result of section computation.
     15
     16        Covered by existing tests.
     17
     18        * accessibility/AccessibilityTable.cpp:
     19        (WebCore::AccessibilityTable::tableElement const):
     20
    1212017-10-03  Daniel Bates  <dabates@apple.com>
    222
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r216123 r222790  
    101101    if (is<HTMLTableElement>(table.element()))
    102102        return downcast<HTMLTableElement>(table.element());
    103    
    104     table.forceSectionsRecalc();
    105 
    106     // If the table has a display:table-row-group, then the RenderTable does not have a pointer to it's HTMLTableElement.
    107     // We can instead find it by asking the firstSection for its parent.
    108     RenderTableSection* firstBody = table.firstBody();
    109     if (!firstBody || !firstBody->element())
     103    // Try to find the table element, when the AccessibilityTable is mapped to an anonymous table renderer.
     104    auto* firstChild = table.firstChild();
     105    if (!firstChild || !firstChild->node())
    110106        return nullptr;
    111    
    112     return ancestorsOfType<HTMLTableElement>(*(firstBody->element())).first();
     107    if (is<HTMLTableElement>(*firstChild->node()))
     108        return downcast<HTMLTableElement>(firstChild->node());
     109    // FIXME: This might find an unrelated parent table element.
     110    return ancestorsOfType<HTMLTableElement>(*(firstChild->node())).first();
    113111}
    114112   
Note: See TracChangeset for help on using the changeset viewer.