Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp |
index 68e572e1ebc66f724809075ef90969df552584d3..b2e2ecdd21d6a568ff991b3a511f0ea29ecb6560 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp |
@@ -6,6 +6,7 @@ |
#include "core/layout/LayoutTreeAsText.h" |
#include "core/layout/api/LayoutViewItem.h" |
#include "core/paint/ObjectPaintProperties.h" |
+#include "core/paint/PaintPropertyTreePrinter.h" |
#include "platform/graphics/paint/GeometryMapper.h" |
#include "platform/graphics/paint/TransformPaintPropertyNode.h" |
#include "platform/testing/UnitTestHelpers.h" |
@@ -16,7 +17,9 @@ |
namespace blink { |
-class PaintPropertyTreeBuilderTest : public RenderingTest { |
+class PaintPropertyTreeBuilderTest |
+ : public RenderingTest |
+ , public ::testing::WithParamInterface<FrameSettingOverrideFunction> { |
public: |
PaintPropertyTreeBuilderTest() |
: RenderingTest(SingleChildFrameLoaderClient::create()) |
@@ -31,6 +34,50 @@ public: |
setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); |
} |
+ bool rootLayerScrolls() |
+ { |
+ return document().settings() && document().settings()->rootLayerScrolls(); |
+ } |
+ |
+ const TransformPaintPropertyNode* rootTransform() |
+ { |
+ FrameView* frameView = document().view(); |
+ if (rootLayerScrolls()) |
+ return frameView->layoutView()->objectPaintProperties()->paintOffsetTranslation(); |
+ return frameView->rootTransform(); |
+ } |
+ |
+ const ClipPaintPropertyNode* rootClip() |
+ { |
+ return rootLayerScrolls() ? nullptr : document().view()->rootClip(); |
+ } |
+ |
+ const TransformPaintPropertyNode* framePreTranslation() |
+ { |
+ FrameView* frameView = document().view(); |
+ if (rootLayerScrolls()) |
+ return frameView->layoutView()->objectPaintProperties()->paintOffsetTranslation(); |
+ return frameView->preTranslation(); |
+ } |
+ |
+ const TransformPaintPropertyNode* frameScrollTranslation() |
+ { |
+ FrameView* frameView = document().view(); |
+ if (rootLayerScrolls()) |
+ return frameView->layoutView()->objectPaintProperties()->scrollTranslation(); |
+ return frameView->scrollTranslation(); |
+ } |
+ |
+ const ClipPaintPropertyNode* frameContentClip() |
+ { |
+ FrameView* frameView = document().view(); |
+ if (rootLayerScrolls()) |
+ return frameView->layoutView()->objectPaintProperties()->overflowClip(); |
+ return frameView->contentClip(); |
+ } |
+ |
+ FrameSettingOverrideFunction settingOverrider() const override { return GetParam(); } |
+ |
private: |
void SetUp() override |
{ |
@@ -69,7 +116,9 @@ do { \ |
EXPECT_EQ(expected, LayoutRect(actual)); \ |
} while (0); |
-TEST_F(PaintPropertyTreeBuilderTest, FixedPosition) |
+INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Values(nullptr, &RootLayerScrollsFrameSettingOverride)); |
+ |
+TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) |
{ |
loadTestData("fixed-position.html"); |
@@ -80,11 +129,11 @@ TEST_F(PaintPropertyTreeBuilderTest, FixedPosition) |
Element* target1 = document().getElementById("target1"); |
const ObjectPaintProperties* target1Properties = target1->layoutObject()->objectPaintProperties(); |
EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->paintOffsetTranslation()->matrix()); |
- EXPECT_EQ(frameView->preTranslation(), target1Properties->paintOffsetTranslation()->parent()); |
+ EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation()->parent()); |
EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->overflowClip()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip()->clipRect()); |
// Likewise, it inherits clip from the viewport, skipping overflow clip of the scroller. |
- EXPECT_EQ(frameView->contentClip(), target1Properties->overflowClip()->parent()); |
+ EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); |
// target2 is a fixed-position element inside a transformed scrolling element. |
// It should be attached under the scrolled box of the transformed element. |
@@ -102,7 +151,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FixedPosition) |
CHECK_VISUAL_RECT(target2->layoutObject(), frameView->layoutView()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll) |
+TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) |
{ |
loadTestData("position-and-scroll.html"); |
@@ -112,10 +161,10 @@ TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll) |
frameView->updateAllLifecyclePhases(); |
const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->objectPaintProperties(); |
EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scrollTranslation()->matrix()); |
- EXPECT_EQ(frameView->scrollTranslation(), scrollerProperties->scrollTranslation()->parent()); |
- EXPECT_EQ(frameView->scrollTranslation(), scrollerProperties->overflowClip()->localTransformSpace()); |
+ EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflowClip()->clipRect()); |
- EXPECT_EQ(frameView->contentClip(), scrollerProperties->overflowClip()->parent()); |
+ EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); |
// The relative-positioned element should have accumulated box offset (exclude scrolling), |
// and should be affected by ancestor scroll transforms. |
@@ -131,13 +180,13 @@ TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll) |
Element* absPos = document().getElementById("abs-pos"); |
const ObjectPaintProperties* absPosProperties = absPos->layoutObject()->objectPaintProperties(); |
EXPECT_EQ(TransformationMatrix().translate(123, 456), absPosProperties->paintOffsetTranslation()->matrix()); |
- EXPECT_EQ(frameView->scrollTranslation(), absPosProperties->paintOffsetTranslation()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), absPosProperties->paintOffsetTranslation()->parent()); |
EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(), absPosProperties->overflowClip()->clipRect()); |
- EXPECT_EQ(frameView->contentClip(), absPosProperties->overflowClip()->parent()); |
+ EXPECT_EQ(frameContentClip(), absPosProperties->overflowClip()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
+TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
{ |
setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
@@ -145,47 +194,48 @@ TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
FrameView* frameView = document().view(); |
frameView->updateAllLifecyclePhases(); |
- EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); |
- EXPECT_EQ(frameView->rootTransform(), frameView->preTranslation()->parent()); |
- EXPECT_EQ(nullptr, frameView->rootTransform()->parent()); |
- EXPECT_EQ(TransformationMatrix().translate(0, -100), frameView->scrollTranslation()->matrix()); |
- EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->parent()); |
- EXPECT_EQ(frameView->preTranslation(), frameView->contentClip()->localTransformSpace()); |
- EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameView->contentClip()->clipRect()); |
- EXPECT_EQ(frameView->rootClip(), frameView->contentClip()->parent()); |
- EXPECT_EQ(nullptr, frameView->rootClip()->parent()); |
+ EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); |
+ if (!rootLayerScrolls()) |
+ EXPECT_EQ(rootTransform(), framePreTranslation()->parent()); |
+ EXPECT_EQ(nullptr, rootTransform()->parent()); |
+ EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation()->matrix()); |
+ EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
+ EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); |
+ EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); |
+ EXPECT_EQ(rootClip(), frameContentClip()->parent()); |
+ if (!rootLayerScrolls()) |
+ EXPECT_EQ(nullptr, rootClip()->parent()); |
LayoutViewItem layoutViewItem = document().layoutViewItem(); |
const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProperties(); |
- EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
+ if (!rootLayerScrolls()) |
+ EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
} |
// TODO(trchen): Settings::rootLayerScrolls cannot be switched after main frame being created. |
// Need to set it during test setup. Besides that, the test still won't work because |
// root layer scrolling mode is not compatible with SPv2 at this moment. |
// (Duplicate display item ID for FrameView and LayoutView.) |
-TEST_F(PaintPropertyTreeBuilderTest, DISABLED_FrameScrollingRootLayerScrolls) |
+TEST_P(PaintPropertyTreeBuilderTest, DISABLED_FrameScrollingRootLayerScrolls) |
{ |
- document().settings()->setRootLayerScrolls(true); |
- |
setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
document().domWindow()->scrollTo(0, 100); |
FrameView* frameView = document().view(); |
frameView->updateAllLifecyclePhases(); |
- EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); |
- EXPECT_EQ(nullptr, frameView->preTranslation()->parent()); |
- EXPECT_EQ(TransformationMatrix(), frameView->scrollTranslation()->matrix()); |
- EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->parent()); |
+ EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); |
+ EXPECT_EQ(nullptr, framePreTranslation()->parent()); |
+ EXPECT_EQ(TransformationMatrix(), frameScrollTranslation()->matrix()); |
+ EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
LayoutViewItem layoutViewItem = document().layoutViewItem(); |
const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProperties(); |
EXPECT_EQ(TransformationMatrix().translate(0, -100), layoutViewProperties->scrollTranslation()->matrix()); |
- EXPECT_EQ(frameView->scrollTranslation(), layoutViewProperties->scrollTranslation()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), layoutViewProperties->scrollTranslation()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, Perspective) |
+TEST_P(PaintPropertyTreeBuilderTest, Perspective) |
{ |
loadTestData("perspective.html"); |
@@ -194,7 +244,7 @@ TEST_F(PaintPropertyTreeBuilderTest, Perspective) |
EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectiveProperties->perspective()->matrix()); |
// The perspective origin is the center of the border box plus accumulated paint offset. |
EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->origin()); |
- EXPECT_EQ(document().view()->scrollTranslation(), perspectiveProperties->perspective()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), perspectiveProperties->perspective()->parent()); |
// Adding perspective doesn't clear paint offset. The paint offset will be passed down to children. |
Element* inner = document().getElementById("inner"); |
@@ -203,7 +253,7 @@ TEST_F(PaintPropertyTreeBuilderTest, Perspective) |
EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffsetTranslation()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, Transform) |
+TEST_P(PaintPropertyTreeBuilderTest, Transform) |
{ |
loadTestData("transform.html"); |
@@ -213,20 +263,20 @@ TEST_F(PaintPropertyTreeBuilderTest, Transform) |
EXPECT_EQ(FloatPoint3D(200, 150, 0), transformProperties->transform()->origin()); |
EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties->transform()->parent()); |
EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->paintOffsetTranslation()->matrix()); |
- EXPECT_EQ(document().view()->scrollTranslation(), transformProperties->paintOffsetTranslation()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), transformProperties->paintOffsetTranslation()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, RelativePositionInline) |
+TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) |
{ |
loadTestData("relative-position-inline.html"); |
Element* inlineBlock = document().getElementById("inline-block"); |
const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObject()->objectPaintProperties(); |
EXPECT_EQ(TransformationMatrix().translate(135, 490), inlineBlockProperties->paintOffsetTranslation()->matrix()); |
- EXPECT_EQ(document().view()->scrollTranslation(), inlineBlockProperties->paintOffsetTranslation()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), inlineBlockProperties->paintOffsetTranslation()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect) |
+TEST_P(PaintPropertyTreeBuilderTest, NestedOpacityEffect) |
{ |
setBodyInnerHTML( |
"<div id='nodeWithoutOpacity'>" |
@@ -256,7 +306,7 @@ TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect) |
EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityProperties->effect()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) |
+TEST_P(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) |
{ |
setBodyInnerHTML( |
"<div id='nodeWithOpacity' style='opacity: 0.6'>" |
@@ -283,7 +333,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) |
EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext) |
+TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext) |
{ |
setBodyInnerHTML( |
"<div id='nodeWithOpacity' style='opacity: 0.6'>" |
@@ -310,7 +360,7 @@ TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext) |
EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, EffectNodesInSVG) |
+TEST_P(PaintPropertyTreeBuilderTest, EffectNodesInSVG) |
{ |
setBodyInnerHTML( |
"<svg id='svgRoot'>" |
@@ -350,7 +400,7 @@ TEST_F(PaintPropertyTreeBuilderTest, EffectNodesInSVG) |
EXPECT_EQ(textWithOpacityProperties->effect(), tspanWithOpacityProperties->effect()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossHTMLSVGBoundary) |
+TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossHTMLSVGBoundary) |
{ |
setBodyInnerHTML( |
"<div id='divWithOpacity' style='opacity: 0.2;'>" |
@@ -375,7 +425,7 @@ TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossHTMLSVGBoundary) |
EXPECT_EQ(svgRootWithOpacityProperties->effect(), rectWithOpacityProperties->effect()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossSVGHTMLBoundary) |
+TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossSVGHTMLBoundary) |
{ |
setBodyInnerHTML( |
"<svg id='svgRootWithOpacity' style='opacity: 0.3;'>" |
@@ -402,7 +452,7 @@ TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossSVGHTMLBoundary) |
EXPECT_EQ(foreignObjectWithOpacityProperties->effect(), spanWithOpacityProperties->effect()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInSVG) |
+TEST_P(PaintPropertyTreeBuilderTest, TransformNodesInSVG) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -431,7 +481,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInSVG) |
EXPECT_EQ(FloatPoint3D(50, 50, 0), svgRootWith3dTransformProperties->transform()->origin()); |
EXPECT_EQ(svgRootWith3dTransformProperties->paintOffsetTranslation(), svgRootWith3dTransformProperties->transform()->parent()); |
EXPECT_EQ(TransformationMatrix().translate(70, 25), svgRootWith3dTransformProperties->paintOffsetTranslation()->matrix()); |
- EXPECT_EQ(document().view()->scrollTranslation(), svgRootWith3dTransformProperties->paintOffsetTranslation()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), svgRootWith3dTransformProperties->paintOffsetTranslation()->parent()); |
LayoutObject& rectWith2dTransform = *document().getElementById("rectWith2dTransform")->layoutObject(); |
const ObjectPaintProperties* rectWith2dTransformProperties = rectWith2dTransform.objectPaintProperties(); |
@@ -446,7 +496,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInSVG) |
EXPECT_EQ(nullptr, rectWith2dTransformProperties->paintOffsetTranslation()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, SVGViewBoxTransform) |
+TEST_P(PaintPropertyTreeBuilderTest, SVGViewBoxTransform) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -477,7 +527,7 @@ TEST_F(PaintPropertyTreeBuilderTest, SVGViewBoxTransform) |
EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), rectProperties->transform()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, SVGRootPaintOffsetTransformNode) |
+TEST_P(PaintPropertyTreeBuilderTest, SVGRootPaintOffsetTransformNode) |
{ |
setBodyInnerHTML( |
"<style>body { margin: 0px; } </style>" |
@@ -488,10 +538,10 @@ TEST_F(PaintPropertyTreeBuilderTest, SVGRootPaintOffsetTransformNode) |
// Ensure that a paint offset transform is not unnecessarily emitted. |
EXPECT_EQ(nullptr, svgProperties->paintOffsetTranslation()); |
EXPECT_EQ(TransformationMatrix().translate(50, 25), svgProperties->svgLocalToBorderBoxTransform()->matrix()); |
- EXPECT_EQ(document().view()->scrollTranslation(), svgProperties->svgLocalToBorderBoxTransform()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), svgProperties->svgLocalToBorderBoxTransform()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) |
+TEST_P(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -517,7 +567,7 @@ TEST_F(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) |
EXPECT_EQ(svgProperties->svgLocalToBorderBoxTransform(), rectProperties->transform()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, SVGNestedViewboxTransforms) |
+TEST_P(PaintPropertyTreeBuilderTest, SVGNestedViewboxTransforms) |
{ |
setBodyInnerHTML( |
"<style>body { margin: 0px; } </style>" |
@@ -544,7 +594,7 @@ TEST_F(PaintPropertyTreeBuilderTest, SVGNestedViewboxTransforms) |
EXPECT_EQ(nestedSvgProperties->transform(), rectProperties->transform()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSVGHTMLBoundary) |
+TEST_P(PaintPropertyTreeBuilderTest, TransformNodesAcrossSVGHTMLBoundary) |
{ |
setBodyInnerHTML( |
"<style> body { margin: 0px; } </style>" |
@@ -567,7 +617,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSVGHTMLBoundary) |
EXPECT_EQ(svgWithTransformProperties->transform(), divWithTransformProperties->transform()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, FixedTransformAncestorAcrossSVGHTMLBoundary) |
+TEST_P(PaintPropertyTreeBuilderTest, FixedTransformAncestorAcrossSVGHTMLBoundary) |
{ |
setBodyInnerHTML( |
"<style> body { margin: 0px; } </style>" |
@@ -597,7 +647,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FixedTransformAncestorAcrossSVGHTMLBoundary |
EXPECT_EQ(containerProperties->transform(), fixedProperties->paintOffsetTranslation()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, ControlClip) |
+TEST_P(PaintPropertyTreeBuilderTest, ControlClip) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -611,15 +661,14 @@ TEST_F(PaintPropertyTreeBuilderTest, ControlClip) |
"</style>" |
"<input id='button' type='button' style='width:345px; height:123px' value='some text'/>"); |
- FrameView* frameView = document().view(); |
LayoutObject& button = *document().getElementById("button")->layoutObject(); |
const ObjectPaintProperties* buttonProperties = button.objectPaintProperties(); |
- EXPECT_EQ(frameView->scrollTranslation(), buttonProperties->overflowClip()->localTransformSpace()); |
+ EXPECT_EQ(frameScrollTranslation(), buttonProperties->overflowClip()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(5, 5, 335, 113), buttonProperties->overflowClip()->clipRect()); |
- EXPECT_EQ(frameView->contentClip(), buttonProperties->overflowClip()->parent()); |
+ EXPECT_EQ(frameContentClip(), buttonProperties->overflowClip()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, BorderRadiusClip) |
+TEST_P(PaintPropertyTreeBuilderTest, BorderRadiusClip) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -639,15 +688,14 @@ TEST_F(PaintPropertyTreeBuilderTest, BorderRadiusClip) |
"</style>" |
"<div id='div'></div>"); |
- FrameView* frameView = document().view(); |
LayoutObject& div = *document().getElementById("div")->layoutObject(); |
const ObjectPaintProperties* divProperties = div.objectPaintProperties(); |
- EXPECT_EQ(frameView->scrollTranslation(), divProperties->overflowClip()->localTransformSpace()); |
+ EXPECT_EQ(frameScrollTranslation(), divProperties->overflowClip()->localTransformSpace()); |
// The overflow clip rect includes only the padding box. |
// padding box = border box(500+60+50, 400+45+55) - border outset(60+50, 45+55) - scrollbars(15, 15) |
EXPECT_EQ(FloatRoundedRect(60, 45, 500, 400), divProperties->overflowClip()->clipRect()); |
const ClipPaintPropertyNode* borderRadiusClip = divProperties->overflowClip()->parent(); |
- EXPECT_EQ(frameView->scrollTranslation(), borderRadiusClip->localTransformSpace()); |
+ EXPECT_EQ(frameScrollTranslation(), borderRadiusClip->localTransformSpace()); |
// The border radius clip is the area enclosed by inner border edge, including the scrollbars. |
// As the border-radius is specified in outer radius, the inner radius is calculated by: |
// inner radius = max(outer radius - border width, 0) |
@@ -661,15 +709,15 @@ TEST_F(PaintPropertyTreeBuilderTest, BorderRadiusClip) |
FloatSize(18, 23), // (bottom left) = max((78, 78) - (60, 55), (0, 0)) |
FloatSize(6, 1)), // (bottom right) = max((56, 56) - (50, 55), (0, 0)) |
borderRadiusClip->clipRect()); |
- EXPECT_EQ(frameView->contentClip(), borderRadiusClip->parent()); |
+ EXPECT_EQ(frameContentClip(), borderRadiusClip->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes) |
+TEST_P(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes) |
{ |
setBodyInnerHTML( |
"<style>body { margin: 0; }</style>" |
"<div id='divWithTransform' style='transform: translate3d(1px, 2px, 3px);'>" |
- " <iframe id='frame'></iframe>" |
+ " <iframe style='border: 7px solid black' id='frame'></iframe>" |
"</div>"); |
Document& frameDocument = setupChildIframe("frame", "<style>body { margin: 0; }</style><div id='transform' style='transform: translate3d(4px, 5px, 6px);'></div>"); |
document().view()->updateAllLifecyclePhases(); |
@@ -687,17 +735,17 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes) |
// This asserts that we have the following tree structure: |
// ... |
// Transform transform=translation=1.000000,2.000000,3.000000 |
- // PreTranslation transform=translation=2.000000,2.000000,0.000000 |
+ // PreTranslation transform=translation=7.000000,7.000000,0.000000 |
// ScrollTranslation transform=translation=0.000000,0.000000,0.000000 |
// Transform transform=translation=4.000000,5.000000,6.000000 |
auto* innerDocumentScrollTranslation = innerDivTransform->parent(); |
EXPECT_EQ(TransformationMatrix().translate3d(0, 0, 0), innerDocumentScrollTranslation->matrix()); |
auto* iframePreTranslation = innerDocumentScrollTranslation->parent(); |
- EXPECT_EQ(TransformationMatrix().translate3d(2, 2, 0), iframePreTranslation->matrix()); |
+ EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0), iframePreTranslation->matrix()); |
EXPECT_EQ(divWithTransformProperties->transform(), iframePreTranslation->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes) |
+TEST_P(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes) |
{ |
setBodyInnerHTML( |
"<style>body { margin: 0; }</style>" |
@@ -738,7 +786,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes) |
EXPECT_EQ(divWithTransformTransform, divWithTransform.objectPaintProperties()->transform()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext) |
+TEST_P(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext) |
{ |
// This test verifies the tree builder correctly computes and records the property tree context |
// for a (pseudo) stacking context that is scrolled by a containing block that is not one of |
@@ -761,7 +809,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext) |
EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTreeState.effect); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
+TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
{ |
// This test verifies the tree builder correctly computes and records the property tree context |
// for a (pseudo) stacking context that has a scrolling painting ancestor that is not its |
@@ -775,18 +823,17 @@ TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
"</div>" |
); |
- FrameView* frameView = document().view(); |
LayoutObject& scroller = *document().getElementById("scroller")->layoutObject(); |
const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties(); |
LayoutObject& child = *document().getElementById("child")->layoutObject(); |
const ObjectPaintProperties* childProperties = child.objectPaintProperties(); |
- EXPECT_EQ(frameView->contentClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip); |
- EXPECT_EQ(frameView->scrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform); |
+ EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip); |
+ EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform); |
EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxProperties()->propertyTreeState.effect); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
+TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
{ |
// This test verifies that the border box space of a table cell is being correctly computed. |
// Table cells have weird location adjustment in our layout/paint implementation. |
@@ -818,15 +865,14 @@ TEST_F(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
"</table>" |
); |
- FrameView* frameView = document().view(); |
LayoutObject& target = *document().getElementById("target")->layoutObject(); |
const ObjectPaintProperties* targetProperties = target.objectPaintProperties(); |
EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties()->paintOffset); |
- EXPECT_EQ(frameView->scrollTranslation(), targetProperties->localBorderBoxProperties()->propertyTreeState.transform); |
+ EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperties()->propertyTreeState.transform); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
+TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
{ |
// This test verifies that clip tree hierarchy being generated correctly for the hard case |
// such that a fixed position element getting clipped by an absolute position CSS clip. |
@@ -852,23 +898,21 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
LayoutRect absoluteClipRect = localClipRect; |
absoluteClipRect.move(123, 456); |
- FrameView* frameView = document().view(); |
- |
LayoutObject& clip = *document().getElementById("clip")->layoutObject(); |
const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
- EXPECT_EQ(frameView->contentClip(), clipProperties->cssClip()->parent()); |
- EXPECT_EQ(frameView->scrollTranslation(), clipProperties->cssClip()->localTransformSpace()); |
+ EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->cssClip()->clipRect()); |
LayoutObject& fixed = *document().getElementById("fixed")->layoutObject(); |
const ObjectPaintProperties* fixedProperties = fixed.objectPaintProperties(); |
EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperties()->propertyTreeState.clip); |
- EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->parent()); |
+ EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->parent()); |
EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->matrix()); |
EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
+TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
{ |
// This test is similar to CSSClipFixedPositionDescendant above, except that |
// now we have a parent overflow clip that should be escaped by the fixed descendant. |
@@ -903,31 +947,29 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
LayoutRect absoluteClipRect = localClipRect; |
absoluteClipRect.move(123, 456); |
- FrameView* frameView = document().view(); |
- |
LayoutObject& overflow = *document().getElementById("overflow")->layoutObject(); |
const ObjectPaintProperties* overflowProperties = overflow.objectPaintProperties(); |
- EXPECT_EQ(frameView->contentClip(), overflowProperties->overflowClip()->parent()); |
- EXPECT_EQ(frameView->scrollTranslation(), overflowProperties->scrollTranslation()->parent()); |
+ EXPECT_EQ(frameContentClip(), overflowProperties->overflowClip()->parent()); |
+ EXPECT_EQ(frameScrollTranslation(), overflowProperties->scrollTranslation()->parent()); |
LayoutObject& clip = *document().getElementById("clip")->layoutObject(); |
const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->parent()); |
EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->cssClip()->clipRect()); |
- EXPECT_EQ(frameView->contentClip(), clipProperties->cssClipFixedPosition()->parent()); |
+ EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent()); |
EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFixedPosition()->localTransformSpace()); |
EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->cssClipFixedPosition()->clipRect()); |
LayoutObject& fixed = *document().getElementById("fixed")->layoutObject(); |
const ObjectPaintProperties* fixedProperties = fixed.objectPaintProperties(); |
EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBorderBoxProperties()->propertyTreeState.clip); |
- EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->parent()); |
+ EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->parent()); |
EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->matrix()); |
EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) |
+TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) |
{ |
setBodyInnerHTML( |
"<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" |
@@ -941,7 +983,7 @@ TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) |
EXPECT_EQ(LayoutPoint(55, 44), spanner.objectPaintProperties()->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, FractionalPaintOffset) |
+TEST_P(PaintPropertyTreeBuilderTest, FractionalPaintOffset) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -962,7 +1004,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FractionalPaintOffset) |
EXPECT_EQ(bPaintOffset, bProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithBasicPixelSnapping) |
+TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetWithBasicPixelSnapping) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -990,7 +1032,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithBasicPixelSnapping) |
EXPECT_EQ(cPaintOffset, cProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughTransform) |
+TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughTransform) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -1018,7 +1060,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughTransfor |
EXPECT_EQ(cPaintOffset, cProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughMultipleTransforms) |
+TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughMultipleTransforms) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -1056,7 +1098,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughMultiple |
EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingWithFixedPos) |
+TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingWithFixedPos) |
{ |
setBodyInnerHTML( |
"<style>" |
@@ -1089,7 +1131,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingWithFixedPos) |
EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset) |
+TEST_P(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset) |
{ |
setBodyInnerHTML( |
"<svg id='svg' style='position: relative; left: 0.1px; transform: matrix(1, 0, 0, 1, 0, 0);'>" |
@@ -1110,7 +1152,7 @@ TEST_F(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset) |
EXPECT_EQ(svgWithTransformProperties->transform(), rectWithTransformProperties->transform()->parent()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, NoRenderingContextByDefault) |
+TEST_P(PaintPropertyTreeBuilderTest, NoRenderingContextByDefault) |
{ |
setBodyInnerHTML("<div style=\"transform: translateZ(0)\"></div>"); |
@@ -1119,7 +1161,7 @@ TEST_F(PaintPropertyTreeBuilderTest, NoRenderingContextByDefault) |
EXPECT_FALSE(properties->transform()->hasRenderingContext()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, Preserve3DCreatesSharedRenderingContext) |
+TEST_P(PaintPropertyTreeBuilderTest, Preserve3DCreatesSharedRenderingContext) |
{ |
setBodyInnerHTML( |
"<div style=\"transform-style: preserve-3d\">" |
@@ -1136,7 +1178,7 @@ TEST_F(PaintPropertyTreeBuilderTest, Preserve3DCreatesSharedRenderingContext) |
EXPECT_EQ(aProperties->transform()->renderingContextID(), bProperties->transform()->renderingContextID()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStyleEndsRenderingContext) |
+TEST_P(PaintPropertyTreeBuilderTest, FlatTransformStyleEndsRenderingContext) |
{ |
setBodyInnerHTML( |
"<div style=\"transform-style: preserve-3d\">" |
@@ -1156,7 +1198,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStyleEndsRenderingContext) |
EXPECT_FALSE(bProperties->transform()->hasRenderingContext()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, NestedRenderingContexts) |
+TEST_P(PaintPropertyTreeBuilderTest, NestedRenderingContexts) |
{ |
setBodyInnerHTML( |
"<div style=\"transform-style: preserve-3d\">" |
@@ -1204,7 +1246,7 @@ static bool someNodeFlattensTransform(const TransformPaintPropertyNode* node, co |
return false; |
} |
-TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStylePropagatesToChildren) |
+TEST_P(PaintPropertyTreeBuilderTest, FlatTransformStylePropagatesToChildren) |
{ |
setBodyInnerHTML( |
"<div id=\"a\" style=\"transform: translateZ(0); transform-style: flat\">" |
@@ -1222,7 +1264,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStylePropagatesToChildren) |
EXPECT_TRUE(someNodeFlattensTransform(bTransform, aTransform)); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, Preserve3DTransformStylePropagatesToChildren) |
+TEST_P(PaintPropertyTreeBuilderTest, Preserve3DTransformStylePropagatesToChildren) |
{ |
setBodyInnerHTML( |
"<div id=\"a\" style=\"transform: translateZ(0); transform-style: preserve-3d\">" |
@@ -1240,7 +1282,7 @@ TEST_F(PaintPropertyTreeBuilderTest, Preserve3DTransformStylePropagatesToChildre |
EXPECT_FALSE(someNodeFlattensTransform(bTransform, aTransform)); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PerspectiveIsNotFlattened) |
+TEST_P(PaintPropertyTreeBuilderTest, PerspectiveIsNotFlattened) |
{ |
// It's necessary to make nodes from the one that applies perspective to |
// ones that combine with it preserve 3D. Otherwise, the perspective doesn't |
@@ -1260,7 +1302,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PerspectiveIsNotFlattened) |
EXPECT_FALSE(someNodeFlattensTransform(bTransform, aPerspective)); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, PerspectiveDoesNotEstablishRenderingContext) |
+TEST_P(PaintPropertyTreeBuilderTest, PerspectiveDoesNotEstablishRenderingContext) |
{ |
// It's necessary to make nodes from the one that applies perspective to |
// ones that combine with it preserve 3D. Otherwise, the perspective doesn't |
@@ -1280,7 +1322,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PerspectiveDoesNotEstablishRenderingContext |
EXPECT_FALSE(bTransform->hasRenderingContext()); |
} |
-TEST_F(PaintPropertyTreeBuilderTest, CachedProperties) |
+TEST_P(PaintPropertyTreeBuilderTest, CachedProperties) |
{ |
setBodyInnerHTML( |
"<div id='a' style='transform: translate(33px, 44px)'>" |