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

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

Issue 1900263002: Update PaintLayer::needsPaintPhase flags when layer self-painting status changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« 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 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/compositing/CompositedLayerMapping.h" 5 #include "core/layout/compositing/CompositedLayerMapping.h"
6 #include "core/paint/PaintControllerPaintTest.h" 6 #include "core/paint/PaintControllerPaintTest.h"
7 #include "platform/graphics/GraphicsContext.h" 7 #include "platform/graphics/GraphicsContext.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "position : relative"); 413 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "position : relative");
414 document().view()->updateAllLifecyclePhases(); 414 document().view()->updateAllLifecyclePhases();
415 ASSERT_TRUE(layerDiv.hasLayer()); 415 ASSERT_TRUE(layerDiv.hasLayer());
416 PaintLayer& layer = *layerDiv.layer(); 416 PaintLayer& layer = *layerDiv.layer();
417 ASSERT_TRUE(layer.isSelfPaintingLayer()); 417 ASSERT_TRUE(layer.isSelfPaintingLayer());
418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); 418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines());
419 EXPECT_TRUE(layer.needsPaintPhaseFloat()); 419 EXPECT_TRUE(layer.needsPaintPhaseFloat());
420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
421 } 421 }
422 422
423 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingSelfPainting)
424 {
425 setBodyInnerHTML(
426 "<div id='will-be-self-painting' style='width: 100px; height: 100px; ove rflow: hidden'>"
427 " <div>"
pdr. 2016/04/20 23:13:39 Why is this inner div required?
Xianzhu 2016/04/21 00:42:35 Haven't looked into the root cause, but without th
Xianzhu 2016/04/21 01:03:41 Without the div, the div at line 428 will be marke
pdr. 2016/04/21 18:20:57 This doesn't seem obviously wrong to me, but I thi
428 " <div style='outline: 1px solid red; background-color: green'>outlin e and background</div>"
429 " </div>"
430 "</div>");
431
432 LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-se lf-painting")->layoutObject());
433 ASSERT_TRUE(layerDiv.hasLayer());
434 EXPECT_FALSE(layerDiv.layer()->isSelfPaintingLayer());
435
436 PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutO bject())->layer();
437 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines());
438 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds());
439
440 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 1 00px; height: 100px; overflow: hidden; position: relative");
441 document().view()->updateAllLifecyclePhases();
442 PaintLayer& layer = *layerDiv.layer();
443 ASSERT_TRUE(layer.isSelfPaintingLayer());
444 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines());
445 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
446 }
447
448 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingNonSelfPainting)
449 {
450 setBodyInnerHTML(
451 "<div id='will-be-non-self-painting' style='width: 100px; height: 100px; overflow: hidden; position: relative'>"
452 " <div>"
453 " <div style='outline: 1px solid red; background-color: green'>outlin e and background</div>"
454 " </div>"
455 "</div>");
456
457 LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-no n-self-painting")->layoutObject());
458 ASSERT_TRUE(layerDiv.hasLayer());
459 PaintLayer& layer = *layerDiv.layer();
460 EXPECT_TRUE(layer.isSelfPaintingLayer());
461 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines());
462 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
463
464 PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutO bject())->layer();
465 EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantOutlines());
466 EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds());
467
468 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 1 00px; height: 100px; overflow: hidden");
469 document().view()->updateAllLifecyclePhases();
470 EXPECT_FALSE(layer.isSelfPaintingLayer());
471 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines());
472 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds());
473 }
474
423 } // namespace blink 475 } // 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