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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp

Issue 2519103002: SVGRoot's writing-mode should not affect SVGText/SVGForeign's location (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/LayoutBox.h" 5 #include "core/layout/LayoutBox.h"
6 6
7 #include "core/html/HTMLElement.h" 7 #include "core/html/HTMLElement.h"
8 #include "core/layout/ImageQualityController.h" 8 #include "core/layout/ImageQualityController.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 const LayoutBox* row2 = toLayoutBox(getLayoutObjectByElementId("row2")); 176 const LayoutBox* row2 = toLayoutBox(getLayoutObjectByElementId("row2"));
177 EXPECT_EQ(LayoutPoint(100, 0), row2->location()); 177 EXPECT_EQ(LayoutPoint(100, 0), row2->location());
178 EXPECT_EQ(LayoutPoint(0, 0), row2->topLeftLocation()); 178 EXPECT_EQ(LayoutPoint(0, 0), row2->topLeftLocation());
179 179
180 const LayoutBox* cell2 = toLayoutBox(getLayoutObjectByElementId("cell2")); 180 const LayoutBox* cell2 = toLayoutBox(getLayoutObjectByElementId("cell2"));
181 EXPECT_EQ(LayoutPoint(100, 0), cell2->location()); 181 EXPECT_EQ(LayoutPoint(100, 0), cell2->location());
182 EXPECT_EQ(LayoutPoint(0, 0), cell2->topLeftLocation()); 182 EXPECT_EQ(LayoutPoint(0, 0), cell2->topLeftLocation());
183 } 183 }
184 184
185 TEST_F(LayoutBoxTest, LocationContainerOfSVG) {
186 setBodyInnerHTML(
187 "<svg id='svg' style='writing-mode:vertical-rl' width='500' height='500'>"
188 " <foreignObject x='44' y='77' width='100' height='80' id='foreign'>"
189 " <div id='child' style='width: 33px; height: 55px'>"
190 " </div>"
191 " </foreignObject>"
192 "</svg>");
193 const LayoutBox* svgRoot = toLayoutBox(getLayoutObjectByElementId("svg"));
194 const LayoutBox* foreign = toLayoutBox(getLayoutObjectByElementId("foreign"));
195 const LayoutBox* child = toLayoutBox(getLayoutObjectByElementId("child"));
196
197 EXPECT_EQ(document().body()->layoutObject(), svgRoot->locationContainer());
198
199 // The foreign object's location is not affected by SVGRoot's writing-mode.
200 EXPECT_FALSE(foreign->locationContainer());
201 EXPECT_EQ(LayoutRect(44, 77, 100, 80), foreign->frameRect());
202 EXPECT_EQ(LayoutPoint(44, 77), foreign->topLeftLocation());
203 // The writing mode style should be still be inherited.
204 EXPECT_TRUE(foreign->hasFlippedBlocksWritingMode());
205
206 // The child of the foreign object is affected by writing-mode.
207 EXPECT_EQ(foreign, child->locationContainer());
208 EXPECT_EQ(LayoutRect(0, 0, 33, 55), child->frameRect());
209 EXPECT_EQ(LayoutPoint(67, 0), child->topLeftLocation());
210 EXPECT_TRUE(child->hasFlippedBlocksWritingMode());
211 }
212
185 } // namespace blink 213 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698