Commit 59bfd3e6 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

ScheduleLayoutTreeUpdate for dirty slot assignments.

We did not schedule a visual update for dirty slot assignments. If
adding a host child is the only thing that happened for a frame, we
would not run the lifecycle update.

Bug: 1137711
Change-Id: Icd3fe88999129e56c7c6eaa5174f4a89ac4df6c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485099Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818804}
parent 2e4555c8
...@@ -232,6 +232,7 @@ void SlotAssignment::SetNeedsAssignmentRecalc() { ...@@ -232,6 +232,7 @@ void SlotAssignment::SetNeedsAssignmentRecalc() {
if (owner_->isConnected()) { if (owner_->isConnected()) {
owner_->GetDocument().GetSlotAssignmentEngine().AddShadowRootNeedingRecalc( owner_->GetDocument().GetSlotAssignmentEngine().AddShadowRootNeedingRecalc(
*owner_); *owner_);
owner_->GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
} }
} }
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
#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/text.h" #include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/html/html_collection.h" #include "third_party/blink/renderer/core/html/html_collection.h"
#include "third_party/blink/renderer/core/html/html_element.h" #include "third_party/blink/renderer/core/html/html_div_element.h"
#include "third_party/blink/renderer/core/html/html_slot_element.h" #include "third_party/blink/renderer/core/html/html_slot_element.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h" #include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
...@@ -164,4 +165,23 @@ TEST_F(SlotAssignmentTest, AssignedNodesAreSet) { ...@@ -164,4 +165,23 @@ TEST_F(SlotAssignmentTest, AssignedNodesAreSet) {
EXPECT_EQ(expected_nodes, slot->AssignedNodes()); EXPECT_EQ(expected_nodes, slot->AssignedNodes());
} }
TEST_F(SlotAssignmentTest, ScheduleVisualUpdate) {
SetBody(R"HTML(
<div id="host">
<shadowroot>
<slot></slot>
</shadowroot>
<div></div>
</div>
)HTML");
GetDocument().View()->UpdateAllLifecyclePhases(DocumentUpdateReason::kTest);
GetDocument().View()->RunPostLifecycleSteps();
auto* div = MakeGarbageCollected<HTMLDivElement>(GetDocument());
GetDocument().getElementById("host")->appendChild(div);
EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending,
GetDocument().Lifecycle().GetState());
}
} // namespace blink } // namespace blink
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