Title: [222790] trunk
- Revision
- 222790
- Author
- [email protected]
- Date
- 2017-10-03 11:24:44 -0700 (Tue, 03 Oct 2017)
Log 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:
* TestExpectations: see webkit.org/b/177799
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (222789 => 222790)
--- trunk/LayoutTests/ChangeLog 2017-10-03 18:09:29 UTC (rev 222789)
+++ trunk/LayoutTests/ChangeLog 2017-10-03 18:24:44 UTC (rev 222790)
@@ -1,3 +1,13 @@
+2017-10-03 Zalan Bujtas <[email protected]>
+
+ [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 <[email protected]>
[CSP] Check policy before opening a new window to a _javascript_ URL
Modified: trunk/LayoutTests/TestExpectations (222789 => 222790)
--- trunk/LayoutTests/TestExpectations 2017-10-03 18:09:29 UTC (rev 222789)
+++ trunk/LayoutTests/TestExpectations 2017-10-03 18:24:44 UTC (rev 222790)
@@ -1508,3 +1508,5 @@
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 ]
Modified: trunk/Source/WebCore/ChangeLog (222789 => 222790)
--- trunk/Source/WebCore/ChangeLog 2017-10-03 18:09:29 UTC (rev 222789)
+++ trunk/Source/WebCore/ChangeLog 2017-10-03 18:24:44 UTC (rev 222790)
@@ -1,3 +1,23 @@
+2017-10-03 Zalan Bujtas <[email protected]>
+
+ [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 <[email protected]>
[CSP] Check policy before opening a new window to a _javascript_ URL
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (222789 => 222790)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2017-10-03 18:09:29 UTC (rev 222789)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2017-10-03 18:24:44 UTC (rev 222790)
@@ -100,16 +100,14 @@
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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes