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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGRootTest.cpp

Issue 2465983002: Rename "paint invalidation rect" etc. to "visual rect". (Closed)
Patch Set: - Created 4 years, 1 month 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/svg/LayoutSVGRootTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRootTest.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRootTest.cpp
index 7bec8fe8c1dbf82cc04d2c94ec6eba1686b9bc17..137969cc24bd0dec0c25f387a55405c715180f06 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRootTest.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRootTest.cpp
@@ -13,89 +13,86 @@ namespace blink {
using LayoutSVGRootTest = RenderingTest;
-TEST_F(LayoutSVGRootTest, OverflowRectMappingWithoutViewportClipWithBorder) {
+TEST_F(LayoutSVGRootTest, VisualRectMappingWithoutViewportClipWithBorder) {
setBodyInnerHTML(
"<svg id='root' style='border: 10px solid red; width: 200px; height: "
"100px; overflow: visible' viewBox='0 0 200 100'>"
" <rect id='rect' x='80' y='80' width='100' height='100'/>"
"</svg>");
- const LayoutSVGRoot* root =
- toLayoutSVGRoot(getLayoutObjectByElementId("root"));
- const LayoutSVGShape* svgRect =
- toLayoutSVGShape(getLayoutObjectByElementId("rect"));
+ const LayoutSVGRoot& root =
+ *toLayoutSVGRoot(getLayoutObjectByElementId("root"));
+ const LayoutSVGShape& svgRect =
+ *toLayoutSVGShape(getLayoutObjectByElementId("rect"));
- LayoutRect rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(
- *svgRect, *root);
+ LayoutRect rect = SVGLayoutSupport::visualRectInAncestorSpace(svgRect, root);
// (80, 80, 100, 100) added by root's content rect offset from border rect,
// not clipped.
EXPECT_EQ(LayoutRect(90, 90, 100, 100), rect);
- LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)
- ->localOverflowRectForPaintInvalidation();
+ LayoutRect rootVisualRect =
+ static_cast<const LayoutObject&>(root).localVisualRect();
// SVG root's overflow includes overflow from descendants.
- EXPECT_EQ(LayoutRect(0, 0, 220, 190), rootOverflowRect);
+ EXPECT_EQ(LayoutRect(0, 0, 220, 190), rootVisualRect);
- rect = rootOverflowRect;
- EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect));
+ rect = rootVisualRect;
+ EXPECT_TRUE(root.mapToVisualRectInAncestorSpace(&root, rect));
EXPECT_EQ(LayoutRect(0, 0, 220, 190), rect);
}
-TEST_F(LayoutSVGRootTest, OverflowRectMappingWithViewportClipAndBorder) {
+TEST_F(LayoutSVGRootTest, VisualRectMappingWithViewportClipAndBorder) {
setBodyInnerHTML(
"<svg id='root' style='border: 10px solid red; width: 200px; height: "
"100px; overflow: hidden' viewBox='0 0 200 100'>"
" <rect id='rect' x='80' y='80' width='100' height='100'/>"
"</svg>");
- const LayoutSVGRoot* root =
- toLayoutSVGRoot(getLayoutObjectByElementId("root"));
- const LayoutSVGShape* svgRect =
- toLayoutSVGShape(getLayoutObjectByElementId("rect"));
+ const LayoutSVGRoot& root =
+ *toLayoutSVGRoot(getLayoutObjectByElementId("root"));
+ const LayoutSVGShape& svgRect =
+ *toLayoutSVGShape(getLayoutObjectByElementId("rect"));
- LayoutRect rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(
- *svgRect, *root);
+ LayoutRect rect = SVGLayoutSupport::visualRectInAncestorSpace(svgRect, root);
// (80, 80, 100, 100) added by root's content rect offset from border rect,
// clipped by (10, 10, 200, 100).
EXPECT_EQ(LayoutRect(90, 90, 100, 20), rect);
- LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)
- ->localOverflowRectForPaintInvalidation();
+ LayoutRect rootVisualRect =
+ static_cast<const LayoutObject&>(root).localVisualRect();
// SVG root with overflow:hidden doesn't include overflow from children, just
// border box rect.
- EXPECT_EQ(LayoutRect(0, 0, 220, 120), rootOverflowRect);
+ EXPECT_EQ(LayoutRect(0, 0, 220, 120), rootVisualRect);
- rect = rootOverflowRect;
- EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect));
+ rect = rootVisualRect;
+ EXPECT_TRUE(root.mapToVisualRectInAncestorSpace(&root, rect));
// LayoutSVGRoot should not apply overflow clip on its own rect.
EXPECT_EQ(LayoutRect(0, 0, 220, 120), rect);
}
-TEST_F(LayoutSVGRootTest, OverflowRectMappingWithViewportClipWithoutBorder) {
+TEST_F(LayoutSVGRootTest, VisualRectMappingWithViewportClipWithoutBorder) {
setBodyInnerHTML(
"<svg id='root' style='width: 200px; height: 100px; overflow: hidden' "
"viewBox='0 0 200 100'>"
" <rect id='rect' x='80' y='80' width='100' height='100'/>"
"</svg>");
- const LayoutSVGRoot* root =
- toLayoutSVGRoot(getLayoutObjectByElementId("root"));
- const LayoutSVGShape* svgRect =
- toLayoutSVGShape(getLayoutObjectByElementId("rect"));
+ const LayoutSVGRoot& root =
+ *toLayoutSVGRoot(getLayoutObjectByElementId("root"));
+ const LayoutSVGShape& svgRect =
+ *toLayoutSVGShape(getLayoutObjectByElementId("rect"));
- LayoutRect rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(
- *svgRect, *root);
+ LayoutRect rect = SVGLayoutSupport::visualRectInAncestorSpace(svgRect, root);
// (80, 80, 100, 100) clipped by (0, 0, 200, 100).
EXPECT_EQ(LayoutRect(80, 80, 100, 20), rect);
- LayoutRect rootOverflowRect = static_cast<const LayoutObject*>(root)
- ->localOverflowRectForPaintInvalidation();
+ LayoutRect rootVisualRect =
+ static_cast<const LayoutObject&>(root).localVisualRect();
// SVG root doesn't have box decoration background, so just use clipped
// overflow of children.
- EXPECT_EQ(LayoutRect(80, 80, 100, 20), rootOverflowRect);
+ EXPECT_EQ(LayoutRect(80, 80, 100, 20), rootVisualRect);
- rect = rootOverflowRect;
- EXPECT_TRUE(root->mapToVisualRectInAncestorSpace(root, rect));
+ rect = rootVisualRect;
+ EXPECT_TRUE(root.mapToVisualRectInAncestorSpace(&root, rect));
EXPECT_EQ(LayoutRect(80, 80, 100, 20), rect);
}

Powered by Google App Engine
This is Rietveld 408576698