blob: d76321fad3bd9948c5a6de26ac4dabd34f2c5a5a [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");
GetDocument().View()->UpdateAllLifecyclePhases();
Element* inc = GetDocument().getElementById("inc");
inc->setAttribute("class", "incX");
GetDocument().UpdateStyleAndLayoutTree();
EXPECT_FALSE(GetDocument().View()->NeedsLayout());
GetDocument().View()->UpdateAllLifecyclePhases();
inc->setAttribute("class", "incY");
GetDocument().UpdateStyleAndLayoutTree();
EXPECT_TRUE(GetDocument().View()->NeedsLayout());
}
} // namespace blink