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

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

Issue 2529293012: Invalidate paint properties on paint offset changes (Closed)
Patch Set: Simpler fix for overflowclip 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 3011 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 EXPECT_FALSE(document().layoutView()->needsPaintPropertyUpdate()); 3022 EXPECT_FALSE(document().layoutView()->needsPaintPropertyUpdate());
3023 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate()); 3023 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
3024 EXPECT_FALSE(transform->needsPaintPropertyUpdate()); 3024 EXPECT_FALSE(transform->needsPaintPropertyUpdate());
3025 EXPECT_FALSE(transform->descendantNeedsPaintPropertyUpdate()); 3025 EXPECT_FALSE(transform->descendantNeedsPaintPropertyUpdate());
3026 EXPECT_FALSE(iframeLayoutView->needsPaintPropertyUpdate()); 3026 EXPECT_FALSE(iframeLayoutView->needsPaintPropertyUpdate());
3027 EXPECT_FALSE(iframeLayoutView->descendantNeedsPaintPropertyUpdate()); 3027 EXPECT_FALSE(iframeLayoutView->descendantNeedsPaintPropertyUpdate());
3028 EXPECT_FALSE(iframeTransform->needsPaintPropertyUpdate()); 3028 EXPECT_FALSE(iframeTransform->needsPaintPropertyUpdate());
3029 EXPECT_FALSE(iframeTransform->descendantNeedsPaintPropertyUpdate()); 3029 EXPECT_FALSE(iframeTransform->descendantNeedsPaintPropertyUpdate());
3030 } 3030 }
3031 3031
3032 TEST_P(PaintPropertyTreeBuilderTest, OverflowClipRecomputedOnChange) {
3033 setBodyInnerHTML(
3034 "<style>"
3035 "body { margin:0 }"
3036 "#div { overflow:hidden; height:0px; }"
3037 "</style>"
3038 "<div id='div'></div>");
3039 auto* div = document().getElementById("div");
3040 div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:7px;");
3041 document().view()->updateAllLifecyclePhases();
3042 auto* properties = div->layoutObject()->paintProperties()->overflowClip();
3043 EXPECT_EQ(FloatRect(0, 0, 7, 0), properties->clipRect().rect());
3044
3045 // Width changes should update the overflow clip.
3046 div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:7px;");
3047 document().view()->updateAllLifecyclePhases();
3048 properties = div->layoutObject()->paintProperties()->overflowClip();
3049 EXPECT_EQ(FloatRect(0, 0, 7, 0), properties->clipRect().rect());
3050 div->setAttribute(HTMLNames::styleAttr, "display:inline-block; width:9px;");
3051 document().view()->updateAllLifecyclePhases();
3052 EXPECT_EQ(FloatRect(0, 0, 9, 0), properties->clipRect().rect());
3053
3054 // An inline block's overflow clip should be updated when padding changes,
3055 // even if the border box remains unchanged.
3056 div->setAttribute(HTMLNames::styleAttr,
3057 "display:inline-block; width:7px; padding-right:3px;");
3058 document().view()->updateAllLifecyclePhases();
3059 properties = div->layoutObject()->paintProperties()->overflowClip();
3060 EXPECT_EQ(FloatRect(0, 0, 10, 0), properties->clipRect().rect());
3061 div->setAttribute(HTMLNames::styleAttr,
3062 "display:inline-block; width:8px; padding-right:2px;");
3063 document().view()->updateAllLifecyclePhases();
3064 EXPECT_EQ(FloatRect(0, 0, 10, 0), properties->clipRect().rect());
3065 div->setAttribute(HTMLNames::styleAttr,
3066 "display:inline-block; width:8px;"
3067 "padding-right:1px; padding-left:1px;");
3068 document().view()->updateAllLifecyclePhases();
3069 EXPECT_EQ(FloatRect(0, 0, 10, 0), properties->clipRect().rect());
3070
3071 // An block's overflow clip should be updated when borders change.
3072 div->setAttribute(HTMLNames::styleAttr, "border-right:3px solid red;");
3073 document().view()->updateAllLifecyclePhases();
3074 properties = div->layoutObject()->paintProperties()->overflowClip();
3075 EXPECT_EQ(FloatRect(0, 0, 797, 0), properties->clipRect().rect());
3076 div->setAttribute(HTMLNames::styleAttr, "border-right:5px solid red;");
3077 document().view()->updateAllLifecyclePhases();
3078 EXPECT_EQ(FloatRect(0, 0, 795, 0), properties->clipRect().rect());
3079 }
3080
3032 } // namespace blink 3081 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698