blob: 6cda24cf7ad8e82aaecdb16fc2bb59c85db89e01 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
namespace blink {
class LayoutViewTest : public RenderingTest {};
TEST_F(LayoutViewTest, UpdateCountersLayout) {
SetBodyInnerHTML(R"HTML(
<style>
div.incX { counter-increment: x }
div.incY { counter-increment: y }
div::before { content: counter(y) }
</style>
<div id=inc></div>
)HTML");
UpdateAllLifecyclePhasesForTest();
Element* inc = GetDocument().getElementById("inc");
inc->setAttribute("class", "incX");
GetDocument().UpdateStyleAndLayoutTree();
EXPECT_FALSE(GetDocument().View()->NeedsLayout());
UpdateAllLifecyclePhasesForTest();
inc->setAttribute("class", "incY");
GetDocument().UpdateStyleAndLayoutTree();
EXPECT_TRUE(GetDocument().View()->NeedsLayout());
}
} // namespace blink