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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2504573002: Don't call isURLAllowed() from layout. (Closed)
Patch Set: Fix everything 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 unified diff | Download patch
OLDNEW
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/LayoutTestHelper.h" 5 #include "core/layout/LayoutTestHelper.h"
6 #include "core/layout/LayoutTreeAsText.h" 6 #include "core/layout/LayoutTreeAsText.h"
7 #include "core/layout/api/LayoutViewItem.h" 7 #include "core/layout/api/LayoutViewItem.h"
8 #include "core/paint/ObjectPaintProperties.h" 8 #include "core/paint/ObjectPaintProperties.h"
9 #include "core/paint/PaintPropertyTreePrinter.h" 9 #include "core/paint/PaintPropertyTreePrinter.h"
10 #include "platform/graphics/paint/GeometryMapper.h" 10 #include "platform/graphics/paint/GeometryMapper.h"
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 23), // (bottom left) = max((78, 78) - (60, 55), (0, 0)) 951 23), // (bottom left) = max((78, 78) - (60, 55), (0, 0))
952 FloatSize(6, 952 FloatSize(6,
953 1)), // (bottom right) = max((56, 56) - (50, 55), (0, 0)) 953 1)), // (bottom right) = max((56, 56) - (50, 55), (0, 0))
954 borderRadiusClip->clipRect()); 954 borderRadiusClip->clipRect());
955 EXPECT_EQ(frameContentClip(), borderRadiusClip->parent()); 955 EXPECT_EQ(frameContentClip(), borderRadiusClip->parent());
956 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 610, 500), &div, 956 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 610, 500), &div,
957 document().view()->layoutView()); 957 document().view()->layoutView());
958 } 958 }
959 959
960 TEST_P(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes) { 960 TEST_P(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes) {
961 setChildFrameHTML(
962 "<style>body { margin: 0; }</style><div id='transform' style='transform: "
963 "translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>");
964
961 setBodyInnerHTML( 965 setBodyInnerHTML(
962 "<style>body { margin: 0; }</style>" 966 "<style>body { margin: 0; }</style>"
963 "<div id='divWithTransform' style='transform: translate3d(1px, 2px, " 967 "<div id='divWithTransform' style='transform: translate3d(1px, 2px, "
964 "3px);'>" 968 "3px);'>"
965 " <iframe style='border: 7px solid black' id='frame'></iframe>" 969 " <iframe style='border: 7px solid black'></iframe>"
966 "</div>"); 970 "</div>");
967 Document& frameDocument = setupChildIframe(
968 "frame",
969 "<style>body { margin: 0; }</style><div id='transform' style='transform: "
970 "translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>");
971 FrameView* frameView = document().view(); 971 FrameView* frameView = document().view();
972 frameView->updateAllLifecyclePhases(); 972 frameView->updateAllLifecyclePhases();
973 973
974 LayoutObject* divWithTransform = 974 LayoutObject* divWithTransform =
975 document().getElementById("divWithTransform")->layoutObject(); 975 document().getElementById("divWithTransform")->layoutObject();
976 const ObjectPaintProperties* divWithTransformProperties = 976 const ObjectPaintProperties* divWithTransformProperties =
977 divWithTransform->paintProperties(); 977 divWithTransform->paintProperties();
978 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), 978 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3),
979 divWithTransformProperties->transform()->matrix()); 979 divWithTransformProperties->transform()->matrix());
980 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform, 980 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform,
981 frameView->layoutView()); 981 frameView->layoutView());
982 982
983 LayoutObject* innerDivWithTransform = 983 LayoutObject* innerDivWithTransform =
984 frameDocument.getElementById("transform")->layoutObject(); 984 childDocument().getElementById("transform")->layoutObject();
985 const ObjectPaintProperties* innerDivWithTransformProperties = 985 const ObjectPaintProperties* innerDivWithTransformProperties =
986 innerDivWithTransform->paintProperties(); 986 innerDivWithTransform->paintProperties();
987 auto* innerDivTransform = innerDivWithTransformProperties->transform(); 987 auto* innerDivTransform = innerDivWithTransformProperties->transform();
988 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), 988 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6),
989 innerDivTransform->matrix()); 989 innerDivTransform->matrix());
990 CHECK_EXACT_VISUAL_RECT(LayoutRect(12, 14, 100, 145), innerDivWithTransform, 990 CHECK_EXACT_VISUAL_RECT(LayoutRect(12, 14, 100, 145), innerDivWithTransform,
991 frameView->layoutView()); 991 frameView->layoutView());
992 992
993 // Ensure that the inner div's transform is correctly rooted in the root 993 // Ensure that the inner div's transform is correctly rooted in the root
994 // frame's transform tree. 994 // frame's transform tree.
995 // This asserts that we have the following tree structure: 995 // This asserts that we have the following tree structure:
996 // ... 996 // ...
997 // Transform transform=translation=1.000000,2.000000,3.000000 997 // Transform transform=translation=1.000000,2.000000,3.000000
998 // PreTranslation transform=translation=7.000000,7.000000,0.000000 998 // PreTranslation transform=translation=7.000000,7.000000,0.000000
999 // ScrollTranslation transform=translation=0.000000,0.000000,0.000000 999 // ScrollTranslation transform=translation=0.000000,0.000000,0.000000
1000 // Transform transform=translation=4.000000,5.000000,6.000000 1000 // Transform transform=translation=4.000000,5.000000,6.000000
1001 auto* innerDocumentScrollTranslation = innerDivTransform->parent(); 1001 auto* innerDocumentScrollTranslation = innerDivTransform->parent();
1002 EXPECT_EQ(TransformationMatrix().translate3d(0, 0, 0), 1002 EXPECT_EQ(TransformationMatrix().translate3d(0, 0, 0),
1003 innerDocumentScrollTranslation->matrix()); 1003 innerDocumentScrollTranslation->matrix());
1004 auto* iframePreTranslation = innerDocumentScrollTranslation->parent(); 1004 auto* iframePreTranslation = innerDocumentScrollTranslation->parent();
1005 EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0), 1005 EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0),
1006 iframePreTranslation->matrix()); 1006 iframePreTranslation->matrix());
1007 EXPECT_EQ(divWithTransformProperties->transform(), 1007 EXPECT_EQ(divWithTransformProperties->transform(),
1008 iframePreTranslation->parent()); 1008 iframePreTranslation->parent());
1009 } 1009 }
1010 1010
1011 TEST_P(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes) { 1011 TEST_P(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes) {
1012 setChildFrameHTML(
1013 "<style>body { margin: 31px; }</style><div "
1014 "id='transform' style='transform: translate3d(7px, 8px, "
1015 "9px); width: 100px; height: 200px'></div>");
1012 setBodyInnerHTML( 1016 setBodyInnerHTML(
1013 "<style>body { margin: 0; }</style>" 1017 "<style>body { margin: 0; }</style>"
1014 "<div id='divWithTransform' style='transform: translate3d(1px, 2px, " 1018 "<div id='divWithTransform' style='transform: translate3d(1px, 2px, "
1015 "3px);'>" 1019 "3px);'>"
1016 " <iframe id='frame' style='transform: translate3d(4px, 5px, 6px); " 1020 " <iframe style='transform: translate3d(4px, 5px, 6px); "
1017 "border: 42px solid; margin: 7px;'></iframe>" 1021 "border: 42px solid; margin: 7px;'></iframe>"
1018 "</div>"); 1022 "</div>");
1019 Document& frameDocument =
1020 setupChildIframe("frame",
1021 "<style>body { margin: 31px; }</style><div "
1022 "id='transform' style='transform: translate3d(7px, 8px, "
1023 "9px); width: 100px; height: 200px'></div>");
1024 FrameView* frameView = document().view(); 1023 FrameView* frameView = document().view();
1025 frameView->updateAllLifecyclePhases(); 1024 frameView->updateAllLifecyclePhases();
1026 1025
1027 // Assert that we have the following tree structure: 1026 // Assert that we have the following tree structure:
1028 // ... 1027 // ...
1029 // Transform transform=translation=1.000000,2.000000,3.000000 1028 // Transform transform=translation=1.000000,2.000000,3.000000
1030 // PaintOffsetTranslation transform=translation=7.000000,7.000000,0.000000 1029 // PaintOffsetTranslation transform=translation=7.000000,7.000000,0.000000
1031 // Transform transform=translation=4.000000,5.000000,6.000000 1030 // Transform transform=translation=4.000000,5.000000,6.000000
1032 // PreTranslation transform=translation=42.000000,42.000000,0.000000 1031 // PreTranslation transform=translation=42.000000,42.000000,0.000000
1033 // ScrollTranslation transform=translation=0.000000,0.000000,0.00000 1032 // ScrollTranslation transform=translation=0.000000,0.000000,0.00000
1034 // PaintOffsetTranslation transform=translation=31.00,31.00,0.00 1033 // PaintOffsetTranslation transform=translation=31.00,31.00,0.00
1035 // Transform transform=translation=7.000000,8.000000,9.000000 1034 // Transform transform=translation=7.000000,8.000000,9.000000
1036 1035
1037 LayoutObject* innerDivWithTransform = 1036 LayoutObject* innerDivWithTransform =
1038 frameDocument.getElementById("transform")->layoutObject(); 1037 childDocument().getElementById("transform")->layoutObject();
1039 auto* innerDivTransform = 1038 auto* innerDivTransform =
1040 innerDivWithTransform->paintProperties()->transform(); 1039 innerDivWithTransform->paintProperties()->transform();
1041 EXPECT_EQ(TransformationMatrix().translate3d(7, 8, 9), 1040 EXPECT_EQ(TransformationMatrix().translate3d(7, 8, 9),
1042 innerDivTransform->matrix()); 1041 innerDivTransform->matrix());
1043 CHECK_EXACT_VISUAL_RECT(LayoutRect(92, 95, 100, 111), innerDivWithTransform, 1042 CHECK_EXACT_VISUAL_RECT(LayoutRect(92, 95, 100, 111), innerDivWithTransform,
1044 frameView->layoutView()); 1043 frameView->layoutView());
1045 1044
1046 auto* innerDocumentPaintOffsetTranslation = innerDivTransform->parent(); 1045 auto* innerDocumentPaintOffsetTranslation = innerDivTransform->parent();
1047 EXPECT_EQ(TransformationMatrix().translate3d(31, 31, 0), 1046 EXPECT_EQ(TransformationMatrix().translate3d(31, 31, 0),
1048 innerDocumentPaintOffsetTranslation->matrix()); 1047 innerDocumentPaintOffsetTranslation->matrix());
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 EXPECT_EQ(framePreTranslation(), 2915 EXPECT_EQ(framePreTranslation(),
2917 childProperties->paintOffsetTranslation()->parent()); 2916 childProperties->paintOffsetTranslation()->parent());
2918 EXPECT_EQ(childProperties->paintOffsetTranslation(), 2917 EXPECT_EQ(childProperties->paintOffsetTranslation(),
2919 childPaintState.transform()); 2918 childPaintState.transform());
2920 // This will change once we added clip expansion node. 2919 // This will change once we added clip expansion node.
2921 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); 2920 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip());
2922 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); 2921 EXPECT_EQ(filterProperties->effect(), childPaintState.effect());
2923 } 2922 }
2924 2923
2925 } // namespace blink 2924 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698