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

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

Issue 2545683002: Move all descendant-dependent flags into the same tree walk. (Closed)
Patch Set: none 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/paint/PaintLayer.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintLayer.h" 5 #include "core/paint/PaintLayer.h"
6 6
7 #include "core/layout/LayoutBoxModelObject.h" 7 #include "core/layout/LayoutBoxModelObject.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 scrollLayer->getScrollableArea()->setScrollOffset(ScrollOffset(1000, 1000), 106 scrollLayer->getScrollableArea()->setScrollOffset(ScrollOffset(1000, 1000),
107 ProgrammaticScroll); 107 ProgrammaticScroll);
108 document().view()->updateAllLifecyclePhasesExceptPaint(); 108 document().view()->updateAllLifecyclePhasesExceptPaint();
109 EXPECT_EQ(LayoutPoint(-1000, -1000), contentLayer->location()); 109 EXPECT_EQ(LayoutPoint(-1000, -1000), contentLayer->location());
110 EXPECT_TRUE(contentLayer->needsRepaint()); 110 EXPECT_TRUE(contentLayer->needsRepaint());
111 EXPECT_TRUE(scrollLayer->needsRepaint()); 111 EXPECT_TRUE(scrollLayer->needsRepaint());
112 document().view()->updateAllLifecyclePhases(); 112 document().view()->updateAllLifecyclePhases();
113 } 113 }
114 114
115 TEST_F(PaintLayerTest, HasNonIsolatedDescendantWithBlendMode) {
116 setBodyInnerHTML(
117 "<div id='stacking-grandparent' style='isolation: isolate'>"
118 " <div id='stacking-parent' style='isolation: isolate'>"
119 " <div id='non-stacking-parent' style='position:relative'>"
120 " <div id='blend-mode' style='mix-blend-mode: overlay'>"
121 " </div>"
122 " </div>"
123 " </div>"
124 "</div>");
125 PaintLayer* stackingGrandparent =
126 toLayoutBoxModelObject(getLayoutObjectByElementId("stacking-grandparent"))
127 ->layer();
128 PaintLayer* stackingParent =
129 toLayoutBoxModelObject(getLayoutObjectByElementId("stacking-parent"))
130 ->layer();
131 PaintLayer* parent =
132 toLayoutBoxModelObject(getLayoutObjectByElementId("non-stacking-parent"))
133 ->layer();
134
135 EXPECT_TRUE(parent->hasNonIsolatedDescendantWithBlendMode());
136 EXPECT_TRUE(stackingParent->hasNonIsolatedDescendantWithBlendMode());
137 EXPECT_FALSE(stackingGrandparent->hasNonIsolatedDescendantWithBlendMode());
138
139 EXPECT_FALSE(parent->hasDescendantWithClipPath());
140 EXPECT_TRUE(parent->hasVisibleDescendant());
141 }
142
143 TEST_F(PaintLayerTest, HasDescendantWithClipPath) {
144 setBodyInnerHTML(
145 "<div id='parent' style='position:relative'>"
146 " <div id='clip-path' style='clip-path: circle(50px at 0 100px)'>"
147 " </div>"
148 "</div>");
149 PaintLayer* parent =
150 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
151 PaintLayer* clipPath =
152 toLayoutBoxModelObject(getLayoutObjectByElementId("clip-path"))->layer();
153
154 EXPECT_TRUE(parent->hasDescendantWithClipPath());
155 EXPECT_FALSE(clipPath->hasDescendantWithClipPath());
156
157 EXPECT_FALSE(parent->hasNonIsolatedDescendantWithBlendMode());
158 EXPECT_TRUE(parent->hasVisibleDescendant());
159 }
160
161 TEST_F(PaintLayerTest, HasVisibleDescendant) {
162 enableCompositing();
163 setBodyInnerHTML(
164 "<div id='invisible' style='position:relative'>"
165 " <div id='visible' style='visibility: visible; position: relative'>"
166 " </div>"
167 "</div>");
168 PaintLayer* invisible =
169 toLayoutBoxModelObject(getLayoutObjectByElementId("invisible"))->layer();
170 PaintLayer* visible =
171 toLayoutBoxModelObject(getLayoutObjectByElementId("visible"))->layer();
172
173 EXPECT_TRUE(invisible->hasVisibleDescendant());
174 EXPECT_FALSE(visible->hasVisibleDescendant());
175
176 EXPECT_FALSE(invisible->hasNonIsolatedDescendantWithBlendMode());
177 EXPECT_FALSE(invisible->hasDescendantWithClipPath());
178 }
179
115 } // namespace blink 180 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698