| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/svg/LayoutSVGRoot.h" | 5 #include "core/layout/svg/LayoutSVGRoot.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/svg/LayoutSVGShape.h" | 8 #include "core/layout/svg/LayoutSVGShape.h" |
| 9 #include "core/layout/svg/SVGLayoutSupport.h" | 9 #include "core/layout/svg/SVGLayoutSupport.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 setBodyInnerHTML( | 41 setBodyInnerHTML( |
| 42 "<svg id='root' style='border: 10px solid red; width: 200px; height: 100
px; overflow: hidden' viewBox='0 0 200 100'>" | 42 "<svg id='root' style='border: 10px solid red; width: 200px; height: 100
px; overflow: hidden' viewBox='0 0 200 100'>" |
| 43 " <rect id='rect' x='80' y='80' width='100' height='100'/>" | 43 " <rect id='rect' x='80' y='80' width='100' height='100'/>" |
| 44 "</svg>"); | 44 "</svg>"); |
| 45 | 45 |
| 46 const LayoutSVGRoot* root = toLayoutSVGRoot(getLayoutObjectByElementId("root
")); | 46 const LayoutSVGRoot* root = toLayoutSVGRoot(getLayoutObjectByElementId("root
")); |
| 47 const LayoutSVGShape* svgRect = toLayoutSVGShape(getLayoutObjectByElementId(
"rect")); | 47 const LayoutSVGShape* svgRect = toLayoutSVGShape(getLayoutObjectByElementId(
"rect")); |
| 48 | 48 |
| 49 LayoutRect rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(
*svgRect, *root); | 49 LayoutRect rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(
*svgRect, *root); |
| 50 // (80, 80, 100, 100) added by root's content rect offset from border rect,
clipped by (10, 10, 200, 100). | 50 // (80, 80, 100, 100) added by root's content rect offset from border rect,
clipped by (10, 10, 200, 100). |
| 51 EXPECT_EQ(LayoutRect(90, 90, 100, 30), rect); | 51 EXPECT_EQ(LayoutRect(90, 90, 100, 20), rect); |
| 52 | 52 |
| 53 LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)->localO
verflowRectForPaintInvalidation(); | 53 LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)->localO
verflowRectForPaintInvalidation(); |
| 54 // SVG root with overflow:hidden doesn't include overflow from children, jus
t border box rect. | 54 // SVG root with overflow:hidden doesn't include overflow from children, jus
t border box rect. |
| 55 EXPECT_EQ(LayoutRect(0, 0, 220, 120), rootOverflowRect); | 55 EXPECT_EQ(LayoutRect(0, 0, 220, 120), rootOverflowRect); |
| 56 | 56 |
| 57 rect = rootOverflowRect; | 57 rect = rootOverflowRect; |
| 58 EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect)); | 58 EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect)); |
| 59 // LayoutSVGRoot should not apply overflow clip on its own rect. | 59 // LayoutSVGRoot should not apply overflow clip on its own rect. |
| 60 EXPECT_EQ(LayoutRect(0, 0, 220, 120), rect); | 60 EXPECT_EQ(LayoutRect(0, 0, 220, 120), rect); |
| 61 } | 61 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)->localO
verflowRectForPaintInvalidation(); | 77 LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)->localO
verflowRectForPaintInvalidation(); |
| 78 // SVG root doesn't have box decoration background, so just use clipped over
flow of children. | 78 // SVG root doesn't have box decoration background, so just use clipped over
flow of children. |
| 79 EXPECT_EQ(LayoutRect(80, 80, 100, 20), rootOverflowRect); | 79 EXPECT_EQ(LayoutRect(80, 80, 100, 20), rootOverflowRect); |
| 80 | 80 |
| 81 rect = rootOverflowRect; | 81 rect = rootOverflowRect; |
| 82 EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect)); | 82 EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect)); |
| 83 EXPECT_EQ(LayoutRect(80, 80, 100, 20), rect); | 83 EXPECT_EQ(LayoutRect(80, 80, 100, 20), rect); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |