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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2370553002: Refactor LocalBorderBoxProperties to use PropertyTreeState (Closed)
Patch Set: Rebase from space Created 4 years, 3 months 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/paint/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 4c2771674bb72f5d1cb9fca1395d44641288d4df..12ec01407c81b9afe05f7db1b724a9d59cec17aa 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -95,11 +95,13 @@ do { \
LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidation()); \
source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties()->paintOffset); \
bool success = false; \
- GeometryPropertyTreeState contentsProperties; \
- (ancestorLayoutObject)->objectPaintProperties()->getContentsProperties(contentsProperties); \
+ const ObjectPaintProperties* ancestorProperies = (ancestorLayoutObject)->objectPaintProperties(); \
+ GeometryPropertyTreeState contentsProperties = ancestorProperies->getContentsProperties(); \
+ const auto* sourceBorderBoxProperties = (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties(); \
+ GeometryPropertyTreeState localBorderBoxProperties(sourceBorderBoxProperties->propertyTreeState.transform, sourceBorderBoxProperties->propertyTreeState.clip, sourceBorderBoxProperties->propertyTreeState.effect); \
FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \
FloatRect(source), \
- (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties()->geometryPropertyTreeState, \
+ localBorderBoxProperties, \
contentsProperties, success); \
ASSERT_TRUE(success); \
EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << expected.toString() << ", actual: " << actual.toString(); \
@@ -851,9 +853,9 @@ TEST_P(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext)
LayoutObject* child = document().getElementById("child")->layoutObject();
const ObjectPaintProperties* childProperties = child->objectPaintProperties();
- EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
- EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
- EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryPropertyTreeState.effect);
+ EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
+ EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
+ EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTreeState.effect);
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->layoutView());
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layoutView());
}
@@ -877,9 +879,9 @@ TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext)
LayoutObject& child = *document().getElementById("child")->layoutObject();
const ObjectPaintProperties* childProperties = child.objectPaintProperties();
- EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
- EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
- EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.effect);
+ EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
+ EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
+ EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxProperties()->propertyTreeState.effect);
if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, document().view()->layoutView());
}
@@ -922,7 +924,7 @@ TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation)
const ObjectPaintProperties* targetProperties = target.objectPaintProperties();
EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties()->paintOffset);
- EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
+ EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperties()->propertyTreeState.transform);
CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().view()->layoutView());
}
@@ -965,9 +967,9 @@ TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant)
LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties();
- EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
- EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform->parent());
- EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform->matrix());
+ EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperties()->propertyTreeState.clip);
+ 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);
CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(),
// TODO(crbug.com/599939): CSS clip of fixed-position descendants is broken in mapToVisualRectInAncestorSpace().
@@ -1013,8 +1015,8 @@ TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant)
LayoutObject* absolute = document().getElementById("absolute")->layoutObject();
const ObjectPaintProperties* absPosProperties = absolute->objectPaintProperties();
- EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
- EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform->parent());
+ EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxProperties()->propertyTreeState.clip);
+ EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties()->propertyTreeState.transform->parent());
EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties()->paintOffset);
CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(),
// TODO(crbug.com/599939): CSS clip of fixed-position descendants is broken in mapToVisualRectInAncestorSpace().
@@ -1074,9 +1076,9 @@ TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared)
LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties();
- EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
- EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform->parent());
- EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform->matrix());
+ EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBorderBoxProperties()->propertyTreeState.clip);
+ 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);
CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(),
// TODO(crbug.com/599939): CSS clip of fixed-position descendants is broken in geometry mapping.
@@ -1623,18 +1625,17 @@ TEST_P(PaintPropertyTreeBuilderTest, OverflowClipContentsProperties)
LayoutObject* child = document().getElementById("child")->layoutObject();
const ObjectPaintProperties* childProperties = child->objectPaintProperties();
- EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
- EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
+ EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties()->propertyTreeState.transform);
+ EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->propertyTreeState.clip);
- GeometryPropertyTreeState contentsProperties;
- clipProperties->getContentsProperties(contentsProperties);
+ GeometryPropertyTreeState contentsProperties = clipProperties->getContentsProperties();
EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform);
EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip);
- EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
- EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
+ EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
+ EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
- EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryPropertyTreeState.effect);
+ EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTreeState.effect);
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
}
@@ -1659,16 +1660,15 @@ TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties)
LayoutObject* child = document().getElementById("child")->layoutObject();
const ObjectPaintProperties* childProperties = child->objectPaintProperties();
- EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
- EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
+ EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties()->propertyTreeState.transform);
+ EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->propertyTreeState.clip);
- GeometryPropertyTreeState contentsProperties;
- clipProperties->getContentsProperties(contentsProperties);
+ GeometryPropertyTreeState contentsProperties = clipProperties->getContentsProperties();
EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform);
EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip);
- EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
- EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
+ EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
+ EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
}
@@ -1689,12 +1689,11 @@ TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties)
const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties();
LayoutObject* child = document().getElementById("child")->layoutObject();
- EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
+ EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties()->propertyTreeState.transform);
// CSS clip on an element causes it to clip itself, not just descendants.
- EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxProperties()->geometryPropertyTreeState.clip);
+ EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxProperties()->propertyTreeState.clip);
- GeometryPropertyTreeState contentsProperties;
- clipProperties->getContentsProperties(contentsProperties);
+ GeometryPropertyTreeState contentsProperties = clipProperties->getContentsProperties();
EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform);
EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip);
@@ -1722,10 +1721,9 @@ TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")->layoutObject();
const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objectPaintProperties();
- EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBoxProperties()->geometryPropertyTreeState.transform);
+ EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBoxProperties()->propertyTreeState.transform);
- GeometryPropertyTreeState contentsProperties;
- svgWithViewBoxProperties->getContentsProperties(contentsProperties);
+ GeometryPropertyTreeState contentsProperties = svgWithViewBoxProperties->getContentsProperties();
EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contentsProperties.transform);
}

Powered by Google App Engine
This is Rietveld 408576698