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

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

Issue 2575423003: Fix geometry mapping issues for float under inline (Closed)
Patch Set: - 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 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 auto* div = document().getElementById("div"); 3213 auto* div = document().getElementById("div");
3214 auto* properties = div->layoutObject()->paintProperties()->overflowClip(); 3214 auto* properties = div->layoutObject()->paintProperties()->overflowClip();
3215 EXPECT_EQ(FloatRect(0, 0, 7, 6), properties->clipRect().rect()); 3215 EXPECT_EQ(FloatRect(0, 0, 7, 6), properties->clipRect().rect());
3216 3216
3217 div->setAttribute(HTMLNames::styleAttr, ""); 3217 div->setAttribute(HTMLNames::styleAttr, "");
3218 document().view()->updateAllLifecyclePhases(); 3218 document().view()->updateAllLifecyclePhases();
3219 EXPECT_TRUE(!div->layoutObject()->paintProperties() || 3219 EXPECT_TRUE(!div->layoutObject()->paintProperties() ||
3220 !div->layoutObject()->paintProperties()->overflowClip()); 3220 !div->layoutObject()->paintProperties()->overflowClip());
3221 } 3221 }
3222 3222
3223 TEST_P(PaintPropertyTreeBuilderTest, FloatUnderInline) {
3224 setBodyInnerHTML(
3225 "<span id='span'"
3226 " style='position: relative; top: 100px; left: 200px; opacity: 0.5'>"
3227 " <div id='target' style='float: left; width: 33px; height: 44px'>"
3228 " </div>"
3229 "</span>");
3230
3231 LayoutObject* span = getLayoutObjectByElementId("span");
3232 const auto* effect = span->paintProperties()->effect();
3233 ASSERT_TRUE(effect);
3234 EXPECT_EQ(0.5f, effect->opacity());
3235
3236 LayoutObject* target = getLayoutObjectByElementId("target");
3237 const auto* localBorderBoxProperties =
3238 target->paintProperties()->localBorderBoxProperties();
3239 ASSERT_TRUE(localBorderBoxProperties);
3240 EXPECT_EQ(LayoutPoint(8, 8), localBorderBoxProperties->paintOffset);
chrishtr 2016/12/16 22:10:30 * { margin: 0 }
Xianzhu 2016/12/17 05:43:18 Added an absolute position div container to ensure
3241 EXPECT_EQ(effect, localBorderBoxProperties->propertyTreeState.effect());
3242 }
3243
3223 // A basic sanity check for over-invalidation of paint properties. 3244 // A basic sanity check for over-invalidation of paint properties.
3224 TEST_P(PaintPropertyTreeBuilderTest, NoPaintPropertyUpdateOnBackgroundChange) { 3245 TEST_P(PaintPropertyTreeBuilderTest, NoPaintPropertyUpdateOnBackgroundChange) {
3225 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); 3246 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>");
3226 auto* div = document().getElementById("div"); 3247 auto* div = document().getElementById("div");
3227 3248
3228 document().view()->updateAllLifecyclePhases(); 3249 document().view()->updateAllLifecyclePhases();
3229 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); 3250 div->setAttribute(HTMLNames::styleAttr, "background-color: green");
3230 document().view()->updateLifecycleToLayoutClean(); 3251 document().view()->updateLifecycleToLayoutClean();
3231 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); 3252 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate());
3232 } 3253 }
3233 3254
3234 } // namespace blink 3255 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698