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

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

Issue 2529293012: Invalidate paint properties on paint offset changes (Closed)
Patch Set: Fix transform underinvalidation, skip several spinvalidation skips Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/HTMLIFrameElement.h" 5 #include "core/html/HTMLIFrameElement.h"
6 #include "core/layout/LayoutTestHelper.h" 6 #include "core/layout/LayoutTestHelper.h"
7 #include "core/layout/LayoutTreeAsText.h" 7 #include "core/layout/LayoutTreeAsText.h"
8 #include "core/layout/api/LayoutViewItem.h" 8 #include "core/layout/api/LayoutViewItem.h"
9 #include "core/paint/ObjectPaintProperties.h" 9 #include "core/paint/ObjectPaintProperties.h"
10 #include "core/paint/PaintPropertyTreePrinter.h" 10 #include "core/paint/PaintPropertyTreePrinter.h"
(...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 EXPECT_FALSE(document().layoutView()->needsPaintPropertyUpdate()); 3052 EXPECT_FALSE(document().layoutView()->needsPaintPropertyUpdate());
3053 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate()); 3053 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
3054 EXPECT_FALSE(transform->needsPaintPropertyUpdate()); 3054 EXPECT_FALSE(transform->needsPaintPropertyUpdate());
3055 EXPECT_FALSE(transform->descendantNeedsPaintPropertyUpdate()); 3055 EXPECT_FALSE(transform->descendantNeedsPaintPropertyUpdate());
3056 EXPECT_FALSE(iframeLayoutView->needsPaintPropertyUpdate()); 3056 EXPECT_FALSE(iframeLayoutView->needsPaintPropertyUpdate());
3057 EXPECT_FALSE(iframeLayoutView->descendantNeedsPaintPropertyUpdate()); 3057 EXPECT_FALSE(iframeLayoutView->descendantNeedsPaintPropertyUpdate());
3058 EXPECT_FALSE(iframeTransform->needsPaintPropertyUpdate()); 3058 EXPECT_FALSE(iframeTransform->needsPaintPropertyUpdate());
3059 EXPECT_FALSE(iframeTransform->descendantNeedsPaintPropertyUpdate()); 3059 EXPECT_FALSE(iframeTransform->descendantNeedsPaintPropertyUpdate());
3060 } 3060 }
3061 3061
3062 TEST_P(PaintPropertyTreeBuilderTest, ClipChangesUpdateOverflowClip) {
3063 setBodyInnerHTML(
3064 "<style>"
3065 " body { margin:0 }"
3066 " #div { overflow:hidden; height:0px; }"
3067 "</style>"
3068 "<div id='div'></div>");
3069 auto* div = document().getElementById("div");
3070 div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:7px;");
3071 document().view()->updateAllLifecyclePhases();
3072 auto* clipProperties = div->layoutObject()->paintProperties()->overflowClip();
3073 EXPECT_EQ(FloatRect(0, 0, 7, 0), clipProperties->clipRect().rect());
3074
3075 // Width changes should update the overflow clip.
3076 div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:7px;");
3077 document().view()->updateAllLifecyclePhases();
3078 clipProperties = div->layoutObject()->paintProperties()->overflowClip();
3079 EXPECT_EQ(FloatRect(0, 0, 7, 0), clipProperties->clipRect().rect());
3080 div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:9px;");
3081 document().view()->updateAllLifecyclePhases();
3082 EXPECT_EQ(FloatRect(0, 0, 9, 0), clipProperties->clipRect().rect());
3083
3084 // An inline block's overflow clip should be updated when padding changes,
3085 // even if the border box remains unchanged.
3086 div->setAttribute(HTMLNames::styleAttr,
3087 "display:inline-block; width:7px; padding-right:3px;");
3088 document().view()->updateAllLifecyclePhases();
3089 clipProperties = div->layoutObject()->paintProperties()->overflowClip();
3090 EXPECT_EQ(FloatRect(0, 0, 10, 0), clipProperties->clipRect().rect());
3091 div->setAttribute(HTMLNames::styleAttr,
3092 "display:inline-block; width:8px; padding-right:2px;");
3093 document().view()->updateAllLifecyclePhases();
3094 EXPECT_EQ(FloatRect(0, 0, 10, 0), clipProperties->clipRect().rect());
3095 div->setAttribute(HTMLNames::styleAttr,
3096 "display:inline-block; width:8px;"
3097 "padding-right:1px; padding-left:1px;");
3098 document().view()->updateAllLifecyclePhases();
3099 EXPECT_EQ(FloatRect(0, 0, 10, 0), clipProperties->clipRect().rect());
3100
3101 // An block's overflow clip should be updated when borders change.
3102 div->setAttribute(HTMLNames::styleAttr, "border-right:3px solid red;");
3103 document().view()->updateAllLifecyclePhases();
3104 clipProperties = div->layoutObject()->paintProperties()->overflowClip();
3105 EXPECT_EQ(FloatRect(0, 0, 797, 0), clipProperties->clipRect().rect());
3106 div->setAttribute(HTMLNames::styleAttr, "border-right:5px solid red;");
3107 document().view()->updateAllLifecyclePhases();
3108 EXPECT_EQ(FloatRect(0, 0, 795, 0), clipProperties->clipRect().rect());
3109
3110 // Removing overflow clip should remove the property.
3111 div->setAttribute(HTMLNames::styleAttr, "overflow:hidden;");
3112 document().view()->updateAllLifecyclePhases();
3113 clipProperties = div->layoutObject()->paintProperties()->overflowClip();
3114 EXPECT_EQ(FloatRect(0, 0, 800, 0), clipProperties->clipRect().rect());
3115 div->setAttribute(HTMLNames::styleAttr, "overflow:visible;");
3116 document().view()->updateAllLifecyclePhases();
3117 EXPECT_TRUE(!div->layoutObject()->paintProperties() ||
3118 !div->layoutObject()->paintProperties()->overflowClip());
3119 }
3120
3121 // crbug.com:645667: Contain paint changes fail to update paint properties.
3122 TEST_P(PaintPropertyTreeBuilderTest,
3123 DISABLED_ContainPaintChangesUpdateOverflowClip) {
3124 setBodyInnerHTML(
3125 "<style>"
3126 " body { margin:0 }"
3127 " #div { will-change:transform; width:7px; height:6px; }"
3128 "</style>"
3129 "<div id='div' style='contain:paint;'></div>");
3130 document().view()->updateAllLifecyclePhases();
3131 auto* div = document().getElementById("div");
3132 auto* properties = div->layoutObject()->paintProperties()->overflowClip();
3133 EXPECT_EQ(FloatRect(0, 0, 7, 6), properties->clipRect().rect());
3134
3135 div->setAttribute(HTMLNames::styleAttr, "");
3136 document().view()->updateAllLifecyclePhases();
3137 EXPECT_TRUE(!div->layoutObject()->paintProperties() ||
3138 !div->layoutObject()->paintProperties()->overflowClip());
3139 }
3140
3062 } // namespace blink 3141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698