Skip to content
Permalink
Browse files
[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:

* TestExpectations: see webkit.org/b/177799


Canonical link: https://commits.webkit.org/194071@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Oct 3, 2017
1 parent b47b336 commit d68ea0f49a614cd15921c742d9d035a3ffc65706
Showing with 39 additions and 9 deletions.
  1. +10 −0 LayoutTests/ChangeLog
  2. +2 −0 LayoutTests/TestExpectations
  3. +20 −0 Source/WebCore/ChangeLog
  4. +7 −9 Source/WebCore/accessibility/AccessibilityTable.cpp
@@ -1,3 +1,13 @@
2017-10-03 Zalan Bujtas <zalan@apple.com>

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

Reviewed by Antti Koivisto.

* TestExpectations: see webkit.org/b/177799

2017-10-03 Daniel Bates <dabates@apple.com>

[CSP] Check policy before opening a new window to a JavaScript URL
@@ -1508,3 +1508,5 @@ webkit.org/b/166025 http/tests/fetch/fetching-same-resource-with-different-optio
imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-003.html [ ImageOnlyFailure ]

webkit.org/b/177799 accessibility/table-detection.html [ Pass Failure ]
@@ -1,3 +1,23 @@
2017-10-03 Zalan Bujtas <zalan@apple.com>

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

Reviewed by Antti Koivisto.

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):

2017-10-03 Daniel Bates <dabates@apple.com>

[CSP] Check policy before opening a new window to a JavaScript URL
@@ -100,16 +100,14 @@ HTMLTableElement* AccessibilityTable::tableElement() const
RenderTable& table = downcast<RenderTable>(*m_renderer);
if (is<HTMLTableElement>(table.element()))
return downcast<HTMLTableElement>(table.element());

table.forceSectionsRecalc();

// If the table has a display:table-row-group, then the RenderTable does not have a pointer to it's HTMLTableElement.
// We can instead find it by asking the firstSection for its parent.
RenderTableSection* firstBody = table.firstBody();
if (!firstBody || !firstBody->element())
// Try to find the table element, when the AccessibilityTable is mapped to an anonymous table renderer.
auto* firstChild = table.firstChild();
if (!firstChild || !firstChild->node())
return nullptr;

return ancestorsOfType<HTMLTableElement>(*(firstBody->element())).first();
if (is<HTMLTableElement>(*firstChild->node()))
return downcast<HTMLTableElement>(firstChild->node());
// FIXME: This might find an unrelated parent table element.
return ancestorsOfType<HTMLTableElement>(*(firstChild->node())).first();
}

bool AccessibilityTable::isDataTable() const

0 comments on commit d68ea0f

Please sign in to comment.