Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc

Issue 2727263003: [LayoutNG] Fix orthogonal writing mode with abs/fixed descendants. (Closed)
Patch Set: fix comment. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc
index b4cfa988cc5fc65aa46f8945a4a904e9b625a870..c2b0ba66fab33c2c8788037916dc462c3896def6 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc
@@ -78,5 +78,84 @@ TEST_F(NGOutOfFlowLayoutPartTest, FixedInsideAbs) {
// fixed2 top is positioned: #fixed2.top
EXPECT_EQ(fixed_2->offsetTop(), LayoutUnit(9));
};
-}
-}
+
+TEST_F(NGOutOfFlowLayoutPartTest, OrthogonalWritingMode1) {
+ setBodyInnerHTML(
+ R"HTML(
+ <style>
+ #container {
+ position: relative;
+ writing-mode: horizontal-tb;
+ width: 200px;
+ height: 400px;
+ }
+ #abs-child {
+ position: absolute;
+ top: 10px;
+ writing-mode: vertical-rl;
+ width: auto;
+ height: 30px;
+ }
+ </style>
+ <div id="container">
+ <div id="abs-child"></div>
+ </div>
+ )HTML");
+
+ LayoutNGBlockFlow* block_flow =
+ toLayoutNGBlockFlow(getLayoutObjectByElementId("container"));
+ auto* node = new NGBlockNode(block_flow);
+ RefPtr<NGConstraintSpace> space =
+ NGConstraintSpace::CreateFromLayoutObject(*block_flow);
+
+ RefPtr<const NGPhysicalFragment> fragment =
+ node->Layout(space.get())->PhysicalFragment();
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(200), LayoutUnit(400)), fragment->Size());
+
+ fragment = toNGPhysicalBoxFragment(fragment.get())->Children()[0];
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(0), LayoutUnit(30)), fragment->Size());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(0), LayoutUnit(10)),
+ fragment->Offset());
+};
+
+TEST_F(NGOutOfFlowLayoutPartTest, OrthogonalWritingMode2) {
+ setBodyInnerHTML(
+ R"HTML(
+ <style>
+ #container {
+ position: relative;
+ writing-mode: horizontal-tb;
+ width: 200px;
+ height: 400px;
+ }
+ #abs-child {
+ position: absolute;
+ top: 10px;
+ writing-mode: vertical-rl;
+ width: 20%;
+ height: 30px;
+ }
+ </style>
+ <div id="container">
+ <div id="abs-child"></div>
+ </div>
+ )HTML");
+
+ LayoutNGBlockFlow* block_flow =
+ toLayoutNGBlockFlow(getLayoutObjectByElementId("container"));
+ auto* node = new NGBlockNode(block_flow);
+ RefPtr<NGConstraintSpace> space =
+ NGConstraintSpace::CreateFromLayoutObject(*block_flow);
+
+ RefPtr<const NGPhysicalFragment> fragment =
+ node->Layout(space.get())->PhysicalFragment();
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(200), LayoutUnit(400)), fragment->Size());
+
+ fragment = toNGPhysicalBoxFragment(fragment.get())->Children()[0];
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(40), LayoutUnit(30)), fragment->Size());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(0), LayoutUnit(10)),
+ fragment->Offset());
+};
+
+} // namespace
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698