Commit 12e739ce authored by Takayoshi Kochi's avatar Takayoshi Kochi Committed by Commit Bot

Simplify logic for <shadow> distribution.

We no longer have multiple shadow roots, <shadow> behaves almost
identical to <content> without select attribute.
We only have to care for the case when <content> and <shadow> are
used in the same shadow root.

This CL simplifies code that used to handle multiple shadow cases
for <shadow> elements in V0 distribution logic.

No visible behavioral change is expected.

Bug: 624724
Change-Id: I88f237f2d26519cd400ef13605f4b3115843b4b7
Reviewed-on: https://chromium-review.googlesource.com/923446Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Takayoshi Kochi <kochi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537592}
parent 39e3d01a
......@@ -155,18 +155,15 @@ ElementShadowV0::DestinationInsertionPointsFor(const Node* key) const {
}
void ElementShadowV0::Distribute() {
HeapVector<Member<HTMLShadowElement>, 32> shadow_insertion_points;
DistributionPool pool(element_shadow_->Host());
ShadowRoot& root = GetShadowRoot();
HTMLShadowElement* shadow_insertion_point = nullptr;
for (const auto& point : root.DescendantInsertionPoints()) {
for (const auto& point : GetShadowRoot().DescendantInsertionPoints()) {
if (!point->IsActive())
continue;
if (auto* shadow = ToHTMLShadowElementOrNull(*point)) {
DCHECK(!shadow_insertion_point);
shadow_insertion_point = shadow;
shadow_insertion_points.push_back(shadow_insertion_point);
} else {
pool.DistributeTo(point, this);
if (ElementShadow* shadow =
......@@ -178,10 +175,7 @@ void ElementShadowV0::Distribute() {
}
}
for (size_t i = shadow_insertion_points.size(); i > 0; --i) {
HTMLShadowElement* shadow_insertion_point = shadow_insertion_points[i - 1];
ShadowRoot* root = shadow_insertion_point->ContainingShadowRoot();
DCHECK(root);
if (shadow_insertion_point) {
pool.DistributeTo(shadow_insertion_point, this);
if (ElementShadow* shadow =
ShadowWhereNodeCanBeDistributedForV0(*shadow_insertion_point))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment