OLD | NEW |
---|---|
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 "hidden'></div>" | 117 "hidden'></div>" |
118 " </div>" | 118 " </div>" |
119 "</div>"); | 119 "</div>"); |
120 | 120 |
121 LayoutObject* overflowClipObject = | 121 LayoutObject* overflowClipObject = |
122 getLayoutObjectByElementId("overflow-clip-layer"); | 122 getLayoutObjectByElementId("overflow-clip-layer"); |
123 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); | 123 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); |
124 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); | 124 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); |
125 } | 125 } |
126 | 126 |
127 TEST_F(LayoutObjectTest, FloatUnderInline) { | |
chrishtr
2016/12/16 22:10:30
Please add more float examples to test your change
Xianzhu
2016/12/17 05:43:18
Added a FloatUnderBlock case, and added test for c
| |
128 enableCompositing(); | |
129 setBodyInnerHTML( | |
130 "<div id='layered-div' style='position: absolute'>" | |
131 " <div id='container'>" | |
132 " <span id='layered-span' style='position: relative'>" | |
133 " <div id='floating' style='float: left'>FLOAT</div>" | |
134 " </span>" | |
135 " </div>" | |
136 "</div>"); | |
137 | |
138 LayoutBoxModelObject* layeredDiv = | |
139 toLayoutBoxModelObject(getLayoutObjectByElementId("layered-div")); | |
140 LayoutBoxModelObject* container = | |
141 toLayoutBoxModelObject(getLayoutObjectByElementId("container")); | |
142 LayoutBoxModelObject* layeredSpan = | |
143 toLayoutBoxModelObject(getLayoutObjectByElementId("layered-span")); | |
144 LayoutObject* floating = getLayoutObjectByElementId("floating"); | |
145 | |
146 EXPECT_EQ(layeredDiv->layer(), layeredDiv->paintingLayer()); | |
147 EXPECT_EQ(layeredSpan->layer(), layeredSpan->paintingLayer()); | |
148 EXPECT_EQ(layeredDiv->layer(), floating->paintingLayer()); | |
149 EXPECT_EQ(container, floating->container()); | |
150 } | |
151 | |
127 namespace { | 152 namespace { |
128 | 153 |
129 class ScopedSPv2 { | 154 class ScopedSPv2 { |
130 public: | 155 public: |
131 ScopedSPv2() { RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); } | 156 ScopedSPv2() { RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); } |
132 ~ScopedSPv2() { m_featuresBackup.restore(); } | 157 ~ScopedSPv2() { m_featuresBackup.restore(); } |
133 | 158 |
134 private: | 159 private: |
135 RuntimeEnabledFeatures::Backup m_featuresBackup; | 160 RuntimeEnabledFeatures::Backup m_featuresBackup; |
136 }; | 161 }; |
(...skipping 30 matching lines...) Expand all Loading... | |
167 EXPECT_FALSE(object->mayNeedPaintInvalidation()); | 192 EXPECT_FALSE(object->mayNeedPaintInvalidation()); |
168 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); | 193 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); |
169 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); | 194 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); |
170 EXPECT_FALSE(object->shouldInvalidateSelection()); | 195 EXPECT_FALSE(object->shouldInvalidateSelection()); |
171 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); | 196 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); |
172 EXPECT_FALSE(object->needsPaintPropertyUpdate()); | 197 EXPECT_FALSE(object->needsPaintPropertyUpdate()); |
173 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); | 198 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); |
174 } | 199 } |
175 | 200 |
176 } // namespace blink | 201 } // namespace blink |
OLD | NEW |