| 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 46b8c9c171d5586567f9c7bb04d81978a45b8da4..c783aacec1190156c35862aa5083e93f7dd3c439 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
|
| @@ -52,7 +52,7 @@ private:
|
| bool m_originalSlimmingPaintV2Enabled;
|
| };
|
|
|
| -#define CHECK_VISUAL_RECT(sourceLayoutObject, ancestorLayoutObject) \
|
| +#define CHECK_VISUAL_RECT(sourceLayoutObject, ancestorLayoutObject, slopFactor) \
|
| do { \
|
| GeometryMapper geometryMapper; \
|
| LayoutRect source(sourceLayoutObject->localOverflowRectForPaintInvalidation()); \
|
| @@ -66,9 +66,13 @@ do { \
|
| \
|
| LayoutRect expected = sourceLayoutObject->localOverflowRectForPaintInvalidation(); \
|
| sourceLayoutObject->mapToVisualRectInAncestorSpace(ancestorLayoutObject, expected); \
|
| - EXPECT_EQ(expected, LayoutRect(actual)); \
|
| + EXPECT_TRUE(expected.contains(LayoutRect(actual))); \
|
| + actual.inflate(slopFactor); \
|
| + EXPECT_TRUE(LayoutRect(actual).contains(expected)); \
|
| } while (0);
|
|
|
| +#define CHECK_EXACT_VISUAL_RECT(sourceLayoutObject, ancestorLayoutObject) CHECK_VISUAL_RECT(sourceLayoutObject, ancestorLayoutObject, 0)
|
| +
|
| TEST_F(PaintPropertyTreeBuilderTest, FixedPosition)
|
| {
|
| loadTestData("fixed-position.html");
|
| @@ -85,7 +89,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FixedPosition)
|
| 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());
|
| - CHECK_VISUAL_RECT(target1->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(target1->layoutObject(), frameView->layoutView());
|
|
|
| // target2 is a fixed-position element inside a transformed scrolling element.
|
| // It should be attached under the scrolled box of the transformed element.
|
| @@ -98,7 +102,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FixedPosition)
|
| EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->overflowClip()->localTransformSpace());
|
| EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip()->clipRect());
|
| EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowClip()->parent());
|
| - CHECK_VISUAL_RECT(target2->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(target2->layoutObject(), frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll)
|
| @@ -115,7 +119,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll)
|
| EXPECT_EQ(frameView->scrollTranslation(), scrollerProperties->overflowClip()->localTransformSpace());
|
| EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflowClip()->clipRect());
|
| EXPECT_EQ(frameView->contentClip(), scrollerProperties->overflowClip()->parent());
|
| - CHECK_VISUAL_RECT(scroller->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(scroller->layoutObject(), frameView->layoutView());
|
|
|
| // The relative-positioned element should have accumulated box offset (exclude scrolling),
|
| // and should be affected by ancestor scroll transforms.
|
| @@ -126,7 +130,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll)
|
| EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->localTransformSpace());
|
| EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip()->clipRect());
|
| EXPECT_EQ(scrollerProperties->overflowClip(), relPosProperties->overflowClip()->parent());
|
| - CHECK_VISUAL_RECT(relPos->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(relPos->layoutObject(), frameView->layoutView());
|
|
|
| // The absolute-positioned element should not be affected by non-positioned scroller at all.
|
| Element* absPos = document().getElementById("abs-pos");
|
| @@ -136,7 +140,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll)
|
| EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->localTransformSpace());
|
| EXPECT_EQ(FloatRoundedRect(0, 0, 300, 400), absPosProperties->overflowClip()->clipRect());
|
| EXPECT_EQ(frameView->contentClip(), absPosProperties->overflowClip()->parent());
|
| - CHECK_VISUAL_RECT(absPos->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(absPos->layoutObject(), frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
|
| @@ -160,7 +164,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
|
| LayoutViewItem layoutViewItem = document().layoutViewItem();
|
| const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProperties();
|
| EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation());
|
| - CHECK_VISUAL_RECT(document().body()->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(document().body()->layoutObject(), frameView->layoutView());
|
| }
|
|
|
| // TODO(trchen): Settings::rootLayerScrolls cannot be switched after main frame being created.
|
| @@ -186,7 +190,7 @@ TEST_F(PaintPropertyTreeBuilderTest, DISABLED_FrameScrollingRootLayerScrolls)
|
| const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProperties();
|
| EXPECT_EQ(TransformationMatrix().translate(0, -100), layoutViewProperties->scrollTranslation()->matrix());
|
| EXPECT_EQ(frameView->scrollTranslation(), layoutViewProperties->scrollTranslation()->parent());
|
| - CHECK_VISUAL_RECT(document().body()->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(document().body()->layoutObject(), frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, Perspective)
|
| @@ -205,7 +209,7 @@ TEST_F(PaintPropertyTreeBuilderTest, Perspective)
|
| const ObjectPaintProperties* innerProperties = inner->layoutObject()->objectPaintProperties();
|
| EXPECT_EQ(TransformationMatrix().translate(50, 100), innerProperties->paintOffsetTranslation()->matrix());
|
| EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffsetTranslation()->parent());
|
| - CHECK_VISUAL_RECT(inner->layoutObject(), document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(inner->layoutObject(), document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, Transform)
|
| @@ -219,7 +223,7 @@ TEST_F(PaintPropertyTreeBuilderTest, Transform)
|
| EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties->transform()->parent());
|
| EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->paintOffsetTranslation()->matrix());
|
| EXPECT_EQ(document().view()->scrollTranslation(), transformProperties->paintOffsetTranslation()->parent());
|
| - CHECK_VISUAL_RECT(transform->layoutObject(), document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(transform->layoutObject(), document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, RelativePositionInline)
|
| @@ -230,7 +234,7 @@ TEST_F(PaintPropertyTreeBuilderTest, RelativePositionInline)
|
| const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObject()->objectPaintProperties();
|
| EXPECT_EQ(TransformationMatrix().translate(135, 490), inlineBlockProperties->paintOffsetTranslation()->matrix());
|
| EXPECT_EQ(document().view()->scrollTranslation(), inlineBlockProperties->paintOffsetTranslation()->parent());
|
| - CHECK_VISUAL_RECT(inlineBlock->layoutObject(), document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(inlineBlock->layoutObject(), document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect)
|
| @@ -247,24 +251,24 @@ TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect)
|
| LayoutObject* nodeWithoutOpacity = document().getElementById("nodeWithoutOpacity")->layoutObject();
|
| const ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpacity->objectPaintProperties();
|
| EXPECT_NE(nullptr, nodeWithoutOpacityProperties);
|
| - CHECK_VISUAL_RECT(nodeWithoutOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(nodeWithoutOpacity, document().view()->layoutView());
|
|
|
| LayoutObject* childWithOpacity = document().getElementById("childWithOpacity")->layoutObject();
|
| const ObjectPaintProperties* childWithOpacityProperties = childWithOpacity->objectPaintProperties();
|
| EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity());
|
| // childWithOpacity is the root effect node.
|
| EXPECT_NE(nullptr, childWithOpacityProperties->effect()->parent());
|
| - CHECK_VISUAL_RECT(childWithOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(childWithOpacity, document().view()->layoutView());
|
|
|
| LayoutObject* grandChildWithoutOpacity = document().getElementById("grandChildWithoutOpacity")->layoutObject();
|
| EXPECT_NE(nullptr, grandChildWithoutOpacity->objectPaintProperties());
|
| - CHECK_VISUAL_RECT(grandChildWithoutOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(grandChildWithoutOpacity, document().view()->layoutView());
|
|
|
| LayoutObject* greatGrandChildWithOpacity = document().getElementById("greatGrandChildWithOpacity")->layoutObject();
|
| const ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGrandChildWithOpacity->objectPaintProperties();
|
| EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity());
|
| EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityProperties->effect()->parent());
|
| - CHECK_VISUAL_RECT(greatGrandChildWithOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(greatGrandChildWithOpacity, document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes)
|
| @@ -281,20 +285,20 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes)
|
| EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity());
|
| EXPECT_NE(nullptr, nodeWithOpacityProperties->effect()->parent());
|
| EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform());
|
| - CHECK_VISUAL_RECT(nodeWithOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(nodeWithOpacity, document().view()->layoutView());
|
|
|
| LayoutObject* childWithTransform = document().getElementById("childWithTransform")->layoutObject();
|
| const ObjectPaintProperties* childWithTransformProperties = childWithTransform->objectPaintProperties();
|
| EXPECT_EQ(nullptr, childWithTransformProperties->effect());
|
| EXPECT_EQ(TransformationMatrix().translate(10, 10), childWithTransformProperties->transform()->matrix());
|
| - CHECK_VISUAL_RECT(childWithTransform, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(childWithTransform, document().view()->layoutView());
|
|
|
| LayoutObject* grandChildWithOpacity = document().getElementById("grandChildWithOpacity")->layoutObject();
|
| const ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpacity->objectPaintProperties();
|
| EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity());
|
| EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperties->effect()->parent());
|
| EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform());
|
| - CHECK_VISUAL_RECT(grandChildWithOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(grandChildWithOpacity, document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext)
|
| @@ -311,20 +315,20 @@ TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext)
|
| EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity());
|
| EXPECT_NE(nullptr, nodeWithOpacityProperties->effect()->parent());
|
| EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform());
|
| - CHECK_VISUAL_RECT(nodeWithOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(nodeWithOpacity, document().view()->layoutView());
|
|
|
| LayoutObject* childWithStackingContext = document().getElementById("childWithStackingContext")->layoutObject();
|
| const ObjectPaintProperties* childWithStackingContextProperties = childWithStackingContext->objectPaintProperties();
|
| EXPECT_EQ(nullptr, childWithStackingContextProperties->effect());
|
| EXPECT_EQ(nullptr, childWithStackingContextProperties->transform());
|
| - CHECK_VISUAL_RECT(childWithStackingContext, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(childWithStackingContext, document().view()->layoutView());
|
|
|
| LayoutObject* grandChildWithOpacity = document().getElementById("grandChildWithOpacity")->layoutObject();
|
| const ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpacity->objectPaintProperties();
|
| EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity());
|
| EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperties->effect()->parent());
|
| EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform());
|
| - CHECK_VISUAL_RECT(grandChildWithOpacity, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(grandChildWithOpacity, document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, EffectNodesInSVG)
|
| @@ -634,7 +638,7 @@ TEST_F(PaintPropertyTreeBuilderTest, ControlClip)
|
| EXPECT_EQ(frameView->scrollTranslation(), buttonProperties->overflowClip()->localTransformSpace());
|
| EXPECT_EQ(FloatRoundedRect(5, 5, 335, 113), buttonProperties->overflowClip()->clipRect());
|
| EXPECT_EQ(frameView->contentClip(), buttonProperties->overflowClip()->parent());
|
| - CHECK_VISUAL_RECT(button, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(button, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, BorderRadiusClip)
|
| @@ -680,7 +684,7 @@ TEST_F(PaintPropertyTreeBuilderTest, BorderRadiusClip)
|
| FloatSize(6, 1)), // (bottom right) = max((56, 56) - (50, 55), (0, 0))
|
| borderRadiusClip->clipRect());
|
| EXPECT_EQ(frameView->contentClip(), borderRadiusClip->parent());
|
| - CHECK_VISUAL_RECT(div, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(div, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes)
|
| @@ -698,13 +702,13 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes)
|
| LayoutObject* divWithTransform = document().getElementById("divWithTransform")->layoutObject();
|
| const ObjectPaintProperties* divWithTransformProperties = divWithTransform->objectPaintProperties();
|
| EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformProperties->transform()->matrix());
|
| - CHECK_VISUAL_RECT(divWithTransform, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(divWithTransform, frameView->layoutView());
|
|
|
| LayoutObject* innerDivWithTransform = frameDocument.getElementById("transform")->layoutObject();
|
| const ObjectPaintProperties* innerDivWithTransformProperties = innerDivWithTransform->objectPaintProperties();
|
| auto* innerDivTransform = innerDivWithTransformProperties->transform();
|
| EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), innerDivTransform->matrix());
|
| - CHECK_VISUAL_RECT(innerDivWithTransform, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(innerDivWithTransform, frameView->layoutView());
|
|
|
| // Ensure that the inner div's transform is correctly rooted in the root frame's transform tree.
|
| // This asserts that we have the following tree structure:
|
| @@ -745,7 +749,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes)
|
| LayoutObject* innerDivWithTransform = frameDocument.getElementById("transform")->layoutObject();
|
| auto* innerDivTransform = innerDivWithTransform->objectPaintProperties()->transform();
|
| EXPECT_EQ(TransformationMatrix().translate3d(7, 8, 9), innerDivTransform->matrix());
|
| - CHECK_VISUAL_RECT(innerDivWithTransform, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(innerDivWithTransform, frameView->layoutView());
|
|
|
| auto* innerDocumentPaintOffsetTranslation = innerDivTransform->parent();
|
| EXPECT_EQ(TransformationMatrix().translate3d(31, 31, 0), innerDocumentPaintOffsetTranslation->matrix());
|
| @@ -762,7 +766,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes)
|
|
|
| LayoutObject* divWithTransform = document().getElementById("divWithTransform")->layoutObject();
|
| EXPECT_EQ(divWithTransformTransform, divWithTransform->objectPaintProperties()->transform());
|
| - CHECK_VISUAL_RECT(divWithTransform, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(divWithTransform, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext)
|
| @@ -787,8 +791,8 @@ TEST_F(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext)
|
| EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
|
| EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
|
| EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTreeState.effect);
|
| - CHECK_VISUAL_RECT(scroller, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(child, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(scroller, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(child, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext)
|
| @@ -814,8 +818,8 @@ TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext)
|
| EXPECT_EQ(frameView->contentClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
|
| EXPECT_EQ(frameView->scrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
|
| EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxProperties()->propertyTreeState.effect);
|
| - CHECK_VISUAL_RECT(scroller, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(child, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(scroller, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(child, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, TableCellLayoutLocation)
|
| @@ -856,7 +860,7 @@ TEST_F(PaintPropertyTreeBuilderTest, TableCellLayoutLocation)
|
|
|
| EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties()->paintOffset);
|
| EXPECT_EQ(frameView->scrollTranslation(), targetProperties->localBorderBoxProperties()->propertyTreeState.transform);
|
| - CHECK_VISUAL_RECT(target, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(target, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant)
|
| @@ -896,7 +900,7 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant)
|
| EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->cssClip()->clipRect());
|
| // TODO(chrishtr): GeomeryMapper rports 40x60 size (i.e. including clip), whereas the old code reports 100x100 (unclipped).
|
| // Fix.
|
| - // CHECK_VISUAL_RECT(clip, frameView->layoutView());
|
| + // CHECK_EXACT_VISUAL_RECT(clip, frameView->layoutView());
|
|
|
| LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
|
| const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties();
|
| @@ -904,7 +908,7 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant)
|
| EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->parent());
|
| EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->matrix());
|
| EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(fixed, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(fixed, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared)
|
| @@ -948,7 +952,7 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared)
|
| const ObjectPaintProperties* overflowProperties = overflow->objectPaintProperties();
|
| EXPECT_EQ(frameView->contentClip(), overflowProperties->overflowClip()->parent());
|
| EXPECT_EQ(frameView->scrollTranslation(), overflowProperties->scrollTranslation()->parent());
|
| - CHECK_VISUAL_RECT(overflow, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(overflow, frameView->layoutView());
|
|
|
| LayoutObject* clip = document().getElementById("clip")->layoutObject();
|
| const ObjectPaintProperties* clipProperties = clip->objectPaintProperties();
|
| @@ -958,7 +962,7 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared)
|
| EXPECT_EQ(frameView->contentClip(), clipProperties->cssClipFixedPosition()->parent());
|
| EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFixedPosition()->localTransformSpace());
|
| EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->cssClipFixedPosition()->clipRect());
|
| - CHECK_VISUAL_RECT(clip, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(clip, frameView->layoutView());
|
|
|
| LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
|
| const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties();
|
| @@ -966,7 +970,7 @@ TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared)
|
| EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->parent());
|
| EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->localBorderBoxProperties()->propertyTreeState.transform->matrix());
|
| EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(fixed, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(fixed, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned)
|
| @@ -981,7 +985,7 @@ TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned)
|
|
|
| LayoutObject* spanner = getLayoutObjectByElementId("spanner");
|
| EXPECT_EQ(LayoutPoint(55, 44), spanner->objectPaintProperties()->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(spanner, document().view()->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(spanner, document().view()->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, FractionalPaintOffset)
|
| @@ -1001,13 +1005,13 @@ TEST_F(PaintPropertyTreeBuilderTest, FractionalPaintOffset)
|
| const ObjectPaintProperties* aProperties = a->objectPaintProperties();
|
| LayoutPoint aPaintOffset = LayoutPoint(FloatPoint(0.1, 0.3));
|
| EXPECT_EQ(aPaintOffset, aProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
|
|
| LayoutObject* b = document().getElementById("b")->layoutObject();
|
| const ObjectPaintProperties* bProperties = b->objectPaintProperties();
|
| LayoutPoint bPaintOffset = aPaintOffset + LayoutPoint(FloatPoint(0.5, 11.1));
|
| EXPECT_EQ(bPaintOffset, bProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithBasicPixelSnapping)
|
| @@ -1033,15 +1037,17 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithBasicPixelSnapping)
|
| // The residual subpixel adjustment should be (0.3,0.3) - (0,0) = (0.3,0.3).
|
| LayoutPoint subpixelAccumulation = LayoutPoint(FloatPoint(0.3, 0.3));
|
| EXPECT_EQ(subpixelAccumulation, bProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
|
|
| // c should be painted starting at subpixelAccumulation + (0.1,0.1) = (0.4,0.4).
|
| LayoutObject* c = document().getElementById("c")->layoutObject();
|
| LayoutPoint cPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.1, 0.1));
|
| const ObjectPaintProperties* cProperties = c->objectPaintProperties();
|
| EXPECT_EQ(cPaintOffset, cProperties->localBorderBoxProperties()->paintOffset);
|
| -// TODO(chrishtr): results differ by pixel snapping
|
| -// CHECK_VISUAL_RECT(c, frameView->layoutView());
|
| + // Visual rects via the non-paint properties system use enclosingIntRect before applying transforms,
|
| + // because they are computed bottom-up and therefore can't apply pixel snapping. Therefore apply a
|
| + // slop of 1px.
|
| + CHECK_VISUAL_RECT(c, frameView->layoutView(), 1);
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughTransform)
|
| @@ -1067,15 +1073,17 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughTransfor
|
| // The residual subpixel adjustment should be (0.7,0.7) - (1,1) = (-0.3,-0.3).
|
| LayoutPoint subpixelAccumulation = LayoutPoint(LayoutPoint(FloatPoint(0.7, 0.7)) - LayoutPoint(1, 1));
|
| EXPECT_EQ(subpixelAccumulation, bProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
|
|
| // c should be painted starting at subpixelAccumulation + (0.7,0.7) = (0.4,0.4).
|
| LayoutObject* c = document().getElementById("c")->layoutObject();
|
| LayoutPoint cPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7, 0.7));
|
| const ObjectPaintProperties* cProperties = c->objectPaintProperties();
|
| EXPECT_EQ(cPaintOffset, cProperties->localBorderBoxProperties()->paintOffset);
|
| -// TODO(chrishtr): results differ by pixel snapping
|
| -// CHECK_VISUAL_RECT(c, frameView->layoutView());
|
| + // Visual rects via the non-paint properties system use enclosingIntRect before applying transforms,
|
| + // because they are computed bottom-up and therefore can't apply pixel snapping. Therefore apply a
|
| + // slop of 1px.
|
| + CHECK_VISUAL_RECT(c, frameView->layoutView(), 1);
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughMultipleTransforms)
|
| @@ -1103,7 +1111,7 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughMultiple
|
| // The residual subpixel adjustment should be (0.7,0.7) - (1,1) = (-0.3,-0.3).
|
| LayoutPoint subpixelAccumulation = LayoutPoint(LayoutPoint(FloatPoint(0.7, 0.7)) - LayoutPoint(1, 1));
|
| EXPECT_EQ(subpixelAccumulation, bProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
|
|
| LayoutObject* c = document().getElementById("c")->layoutObject();
|
| const ObjectPaintProperties* cProperties = c->objectPaintProperties();
|
| @@ -1113,15 +1121,17 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingThroughMultiple
|
| EXPECT_EQ(TransformationMatrix().translate(0, 0), cProperties->transform()->parent()->matrix());
|
| // The residual subpixel adjustment should still be (-0.3,-0.3).
|
| EXPECT_EQ(subpixelAccumulation, cProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(c, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(c, frameView->layoutView());
|
|
|
| // d should be painted starting at subpixelAccumulation + (0.7,0.7) = (0.4,0.4).
|
| LayoutObject* d = document().getElementById("d")->layoutObject();
|
| LayoutPoint dPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7, 0.7));
|
| const ObjectPaintProperties* dProperties = d->objectPaintProperties();
|
| EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset);
|
| -// TODO(chrishtr): results differ by pixel snapping
|
| -// CHECK_VISUAL_RECT(d, frameView->layoutView());
|
| + // Visual rects via the non-paint properties system use enclosingIntRect before applying transforms,
|
| + // because they are computed bottom-up and therefore can't apply pixel snapping. Therefore apply a
|
| + // slop of 1px.
|
| + CHECK_VISUAL_RECT(d, frameView->layoutView(), 1);
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingWithFixedPos)
|
| @@ -1148,21 +1158,23 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingWithFixedPos)
|
| // The residual subpixel adjustment should be (0.7,0) - (1,0) = (-0.3,0).
|
| LayoutPoint subpixelAccumulation = LayoutPoint(LayoutPoint(FloatPoint(0.7, 0)) - LayoutPoint(1, 0));
|
| EXPECT_EQ(subpixelAccumulation, bProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
|
|
| LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
|
| const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties();
|
| // The residual subpixel adjustment should still be (-0.3,0).
|
| EXPECT_EQ(subpixelAccumulation, fixedProperties->localBorderBoxProperties()->paintOffset);
|
| - CHECK_VISUAL_RECT(fixed, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(fixed, frameView->layoutView());
|
|
|
| // d should be painted starting at subpixelAccumulation + (0.7,0) = (0.4,0).
|
| LayoutObject* d = document().getElementById("d")->layoutObject();
|
| LayoutPoint dPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7, 0));
|
| const ObjectPaintProperties* dProperties = d->objectPaintProperties();
|
| EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset);
|
| -// TODO(chrishtr): results differ by pixel snapping
|
| -// CHECK_VISUAL_RECT(d, frameView->layoutView());
|
| + // Visual rects via the non-paint properties system use enclosingIntRect before applying transforms,
|
| + // because they are computed bottom-up and therefore can't apply pixel snapping. Therefore apply a
|
| + // slop of 1px.
|
| + CHECK_VISUAL_RECT(d, frameView->layoutView(), 1);
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset)
|
| @@ -1213,8 +1225,8 @@ TEST_F(PaintPropertyTreeBuilderTest, Preserve3DCreatesSharedRenderingContext)
|
| EXPECT_TRUE(aProperties->transform()->hasRenderingContext());
|
| EXPECT_TRUE(bProperties->transform()->hasRenderingContext());
|
| EXPECT_EQ(aProperties->transform()->renderingContextID(), bProperties->transform()->renderingContextID());
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStyleEndsRenderingContext)
|
| @@ -1239,8 +1251,8 @@ TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStyleEndsRenderingContext)
|
| // child #b should not.
|
| EXPECT_TRUE(aProperties->transform()->hasRenderingContext());
|
| EXPECT_FALSE(bProperties->transform()->hasRenderingContext());
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, NestedRenderingContexts)
|
| @@ -1269,8 +1281,8 @@ TEST_F(PaintPropertyTreeBuilderTest, NestedRenderingContexts)
|
| EXPECT_TRUE(aProperties->transform()->hasRenderingContext());
|
| EXPECT_TRUE(bProperties->transform()->hasRenderingContext());
|
| EXPECT_NE(aProperties->transform()->renderingContextID(), bProperties->transform()->renderingContextID());
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| // Returns true if the first node has the second as an ancestor.
|
| @@ -1315,8 +1327,8 @@ TEST_F(PaintPropertyTreeBuilderTest, FlatTransformStylePropagatesToChildren)
|
| // Some node must flatten the inherited transform from #a before it reaches
|
| // #b's transform.
|
| EXPECT_TRUE(someNodeFlattensTransform(bTransform, aTransform));
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, Preserve3DTransformStylePropagatesToChildren)
|
| @@ -1338,8 +1350,8 @@ TEST_F(PaintPropertyTreeBuilderTest, Preserve3DTransformStylePropagatesToChildre
|
| // No node may flatten the inherited transform from #a before it reaches
|
| // #b's transform.
|
| EXPECT_FALSE(someNodeFlattensTransform(bTransform, aTransform));
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PerspectiveIsNotFlattened)
|
| @@ -1363,8 +1375,8 @@ TEST_F(PaintPropertyTreeBuilderTest, PerspectiveIsNotFlattened)
|
| ASSERT_TRUE(bTransform);
|
| ASSERT_TRUE(nodeHasAncestor(bTransform, aPerspective));
|
| EXPECT_FALSE(someNodeFlattensTransform(bTransform, aPerspective));
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, PerspectiveDoesNotEstablishRenderingContext)
|
| @@ -1388,8 +1400,8 @@ TEST_F(PaintPropertyTreeBuilderTest, PerspectiveDoesNotEstablishRenderingContext
|
| const TransformPaintPropertyNode* bTransform = bProperties->transform();
|
| ASSERT_TRUE(bTransform);
|
| EXPECT_FALSE(bTransform->hasRenderingContext());
|
| - CHECK_VISUAL_RECT(a, frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a, frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b, frameView->layoutView());
|
| }
|
|
|
| TEST_F(PaintPropertyTreeBuilderTest, CachedProperties)
|
| @@ -1417,9 +1429,9 @@ TEST_F(PaintPropertyTreeBuilderTest, CachedProperties)
|
| const TransformPaintPropertyNode* cTransformNode = cProperties->transform();
|
| EXPECT_EQ(TransformationMatrix().translate(77, 88), cTransformNode->matrix());
|
|
|
| - CHECK_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
|
|
| // Change transform of b. B's transform node should be a new node with the new value,
|
| // and a and c's transform nodes should be unchanged (with c's parent adjusted).
|
| @@ -1438,9 +1450,9 @@ TEST_F(PaintPropertyTreeBuilderTest, CachedProperties)
|
| EXPECT_EQ(cTransformNode, cProperties->transform());
|
| EXPECT_EQ(bTransformNode, cTransformNode->parent());
|
|
|
| - CHECK_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
|
|
| // Remove transform from b. B's transform node should be removed from the tree,
|
| // and a and c's transform nodes should be unchanged (with c's parent adjusted).
|
| @@ -1457,9 +1469,9 @@ TEST_F(PaintPropertyTreeBuilderTest, CachedProperties)
|
| EXPECT_EQ(cTransformNode, cProperties->transform());
|
| EXPECT_EQ(aTransformNode, cTransformNode->parent());
|
|
|
| - CHECK_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
|
|
| // Re-add transform to b. B's transform node should be inserted into the tree,
|
| // and a and c's transform nodes should be unchanged (with c's parent adjusted).
|
| @@ -1478,9 +1490,9 @@ TEST_F(PaintPropertyTreeBuilderTest, CachedProperties)
|
| EXPECT_EQ(cTransformNode, cProperties->transform());
|
| EXPECT_EQ(bTransformNode, cTransformNode->parent());
|
|
|
| - CHECK_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| - CHECK_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(a->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(b->layoutObject(), frameView->layoutView());
|
| + CHECK_EXACT_VISUAL_RECT(c->layoutObject(), frameView->layoutView());
|
| }
|
|
|
| } // namespace blink
|
|
|