Chromium Code Reviews| 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/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 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3224 TEST_P(PaintPropertyTreeBuilderTest, NoPaintPropertyUpdateOnBackgroundChange) { | 3224 TEST_P(PaintPropertyTreeBuilderTest, NoPaintPropertyUpdateOnBackgroundChange) { |
| 3225 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); | 3225 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); |
| 3226 auto* div = document().getElementById("div"); | 3226 auto* div = document().getElementById("div"); |
| 3227 | 3227 |
| 3228 document().view()->updateAllLifecyclePhases(); | 3228 document().view()->updateAllLifecyclePhases(); |
| 3229 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); | 3229 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); |
| 3230 document().view()->updateLifecycleToLayoutClean(); | 3230 document().view()->updateLifecycleToLayoutClean(); |
| 3231 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); | 3231 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); |
| 3232 } | 3232 } |
| 3233 | 3233 |
| 3234 TEST_P(PaintPropertyTreeBuilderTest, LocalBorderBoxChanges) { | |
|
chrishtr
2016/12/15 19:42:52
For completeness, please also add a test for posit
| |
| 3235 setBodyInnerHTML( | |
| 3236 "<style>" | |
| 3237 " body { margin: 0 }" | |
| 3238 " #scroller { width: 3px; height: 5px; overflow: scroll; }" | |
| 3239 " #child { top: 0; left: 0; }" | |
| 3240 "</style>" | |
| 3241 "<div id='scroller'>" | |
| 3242 " <div id='child'>" | |
| 3243 " <div id='grandChild'></div>" | |
| 3244 " </div>" | |
| 3245 "</div>"); | |
| 3246 document().view()->updateAllLifecyclePhases(); | |
| 3247 auto* grandChild = document().getElementById("grandChild"); | |
| 3248 auto* grandChildProperties = grandChild->layoutObject()->paintProperties(); | |
| 3249 auto* localBorderBox = grandChildProperties->localBorderBoxProperties(); | |
| 3250 EXPECT_EQ(FloatRect(0, 0, 3, 5), | |
| 3251 localBorderBox->propertyTreeState.clip()->clipRect().rect()); | |
| 3252 | |
| 3253 // Update the scroller's transform value but ensure the child's paint offset | |
| 3254 // is unchanged so subtree updates are not forced by paint offset changes. | |
| 3255 auto* scroller = document().getElementById("scroller"); | |
| 3256 scroller->setScrollTop(7); | |
| 3257 auto* child = document().getElementById("child"); | |
| 3258 child->setAttribute(HTMLNames::styleAttr, "position: absolute"); | |
| 3259 document().view()->updateAllLifecyclePhases(); | |
| 3260 EXPECT_EQ(FloatRect(0, 0, 800, 600), | |
|
chrishtr
2016/12/15 19:42:52
Also check its transform node and scroll node to s
| |
| 3261 localBorderBox->propertyTreeState.clip()->clipRect().rect()); | |
| 3262 } | |
| 3263 | |
| 3234 } // namespace blink | 3264 } // namespace blink |
| OLD | NEW |