Index: third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp b/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
index da485a3d3d47d6d2286b033eaa6dca8dec221cbf..1994a13de8f15ba7d9a37399489fda9e8da1771a 100644 |
--- a/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
+++ b/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
@@ -739,7 +739,7 @@ TEST_F(TextAutosizerTest, ResizeAndGlyphOverflowChanged) { |
Element* html = GetDocument().body()->parentElement(); |
html->setInnerHTML( |
"<head>" |
- " <meta name='viewport' content='800'>" |
+ " <meta name='viewport' content='width=800'>" |
" <style>" |
" html { font-size:16px; font-family:'Times New Roman';}" |
" </style>" |
@@ -774,4 +774,46 @@ TEST_F(TextAutosizerTest, ResizeAndGlyphOverflowChanged) { |
IntSize(360, 640)); |
GetDocument().View()->UpdateAllLifecyclePhases(); |
} |
+ |
+TEST_F(TextAutosizerTest, LayoutViewWidthProvider) { |
+ Element* html = GetDocument().body()->parentElement(); |
+ html->setInnerHTML( |
+ "<head>" |
+ " <meta name='viewport' content='width=800'>" |
+ " <style>" |
+ " html { font-size:16px;}" |
+ " #content {margin-left: 140px;}" |
+ " </style>" |
+ "</head>" |
+ "<body>" |
+ " <div id='content'>" |
+ " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do" |
+ " eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim" |
+ " ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut" |
+ " aliquip ex ea commodo consequat. Duis aute irure dolor in" |
+ " reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla" |
+ " pariatur. Excepteur sint occaecat cupidatat non proident, sunt in" |
+ " culpa qui officia deserunt mollit anim id est laborum." |
+ " </div>" |
+ " <div id='panel'></div>" |
+ "</body>", |
+ ASSERT_NO_EXCEPTION); |
+ GetDocument().View()->UpdateAllLifecyclePhases(); |
+ |
+ Element* content = GetDocument().GetElementById("content"); |
+ // (specified font-size = 16px) * (viewport width = 800px) / |
+ // (window width = 320px) = 40px. |
+ EXPECT_FLOAT_EQ(40.f, |
+ content->GetLayoutObject()->Style()->ComputedFontSize()); |
+ |
+ GetDocument().GetElementById("panel")->setInnerHTML("insert text"); |
+ content->setInnerHTML(content->innerHTML()); |
pdr.
2017/04/20 06:25:46
Sorry I missed this before. Why is this needed?
cathiechentx
2017/04/27 10:51:42
This is to trigger layout of <div id='content'>. S
|
+ GetDocument().View()->UpdateAllLifecyclePhases(); |
+ |
+ // (specified font-size = 16px) * (viewport width = 800px) / |
+ // (window width = 320px) = 40px. |
+ EXPECT_FLOAT_EQ(40.f, |
+ content->GetLayoutObject()->Style()->ComputedFontSize()); |
+} |
+ |
} // namespace blink |