Commit 9cd83640 authored by Hayato Ito's avatar Hayato Ito Committed by Commit Bot

Disallow recursive recalc slot assignment

This CL is separated out from the wip CL, https://crrev.com/c/1350441,
where recursive recalc slot assignment causes the tricky bug which is
hard to debug.

It would be better to detect recursive recalc slot assignment, which
shouldn't happen.

Change-Id: I07d2d22ea8e083ef1de5134d6879cb1a141ce183

BUG=906494

Change-Id: I07d2d22ea8e083ef1de5134d6879cb1a141ce183
Reviewed-on: https://chromium-review.googlesource.com/c/1354727Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612098}
parent 495c4fed
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/core/dom/node_traversal.h" #include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/dom/slot_assignment_engine.h" #include "third_party/blink/renderer/core/dom/slot_assignment_engine.h"
#include "third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h"
#include "third_party/blink/renderer/core/html/forms/html_opt_group_element.h" #include "third_party/blink/renderer/core/html/forms/html_opt_group_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_element.h" #include "third_party/blink/renderer/core/html/forms/html_select_element.h"
#include "third_party/blink/renderer/core/html/html_details_element.h" #include "third_party/blink/renderer/core/html/html_details_element.h"
...@@ -226,6 +227,9 @@ void SlotAssignment::RecalcAssignment() { ...@@ -226,6 +227,9 @@ void SlotAssignment::RecalcAssignment() {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
DCHECK(!owner_->GetDocument().IsSlotAssignmentRecalcForbidden()); DCHECK(!owner_->GetDocument().IsSlotAssignmentRecalcForbidden());
#endif #endif
// To detect recursive RecalcAssignment, which shouldn't happen.
SlotAssignmentRecalcForbiddenScope forbid_slot_recalc(owner_->GetDocument());
needs_assignment_recalc_ = false; needs_assignment_recalc_ = false;
for (Member<HTMLSlotElement> slot : Slots()) for (Member<HTMLSlotElement> slot : Slots())
......
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