| Index: third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
|
| index a12acfb5202b02d252c807ee3203cf5d7b79e957..013e6fca70ee97ac6624d6d032e80482f4efaa2e 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "core/dom/ElementTraversal.h"
|
| #include "core/layout/LayoutBlock.h"
|
|
|
| #include "core/layout/LayoutBlockFlow.h"
|
| @@ -20,4 +21,33 @@ TEST_F(LayoutBlockTest, LayoutNameCalledWithNullStyle) {
|
| obj->destroy();
|
| }
|
|
|
| +TEST_F(LayoutBlockTest, WidthAvailableToChildrenChanged) {
|
| + RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false);
|
| + setBodyInnerHTML(
|
| + "<!DOCTYPE html>"
|
| + "<div id='list' style='overflow-y:auto; width:150px; height:100px'>"
|
| + " <div style='height:20px'>Item</div>"
|
| + " <div style='height:20px'>Item</div>"
|
| + " <div style='height:20px'>Item</div>"
|
| + " <div style='height:20px'>Item</div>"
|
| + " <div style='height:20px'>Item</div>"
|
| + " <div style='height:20px'>Item</div>"
|
| + "</div>");
|
| + Element* listElement = document().getElementById("list");
|
| + ASSERT_TRUE(listElement);
|
| + LayoutBox* listBox = toLayoutBox(listElement->layoutObject());
|
| + Element* itemElement = ElementTraversal::firstChild(*listElement);
|
| + ASSERT_TRUE(itemElement);
|
| + ASSERT_GT(listBox->verticalScrollbarWidth(), 0);
|
| + ASSERT_EQ(itemElement->offsetWidth(),
|
| + 150 - listBox->verticalScrollbarWidth());
|
| +
|
| + DummyExceptionStateForTesting exceptionState;
|
| + listElement->style()->setCSSText("width:150px;height:100px;", exceptionState);
|
| + ASSERT_FALSE(exceptionState.hadException());
|
| + document().view()->updateAllLifecyclePhases();
|
| + ASSERT_EQ(listBox->verticalScrollbarWidth(), 0);
|
| + ASSERT_EQ(itemElement->offsetWidth(), 150);
|
| +}
|
| +
|
| } // namespace blink
|
|
|