OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/LayoutBlockFlow.h" | 5 #include "core/layout/LayoutBlockFlow.h" |
6 #include "core/layout/LayoutMultiColumnFlowThread.h" | 6 #include "core/layout/LayoutMultiColumnFlowThread.h" |
7 | 7 |
8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 "</div>"); | 83 "</div>"); |
84 EXPECT_EQ(0, strutForBox("img1")); | 84 EXPECT_EQ(0, strutForBox("img1")); |
85 EXPECT_EQ(50, strutForBox("img2")); | 85 EXPECT_EQ(50, strutForBox("img2")); |
86 } | 86 } |
87 | 87 |
88 TEST_F(PaginationStrutTest, BreakBefore) | 88 TEST_F(PaginationStrutTest, BreakBefore) |
89 { | 89 { |
90 setBodyInnerHTML( | 90 setBodyInnerHTML( |
91 "<div style='overflow:-webkit-paged-y; height:400px; line-height:50px;'>
" | 91 "<div style='overflow:-webkit-paged-y; height:400px; line-height:50px;'>
" |
92 " <div id='block1'>line1</div>" | 92 " <div id='block1'>line1</div>" |
93 " <div id='block2' style='-webkit-column-break-before:always;'>line2<
/div>" | 93 " <div id='block2' style='break-before:page;'>line2</div>" |
94 "</div>"); | 94 "</div>"); |
95 EXPECT_EQ(0, strutForBox("block1")); | 95 EXPECT_EQ(0, strutForBox("block1")); |
96 EXPECT_EQ(0, strutForLine("block1", 0)); | 96 EXPECT_EQ(0, strutForLine("block1", 0)); |
97 EXPECT_EQ(350, strutForBox("block2")); | 97 EXPECT_EQ(350, strutForBox("block2")); |
98 EXPECT_EQ(0, strutForLine("block2", 0)); | 98 EXPECT_EQ(0, strutForLine("block2", 0)); |
99 } | 99 } |
100 | 100 |
101 TEST_F(PaginationStrutTest, BlockWithStrutPropagatedFromInnerBlock) | 101 TEST_F(PaginationStrutTest, BlockWithStrutPropagatedFromInnerBlock) |
102 { | 102 { |
103 setBodyInnerHTML( | 103 setBodyInnerHTML( |
104 "<div style='overflow:-webkit-paged-y; height:200px; line-height:150px;'
>" | 104 "<div style='overflow:-webkit-paged-y; height:200px; line-height:150px;'
>" |
105 " <div id='block1'>line1</div>" | 105 " <div id='block1'>line1</div>" |
106 " <div id='block2' style='padding-top:2px;'>" | 106 " <div id='block2' style='padding-top:2px;'>" |
107 " <div id='innerBlock' style='padding-top:2px;'>line2</div>" | 107 " <div id='innerBlock' style='padding-top:2px;'>line2</div>" |
108 " </div>" | 108 " </div>" |
109 "</div>"); | 109 "</div>"); |
110 EXPECT_EQ(0, strutForBox("block1")); | 110 EXPECT_EQ(0, strutForBox("block1")); |
111 EXPECT_EQ(0, strutForLine("block1", 0)); | 111 EXPECT_EQ(0, strutForLine("block1", 0)); |
112 EXPECT_EQ(50, strutForBox("block2")); | 112 EXPECT_EQ(50, strutForBox("block2")); |
113 EXPECT_EQ(0, strutForBox("innerBlock")); | 113 EXPECT_EQ(0, strutForBox("innerBlock")); |
114 EXPECT_EQ(0, strutForLine("innerBlock", 0)); | 114 EXPECT_EQ(0, strutForLine("innerBlock", 0)); |
115 } | 115 } |
116 | 116 |
117 TEST_F(PaginationStrutTest, BlockWithStrutPropagatedFromUnbreakableInnerBlock) | 117 TEST_F(PaginationStrutTest, BlockWithStrutPropagatedFromUnbreakableInnerBlock) |
118 { | 118 { |
119 setBodyInnerHTML( | 119 setBodyInnerHTML( |
120 "<div style='overflow:-webkit-paged-y; height:400px; line-height:150px;'
>" | 120 "<div style='overflow:-webkit-paged-y; height:400px; line-height:150px;'
>" |
121 " <div id='block1'>line1</div>" | 121 " <div id='block1'>line1</div>" |
122 " <div id='block2' style='padding-top:2px;'>" | 122 " <div id='block2' style='padding-top:2px;'>" |
123 " <div id='innerBlock' style='padding-top:2px; -webkit-column-bre
ak-inside:avoid;'>" | 123 " <div id='innerBlock' style='padding-top:2px; break-inside:avoid
;'>" |
124 " line2<br>" | 124 " line2<br>" |
125 " line3<br>" | 125 " line3<br>" |
126 " </div>" | 126 " </div>" |
127 " </div>" | 127 " </div>" |
128 "</div>"); | 128 "</div>"); |
129 EXPECT_EQ(0, strutForBox("block1")); | 129 EXPECT_EQ(0, strutForBox("block1")); |
130 EXPECT_EQ(0, strutForLine("block1", 0)); | 130 EXPECT_EQ(0, strutForLine("block1", 0)); |
131 EXPECT_EQ(250, strutForBox("block2")); | 131 EXPECT_EQ(250, strutForBox("block2")); |
132 EXPECT_EQ(0, strutForBox("innerBlock")); | 132 EXPECT_EQ(0, strutForBox("innerBlock")); |
133 EXPECT_EQ(0, strutForLine("innerBlock", 0)); | 133 EXPECT_EQ(0, strutForLine("innerBlock", 0)); |
134 EXPECT_EQ(0, strutForLine("innerBlock", 1)); | 134 EXPECT_EQ(0, strutForLine("innerBlock", 1)); |
135 } | 135 } |
136 | 136 |
137 TEST_F(PaginationStrutTest, InnerBlockWithBreakBefore) | 137 TEST_F(PaginationStrutTest, InnerBlockWithBreakBefore) |
138 { | 138 { |
139 setBodyInnerHTML( | 139 setBodyInnerHTML( |
140 "<div style='overflow:-webkit-paged-y; height:200px; line-height:150px;'
>" | 140 "<div style='overflow:-webkit-paged-y; height:200px; line-height:150px;'
>" |
141 " <div id='block1'>line1</div>" | 141 " <div id='block1'>line1</div>" |
142 " <div id='block2' style='padding-top:2px;'>" | 142 " <div id='block2' style='padding-top:2px;'>" |
143 " <div id='innerBlock' style='padding-top:2px; -webkit-column-bre
ak-before:always;'>line2</div>" | 143 " <div id='innerBlock' style='padding-top:2px; break-before:page;
'>line2</div>" |
144 " </div>" | 144 " </div>" |
145 "</div>"); | 145 "</div>"); |
146 EXPECT_EQ(0, strutForBox("block1")); | 146 EXPECT_EQ(0, strutForBox("block1")); |
147 EXPECT_EQ(0, strutForLine("block1", 0)); | 147 EXPECT_EQ(0, strutForLine("block1", 0)); |
148 EXPECT_EQ(0, strutForBox("block2")); | 148 EXPECT_EQ(0, strutForBox("block2")); |
149 EXPECT_EQ(48, strutForBox("innerBlock")); | 149 EXPECT_EQ(48, strutForBox("innerBlock")); |
150 EXPECT_EQ(0, strutForLine("innerBlock", 0)); | 150 EXPECT_EQ(0, strutForLine("innerBlock", 0)); |
151 } | 151 } |
152 | 152 |
153 } // namespace blink | 153 } // namespace blink |
OLD | NEW |