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

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

Issue 2579363003: Update paint properties on FrameView visibility changes (Closed)
Patch Set: Add unittest 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return frameView->scrollTranslation(); 56 return frameView->scrollTranslation();
57 } 57 }
58 58
59 const ClipPaintPropertyNode* frameContentClip() { 59 const ClipPaintPropertyNode* frameContentClip() {
60 FrameView* frameView = document().view(); 60 FrameView* frameView = document().view();
61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
62 return frameView->layoutView()->paintProperties()->overflowClip(); 62 return frameView->layoutView()->paintProperties()->overflowClip();
63 return frameView->contentClip(); 63 return frameView->contentClip();
64 } 64 }
65 65
66 const ScrollPaintPropertyNode* frameScroll() { 66 const ScrollPaintPropertyNode* frameScroll(FrameView* frameView = nullptr) {
67 FrameView* frameView = document().view(); 67 if (!frameView)
68 frameView = document().view();
68 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
69 return frameView->layoutView()->paintProperties()->scroll(); 70 return frameView->layoutView()->paintProperties()->scroll();
70 return frameView->scroll(); 71 return frameView->scroll();
71 } 72 }
72 73
73 LayoutPoint paintOffset(const LayoutObject* object) { 74 LayoutPoint paintOffset(const LayoutObject* object) {
74 return object->paintProperties()->localBorderBoxProperties()->paintOffset; 75 return object->paintProperties()->localBorderBoxProperties()->paintOffset;
75 } 76 }
76 77
77 private: 78 private:
(...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3224 TEST_P(PaintPropertyTreeBuilderTest, NoPaintPropertyUpdateOnBackgroundChange) { 3225 TEST_P(PaintPropertyTreeBuilderTest, NoPaintPropertyUpdateOnBackgroundChange) {
3225 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); 3226 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>");
3226 auto* div = document().getElementById("div"); 3227 auto* div = document().getElementById("div");
3227 3228
3228 document().view()->updateAllLifecyclePhases(); 3229 document().view()->updateAllLifecyclePhases();
3229 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); 3230 div->setAttribute(HTMLNames::styleAttr, "background-color: green");
3230 document().view()->updateLifecycleToLayoutClean(); 3231 document().view()->updateLifecycleToLayoutClean();
3231 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); 3232 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate());
3232 } 3233 }
3233 3234
3235 // Disabled due to stale scrollsOverflow values, see: https://crbug.com/675296.
3236 TEST_P(PaintPropertyTreeBuilderTest,
3237 DISABLED_FrameVisibilityChangeUpdatesProperties) {
3238 setBodyInnerHTML(
3239 "<style>body { margin: 0; }</style>"
3240 "<div id='iframeContainer'>"
3241 " <iframe id='iframe' style='width: 100px; height: 100px;'></iframe>"
3242 "</div>");
3243 setChildFrameHTML(
3244 "<style>body { margin: 0; }</style>"
3245 "<div id='forceScroll' style='height: 3000px;'></div>");
3246
3247 FrameView* frameView = document().view();
3248 frameView->updateAllLifecyclePhases();
3249 EXPECT_EQ(nullptr, frameScroll(frameView));
3250 FrameView* childFrameView = childDocument().view();
3251 EXPECT_NE(nullptr, frameScroll(childFrameView));
3252
3253 auto* iframeContainer = document().getElementById("iframeContainer");
3254 iframeContainer->setAttribute(HTMLNames::styleAttr, "visibility: hidden;");
3255 frameView->updateAllLifecyclePhases();
3256
3257 EXPECT_EQ(nullptr, frameScroll(frameView));
3258 EXPECT_EQ(nullptr, frameScroll(childFrameView));
3259 }
3260
3234 } // namespace blink 3261 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698