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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp

Issue 2575423003: Fix geometry mapping issues for float under inline (Closed)
Patch Set: SVG floating Created 3 years, 11 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 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/layout/LayoutObject.h" 5 #include "core/layout/LayoutObject.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.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 #include "platform/json/JSONValues.h" 10 #include "platform/json/JSONValues.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 "hidden'></div>" 118 "hidden'></div>"
119 " </div>" 119 " </div>"
120 "</div>"); 120 "</div>");
121 121
122 LayoutObject* overflowClipObject = 122 LayoutObject* overflowClipObject =
123 getLayoutObjectByElementId("overflow-clip-layer"); 123 getLayoutObjectByElementId("overflow-clip-layer");
124 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); 124 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns"));
125 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); 125 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer());
126 } 126 }
127 127
128 TEST_F(LayoutObjectTest, FloatUnderBlock) {
129 setBodyInnerHTML(
130 "<div id='layered-div' style='position: absolute'>"
131 " <div id='container'>"
132 " <div id='floating' style='float: left'>FLOAT</div>"
133 " </div>"
134 "</div>");
135
136 LayoutBoxModelObject* layeredDiv =
137 toLayoutBoxModelObject(getLayoutObjectByElementId("layered-div"));
138 LayoutBoxModelObject* container =
139 toLayoutBoxModelObject(getLayoutObjectByElementId("container"));
140 LayoutObject* floating = getLayoutObjectByElementId("floating");
141
142 EXPECT_EQ(layeredDiv->layer(), layeredDiv->paintingLayer());
143 EXPECT_EQ(layeredDiv->layer(), floating->paintingLayer());
144 EXPECT_EQ(container, floating->container());
145 EXPECT_EQ(container, floating->containingBlock());
146 }
147
148 TEST_F(LayoutObjectTest, FloatUnderInline) {
149 setBodyInnerHTML(
150 "<div id='layered-div' style='position: absolute'>"
151 " <div id='container'>"
152 " <span id='layered-span' style='position: relative'>"
153 " <div id='floating' style='float: left'>FLOAT</div>"
154 " </span>"
155 " </div>"
156 "</div>");
157
158 LayoutBoxModelObject* layeredDiv =
159 toLayoutBoxModelObject(getLayoutObjectByElementId("layered-div"));
160 LayoutBoxModelObject* container =
161 toLayoutBoxModelObject(getLayoutObjectByElementId("container"));
162 LayoutBoxModelObject* layeredSpan =
163 toLayoutBoxModelObject(getLayoutObjectByElementId("layered-span"));
164 LayoutObject* floating = getLayoutObjectByElementId("floating");
165
166 EXPECT_EQ(layeredDiv->layer(), layeredDiv->paintingLayer());
167 EXPECT_EQ(layeredSpan->layer(), layeredSpan->paintingLayer());
168 EXPECT_EQ(layeredDiv->layer(), floating->paintingLayer());
169 EXPECT_EQ(container, floating->container());
170 EXPECT_EQ(container, floating->containingBlock());
171
172 bool ancestorSkipped = false;
173 EXPECT_EQ(container, floating->container(layeredSpan, &ancestorSkipped));
174 EXPECT_TRUE(ancestorSkipped);
175
176 ancestorSkipped = false;
177 EXPECT_EQ(container, floating->container(container, &ancestorSkipped));
178 EXPECT_FALSE(ancestorSkipped);
179 }
180
128 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) { 181 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) {
129 LayoutObject* object = document().body()->layoutObject(); 182 LayoutObject* object = document().body()->layoutObject();
130 object->setShouldDoFullPaintInvalidation(); 183 object->setShouldDoFullPaintInvalidation();
131 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); 184 EXPECT_TRUE(object->shouldDoFullPaintInvalidation());
132 object->m_bitfields.setChildShouldCheckForPaintInvalidation(true); 185 object->m_bitfields.setChildShouldCheckForPaintInvalidation(true);
133 EXPECT_TRUE(object->m_bitfields.childShouldCheckForPaintInvalidation()); 186 EXPECT_TRUE(object->m_bitfields.childShouldCheckForPaintInvalidation());
134 object->setMayNeedPaintInvalidation(); 187 object->setMayNeedPaintInvalidation();
135 EXPECT_TRUE(object->mayNeedPaintInvalidation()); 188 EXPECT_TRUE(object->mayNeedPaintInvalidation());
136 object->setMayNeedPaintInvalidationSubtree(); 189 object->setMayNeedPaintInvalidationSubtree();
137 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree()); 190 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree());
(...skipping 17 matching lines...) Expand all
155 EXPECT_FALSE(object->mayNeedPaintInvalidation()); 208 EXPECT_FALSE(object->mayNeedPaintInvalidation());
156 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); 209 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree());
157 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); 210 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage());
158 EXPECT_FALSE(object->shouldInvalidateSelection()); 211 EXPECT_FALSE(object->shouldInvalidateSelection());
159 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); 212 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation());
160 EXPECT_FALSE(object->needsPaintPropertyUpdate()); 213 EXPECT_FALSE(object->needsPaintPropertyUpdate());
161 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); 214 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate());
162 } 215 }
163 216
164 } // namespace blink 217 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698