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

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

Issue 2258523006: Convert Settings::rootLayerScrolls to RuntimeEnabledFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & fix mistake Created 4 years, 4 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 509eb77eb446a825355e81cf2e30de3ceee274f1..e563192d1b552ec79c2131c9baeb56c416b6f329 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -16,13 +16,28 @@
namespace blink {
+typedef bool TestParamRootLayerScrolling;
class PaintPropertyTreeBuilderTest
: public RenderingTest
- , public ::testing::WithParamInterface<FrameSettingOverrideFunction> {
+ , public ::testing::WithParamInterface<TestParamRootLayerScrolling> {
public:
PaintPropertyTreeBuilderTest()
: RenderingTest(SingleChildFrameLoaderClient::create())
- , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { }
+ , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ , m_originalRootLayerScrollingEnabled(RuntimeEnabledFeatures::rootLayerScrollingEnabled())
+ , m_enableRootLayerScrolling(GetParam())
+ {
+ RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
+ RuntimeEnabledFeatures::setRootLayerScrollingEnabled(m_enableRootLayerScrolling);
+ }
+
+ ~PaintPropertyTreeBuilderTest()
+ {
+ CHECK_EQ(true, RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ CHECK_EQ(m_enableRootLayerScrolling, RuntimeEnabledFeatures::rootLayerScrollingEnabled());
+ RuntimeEnabledFeatures::setRootLayerScrollingEnabled(m_originalRootLayerScrollingEnabled);
esprehn 2016/08/25 23:59:24 We do this manually in a lot of places?
trchen 2016/08/26 00:15:11 Good point. I was tired of this too. I can make it
+ RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPaintV2Enabled);
+ }
void loadTestData(const char* fileName)
{
@@ -33,22 +48,17 @@ public:
setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size()));
}
- bool rootLayerScrolls()
- {
- return document().settings() && document().settings()->rootLayerScrolls();
- }
-
const TransformPaintPropertyNode* rootTransform()
{
FrameView* frameView = document().view();
- if (rootLayerScrolls())
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
return frameView->layoutView()->objectPaintProperties()->paintOffsetTranslation();
return frameView->rootTransform();
}
const ClipPaintPropertyNode* rootClip()
{
- if (rootLayerScrolls())
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
return document().view()->layoutView()->objectPaintProperties()->localBorderBoxProperties()->propertyTreeState.clip.get();
return document().view()->rootClip();
}
@@ -56,7 +66,7 @@ public:
const TransformPaintPropertyNode* framePreTranslation()
{
FrameView* frameView = document().view();
- if (rootLayerScrolls())
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
return frameView->layoutView()->objectPaintProperties()->paintOffsetTranslation();
return frameView->preTranslation();
}
@@ -64,7 +74,7 @@ public:
const TransformPaintPropertyNode* frameScrollTranslation()
{
FrameView* frameView = document().view();
- if (rootLayerScrolls())
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
return frameView->layoutView()->objectPaintProperties()->scrollTranslation();
return frameView->scrollTranslation();
}
@@ -72,17 +82,14 @@ public:
const ClipPaintPropertyNode* frameContentClip()
{
FrameView* frameView = document().view();
- if (rootLayerScrolls())
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
return frameView->layoutView()->objectPaintProperties()->overflowClip();
return frameView->contentClip();
}
- FrameSettingOverrideFunction settingOverrider() const override { return GetParam(); }
-
private:
void SetUp() override
{
- RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
Settings::setMockScrollbarsEnabled(true);
RenderingTest::SetUp();
@@ -94,10 +101,11 @@ private:
RenderingTest::TearDown();
Settings::setMockScrollbarsEnabled(false);
- RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPaintV2Enabled);
}
bool m_originalSlimmingPaintV2Enabled;
+ bool m_originalRootLayerScrollingEnabled;
+ bool m_enableRootLayerScrolling;
};
#define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, slopFactor) \
@@ -130,7 +138,7 @@ do { \
#define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0)
-INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Values(nullptr, &RootLayerScrollsFrameSettingOverride));
+INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Bool());
TEST_P(PaintPropertyTreeBuilderTest, FixedPosition)
{
@@ -179,7 +187,7 @@ TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll)
EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflowClip()->clipRect());
EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent());
// http://crbug.com/638415
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layoutObject(), frameView->layoutView());
}
@@ -203,7 +211,7 @@ TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll)
EXPECT_EQ(FloatRoundedRect(0, 0, 300, 400), absPosProperties->overflowClip()->clipRect());
EXPECT_EQ(frameContentClip(), absPosProperties->overflowClip()->parent());
// http://crbug.com/638415
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(123, 456, 300, 400), absPos->layoutObject(), frameView->layoutView());
}
}
@@ -217,7 +225,7 @@ TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
FrameView* frameView = document().view();
frameView->updateAllLifecyclePhases();
EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix());
- if (!rootLayerScrolls())
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
EXPECT_EQ(rootTransform(), framePreTranslation()->parent());
EXPECT_EQ(nullptr, rootTransform()->parent());
EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation()->matrix());
@@ -225,13 +233,13 @@ TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace());
EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect());
EXPECT_EQ(rootClip(), frameContentClip()->parent());
- if (!rootLayerScrolls())
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
EXPECT_EQ(nullptr, rootClip()->parent());
LayoutViewItem layoutViewItem = document().layoutViewItem();
const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProperties();
// http://crbug.com/638415
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation());
CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()->layoutObject(), frameView->layoutView());
}
@@ -268,7 +276,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Transform)
EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->paintOffsetTranslation()->matrix());
EXPECT_EQ(frameScrollTranslation(), transformProperties->paintOffsetTranslation()->parent());
// http://crbug.com/638415
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), transform->layoutObject(), document().view()->layoutView());
}
}
@@ -748,7 +756,7 @@ TEST_P(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes)
const ObjectPaintProperties* divWithTransformProperties = divWithTransform->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformProperties->transform()->matrix());
// http://crbug.com/638415
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform, frameView->layoutView());
}
@@ -815,7 +823,7 @@ TEST_P(PaintPropertyTreeBuilderTest, TransformNodesInTransformedSubframes)
LayoutObject* divWithTransform = document().getElementById("divWithTransform")->layoutObject();
EXPECT_EQ(divWithTransformTransform, divWithTransform->objectPaintProperties()->transform());
// http://crbug.com/638415
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 248), divWithTransform, frameView->layoutView());
}
}
@@ -868,7 +876,7 @@ TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext)
EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->propertyTreeState.clip);
EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxProperties()->propertyTreeState.transform);
EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxProperties()->propertyTreeState.effect);
- if (!rootLayerScrolls()) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, document().view()->layoutView());
}
CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view()->layoutView());

Powered by Google App Engine
This is Rietveld 408576698