📍 Job linux-r350-perf/blink_perf.dom complete.
See results at: https://pinpoint-dot-chromeperf.appspot.com/job/12e7ed9cc90000
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Looks good to me - just nits and maybe a test add.
// multiple are inserted or removed. As an optimization, children which are
// actually option or input elements are not included in this map.nit: `children which themselves are option or input elements`
auto it = children_descendant_counts_map_.find(nearest_ancestor_select_child);Does this need line wrapping?
{From review agent}
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
// multiple are inserted or removed. As an optimization, children which are
// actually option or input elements are not included in this map.nit: `children which themselves are option or input elements`
Done
auto it = children_descendant_counts_map_.find(nearest_ancestor_select_child);Does this need line wrapping?
Done
{From review agent}
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
Done
Consider adding a test case to explicitly validate what happens when a node is moved from being a grandchild to a direct child. This will help prevent future regressions.
```cpp
// Move input from grand-child to direct child
auto* c3i = GetElementById("c3i");
select->appendChild(c3i);
// The input is a direct child, so it shouldn't be in the map
EXPECT_FALSE(select->ChildrenDescendantCounts().Contains(c3i));
// The wrapper c3 should no longer have any inputs tracked
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_inputs, 0);
// The wrapper c3 still has its option
EXPECT_EQ(select->ChildrenDescendantCounts().at(c3).num_options, 1);
// The total number of descendant inputs should remain unchanged
EXPECT_EQ(select->NumDescendantInputs(), 2);
// Ensure the DOM and slots are still correct
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
EXPECT_EQ(c3i->AssignedSlot(), input_slot());
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Optimize HTMLSelectElement descendant tracking
Commit 1e01c3e807d05f2371faeff662a4bc1d676b0597 introduced
children_descendant_counts_map_ to track descendant options and inputs
for FilterableSelect. However, updating this map for every option
insertion/removal introduced significant overhead (hash map operations,
write barriers, and GC tracing) particularly when options are direct
children of the select.
This patch optimizes this by:
1. Skipping children_descendant_counts_map_ operations for direct
children of the select element, as they can be identified directly
without the map.
2. Only tracking and assigning select_child during ancestor walks
if FilterableSelect is enabled.
3. Updating slotting logic in select_type.cc to check for direct inputs
using IsA<HTMLInputElement> since they are no longer in the map.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |